function execute()
 {
     global $wgServer, $wgRequest, $wgOut, $wgUser, $wgLanguageCode;
     wfLoadExtensionMessages('RCPatrol');
     $userGroups = $wgUser->getGroups();
     if (!$wgUser->isAllowed('patrol') || in_array('patrolblock', $userGroups)) {
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if ($wgRequest->getVal('a') == 'rollback') {
         self::doRollback();
         return;
     }
     self::setActiveWidget();
     // INTL: Leaderboard is across the user database so we'll just enable for English at the moment
     if ($wgLanguageCode == 'en') {
         self::setLeaderboard();
     }
     $wgOut->addJScode('rcpj');
     $wgOut->addCSScode('rcpc');
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit() . QuickNoteEdit::displayQuickNote());
     $result = self::getNextArticleToPatrol();
     if ($result) {
         $rcTest = null;
         $testHtml = "";
         if (class_exists('RCTest') && RCTest::isEnabled()) {
             $rcTest = new RCTest();
             $testHtml = $rcTest->getTestHtml();
         }
         $wgOut->addHTML("<div id='rct_results'></div>");
         $wgOut->addHTML("<div id='bodycontents2' class='tool sticky'>");
         $titleText = RCTestStub::getTitleText($result, $rcTest);
         $wgOut->addHTML("<div id='articletitle' style='display:none;'>{$titleText}</div>");
         $wgOut->addHTML("<div id='rc_header' class='tool_header'>");
         $wgOut->addHTML('<a href="#" id="rcpatrol_keys">Get Shortcuts</a>');
         // if this was a redirect, the title may have changed so update our context
         $oldTitle = $this->getContext()->getTitle();
         $this->getContext()->setTitle($result['title']);
         $d = RCTestStub::getDifferenceEngine($this->getContext(), $result, $rcTest);
         $d->loadRevisionData();
         $this->getContext()->setTitle($oldTitle);
         $wgOut->addHTML(RCPatrol::getButtons($result, $d->mNewRev, $rcTest));
         $wgOut->addHTML('<div id="rcpatrol_info" style="display:none;">' . wfMessage('rcpatrol_keys')->text() . '</div>');
         $wgOut->addHTML("</div>");
         //end too_header
         $d->showDiffPage();
         $wgOut->addHTML($testHtml);
         $wgOut->addHTML("</div>");
     } else {
         $wgOut->addWikiMsg('markedaspatrolledtext');
     }
     $wgOut->setPageTitle("RC Patrol");
 }
Beispiel #2
0
 function execute()
 {
     global $wgServer, $wgRequest, $wgOut, $wgUser, $wgLanguageCode;
     wfLoadExtensionMessages('RCPatrol');
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('mousetrap.min.js'), 'extensions/wikihow/common', false));
     $userGroups = $wgUser->getGroups();
     if (!$wgUser->isAllowed('patrol') || in_array('patrolblock', $userGroups)) {
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     self::setActiveWidget();
     // INTL: Leaderboard is across the user database so we'll just enable for English at the moment
     if ($wgLanguageCode == 'en') {
         self::setLeaderboard();
     }
     $html = '';
     $html .= HtmlSnips::makeUrlTags('js', array('rcpatrol.js'), 'extensions/wikihow/rcpatrol', false);
     // useful for debugging:
     //$html .= '<script src="/extensions/wikihow/rcpatrol/rcpatrol.js"></script>';
     $html .= HtmlSnips::makeUrlTags('css', array('rcpatrol.css'), 'extensions/wikihow/rcpatrol', false);
     $wgOut->addHTML($html);
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit() . QuickNoteEdit::displayQuickNote());
     $result = self::getNextArticleToPatrol();
     if ($result) {
         $rcTest = null;
         $testHtml = "";
         if (class_exists('RCTest') && RCTest::isEnabled()) {
             $rcTest = new RCTest();
             $testHtml = $rcTest->getTestHtml();
         }
         $wgOut->addHTML("<div id='rct_results'></div>");
         $wgOut->addHTML("<div id='bodycontents2' class='tool sticky'>");
         $titleText = RCTestStub::getTitleText($result, $rcTest);
         $wgOut->addHTML("<div id='articletitle' style='display:none;'>{$titleText}</div>");
         $wgOut->addHTML("<div id='rc_header' class='tool_header'>");
         $d = RCTestStub::getDifferenceEngine($result, $rcTest);
         $d->loadRevisionData();
         $wgOut->addHTML(RCPatrol::getButtons($result, $d->mNewRev, $rcTest));
         $wgOut->addHTML("</div>");
         //end too_header
         $d->showDiffPage();
         $wgOut->addHTML($testHtml);
         $wgOut->addHTML("</div>");
     } else {
         $wgOut->addWikiMsg('markedaspatrolledtext');
     }
     $wgOut->setPageTitle("RC Patrol");
 }
