Exemplo n.º 1
0
 /**
  * Wraps around the Fu_DB::save method and adds error to Fu_Feedback
  */
 function find_all($options = array())
 {
     try {
         if (!$options['limit']) {
             $options['limit'] = '9999999';
         }
         $results = parent::find_all($options);
         $results->num_rows = $results->total_rows;
         return $results;
     } catch (Fu_DB_Validation_Exception $e) {
         $errors = $e->getErrors();
         foreach ($errors as $error) {
             Fu_Feedback::add_error($error['message']);
         }
         throw new Fu_DB_Exception('Validations failed');
     }
 }
Exemplo n.º 2
0
 function change_password($old, $new)
 {
     $u = $this->get_logged_in_user();
     if ($u->password == $old) {
         $u->password = $new;
         return $u->save();
     } else {
         Fu_Feedback::add_error('Incorrect password');
         return false;
     }
 }