/** * @param $thread Thread */ function showSummarizeForm($thread) { $submitted_nonce = $this->request->getVal('lqt_nonce'); $nonce_key = wfMemcKey('lqt-nonce', $submitted_nonce, $this->user->getName()); if (!$this->handleNonce($submitted_nonce, $nonce_key)) { return; } if ($thread->summary()) { $article = $thread->summary(); } else { $t = $this->newSummaryTitle($thread); $article = new Article($t, 0); } $html = Xml::openElement('div', array('class' => 'lqt-edit-form lqt-summarize-form')); $this->output->addHTML($html); $this->output->addWikiMsg('lqt-summarize-intro'); $talkpage = $thread->article(); LqtHooks::$editTalkpage = $talkpage; LqtHooks::$editArticle = $article; LqtHooks::$editThread = $thread; LqtHooks::$editType = 'summarize'; LqtHooks::$editAppliesTo = $thread; $e = new EditPage($article); // Add an offset so it works if it's on the wrong page. $dbr = wfGetDB(DB_SLAVE); $offset = wfTimestamp(TS_UNIX, $thread->topmostThread()->sortkey()); $offset++; $offset = $dbr->timestamp($offset); $e->suppressIntro = true; $e->editFormTextBeforeContent .= $this->perpetuate('lqt_method', 'hidden') . $this->perpetuate('lqt_operand', 'hidden') . Html::hidden('lqt_nonce', MWCryptRand::generateHex(32)) . Html::hidden('offset', $offset); $e->edit(); if ($e->didSave) { $bump = !$this->request->getCheck('wpBumpThread') || $this->request->getBool('wpBumpThread'); LqtView::summarizeMetadataUpdates(array('thread' => $thread, 'article' => $article, 'summary' => $e->summary, 'bump' => $bump)); if ($submitted_nonce && $nonce_key) { global $wgMemc; $wgMemc->set($nonce_key, 1, 3600); } } if ($this->output->getRedirect() != '') { $redirectTitle = clone $talkpage->getTitle(); $redirectTitle->setFragment('#' . $this->anchorName($thread)); $this->output->redirect($this->title->getLocalURL()); } $this->output->addHTML('</div>'); }