Beispiel #3
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod();
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $this->skipTool->skipItem($methodId);
             $this->skipTool->unUseItem($methodId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setHTMLTitle(wfMsg('methodeditor'));
     $wgOut->setPageTitle(wfMsg('methodeditor'));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodeditor.css'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodeditor.js'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.cookie.js'), 'extensions/wikihow/common', false));
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     $user = $this->getContext()->getUser();
     if (!$user || $user->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!$this->userAllowed($user)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_page");
     if ($wgRequest->getVal('allarticles')) {
         $wgOut->setArticleBodyOnly(true);
         $dbr = wfGetDB(DB_SLAVE);
         $date = date('Y-m-d');
         header('Content-type: application/force-download');
         header('Content-disposition: attachment; filename="methods_' . $date . '.xls"');
         $res = $dbr->select(MethodEditor::TABLE_NAME, array('ama_page'), array('ama_patrolled' => '1'), __METHOD__, array('GROUP BY' => 'ama_page'));
         foreach ($res as $row) {
             $title = Title::newFromID($row->ama_page);
             if ($title) {
                 echo $title->getFullURL() . "\n";
             }
         }
         return;
     }
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod($wgRequest->getVal('aid'));
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $articleId = $wgRequest->getVal('articleId');
             $this->skipTool->skipItem($articleId);
             $this->skipTool->unUseItem($articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setPageTitle(wfMessage('methodeditor')->text());
     $wgOut->addJScode('csjs');
     $wgOut->addCSScode('methc');
     $wgOut->addJScode('methj');
     $wgOut->addJScode('jcookj');
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $groups = $user->getGroups();
     $showList = in_array('staff', $groups) || in_array('staff_widget', $groups);
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('showList' => $showList));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
Beispiel #5
0
 function execute($par)
 {
     global $wgUser, $wgOut, $wgRequest;
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->getID() == 0) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     wfLoadExtensionMessages("QG");
     if ($wgRequest->getVal('fetchInnards')) {
         $wgOut->disable();
         header('Vary: Cookie');
         $result = self::getNextInnards($wgRequest->getVal('qc_type'), $wgRequest->getVal('by_username'));
         print_r(json_encode($result));
         return;
     } elseif ($wgRequest->getVal('getOptions')) {
         $wgOut->setArticleBodyOnly(true);
         $wgOut->addHTML(self::getOptionMenu($wgRequest->getVal('menuName'), $wgRequest->getVal('choices'), $wgRequest->getVal('username')));
         return;
     } elseif ($wgRequest->getVal('getVoteBlock')) {
         $wgOut->setArticleBodyOnly(true);
         $wgOut->addHTML(self::getVoteBlock($wgRequest->getVal('qc_id')));
         return;
     } elseif ($wgRequest->wasPosted()) {
         if ($wgRequest->getVal('qc_skip', 0) == 1) {
             QCRule::skip($wgRequest->getVal('qc_id'));
         } else {
             QCRule::vote($wgRequest->getVal('qc_id'), $wgRequest->getVal('qc_vote'));
         }
         $wgOut->disable();
         $result = self::getNextInnards($wgRequest->getVal('qc_type'), $wgRequest->getVal('by_username'));
         header('Vary: Cookie');
         print_r(json_encode($result));
         return;
     }
     /** 
      * This is the shell of the page, has the buttons, etc. 
      */
     $wgOut->setHTMLTitle('Quality Guardian');
     $wgOut->addScript("<script type='text/javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/qc/qc.js?rev=') . WH_SITEREV . "'></script>");
     $wgOut->addStyle('/extensions/min/f/extensions/wikihow/qc/qc.css?rev=' . WH_SITEREV);
     $wgOut->addStyle(wfGetPad('/skins/common/diff.css?' . WH_SITEREV));
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit() . QuickNoteEdit::displayQuickNote(true));
     $wgOut->setHTMLTitle(wfMsg('quality_control'));
     $wgOut->setPageTitle(wfMsg('quality_control'));
     // add standings widget
     $group = new QCStandingsGroup();
     $indi = new QCStandingsIndividual();
     $indi->addStatsWidget();
     $group->addStandingsWidget();
 }