function execute($par)
 {
     global $wgDebugToolbar;
     $request = $this->getRequest();
     $out = $this->getOutput();
     $this->checkPermissions();
     wfLoadExtensionMessages("UCIPatrol");
     if ($request->getVal("stats")) {
         $out->disable();
         $result = $this->getStats();
         if ($request->getVal("format") == "json") {
             echo json_encode($result);
             return;
         }
         UCIPatrol::printStatsUploads($result['uploads']);
         UCIPatrol::printStatsTitles($result['titles']);
         return;
     }
     if ($request->wasPosted()) {
         $out->disable();
         // wrapping it all in try catch to get any database errors
         try {
             $result = array();
             if ($request->getVal('next')) {
                 $result = $this->getNext();
             } elseif ($request->getVal('skip')) {
                 $this->skip();
             } elseif ($request->getVal('bad')) {
                 $this->downVote();
             } elseif ($request->getVal('good')) {
                 $this->upVote();
             } elseif ($request->getVal('undo')) {
                 $this->undo();
             } elseif ($request->getVal('error')) {
                 $this->error();
                 $result = $this->getNext();
             } elseif ($request->getVal('resetskip')) {
                 $this->resetSkip();
                 $result = $this->getNext();
             } elseif ($request->getVal('flag')) {
                 $this->flag();
                 $result = UCIPatrol::getImagesHTML($request->getVal('hostPage'));
                 echo $result;
                 return;
             }
             // if debug toolbar is active, pass logs back in json response
             if ($wgDebugToolbar) {
                 $result['debug']['log'] = MWDebug::getLog();
             }
             echo json_encode($result);
         } catch (MWException $e) {
             $result = $result ?: array();
             $result['error'][] = $e->getText();
             echo json_encode($result);
             throw $e;
         }
     } else {
         $out->setHTMLTitle(wfMessage('ucipatrol')->text());
         $out->setPageTitle(wfMessage('ucipatrol')->text());
         $out->addJSCode('mt');
         // Mousetrap library
         $out->addCSSCode('ucipc');
         // Tips Patrol CSS
         $out->addScript(HtmlSnips::makeUrlTags('js', array('ucipatrol.js'), 'extensions/wikihow/mobile/ucipatrol', false));
         if ($wgDebugToolbar) {
             $out->addScript(HtmlSnips::makeUrlTags('js', array('consoledebug.js'), 'extensions/wikihow/debug', false));
         }
         EasyTemplate::set_path(dirname(__FILE__));
         $anon = $this->getUser()->isAnon();
         $out->addHTML(EasyTemplate::html('UCIPatrol.tmpl.php', $vars));
         $out->addScript("<script>\$(document).ready(function(){WH.uciPatrol.init({$anon})});</script>");
         $bubbleText = "Help us pick the best user submitted photos to match the article.";
         InterfaceElements::addBubbleTipToElement('uci', 'ucitp', $bubbleText);
         $this->displayLeaderboards();
     }
 }