Пример #1
0
 public function __construct()
 {
     parent::__construct();
     if (self::$_saved === null) {
         self::$_saved = false;
     }
     if (self::$_need_save === null) {
         self::$_need_save = false;
     }
     $tmp = input()->cookie();
     if (array_count($tmp) > 0) {
         if (array_key_isset('PHPSESSID', $tmp)) {
             unset($tmp['PHPSESSID']);
         }
         if (array_count($tmp) > 0) {
             foreach ($tmp as $key => $val) {
                 if (is_varible_name($key)) {
                     if ($val != '') {
                         $this->_properties[$key] = unserialize(@gzuncompress(base64_decode($val)));
                     } else {
                         $this->_properties[$key] = '';
                     }
                 }
             }
         }
     }
     unset($tmp);
 }
Пример #2
0
 public function __set($name, $value)
 {
     global $_SESSION;
     if (is_string($name) && is_varible_name($name)) {
         $_SESSION[$name] = $this->_properties[$name] = $value;
     }
 }
Пример #3
0
 public function __set($name, $value)
 {
     if (is_string($name) && is_varible_name($name)) {
         $method = studly_case($name);
         $method = "set{$method}Property";
         if (method_exists($this, $method)) {
             $this->_properties[$name] = $this->{$method}($value);
         } else {
             $this->_properties[$name] = $value;
         }
     } else {
         throw new stdObjectException('Incorrect varible name');
     }
 }
Пример #4
0
 public function getControllerLang($controller_name)
 {
     if (is_controller_exists($controller_name)) {
         $lng_dir = LANGUAGE_DIR . DIR_SEP . strtolower($controller_name);
         $current_lng_file = wasp_strtolower($this->CURRENT_LANG . '.php');
         $default_lng_file = wasp_strtolower($this->DEFAULT_LANG . '.php');
         if (is_dir($lng_dir) && is_file($lng_dir . DIR_SEP . $default_lng_file)) {
             $strings = (include $lng_dir . DIR_SEP . $default_lng_file);
             if (array_count($strings) > 0) {
                 foreach ($strings as $key => $val) {
                     if (is_varible_name($key) && is_scalar($val)) {
                         $this->strings->{$key} = $val;
                     }
                 }
             }
         }
         if ($this->DEFAULT_LANG != $this->CURRENT_LANG) {
             if (is_dir($lng_dir) && is_file($lng_dir . DIR_SEP . $current_lng_file)) {
                 $strings = (include $lng_dir . DIR_SEP . $current_lng_file);
                 if (array_count($strings) > 0) {
                     foreach ($strings as $key => $val) {
                         if (is_varible_name($key) && is_scalar($val)) {
                             $this->strings->{$key} = $val;
                         }
                     }
                 }
             }
         }
     }
 }
Пример #5
0
 /**
  * Redirector
  * 
  * @param array $data
  * @param integer $status
  */
 function redirect($data = null)
 {
     if (!is_array($data)) {
         if (is_string($data)) {
             header('Location: ' . make_url($data), true, 301);
             exit;
         } else {
             if (empty($data)) {
                 header('Location: ' . BASE_URL);
                 exit;
             }
         }
         wasp_error('Incorrect redirect path');
     }
     $msgTemp = [];
     if (!empty($data['message'])) {
         $msgTemp['message'] = $data['message'];
     }
     if (!empty($data['error'])) {
         $msgTemp['error'] = $data['error'];
     }
     if (array_count($msgTemp) > 0) {
         make_temp('redirect', serialize($msgTemp));
     }
     unset($data['message'], $data['error'], $msgTemp);
     if (empty($data['controller'])) {
         unset($data['controller'], $data['method']);
         $_ = '';
         if (array_count($data) > 0) {
             foreach ($data as $key => $val) {
                 if (is_varible_name($key) && is_scalar($val)) {
                     $_ .= "/{$key}/{$val}";
                 }
             }
         }
         header('Location: ' . BASE_URL . (!empty($_) ? '/index/default' . $_ : ''));
         exit;
     }
     $_ = BASE_URL . '/' . $data['controller'];
     if (isset($data['method'])) {
         $_ .= '/' . $data['method'];
     }
     unset($data['controller'], $data['method']);
     if (array_count($data) > 0) {
         foreach ($data as $key => $val) {
             if (is_varible_name($key) && is_scalar($val)) {
                 $_ .= "/{$key}/{$val}";
             }
         }
     }
     if (is_ajax() && !headers_sent()) {
         http_cache_off();
         if (get_x_response_type() == 'html') {
             exit(javascript('window.location.href = "' . $_ . '";'));
         } else {
             if (get_x_response_type() == 'script') {
                 exit('window.location.href = "' . $_ . '";');
             }
         }
     }
     header('Location: ' . $_, true, 301);
     exit;
 }