Exemple #1
0
 public function InitAction($aVars)
 {
     $oLang = $this->Lang_Dictionary();
     $this->Viewer_Assign('oLang', $oLang);
     $oUser = $this->GetUser();
     if ($oUser && $oUser->IsAdministrator() && Config::Get('plugin.' . $this->sPlugin . '.' . 'icon_menu')) {
         $sScript = Plugin::GetTemplateWebPath($this->sPlugin) . 'js/' . 'icon_menu.js';
         $this->Viewer_AppendScript($sScript);
     }
     if (Router::GetAction() == 'admin' || Router::GetAction() == 'error') {
         return;
     }
     if (!$oUser) {
         if (Router::GetAction() == 'registration') {
             $aIp = admGetAllUserIp();
             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') && ADMIN_SITE_CLOSED && !$oUser->IsAdministrator()) {
         $this->SiteClosed();
     }
     if ($oUser->IsBannedByLogin() || $oUser->IsBannedByIp() && !$oUser->IsAdministrator()) {
         return $this->UserBanned($oUser);
     }
 }
/**
 * Определение (и сохранение в куках на год) уникального ID посетителя сайта
 *
 * @return string
 */
function admGetVisitorId()
{
    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(admGetAllUserIp()));
                }
            } 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;
}
 public function InitAction()
 {
     $oLang = $this->Lang_Dictionary();
     $this->Viewer_Assign('oLang', $oLang);
     $this->Viewer_Assign('MSIE6', admMSIE6());
     $this->Viewer_Assign('WEB_ADMIN_SKIN', admMSIE6());
     $oUser = $this->_getUser();
     $this->_checkPluginAction();
     if ($oUser and $oUser->IsAdministrator() and Config::Get('plugin.' . $this->sPlugin . '.' . 'icon_menu') and Router::GetAction() != 'admin') {
         $sScript = Config::Get('path.admin.skin') . '/js/' . 'icon_menu.js';
         $this->Viewer_AppendScript($sScript);
     }
     if (Router::GetAction() == 'admin' or Router::GetAction() == 'error') {
         return;
     }
     if (!$oUser) {
         if (Router::GetAction() == 'registration') {
             $aIp = admGetAllUserIp();
             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);
     }
 }