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); } } } } }
public function register($update = 0) { $c_users = Webmodel::$model['user_admin']->select_count(); if ($c_users == 0) { ob_start(); if (Routes::$request_method == 'GET') { $this->login->create_account_form(); } else { if (Routes::$request_method == 'POST') { if ($this->login->create_account()) { View::set_flash(I18n::lang('phangoapp/admin', 'user_added_success', 'The user was added successfully')); $url_return = Routes::make_simple_url(ADMIN_FOLDER . '/login'); Routes::redirect($url_return); } else { $this->login->create_account_form(); } } } $cont_index = ob_get_contents(); ob_end_clean(); echo View::load_view(array($cont_index), 'loginadmin'); } }