/** * Delete a solved captcha image, if $wgCaptchaDeleteOnSolve is true. */ function passCaptcha() { global $wgCaptchaDeleteOnSolve; $info = $this->retrieveCaptcha(); // get the captcha info before it gets deleted $pass = parent::passCaptcha(); if ($pass && $wgCaptchaDeleteOnSolve) { $filename = $this->imagePath($info['salt'], $info['hash']); if (file_exists($filename)) { unlink($filename); } } return $pass; }
/** * Delete a solved captcha image, if $wgCaptchaDeleteOnSolve is true. */ function passCaptcha() { global $wgCaptchaDeleteOnSolve; $info = $this->retrieveCaptcha(); // get the captcha info before it gets deleted $pass = parent::passCaptcha(); if ($pass && $wgCaptchaDeleteOnSolve) { $this->getBackend()->quickDelete(array('src' => $this->imagePath($info['salt'], $info['hash']))); } return $pass; }
/** * handle ConfirmEdit captcha, only for CreatePage, which will be treated a bit differently (edits in special page) * this function is based on Bartek's solution for CreateAPage done in t:r6990 [RT#21902] - Marooned * @param SimpleCaptcha $captcha * @param $editPage * @param $newtext * @param $section * @param $merged * @param $result * @return bool */ public function wfCreatePageOnConfirmEdit(&$captcha, &$editPage, $newtext, $section, $merged, &$result) { global $wgTitle; $canonspname = array_shift(SpecialPageFactory::resolveAlias($wgTitle->getDBkey())); if ($canonspname != 'CreatePage') { return true; } if ($captcha->shouldCheck($editPage, $newtext, $section, $merged)) { if ($captcha->passCaptcha()) { $result = true; return false; } else { global $wgHooks, $wgCreatePageCaptchaTriggered; $wgCreatePageCaptchaTriggered = true; $wgHooks['EditPage::showEditForm:beforeToolbar'][] = array($this, 'renderFormHeaderWrapper'); $result = false; return true; } } else { return true; } }