function show($params)
 {
     global $wgOut, $wgUser, $wgLang;
     $dqi = DeleteQueueItem::newFromId($params[1]);
     if (!$dqi) {
         $wgOut->setPageTitle(wfMsg('deletequeue-case-no-case-title'));
         $wgOut->addWikiMsg('deletequeue-case-no-case', $params[1]);
         return;
     }
     $wgOut->setPageTitle(wfMsg('deletequeue-case-title'));
     $wgOut->addWikiMsg('deletequeue-case-intro');
     if (wfTimestamp(TS_UNIX, $dqi->getExpiry()) < time() && $wgUser->isAllowed($dqi->getQueue() . '-review')) {
         $wgOut->addWikiMsg('deletequeue-case-needs-review', $this->getTitle("case/" . $params[1] . "/review"));
     }
     // Show basic data
     $sk = $wgUser->getSkin();
     $fields = array();
     $fields['deletequeue-case-page'] = $sk->link($this->getTitle());
     $fields['deletequeue-case-reason'] = DeleteQueueInterface::formatReason(null, $dqi->getReason());
     $expiry = $dqi->getExpiry();
     if ($expiry) {
         $fields['deletequeue-case-expiry'] = $wgLang->timeanddate($expiry);
     }
     $fields['deletequeue-case-votes'] = $dqi->formatVoteCount();
     $wgOut->addHTML(Xml::element('h2', null, wfMsg('deletequeue-case-details')) . Xml::buildForm($fields) . Xml::element('h2', null, wfMsg('deletequeue-case-votes')));
     $article = $dqi->getArticle();
     $this->showVotes($article, $dqi);
 }
 /**
  * Attempt to submit the propose deletion form.
  * @param $article Article object.
  * @param $action The action (speedynom, prod, etc)
  * @return Boolean Whether or not the submission was successful.
  */
 public function trySubmit($article, $queue)
 {
     global $wgUser, $wgOut, $wgRequest;
     $token = $wgRequest->getText('wpEditToken');
     if (!$wgUser->matchEditToken($token)) {
         return false;
     }
     // Import form data.
     $reason1 = $wgRequest->getText('wpReason');
     $reason2 = $wgRequest->getText('wpExtra');
     $reason = DeleteQueueInterface::formatReason($reason1, $reason2);
     // Allow hooks to terminate
     $error = '';
     if (!wfRunHooks('AbortDeleteQueueNominate', array($wgUser, $article, $queue, $reason, &$error))) {
         $wgOut->addWikitext($error);
         return false;
     }
     // Transaction
     $dbw = wfGetDB(DB_MASTER);
     $dbw->begin();
     // Set in database.
     $dqi = DeleteQueueItem::newFromArticle($article);
     if ($dqi->getQueue()) {
         $dbw->rollback();
         $wgOut->addWikiMsg('deletequeue-nom-alreadyqueued');
         return false;
     }
     $dqi->setQueue($queue, $reason);
     $dqi->addRole('nominator');
     $log = new LogPage('delete');
     $log->addEntry("nominate", $article->mTitle, $reason, wfMsgNoTrans('deletequeue-queue-' . $queue));
     $dbw->commit();
     $wgOut->redirect($article->mTitle->getLocalUrl());
     return true;
 }
 /**
  * Attempt submission of the "Review Speedy" form.
  * @param $article Article object being reviewed
  */
 public function submit()
 {
     global $wgUser, $wgOut, $wgRequest;
     $article = $this->mArticle;
     $token = $wgRequest->getText('wpEditToken');
     if (!$wgUser->matchEditToken($token)) {
         return false;
     }
     // Process the action
     $action = $wgRequest->getVal('wpSpeedyAction');
     $processed = true;
     $dqi = DeleteQueueItem::newFromArticle($article);
     $newQueue = $wgRequest->getVal('wpSpeedyRequeue');
     $lp = new LogPage('delete');
     $reason = $wgRequest->getText('wpReason');
     // Check the action against the list
     list($enabledActions) = $this->availableActions();
     if (!in_array($action, $enabledActions) && ($action != 'requeue' || !in_array("requeue-{$newQueue}", $enabledActions))) {
         return wfMsg('deletequeue-review-actiondenied');
     }
     $queue = $dqi->getQueue();
     // Transaction
     $dbw = wfGetDB(DB_MASTER);
     $dbw->begin();
     switch ($action) {
         case 'delete':
             $article->doDelete($dqi->getQueue());
             $processed = true;
             break;
         case 'change':
             $reason1 = $wgRequest->getText('wpSpeedyNewReason');
             $reason2 = $wgRequest->getText('wpSpeedyNewExtra');
             $reason = DeleteQueueInterface::formatReason($reason1, $reason2);
             $article->doDelete($reason);
             $processed = true;
             break;
         case 'dequeue':
             $lp->addEntry('dequeue', $article->mTitle, $reason, $queue);
             $processed = true;
             break;
         case 'requeue':
             $lp->addEntry('requeue', $article->mTitle, $reason, array(wfMsgForContent("deletequeue-queue-{$queue}"), wfMsgForContent("deletequeue-queue-{$newQueue}")));
             $reason1 = $wgRequest->getText('wpSpeedyNewReason');
             $reason2 = $wgRequest->getText('wpSpeedyNewExtra');
             $newReason = DeleteQueueInterface::formatReason($reason1, $reason2);
             $dqi->setQueue($newQueue, $reason);
             $processed = false;
             break;
         default:
             // Invalid action
             $dbw->commit();
             return wfMsg('deletequeue-review-badaction');
     }
     if ($processed) {
         // Delete from the DB
         $dqi->deQueue();
         // Redirect to the page
         $wgOut->redirect($article->mTitle->getLocalURL());
         // Commit transaction
         $dbw->commit();
         return true;
     }
     $dbw->commit();
     return true;
 }