示例#1
0
 public static function checkConnection()
 {
     if (!self::isConnected()) {
         //check if have cookie login, and if is valid
         if (!is_null(Cookie::get('login'))) {
             self::connect(true);
         }
     }
 }
示例#2
0
}
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);