public function handleAction()
{
global $notification, $conf;
$page = Wicked_Page::getPage($this->referrer());
if (!$this->allows(Wicked::MODE_EDIT)) {
$notification->push(sprintf(_("You don't have permission to edit \"%s\"."), $page->pageName()));
} else {
if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth() && Horde_String::lower(Horde_Util::getFormData('wicked_captcha')) != Horde_String::lower(Wicked::getCAPTCHA())) {
$notification->push(_("Random string did not match."), 'horde.error');
return;
}
$text = Horde_Util::getFormData('page_text');
$changelog = Horde_Util::getFormData('changelog');
if ($conf['wicked']['require_change_log'] && empty($changelog)) {
$notification->push(_("You must provide a change log."), 'horde.error');
$GLOBALS['page_output']->addInlineScript(array('if (document.editform && document.editform.changelog) document.editform.changelog.focus()'), true);
return;
}
if (trim($text) == trim($page->getText())) {
$notification->push(_("No changes made"), 'horde.warning');
} else {
$page->updateText($text, $changelog);
$notification->push(_("Page Saved"), 'horde.success');
}
if ($page->allows(Wicked::MODE_UNLOCKING)) {
$page->unlock();
}
}
// Show the newly saved page.
Wicked::url($this->referrer(), true)->redirect();
}