Ejemplo n.º 1
0
 /**
  * @param array $path
  */
 public function __controller(array $path)
 {
     \classes\compiler::disable();
     error_reporting(-1);
     \core::$css = ['/.core/module/cms/css/styles.css'];
     \core::$js = ['/.core/js/jquery.js', '/.core/js/_ajax.js', '/.core/js/content_collapse.js', '/.core/module/cms/js/cms.js', '/.core/js/colorbox.js', '/.core/plugins/ckeditor/ckeditor.js'];
     if (\core::is_admin() && !isset($path[1])) {
         $path[1] = 'dashboard';
     }
     $this->view = 'login';
     if (isset($path[1]) && !empty($path[1]) && \core::is_admin()) {
         $this->view = $path[1];
         if (isset($path[2])) {
             $this->set_from_mid($path[2]);
             $this->npp = session::is_set('cms', $this->module->get_class_name(), 'npp') ? session::get('cms', $this->module->get_class_name(), 'npp') : 25;
             $this->page = isset($path[4]) ? $path[4] : 1;
             $this->current_class = $this->module->get_class();
         }
     }
     if (isset($path[3]) && !empty($path[3]) && core::is_admin()) {
         /** @var table $class */
         $class = $this->current_class;
         $class::$retrieve_unlive = true;
         $class::$retrieve_deleted = true;
         $this->current->do_retrieve_from_id([], $path[3]);
     }
     parent::__controller($path);
 }
Ejemplo n.º 2
0
 /**
  * @return \PDOStatement
  */
 public function execute()
 {
     $query = 'DELETE FROM ' . $this->table . $this->get_filters();
     compiler::break_cache($this->table);
     cache::break_cache($this->table);
     return _db::query($query, $this->parameters);
 }
Ejemplo n.º 3
0
 public function execute()
 {
     $query = 'UPDATE ' . $this->table . ' SET ' . $this->get_values() . $this->get_filters();
     compiler::break_cache($this->table);
     cache::break_cache($this->table);
     return _db::query($query, $this->parameters);
 }
Ejemplo n.º 4
0
 protected static function start()
 {
     if (!static::$started) {
         session_start();
         \classes\compiler::disable();
         static::$started = true;
     }
 }
Ejemplo n.º 5
0
 public function __controller(array $path)
 {
     if (isset($path[1])) {
         $this->import_string = filter_var(urldecode($path[1]), FILTER_SANITIZE_STRING);
         compiler::disable();
     }
     parent::__controller($path);
 }
Ejemplo n.º 6
0
 public function execute()
 {
     $query = 'REPLACE INTO ' . $this->table . ' SET ' . $this->get_values();
     _db::query($query, $this->parameters);
     $id = _db::insert_id();
     compiler::break_cache($this->table);
     cache::break_cache($this->table);
     return $id;
 }
Ejemplo n.º 7
0
 public static function is_admin()
 {
     compiler::allow();
     return session::is_set('admin');
 }
Ejemplo n.º 8
0
 public static function grab($key, callable $callback, $dependencies = ['global'], $time = null)
 {
     compiler::$dependants = array_merge(compiler::$dependants, $dependencies);
     try {
         $data = cache::get($key, $dependencies);
     } catch (\Exception $e) {
         $data = $callback();
         cache::set([$key => $data], $dependencies, $time);
     }
     return $data;
 }