예제 #1
0
 public function home($lang)
 {
     if (in_array($lang, I18n::$arr_i18n)) {
         $_SESSION['language'] = $lang;
         if ($_SERVER['HTTP_REFERER'] == '') {
             $_SERVER['HTTP_REFERER'] = Routes::$root_url;
         }
         if (preg_match('/\\/lang\\//', $_SERVER['HTTP_REFERER'])) {
             $_SERVER['HTTP_REFERER'] = Routes::$root_url;
         }
         Routes::redirect($_SERVER['HTTP_REFERER']);
     }
 }
예제 #2
0
 public function update_model($action)
 {
     $id = $_GET[$this->model->idmodel];
     settype($id, 'integer');
     $idmodel = $this->model->idmodel;
     $arr_row = $this->model->select_a_row($id, array(), true);
     settype($arr_row[$idmodel], 'integer');
     if ($arr_row[$idmodel] > 0) {
         if (Routes::$request_method == 'GET') {
             $this->form($arr_row, $action, 1);
         } else {
             if (Routes::$request_method == 'POST') {
                 $this->model->set_conditions('WHERE ' . $idmodel . '=' . $id);
                 if (!$this->model->update($_POST, $this->safe)) {
                     echo '<p><span class="error">' . $this->model->std_error . '</span></p>';
                     $this->form($_POST, $action, 1);
                 } else {
                     View::set_flash($this->text_updated_item);
                     Routes::redirect($this->url);
                 }
             }
         }
     }
 }
예제 #3
0
 public function logout()
 {
     ob_start();
     $this->login->logout();
     $cont_index = ob_get_contents();
     ob_end_clean();
     Routes::redirect(Routes::make_simple_url(ADMIN_FOLDER . '/login'));
 }