case 'info': case 'markpatrolled': case 'validate': case 'render': case 'deletetrackback': $wgArticle->{$action}(); break; case 'print': $wgArticle->view(); break; case 'dublincore': if (!$wgEnableDublinCoreRdf) { wfHttpError(403, 'Forbidden', wfMsg('nodublincore')); } else { require_once 'includes/Metadata.php'; wfDublinCoreRdf($wgArticle); } break; case 'creativecommons': if (!$wgEnableCreativeCommonsRdf) { wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons')); } else { require_once 'includes/Metadata.php'; wfCreativeCommonsRdf($wgArticle); } break; case 'credits': require_once 'includes/Credits.php'; showCreditsPage($wgArticle); break; case 'submit':
/** * Perform one of the "standard" actions */ function performAction(&$output, &$article, &$title, &$user, &$request) { wfProfileIn('MediaWiki::performAction'); $action = $this->getVal('Action'); if (in_array($action, $this->getVal('DisabledActions', array()))) { /* No such action; this will switch to the default case */ $action = 'nosuchaction'; } switch ($action) { case 'view': $output->setSquidMaxage($this->getVal('SquidMaxage')); $article->view(); break; case 'watch': case 'unwatch': case 'delete': case 'revert': case 'rollback': case 'protect': case 'unprotect': case 'info': case 'markpatrolled': case 'render': case 'deletetrackback': case 'purge': $article->{$action}(); break; case 'print': $article->view(); break; case 'dublincore': if (!$this->getVal('EnableDublinCoreRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nodublincore')); } else { require_once 'includes/Metadata.php'; wfDublinCoreRdf($article); } break; case 'creativecommons': if (!$this->getVal('EnableCreativeCommonsRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons')); } else { require_once 'includes/Metadata.php'; wfCreativeCommonsRdf($article); } break; case 'credits': require_once 'includes/Credits.php'; showCreditsPage($article); break; case 'submit': if (!$this->getVal('CommandLineMode') && !$request->checkSessionCookie()) { /* Send a cookie so anons get talk message notifications */ User::SetupSession(); } /* Continue... */ /* Continue... */ case 'edit': $internal = $request->getVal('internaledit'); $external = $request->getVal('externaledit'); $section = $request->getVal('section'); $oldid = $request->getVal('oldid'); if (!$this->getVal('UseExternalEditor') || $action == 'submit' || $internal || $section || $oldid || !$user->getOption('externaleditor') && !$external) { $editor = new EditPage($article); $editor->submit(); } elseif ($this->getVal('UseExternalEditor') && ($external || $user->getOption('externaleditor'))) { $mode = $request->getVal('mode'); $extedit = new ExternalEdit($article, $mode); $extedit->edit(); } break; case 'history': if ($_SERVER['REQUEST_URI'] == $title->getInternalURL('action=history')) { $output->setSquidMaxage($this->getVal('SquidMaxage')); } $history = new PageHistory($article); $history->history(); break; case 'raw': $raw = new RawPage($article); $raw->view(); break; default: if (wfRunHooks('UnknownAction', array($action, $article))) { $output->showErrorPage('nosuchaction', 'nosuchactiontext'); } } wfProfileOut('MediaWiki::performAction'); }
/** * Perform one of the "standard" actions */ function performAction(&$output, &$article, &$title, &$user, &$request) { wfProfileIn('MediaWiki::performAction'); if (!wfRunHooks('MediaWikiPerformAction', array($output, $article, $title, $user, $request))) { wfProfileOut('MediaWiki::performAction'); return; } $action = $this->getVal('Action'); if (in_array($action, $this->getVal('DisabledActions', array()))) { /* No such action; this will switch to the default case */ $action = 'nosuchaction'; } switch ($action) { case 'view': $output->setSquidMaxage($this->getVal('SquidMaxage')); $article->view(); break; case 'watch': case 'unwatch': case 'delete': case 'revert': case 'rollback': case 'protect': case 'unprotect': case 'info': case 'markpatrolled': case 'render': case 'deletetrackback': case 'purge': $article->{$action}(); break; case 'print': $article->view(); break; case 'dublincore': if (!$this->getVal('EnableDublinCoreRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nodublincore')); } else { require_once 'includes/Metadata.php'; wfDublinCoreRdf($article); } break; case 'creativecommons': if (!$this->getVal('EnableCreativeCommonsRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons')); } else { require_once 'includes/Metadata.php'; wfCreativeCommonsRdf($article); } break; case 'credits': require_once 'includes/Credits.php'; showCreditsPage($article); break; case 'submit': case 'submit2': if (session_id() == '') { /* Send a cookie so anons get talk message notifications */ wfSetupSession(); } /* Continue... */ /* Continue... */ case 'edit': if (wfRunHooks('CustomEditor', array($article, $user))) { $internal = $request->getVal('internaledit'); $external = $request->getVal('externaledit'); $section = $request->getVal('section'); $oldid = $request->getVal('oldid'); ///------------------------------------------- // XXADDED // do we have a title? if not, it's a new article, use the wrapper. if ($request->getVal('advanced') != 'true') { $newArticle = false; // if it's not new, is it already a wikiHow? $validWikiHow = false; if ($title->getNamespace() == NS_MAIN && $request->getVal('section', null) == null) { if ($request->getVal("title") == "") { $newArticle = true; } else { if ($title->getArticleID() == 0) { $newArticle = true; } } if (!$newArticle) { $validWikiHow = WikihowArticleEditor::useWrapperForEdit($article); } } // use the wrapper if it's a new article or // if it's an existing wikiHow article $t = $request->getVal('title', null); $editor = $user->getOption('defaulteditor', ''); if (empty($editor)) { $editor = $user->getOption('useadvanced', false) ? 'advanced' : 'visual'; } if ($t != null && $t != wfMsg('mainpage') && $editor == 'advanced' && !$request->getVal('override', null)) { // use advanced if they have already set a title // and have the default preference setting #echo "uh oh!"; } else { if ($action != "submit") { if ($newArticle || $action == 'submit2' || $validWikiHow && ($editor != 'advanced' || $request->getVal("override", "") == "yes")) { require_once 'EditPageWrapper.php'; $editor = new EditPageWrapper($article); $editor->edit(); break; } else { #echo "uh oh!"; } } } } if (!$this->getVal('UseExternalEditor') || $action == 'submit' || $internal || $section || $oldid || !$user->getOption('externaleditor') && !$external) { $editor = new EditPage($article); $editor->submit(); } elseif ($this->getVal('UseExternalEditor') && ($external || $user->getOption('externaleditor'))) { $mode = $request->getVal('mode'); $extedit = new ExternalEdit($article, $mode); $extedit->edit(); } } break; case 'history': global $wgRequest; if ($wgRequest->getFullRequestURL() == $title->getInternalURL('action=history')) { $output->setSquidMaxage($this->getVal('SquidMaxage')); } $history = new PageHistory($article); $history->history(); break; case 'raw': $raw = new RawPage($article); $raw->view(); break; default: if (wfRunHooks('UnknownAction', array($action, $article))) { $output->showErrorPage('nosuchaction', 'nosuchactiontext'); return; } } wfProfileOut('MediaWiki::performAction'); }