public function captcha($securityName, $type) { $captcha = Security::getSecurity($securityName); if (!$captcha) { $this->router->show404(true); } if ($type == 'refresh') { $this->setAjaxController(); $captcha->flush(); $this->addAjaxDatas('imageUrl', $captcha->get('image', true)); $this->addAjaxDatas('audioUrl', $captcha->get('audio', true)); } else { if ($type == 'image') { if (!$captcha->getImage()) { $this->router->show404(true); } $captcha->get('image'); } elseif ($type == 'audio') { if (!$captcha->getAudio()) { $this->router->show404(true); } $captcha->get('audio'); } else { $this->router->show404(true); } $this->setAutoCallDisplay(false); } }
} if (defined('LOGGER_MAIL') && LOGGER_MAIL && defined('LOGGER_MAIL_TO_EMAIL') && defined('LOGGER_MAIL_TO_NAME') && !static::getDebug()) { $mailConfig = array('fromEmail' => ADMIN_EMAIL, 'fromName' => $language->getVar('site_name'), 'toEmail' => LOGGER_MAIL_TO_EMAIL, 'toName' => LOGGER_MAIL_TO_NAME, 'mailSubject' => $language->getVar('site_name') . ' logs'); $log->attach(new Mail($mailConfig)); } if (defined('LOGGER_ERROR') && LOGGER_ERROR) { $exc->attach(new Log()); $err->attach(new Log()); } // Config router host if (!defined('HOSTNAME')) { throw new \Exception('Miss hostname constant'); } Router::setHost(HOSTNAME); // Auto set language, by session $languageLoaded = Language::getInstance()->getLanguage(); $langSession = Session::getInstance()->get('language'); if (!is_null($langSession) && $langSession != $languageLoaded) { $language->setLanguage($langSession); $languageLoaded = $langSession; } // Auto set language, by cookie $langCookie = Cookie::get('language'); if (!is_null($langCookie) && $langCookie != $languageLoaded) { $language->setLanguage($langCookie); $languageLoaded = $langSession; } // Security Security::autorun(); // Clean unset($bench, $globalizer, $language, $exc, $err, $log);