public function update($type = null, $ID = null)
 {
     if (Input::exists('post')) {
         if ($type == 'block') {
             DB::load()->update('Users', 'ID', Input::get('ID'), array('Status_ID' => 1));
             Session::set('SUCCESS', I18n::get('SYSTEM_CRUD_SUCCESS'));
             Redirect::to(Input::get('current'));
         }
         if ($type == 'unblock') {
             DB::load()->update('Users', 'ID', Input::get('ID'), array('Status_ID' => 2));
             Session::set('SUCCESS', I18n::get('SYSTEM_CRUD_SUCCESS'));
             Redirect::to(Input::get('current'));
         }
         //Update post
         //$this->validateInput();
         // update
         DB::load()->update('Users', 'ID', Input::get('ID'), array('Updated' => time(), 'Email' => Input::get('email'), 'Name' => Input::get('full_name')));
         Session::set('SUCCESS', I18n::get('SYSTEM_CRUD_SUCCESS'));
         Redirect::to(Input::get('current'));
     } else {
         $user = DB::load()->query('SELECT Users.ID, Users.Username, Users.Name, Users.Email,
                   Users.Org
                   FROM Users
                   WHERE Users.ID = ? ', array($ID))->results();
         return (object) array('data' => $user);
     }
 }
 public function verify()
 {
     if (Input::exists('post') && Token::check('csrf_token', Input::get('csrf_token'))) {
         $login = app('Auth')->login(Input::get('username'), Input::get('password'), Input::get('remember'));
         if ($login) {
             redirect();
         }
     }
 }
 public function update($type, $ID)
 {
     if (Input::exists('post') && $ID == Input::get('ID')) {
         //Update post
         $this->validateInput();
         // update
         DB::load()->update('Options', 'ID', Input::get('ID'), array('Value' => Input::get('editor')));
         Session::set('SUCCESS', I18n::get('SYSTEM_CRUD_SUCCESS'));
         Redirect::to(Input::get('current_url'));
     } else {
         $options = DB::load()->query("SELECT \n        ID,Label, Name, Value FROM Options WHERE ID = ? ORDER BY ID DESC", array($ID))->results();
         return (object) array('options' => $options);
     }
 }
 public function delete($type)
 {
     if (Input::exists()) {
         $source = PATH_ROOT . 'public/uploads/source/';
         $thumbs = PATH_ROOT . 'public/uploads/thumbs/';
         $upload = DB::load()->select(array('ID, Slug'), 'Uploads', null, array(array('ID', '=', Input::get('ID'))))->results();
         $file = $upload[0]->Slug;
         Upload::load($source)->remove($file);
         Upload::load($source)->remove($file, $thumbs);
         DB::load()->delete('Uploads', array(array('ID', '=', Input::get('ID'))));
         Session::set('SUCCESS', I18n::get('SYSTEM_CRUD_SUCCESS'));
     }
     Redirect::to($this->data['project_url'] . 'admin/read/uploads');
 }
 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'));
     }
 }
 public function create()
 {
     if (Input::exists()) {
         Redirect::to($this->data['project_url'] . 'users/create');
     }
 }
示例#7
0
<?php

// load class
require_once '../src/Input.php';
//use class
use WebSupportDK\PHPHttp\Input;
// get input from posts,get or files. Item is the name form the form or url query string.
//  If it has more than one array, you can use $info to get that
Input::get($item = 'username', $info = null);
// check if input exists in form of posts, get or files.
Input::exists($type = 'post', $data = null);
// in combination with Input::get(), you can return input to a input field
Input::exists($type = 'post', Input::get($item = 'username', $info = null));
// strip a string form tags
Input::strip($string, $tags);
// escape a string for unwanted things
Input::escape($string);
// serialize a string
Input::serialize($input);
// unserialize as string
Input::unserialize($input);
// make a string to a slug, what to replace and what delimiter to use
Input::toSlug($string, $replace = array(), $delimiter = '-');
// create a jsqon string from input
Input::jsonEncode($input);
// create a array from json string
Input::jsonDecode($json);