public function check_maintenance() { $config = Model_Config::find('first'); View::set_global('config', $config); if ($this->action === 'maintenance' && (int) $config->maintenance !== 1) { Response::redirect('/'); } if (!in_array($this->action, ['maintenance']) && (int) $config->maintenance === 1) { Response::redirect('/maintenance'); } }
public static function update($data) { try { $data['updated_at'] = date('Y-m-d H:i:s', Date::forge()->get_timestamp()); $query = Model_Config::find(1); $query->set($data); $query->save(); } catch (Exception $e) { Log::write('ERROR', $e->getMessage()); return false; } return true; }
public function action_index() { $this->data['config'] = Model_Config::find('first'); $this->template->content = View::forge($this->layout . '/dashboard/index', $this->data); }