/** * @return void */ public function captcha() { if (!Core::checkRequiredGetVars("form", "input")) { Go::to404(); } $form = $_GET["form"]; $input = $_GET["input"]; if (isset($_GET["backoffice"]) && $_GET["backoffice"] == 1) { Core::$isBackoffice = true; } $form = new Form($form); $captcha = $form->getInput($input); if (empty($captcha) || $captcha["tag"] != Form::TAG_CAPTCHA) { Go::to404(); } $avaibles = array("backgroundColor", "fontSizeMax", "fontSizeMin", "width", "height", "rotation", "transparent"); if (!isset($captcha["length"]) || empty($captcha["length"]) || $captcha["length"] == 0) { $captcha["length"] = 5; } $c = new Captcha($captcha["length"], $input); if (isset($captcha["fontColors"]) && is_array($captcha["fontColors"])) { $a = $captcha["fontColors"]; for ($i = 0, $max = count($a); $i < $max; $i++) { $c->addFontColor($a[$i]); } } if (isset($captcha["fontFace"]) && is_array($captcha["fontFace"])) { $a = $captcha["fontFace"]; for ($i = 0, $max = count($a); $i < $max; $i++) { $c->addFontFace($a[$i]); } } for ($i = 0, $max = count($avaibles); $i < $max; $i++) { if (isset($captcha[$avaibles[$i]]) && !empty($captcha[$avaibles[$i]])) { $c->{$avaibles}[$i] = $captcha[$avaibles[$i]]; } } $c->render(); exit; }