Пример #1
0
 public function InitAction()
 {
     $oLang = $this->Lang_Dictionary();
     $this->Viewer_Assign('oLang', $oLang);
     $this->Viewer_Assign('MSIE6', ACE::MSIE6());
     $this->Viewer_Assign('WEB_ADMIN_SKIN', ACE::MSIE6());
     $oUser = $this->_getUser();
     $this->_checkPluginAction();
     $sScript = Config::Get('path.admin.skin') . '/assets/js/' . 'ace-admin.js';
     $this->Viewer_AppendScript($sScript);
     if (Router::GetAction() == 'admin' or Router::GetAction() == 'error') {
         return;
     }
     if (!$oUser) {
         if (Router::GetAction() == 'registration') {
             $aIp = ACE::GetAllUserIp();
             foreach ($aIp as $sIp) {
                 if ($this->PluginAceadminpanel_Admin_IsBanIp($sIp)) {
                     $this->Message_AddErrorSingle($this->Lang_Get('adm_banned2_text'), $this->Lang_Get('adm_denied_title'));
                     return $this->_userBanned(null);
                 }
             }
         }
         return;
     }
     if (defined('ADMIN_SITE_CLOSED') and ADMIN_SITE_CLOSED and !$oUser->IsAdministrator()) {
         $this->SiteClosed();
     }
     if ($oUser->IsBannedByLogin() || ($oUser->IsBannedByIp() and !$oUser->IsAdministrator())) {
         return $this->_UserBanned($oUser);
     }
 }
Пример #2
0
 /**
  * Определение (и сохранение в куках на год) уникального ID посетителя сайта
  *
  * @return string
  */
 static function GetVisitorId()
 {
     if (!defined('ADM_VISITOR_ID')) {
         if (!isset($_COOKIE['visitor_id'])) {
             if (headers_sent()) {
                 if (!isset($_SERVER['HTTP_USER_AGENT'])) {
                     // это точно не браузер
                     $sVisitorId = '';
                 } else {
                     $sUserAgent = @$_SERVER['HTTP_USER_AGENT'];
                     $sVisitorId = md5($sUserAgent . '::' . serialize(ACE::GetAllUserIp()));
                 }
             } else {
                 $sVisitorId = md5(uniqid(time()));
             }
         } else {
             $sVisitorId = $_COOKIE['visitor_id'];
         }
         if (!headers_sent()) {
             setcookie('visitor_id', $sVisitorId, time() + 60 * 60 * 24 * 365, Config::Get('sys.cookie.path'), Config::Get('sys.cookie.host'));
         }
         define('ADM_VISITOR_ID', $sVisitorId);
     }
     return ADM_VISITOR_ID;
 }