/** * 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'); }
$editor = new EditPage($wgArticle); $editor->submit(); } elseif ($wgUseExternalEditor && ($external || $wgUser->getOption('externaleditor'))) { require_once 'includes/ExternalEdit.php'; $mode = $wgRequest->getVal('mode'); $extedit = new ExternalEdit($wgArticle, $mode); $extedit->edit(); } break; case 'history': if ($_SERVER['REQUEST_URI'] == $wgTitle->getInternalURL('action=history')) { $wgOut->setSquidMaxage($wgSquidMaxage); } require_once 'includes/PageHistory.php'; $history = new PageHistory($wgArticle); $history->history(); break; case 'raw': require_once 'includes/RawPage.php'; $raw = new RawPage($wgArticle); $raw->view(); break; case 'purge': wfPurgeSquidServers(array($wgTitle->getInternalURL())); $wgOut->setSquidMaxage($wgSquidMaxage); $wgTitle->invalidateCache(); $wgArticle->view(); break; default: if (wfRunHooks('UnknownAction', array($action, $wgArticle))) { $wgOut->errorpage('nosuchaction', 'nosuchactiontext');
/** * 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'); }
function get_history_disp($titleKey, $mvd_id) { global $mvgIP, $wgOut; $title = Title::newFromText($titleKey, MV_NS_MVD); $article = new Article($title); $pageHistoryAjax = new PageHistory($article); //@@todo fix problems... ajax action url context !=history url context // so forming urls for links get errors $pageHistoryAjax->history(); return $wgOut->getHTML(); }
/** * Perform one of the "standard" actions * * @param $output OutputPage * @param $article Article * @param $title Title * @param $user User * @param $request WebRequest */ function performAction(&$output, &$article, &$title, &$user, &$request) { wfProfileIn(__METHOD__); if (!wfRunHooks('MediaWikiPerformAction', array($output, $article, $title, $user, $request, $this))) { wfProfileOut(__METHOD__); 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 'raw': // includes JS/CSS $raw = new RawPage($article); $raw->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 { $rdf = new DublinCoreRdf($article); $rdf->show(); } break; case 'creativecommons': if (!$this->getVal('EnableCreativeCommonsRdf')) { wfHttpError(403, 'Forbidden', wfMsg('nocreativecommons')); } else { $rdf = new CreativeCommonsRdf($article); $rdf->show(); } break; case 'credits': Credits::showPage($article); break; case 'submit': if (session_id() == '') { /* Send a cookie so anons get talk message notifications */ wfSetupSession(); } /* Continue... */ /* Continue... */ case 'edit': case 'editredlink': if (wfRunHooks('CustomEditor', array($article, $user))) { $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 ($request->getFullRequestURL() == $title->getInternalURL('action=history')) { $output->setSquidMaxage($this->getVal('SquidMaxage')); } $history = new PageHistory($article); $history->history(); break; default: if (wfRunHooks('UnknownAction', array($action, $article))) { $output->showErrorPage('nosuchaction', 'nosuchactiontext'); } } wfProfileOut(__METHOD__); }
function execute($par) { global $wgUser, $wgOut, $wgRequest, $wgTitle; if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext'); return; } wfLoadExtensionMessages("NFDGuardian"); if ($wgRequest->getVal('fetchInnards')) { //get next article to vote on $wgOut->disable(); $result = self::getNextInnards($wgRequest->getVal('nfd_type')); print_r(json_encode($result)); return; } else { if ($wgRequest->getVal('getVoteBlock')) { //get all the votes for the right rail module $wgOut->setArticleBodyOnly(true); $wgOut->addHTML(self::getVoteBlock($wgRequest->getVal('nfd_id'))); return; } else { if ($wgRequest->getVal('edit')) { //get the html that goes into the page when a user clicks the edit tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $a = new Article($t); $editor = new EditPage($a); $editor->edit(); //Old code for when we wanted to remove //the nfd template from the edit window /*$content = $wgOut->getHTML(); $wgOut->clearHTML(); //grab the edit form $data = array(); $data['form'] = $content; //then take out the template $c = new NFDProcessor(); $template = $c->getFullTemplate($wgRequest->getVal('nfd_id')); $articleContent = $a->getContent(); $articleContent = str_replace($template, "", $articleContent); $data['newContent'] = $articleContent; print_r(json_encode($data));*/ } return; } else { if ($wgRequest->getVal('discussion')) { //get the html that goes into the page when a user clicks the discussion tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $tDiscussion = $t->getTalkPage(); if ($tDiscussion) { $a = new Article($tDiscussion); $content = $a->getContent(); $wgOldTitle = $wgTitle; $wgTitle = $tDiscussion; $wgOut->addHTML($wgOut->parse($content)); $wgOut->addHTML(Postcomment::getForm(true, $tDiscussion, true)); $wgTitle = $wgOldTitle; } } return; } else { if ($wgRequest->getVal('confirmation')) { //get confirmation dialog after user has edited the article $wgOut->setArticleBodyOnly(true); echo $this->confirmationModal($wgRequest->getVal('articleId')); return; } else { if ($wgRequest->getVal('history')) { //get the html that goes into the page when a user clicks the history tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $a = new Article($t); $pageHistory = new PageHistory($a); $pageHistory->history(); return; } } else { if ($wgRequest->getVal('diff')) { //get the html that goes into the page when a user asks for a diffs $wgOut->setArticleBodyOnly(true); $t = Title::newFromID($wgRequest->getVal('articleId')); if ($t) { $a = new Article($t); $wgOut->addHtml('<div class="article_inner">'); $a->view(); $wgOut->addHtml('</div>'); } return; } else { if ($wgRequest->getVal('article')) { //get the html that goes into the page when a user clicks the article tab $wgOut->setArticleBodyOnly(true); $t = Title::newFromId($wgRequest->getVal('articleId')); if ($t) { $r = Revision::newFromTitle($t); if ($r) { $popts = $wgOut->parserOptions(); $popts->setTidy(true); echo WikihowArticleHTML::processArticleHTML($wgOut->parse($r->getText(), $t, $popts), array('no-ads' => 1, 'ns' => $t->getNamespace())); } } return; } else { if ($wgRequest->wasPosted()) { $wgOut->setArticleBodyOnly(true); if ($wgRequest->getVal('submitEditForm')) { //user has edited the article from within the NFD Guardian tool $wgOut->disable(); $this->submitEdit(); $result = self::getNextInnards($wgRequest->getVal('nfd_type')); print_r(json_encode($result)); return; } else { //user has voted if ($wgRequest->getVal('nfd_skip', 0) == 1) { NFDProcessor::skip($wgRequest->getVal('nfd_id')); } else { NFDProcessor::vote($wgRequest->getVal('nfd_id'), $wgRequest->getVal('nfd_vote')); } $wgOut->disable(); $result = self::getNextInnards($wgRequest->getVal('nfd_type')); print_r(json_encode($result)); return; } } } } } } } } } } /** * This is the shell of the page, has the buttons, etc. */ $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('nfdGuardian.js'), 'extensions/wikihow/nfd', false)); $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false)); $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('nfdGuardian.css'), 'extensions/wikihow/nfd', false)); //add delete confirmation to bottom of page $wgOut->addHtml("<div class='waiting'><img src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "' alt='' /></div>"); $tmpl = new EasyTemplate(dirname(__FILE__)); $wgOut->addHTML($tmpl->execute('NFDdelete.tmpl.php')); $wgOut->setHTMLTitle(wfMsg('nfd')); $wgOut->setPageTitle(wfMsg('nfd')); // add standings widget $group = new NFDStandingsGroup(); $indi = new NFDStandingsIndividual(); $indi->addStatsWidget(); $group->addStandingsWidget(); }