protected function _command()
 {
     Buffer::set('command', self::COMMAND, 'post');
     Buffer::set('action', self::ACTION, 'post');
     require_once BASEPATH . 'strategies/commands.php';
     $class_name = 'Commands_strategy';
     $command = new $class_name();
     $command->execute();
 }
Exemple #2
0
            unset($words);
        }
        return $structures[$name];
    }
}
if (!function_exists('config')) {
    function config()
    {
        static $conf;
        $key_buffer = 'reloading_config_status';
        if (empty($conf) or !is_array($conf)) {
            include_once BASEPATH . 'config/config.php';
            if (!isset($config) or !is_array($config)) {
                exit('Config error');
            }
            $conf = $config;
            unset($config);
        }
        $status = Buffer::get($key_buffer);
        $ap_name = Buffer::get(URL_AP);
        if (!empty($ap_name) and $status != $ap_name) {
            if (!is_array($conf)) {
                $conf = array();
            }
            include_once APPPATH . "modules/{$ap_name}/config.php";
            if (array_key_exists(URL_AP, $conf)) {
                unset($conf[URL_AP]);
            }
            if (!isset($config)) {
                exit('Config error');
            }
            $conf[URL_AP] = $config;
            Buffer::set($key_buffer, $ap_name);
            unset($config);
        }
        $argv_list = func_get_args();
        $cursor =& $conf;
        foreach ($argv_list as $key) {
            if (!is_array($cursor) or !array_key_exists($key, $cursor)) {
Exemple #3
0
 }
 $controller = (string) str_replace('-', '_', $controller);
 Buffer::set(URL_CONTROLLER, $controller);
 if (!empty($path[$i])) {
     $method = $path[$i];
     ++$i;
 }
 $method = (string) str_replace('-', '_', $method);
 Buffer::set(URL_METHOD, $method);
 if (!empty($path[$i])) {
     for ($j = 0; $j < $i; $j++) {
         unset($path[$j]);
     }
     $options = array_values($path);
 }
 Buffer::set(URL_OPT, $options);
 //Проверяем корректность сессии
 if (!Session::analysis()) {
     Session::create();
 }
 //Разрешён ли вообще доступ пользователю?
 $access_zone = config(URL_AP, 'access', 'zone');
 $access_users = (array) config(URL_AP, 'access', 'user');
 if ($access_zone != Z_PUBLIC) {
     $user = Loader::get_user();
     if (!empty($access_users) and !in_array(User::T_ALL, $access_users) and $user->is_visitor() or !in_array($user->get_type(), $access_users)) {
         require_once PATH_STRATEGIES . 'identification.php';
         $class_name = 'Identification' . $postfix;
         $strategy = new $class_name();
     }
 }