Beispiel #1
0
 protected function _init($key, $reset = false)
 {
     if (!is_array($this->{$key}) || $reset) {
         $this->{$key} = array();
         if (!$reset && !empty($GLOBALS['config']['header'][$key])) {
             $this->{$key} = StringHelper::mixedToArray($GLOBALS['config']['header'][$key]);
         }
     }
 }
Beispiel #2
0
 public function addAppReferrer($params = NULL)
 {
     $fc = FrontController::getInstance();
     if (!empty($params)) {
         $params = StringHelper::mixedToArray($params);
         $arr = array();
         foreach ($params as $p) {
             if (array_key_exists($p, $fc->request)) {
                 $arr[$p] = $fc->request[$p];
             }
         }
         $this->addReferrer($fc->thisUrl($arr));
     } else {
         $this->addReferrer($fc->thisUrl());
     }
 }
Beispiel #3
0
 /**
  * check data before submitting
  */
 public function check($fields = '')
 {
     if (empty($this->data)) {
         return false;
     }
     $arr = StringHelper::mixedToArray($fields);
     $ok = true;
     if (count($arr)) {
         foreach ($arr as $key) {
             if (empty($this->data[$key])) {
                 $this->_error[$key] = 'compulsory_field';
                 $ok = false;
             }
         }
     }
     return $ok;
 }
Beispiel #4
0
 /**
  * reset a session variable
  */
 public function cleanSessionVariable($keys)
 {
     $keys = StringHelper::mixedToArray($keys);
     foreach ($keys as $key) {
         if (isset($_SESSION['appVariables'][$key])) {
             unset($_SESSION['appVariables'][$key]);
         }
     }
 }