protected function __init()
 {
     Config::_getInstance()->load('PasswordHash');
     foreach (config('PasswordHash') as $key => $value) {
         $this->{$key} = $value;
     }
 }
Example #2
0
 protected function __init()
 {
     Config::_getInstance()->load('DB');
     $this->link = new mysqli(config('host', 'DB'), config('user', 'DB'), config('password', 'DB'), config('db', 'DB'));
     if ($this->link->connect_error) {
         $this->addError('connection', $this->link->connect_errno, $this->link->connect_error);
     }
     $this->link->set_charset(config('encoding', 'DB'));
 }
Example #3
0
 /**
  * @return $this
  */
 public function cleanExpired()
 {
     if (!IS_CLI) {
         return error404();
     }
     Config::_getInstance()->load('Token');
     $eI = config('expireInterval', 'Token');
     DB::_getInstance()->query("DELETE FROM `Token` WHERE `Created` < NOW() - INTERVAL {$eI} AND `ID` > 1");
     return $this;
 }
Example #4
0
 private function autoload()
 {
     foreach (Config::_getInstance()->getValue('helper', 'Loader') as $helper) {
         include_once HELPER_PATH . "{$helper}.php";
     }
     foreach (Config::_getInstance()->getValue('lang', 'Loader') as $lang) {
         Lang::_getInstance()->load($lang);
     }
     foreach (Config::_getInstance()->getValue('config', 'Loader') as $config) {
         Config::_getInstance()->load($config);
     }
 }
 /**
  * @return $this
  */
 public function test()
 {
     Config::_getInstance()->load('UpgradeDB');
     if (!config('enabled', 'UpgradeDB')) {
         lang('disabled', 'UpgradeDB');
         exit;
     }
     Error::_getInstance()->flush()->_('verbosity', 'die');
     if (is_null($this->index()->run('test')->__())) {
         lang('upToDate', 'UpgradeDB');
         exit;
     }
     if (!copyContent(BASE_PATH . config('testContentPath', 'UpgradeDB'), BASE_PATH . config('contentPath', 'Default'))) {
         lang('copyContentFailure', 'UpgradeDB');
     }
     lang('copyContentSuccess', 'UpgradeDB');
     linefeed();
     return $this;
 }
Example #6
0
 protected function __init()
 {
     Config::_getInstance()->load('Input');
     $this->_vars = array_merge(config('Input'), $_COOKIE, $_REQUEST);
 }
Example #7
0
/**
 * @param string $key
 * @param string $type
 * @param mixed $value
 * @return Config|callable|mixed
 */
function config($key, $type = null, $value = null)
{
    return is_null($value) ? Config::_getInstance()->getValue($key, $type) : Config::_getInstance()->setValue($key, $type, $value);
}
 protected function __init()
 {
     $this->mode = array();
     Config::_getInstance()->load('Validation');
 }
Example #9
0
 protected function __init()
 {
     Config::_getInstance()->load('Output');
 }
Example #10
0
 protected function __init()
 {
     Config::_getInstance()->load('Debug');
 }
Example #11
0
 /**
  * @return $this
  */
 public function create()
 {
     if (func_num_args() == 0 || !array_key_exists('tmp_name', $_FILES[config('uploadFileIndex', 'Default')])) {
         return error404();
     }
     Config::_getInstance()->load($this->_('type'));
     if (is_array($_FILES[config('uploadFileIndex', 'Default')]['tmp_name'])) {
         $fileNames = $_FILES[config('uploadFileIndex', 'Default')]['tmp_name'];
         $ids = array_fill(0, count($fileNames), array_fill(0, func_num_args(), 0));
         $single = false;
     } else {
         $fileNames = array($_FILES[config('uploadFileIndex', 'Default')]['tmp_name']);
         $ids = array(func_get_args());
         $single = true;
     }
     $result = array();
     if (func_num_args() == 1) {
         for ($i = 0; $i < count($fileNames); $i++) {
             $result[$i] = $this->prepareSource($fileNames[$i])->parse(input('filter'))->prepareFilter()->save($ids[$i][0])->finalize()->__();
         }
     } else {
         for ($i = 0; $i < count($fileNames); $i++) {
             $result[$i] = array();
             foreach ($ids[$i] as $j => $id) {
                 if ($id == -1) {
                     $result[$i] = array_merge($result[$i], array("ID" . ($j + 1) => -1));
                     continue;
                 }
                 $t = $this->prepareSource($fileNames[$i])->parse(input('filter') . "/{$j}")->prepareFilter()->save($id)->__();
                 $result[$i] = array_merge($result[$i], array_combine(array_map(postfix($j ? $j + 1 : ""), array_keys($t)), array_values($t)));
             }
             $this->finalize();
         }
     }
     return $this->result($single ? $result[0] : array('multiple' => $result));
 }