function doSubmit() { wfProfileIn(__METHOD__); global $wgOut, $wgUser; /* empty name */ if (strlen($this->mBlockedPhrase) == 0) { $this->showForm(wfMsgHtml('spamregex-warning-1')); wfProfileOut(__METHOD__); return; } /* validate expression */ if (!($simple_regex = spamRegexList::validateRegex($this->mBlockedPhrase))) { $this->showForm(wfMsgHtml('spamregex-error-1')); wfProfileOut(__METHOD__); return; } /* make insert */ $dbw = wfGetDB(DB_MASTER); $name = $wgUser->getName(); $timestamp = wfTimestampNow(); /* we need at least one block mode specified... we can have them both, of course */ if (!$this->mBlockedTextbox && !$this->mBlockedSummary) { $this->showForm(wfMsgHtml('spamregex-warning-2')); wfProfileOut(__METHOD__); return; } $dbw->insert('spam_regex', array('spam_text' => $this->mBlockedPhrase, 'spam_timestamp' => $timestamp, 'spam_user' => $name, 'spam_textbox' => $this->mBlockedTextbox, 'spam_summary' => $this->mBlockedSummary), __METHOD__, array('IGNORE')); /* duplicate entry */ if (!$dbw->affectedRows()) { $this->showForm(wfMsgHtml('spamregex-already-blocked', $this->mBlockedPhrase)); wfProfileOut(__METHOD__); return; } spamRegexList::unsetKeys(); /* redirect */ $titleObj = SpecialPage::getTitleFor('SpamRegex'); wfProfileOut(__METHOD__); $wgOut->redirect($titleObj->getFullURL('action=success_block&text=' . urlencode($this->mBlockedPhrase) . '&' . spamRegexList::getListBits())); }