Пример #1
0
 protected function _is_display()
 {
     $user = Loader::get_user();
     $access_zone = config(URL_AP, 'access', 'zone');
     $access_users = (array) config(URL_AP, 'access', 'user');
     $access_groups = (array) config(URL_AP, 'access', 'group');
     $controller_name = Buffer::get(URL_CONTROLLER);
     $controller_zone = config(URL_CONTROLLER, $controller_name, 'zone');
     $permissions = config(URL_AP, 'access', $controller_name, 'permissions') | config(URL_AP, 'access', 'permissions');
     $path_url = get_path_url();
     //Попытка доступа в области закрытые для посещения?
     if ($controller_zone == Z_CLOSED or $access_zone == Z_CLOSED) {
         return FALSE;
     }
     if ($access_zone != Z_PUBLIC and $user->is_visitor()) {
         return FALSE;
     }
     //Проверяем не заблокирован ли IP
     if (config(URL_AP, 'access', 'check_blocked_ip')) {
         Security::check_access_ip();
     }
     //разрешён ли вход этому типу пользователей?
     if (!in_array(User::T_ALL, $access_users) and !empty($access_users) and !in_array($user->get_type(), $access_users)) {
         return FALSE;
     }
     //Состоит ли пользователь в нужных для доступа группах?
     if (!$user->is_groups($access_groups)) {
         return FALSE;
     }
     //Проверка прав доступа при входе в закрытую зону сайта
     if ((bool) $permissions === TRUE and ($controller_zone == Z_PRIVATE or $access_zone == Z_PRIVATE) and !($user->check_permission($path_url) & $permissions)) {
         return FALSE;
     }
     return TRUE;
 }
Пример #2
0
 //Определяем точку доступа
 $ap_url = empty($path[$i]) ? '' : $path[$i];
 foreach ($route as $key => $value) {
     if ($value == $ap_url) {
         $ap = $key;
         break;
     }
     if (empty($value)) {
         $ap = $key;
         --$i;
         // чтобы не пропустить текущий сегмент URL
         break;
     }
 }
 if (empty($ap)) {
     throw new Exception_wx(4040003, get_path_url());
 }
 ++$i;
 $ap = (string) str_replace('-', '_', $ap);
 Buffer::set(URL_AP, $ap);
 //Объявляем глобальное имя точки доступа в системе
 $controller = config(URL_AP, 'default', 'controller');
 $method = config(URL_AP, 'default', 'method');
 if (!empty($path[$i])) {
     $controller = $path[$i];
     ++$i;
 }
 $controller = (string) str_replace('-', '_', $controller);
 Buffer::set(URL_CONTROLLER, $controller);
 if (!empty($path[$i])) {
     $method = $path[$i];
Пример #3
0
 public static function generate_key()
 {
     //if ($short)
     //{
     return crc32(get_path_url());
     //}
     //$style_suite = config(URL_AP, 'default', 'style_suite');
     //$postfix = ( config('web','is_mobile') ) ? "{$style_suite}_mobile" : $style_suite;
     //$get_string = config('settings', 'get_string');
     //return crc32( get_path_url() ).'__page_'.$get_string.'-'.$postfix;
 }