Exemplo n.º 1
0
 public static function checkDbTables()
 {
     // database tables installer
     if (!\Meta\Db::tableExists('db_migrations')) {
         // import the whole initial databse file
         \Meta\Db::execute(file_get_contents(abspath('sql/database.sql')));
         Flash::success(t('Database imported.'));
         redirect(page_home());
     }
 }
Exemplo n.º 2
0
 public function onValidated()
 {
     $uid = \User\User::logged()->id;
     $data = $this->getData();
     Db::saveSafe('users', $data);
     Flash::success(t('Profile saved'));
     // change password
     $pass = $data['password_new'];
     if (strlen($pass) > 0) {
         Db::update('users', array('password' => md5($pass)), array('id' => $uid));
         Flash::success(t('Password changed'));
     }
     redirect(url(current_path()));
 }
Exemplo n.º 3
0
 public function onAfterSave()
 {
     Flash::success(t('Record saved'));
     redirect(current_path());
 }
Exemplo n.º 4
0
 public function onDelete()
 {
     \Meta\Db::delete($this->table, array('id' => $_GET['id']));
     \Meta\Flash::success(t('Record deleted'));
     redirect(current_path());
 }