コード例 #1
0
 public function validateFile()
 {
     $v = Validator::load();
     $v->checkFile($_FILES, array('files' => array('ext' => array('png', 'jpg', 'jpeg'), 'size' => 3000000)));
     if (!$v->passed()) {
         foreach ($v->errors() as $error) {
             $_SESSION['ERRORS'][] = $error;
         }
         var_dump($v->errors());
         Redirect::to($this->data['current_url']);
         exit;
     }
 }
コード例 #2
0
 public function validateInput()
 {
     $v = Validator::load();
     $v->checkPost($_POST, array('editor' => array('required' => true, 'min' => 1)));
     if (!$v->passed()) {
         //            Session::set($title, Input::get($title));
         foreach ($v->errors() as $error) {
             $_SESSION['ERRORS'][] = $error;
         }
         Redirect::to(Input::get('current_url'));
         exit;
     }
 }
コード例 #3
0
 public function reset($key)
 {
     if (isset($key)) {
         $user = UserModel::load()->get(array(array('Reset_token', '=', $key)));
         if ($user) {
             if ($user[0]->Status_ID == 0) {
                 UserModel::load()->update(array('Status_ID' => 1), $user[0]->ID);
                 Session::set('SUCCESS', 'User activated!');
                 Redirect::to($this->url);
             } elseif ($user[0]->Status_ID == 1) {
                 Session::set('WARNING', 'User already activated!');
                 Redirect::to($this->url);
             } elseif ($user[0]->Status_ID == 2) {
                 Session::set('ERRORS', 'User blocked!');
                 Redirect::to($this->url);
             }
         }
         Session::set('ERRORS', 'User key invalid!');
         Redirect::to($this->url);
     }
 }
コード例 #4
0
 public function favorite()
 {
     if (Input::exists()) {
         $check = DB::load()->query('SELECT Meta_ID, Item_ID
                 FROM Meta_items 
                 WHERE Meta_ID = ?
                 AND Item_ID = ?
                 AND Type = ?', array(Input::get('post_id'), Input::get('user_id'), 'favorite'));
         if ($check->results() && $check->_error == false) {
             Session::set('INFO', 'Favorit eksitere allerede.');
             Redirect::to(Input::get('current_url'));
         }
         DB::load()->insert('Meta_items', array('Meta_ID' => Input::get('post_id'), 'Item_ID' => Input::get('user_id'), 'Type' => 'favorite'));
         Session::set('SUCCESS', 'Favorit gemt!');
         Redirect::to(Input::get('current_url'));
     }
 }
コード例 #5
0
 public function validateInput()
 {
     $validate = Validator::load(DB::load());
     $validation = $validate->checkPost($_POST, array('username' => array('required' => true, 'min' => 3, 'max' => 32, 'notTaken' => 'Users'), 'full_name' => array('required' => true, 'min' => 3, 'max' => 50), 'org' => array('required' => false, 'max' => 32), 'password' => array('required' => true, 'min' => 3, 'max' => 64, 'ValidPass' => Input::get('password')), 'email' => array('required' => true, 'min' => 3, 'max' => 32, 'validEmail' => Input::get('email'))));
     if (!$v->passed()) {
         foreach ($v->errors() as $error) {
             Session::addKey('WARNINGS', $error, $error);
         }
         Redirect::to(Input::get('current'));
         exit;
     }
 }