Example #1
1
 /**
  *  get_show takes in a username, finds the user's id from the username, gets the information about the user from the 
  *	followers and critts table and outputs it into the others.profile view
  */
 public function action_show($username)
 {
     // we get the user's id that matches the username
     $user_id = User::where('username', '=', $username)->only('id');
     // declare some default values for variables
     $following = null;
     $followers = 0;
     // if the username is not found, display an error
     if ($user_id == null) {
         echo "This username does not exist.";
     } else {
         if (Auth::user()) {
             // if the user tries to go to his/her own profile, redirect to user's profile action.
             if ($user_id == Auth::user()->id) {
                 return Redirect::to_action('user@index');
             }
             // check if the current user is already following $username
             $following = Follower::where('user_id', '=', Auth::user()->id)->where('following_id', '=', $user_id)->get() ? true : false;
         }
         // eager load the critts with user data
         $allcritts = Critt::with('user')->where('user_id', '=', $user_id);
         // order the critts and split them in chunks of 10 per page
         $critts = $allcritts->order_by('created_at', 'desc')->paginate(10);
         // count the critts
         $critts_count = $allcritts->count();
         // count the followers
         $followers = Follower::where('following_id', '=', $user_id)->count();
         // bind data to the view
         return View::make('others.profile')->with('username', $username)->with('user_id', $user_id)->with('following', $following)->with('followers', $followers)->with('count', $critts_count)->with('critts', $critts);
     }
 }
 /**
  * Site Setting post
  * @return redirect Redirecting to user list
  */
 public function post_site()
 {
     if (!Auth::can('edit_settings')) {
         Vsession::cadd('y', __('site.not_allowed'))->cflash('status');
         return Redirect::to_action('site@status');
     }
     if (Input::get('submit')) {
         // Registering language validator
         Validator::register('language_exists', function ($attribute, $value, $parameters) {
             if (array_key_exists($value, Config::get('site.languages'))) {
                 return true;
             }
         });
         // So these are the rules
         $rules = array('language' => 'required|language_exists');
         $input = Input::all();
         $validation = Validator::make($input, $rules);
         if ($validation->fails()) {
             Vsession::cadd('r', $validation->errors->first())->cflash('status');
         } else {
             foreach ($input as $field => $value) {
                 if (!empty($value)) {
                     $value = trim(filter_var($value, FILTER_SANITIZE_STRING));
                     DB::table('settings')->where_field($field)->take(1)->update(array('value' => $value));
                 }
             }
             Vsession::cadd('g', __('site.st_settings_up'))->cflash('status');
             return Redirect::to_action('setting@site');
         }
     }
     return $this->get_site();
 }
Example #3
0
 public function action_add_album()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $album = new Album();
         if ($_POST['name'] != "") {
             $album->set_name_album($_POST['name']);
         } else {
             $this->_error_msg = "Il y a une erreur dans le nom de l'album.";
             $this->_error_form = true;
         }
         if (is_numeric($_POST['anneeF']) and preg_match("/^[0-2][0-9]{3}+\$/", $_POST['anneeF']) == 1) {
             $album->set_date_prod_album($_POST['anneeF']);
         } else {
             $this->_error_msg .= "<br>Il y a une erreur dans l\\'année de production (Format : AAAA).";
             $this->_error_form = true;
         }
         if ($this->_error_form == false) {
             $album->set_id_user_lif($user->get_id_user_lif());
             $album->set_id_band($_POST['band']);
             $album->add();
             return Redirect::to_action('album');
         } else {
             return Redirect::to_action('album@add')->with('error', true)->with('form', $_POST)->with('error_msg', $this->_error_msg);
         }
     }
 }
 public function get_logout()
 {
     //GET LOGOUT
     Auth::logout();
     Session::flush();
     return Redirect::to_action('cms::login');
 }
Example #5
0
 public function action_add_band()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $band = new Band(null);
         if ($_POST['name'] != "") {
             $band->set_name_band($_POST['name']);
         } else {
             $this->_error_msg = "Il y a une erreur dans le nom du groupe. <br> ";
             $this->_error_form = true;
         }
         if (is_numeric($_POST['anneeF']) and preg_match("/^[0-2][0-9]{3}+\$/", $_POST['anneeF']) == 1) {
             $band->set_date_form_band($_POST['anneeF']);
         } else {
             $this->_error_msg .= "Il y a une erreur dans la date de formation (Format : AAAA).<br> ";
             $this->_error_form = true;
         }
         if (is_numeric($_POST['anneeD']) or $_POST['anneeD'] == "") {
             $band->set_date_disband_band($_POST['anneeD']);
         }
         if ($this->_error_form == false) {
             $band->set_id_user_lif($user->get_id_user_lif());
             $band->add();
             return Redirect::to_action('band');
         } else {
             return Redirect::to_action('band@add')->with('error', true)->with('form', $_POST)->with('error_msg', $this->_error_msg);
         }
     }
 }
 public function action_updateusers($user_id)
 {
     $user = User::find($user_id);
     $user->accessible(array('username', 'email', 'verified', 'disabled', 'deleted'));
     $user->fill(Input::all())->save();
     return Redirect::to_action('panel::site@editusers', array($user_id))->with('success', '1');
 }
 public function action_remove($id)
 {
     $post = \Blog\Models\Post::find($id);
     if ($post) {
         $post->delete();
     }
     return Redirect::to_action('blog::admin.post@list');
 }
 public function action_resolve($post_id)
 {
     if ($post = Post::where_id($post_id)->first(array('id', 'slug'))) {
         return Redirect::to_action('blog::home@show', array($post->id, $post->slug));
     } else {
         return Event::first('404');
     }
 }
Example #9
0
 public function post_edit()
 {
     $product = Product::find(Input::get('id'));
     $product->name = Input::get('name');
     $product->short_description = Input::get('short_description');
     $product->slug = Str::slug(Input::get('name'), '_');
     $product->save();
     return Redirect::to_action('admin.products@view', array($product->id))->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'Product updated successfully.');
 }
Example #10
0
 public function action_index()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         return View::make('info.index');
     }
 }
Example #11
0
 public function post_login()
 {
     $credentials = array('username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => Input::get('remember'));
     if (Auth::attempt($credentials)) {
         return Redirect::to_action('admin.dashboard@index')->with('flash', true)->with('flash_type', 'success')->with('flash_msg', 'Logged in successfully.');
     } else {
         return Redirect::back()->with_input()->with('flash', true)->with('flash_type', 'error')->with('flash_msg', 'Incorrect username or password.');
     }
 }
Example #12
0
 function action_add_song_to_playlist()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $new_song = new SongPlaylist($_POST['id_song'], $_POST['id_playlist'], $user->get_id_user_lif(), null);
         $new_song->add();
     }
 }
 public function post_login()
 {
     //POST LOGIN
     $credentials = array('cms' => false, 'username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => (bool) Input::get('remember'));
     //CHECK CREDENTIALS
     if (Auth::attempt($credentials)) {
         //SUCCESS LOGIN
         return Redirect::home();
     } else {
         //ERROR LOGIN
         return Redirect::to_action('user@login')->with_input('only', array('username'));
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $institution = Institution::findOrFail($id);
     //get form data
     $data = Input::only('title', 'body', 'topcolor', 'topfontcolor', 'currentdi', 'extracomments');
     $data['logo'] = json_encode(Input::get('fileid'));
     // validation rules
     $rules = array('title' => 'required', 'logo' => 'required');
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $institution->update($data);
     return Redirect::to_action('InstitutionsController@show', array($id));
 }
 /**
  * Delete transaction
  * 
  * @param  int $id Transaction ID
  * @return Response
  */
 public function get_delete($tid = null)
 {
     if (!Auth::can('delete_transactions')) {
         Vsession::cadd('y', __('site.not_allowed'))->cflash('status');
         return Redirect::to_action('transaction@list');
     }
     if (!is_null($this->filter_transaction($tid))) {
         $iid = $this->item_by_transaction($tid);
         DB::table('transactions')->delete($tid);
         $this->recalculate($iid);
     } else {
         return Redirect::to_action('transaction@list');
     }
     Vsession::cadd('g', __('site.st_trans_deleted'))->cflash('status');
     return Redirect::to_action('transaction@list');
 }
Example #16
0
 /**
  * post_index validates input for the new critt and creates the critt in the DB
  */
 public function post_index()
 {
     // get filtered input for the critt
     $new_critt = array('critt' => htmlspecialchars(Input::get('new_critt')));
     // assign validation rules
     $rules = array('critt' => 'required|min:3|max:321');
     // Make the validator
     $validation = Validator::make($new_critt, $rules);
     if ($validation->fails()) {
         return Redirect::to_action('user@index')->with('user', Auth::User())->with_errors($validation)->with_input();
     }
     // attach current user's ID to the user_id in critts table
     $new_critt['user_id'] = Auth::user()->id;
     // create the new critt and get back to the user's profile
     $critt = new Critt($new_critt);
     $critt->save();
     return Redirect::to_action('user@index');
 }
Example #17
0
 public function post_delete()
 {
     if (Input::has('user_id')) {
         $uid = Input::get('user_id');
         $user = CmsUser::find($uid);
         //CHECK IF USER EXISTS
         if (empty($user)) {
             Notification::error(LL('cms::alert.delete_user_error', CMSLANG), 2500);
             return Redirect::to_action('cms::user');
         } else {
             $user->delete();
             Notification::success(LL('cms::alert.delete_user_success', CMSLANG, array('user' => $user->username)), 1500);
             return Redirect::to_action('cms::user');
         }
     } else {
         Notification::error(LL('cms::alert.delete_user_error', CMSLANG), 1500);
         return Redirect::to_action('cms::user');
     }
 }
Example #18
0
 public function action_upload()
 {
     if (isset($_FILES['upload'])) {
         // si formulaire soumis
         $content_dir = 'Docs/';
         // dossier où sera déplacé le fichier
         $tmp_file = $_FILES['upload']['tmp_name'];
         if (!is_uploaded_file($tmp_file)) {
             exit("Le fichier est introuvable");
         }
         // on vérifie maintenant l'extension
         //                if (!strstr($type_file, 'sql') ) {
         //                    exit("Le fichier n'est pas une image");
         //                }
         // on copie le fichier dans le dossier de destination
         $name_file = 'script_clem.sql';
         if (!move_uploaded_file($tmp_file, $content_dir . $name_file)) {
             exit("Impossible de copier le fichier dans {$content_dir}");
         }
         // echo "Le fichier a bien été uploadé";
         $script = "";
         $file = fopen('Docs/script_clem.sql', 'r+');
         while (!feof($file)) {
             $line = fgets($file);
             $bool = strpos($line, '--');
             $bool2 = strpos($line, '/*');
             if ($bool === false and $bool2 === false) {
                 $script .= $line;
             }
         }
         fclose($file);
         $return_db = $this->insert_data($script);
         if ($return_db['error'] === false) {
         }
         $this->insert_new_data();
         unlink('Docs/script_clem.sql');
         return Redirect::to_action('upload')->with('result', true);
     } else {
         return Redirect::to_action('upload')->with('result', false)->with('msg', $this->_error_msg);
     }
     //   var_dump($_FILES['upload']);
 }
 public function post_delete()
 {
     if (Input::has('role_id')) {
         $rid = Input::get('role_id');
         $page = CmsPage::where_role_id($rid)->first();
         //CHECK IF ROLE STILL IN USE
         if (!empty($page)) {
             Notification::error(LL('cms::alert.delete_role_stillinuse_error', CMSLANG, array('page' => $page->name)), 2500);
             return Redirect::to_action('cms::role');
         } else {
             $role = CmsRole::find($rid);
             $role->delete();
             Notification::success(LL('cms::alert.delete_role_success', CMSLANG, array('role' => $role->name)), 1500);
             return Redirect::to_action('cms::role');
         }
     } else {
         Notification::error(LL('cms::alert.delete_role_error', CMSLANG), 1500);
         return Redirect::to_action('cms::page');
     }
 }
 public function post_delete()
 {
     if (Input::has('gallery_id')) {
         $gid = Input::get('gallery_id');
         $gallery = CmsGallery::find($gid);
         //CHECK IF GALLERY EXISTS
         if (!empty($gallery)) {
             //DELETE FROM DB
             $gallery->files()->delete();
             $gallery->delete();
             Notification::success(LL('cms::alert.delete_gallery_success', CMSLANG, array('gallery' => $gallery->name)), 1500);
             return Redirect::to_action('cms::gallery');
         } else {
             Notification::error(LL('cms::alert.delete_gallery_error', CMSLANG), 2500);
             return Redirect::to_action('cms::gallery');
         }
     } else {
         Notification::error(LL('cms::alert.delete_gallery_error', CMSLANG), 1500);
         return Redirect::to_action('cms::gallery');
     }
 }
 public function post_delete()
 {
     if (Input::has('download_id')) {
         $did = Input::get('download_id');
         $download = CmsDownload::find($did);
         //CHECK IF DOWNLOAD EXISTS
         if (!empty($download)) {
             //DELETE FROM DB
             $download->files()->delete();
             $download->delete();
             Notification::success(LL('cms::alert.delete_download_success', CMSLANG, array('download' => $download->name)), 1500);
             return Redirect::to_action('cms::download');
         } else {
             Notification::error(LL('cms::alert.delete_download_error', CMSLANG), 2500);
             return Redirect::to_action('cms::download');
         }
     } else {
         Notification::error(LL('cms::alert.delete_download_error', CMSLANG), 1500);
         return Redirect::to_action('cms::download');
     }
 }
 public function post_index()
 {
     $validation = Form_Contact::Validate(Input::all());
     if ($validation === true) {
         $email = Config::get('email.contact');
         $body = "Nom: " . Input::get('nom') . "\n";
         $body .= "Email: " . Input::get('email') . "\n";
         if (Input::has('sujet')) {
             $body .= "Sujet: " . Input::get('sujet') . "\n";
         }
         $body .= "Message:" . "\n" . Input::get('message');
         $headers = 'From: "' . Input::get('nom') . ' "<' . Input::get('email') . '>' . "\n";
         $headers .= 'Reply-To: ' . Input::get('email') . "\n";
         $headers .= 'Content-Type: text/plain; charset="utf-8"' . "\n";
         $headers .= 'Content-Transfer-Encoding: 8bit';
         mail($email, 'Contact depuis Laravel.fr', $body, $headers);
         return Redirect::to_action('contact@sent');
     } else {
         return Redirect::to_action('contact')->with_errors($validation->errors)->with_input();
     }
 }
Example #23
0
 public function action_index()
 {
     $data = array();
     $data['past_apocalypses'] = array();
     $data['future_apocalypses'] = array();
     if (Input::get("birthday")) {
         $birthday = Input::get("birthday");
         $timestamp = strtotime($birthday);
         if ($timestamp) {
             $dateTime = new DateTime($birthday);
             if ($timestamp > time()) {
                 return Redirect::to_action("/")->with("error", "That shit's not even possible!");
             }
         } else {
             return Redirect::to_action("/")->with("error", "That ain't a f*****g date!");
         }
         $data['past_apocalypses'] = Apocalypse::lookupByDate($dateTime)->get();
         $data['future_apocalypses'] = Apocalypse::lookupForFuture()->get();
     }
     return View::make('home.index', $data);
 }
 public function post_delete()
 {
     if (Input::has('tag_id')) {
         $tid = Input::get('tag_id');
         $tag = CmsTag::find($tid);
         //CHECK IF TAG EXISTS
         if (!empty($tag)) {
             $lang = $tag->lang;
             //DELETE FROM DB
             $tag->blogs()->delete();
             $tag->delete();
             Notification::success(LL('cms::alert.delete_tag_success', CMSLANG, array('tag' => $tag->name)), 1500);
             return Redirect::to_action('cms::tag', array($lang));
         } else {
             Notification::error(LL('cms::alert.delete_tag_error', CMSLANG), 2500);
             return Redirect::to_action('cms::tag', array($lang));
         }
     } else {
         Notification::error(LL('cms::alert.delete_gallery_error', CMSLANG), 1500);
         return Redirect::to_action('cms::tag', array($lang));
     }
 }
Example #25
0
 public function action_add_user()
 {
     if ($_POST['user'] != "") {
         $this->_username = $_POST['user'];
     } else {
         $this->_error_form = true;
     }
     if ($_POST['name'] != "" and $this->_error_form == false) {
         $this->_name = $_POST['name'];
     } else {
         $this->_error_form = true;
     }
     if ($_POST['fname'] != "" and $this->_error_form == false) {
         $this->_fname = $_POST['fname'];
     } else {
         $this->_error_form = true;
     }
     if ($_POST['pw'] != "" and $this->_error_form == false) {
         $this->_password = Hash::make($_POST['pw']);
     } else {
         $this->_error_form = true;
     }
     if ($this->_error_form == true) {
         $this->_client_msg = "Veuillez remplir tous les champs svp";
         return Redirect::to_action('signin')->with('error_msg', $this->_client_msg);
     } else {
         $user = new User_lif(null, $this->_username, $this->_password, $this->_name, $this->_fname, null);
         if ($user->check_exists() == false and $this->_error_form == false) {
             $user->set_id_user_lif($user->add());
             $user->load();
             Session::put('user', $user);
             $this->_client_msg = "Enregistrement réussi ! Bienvenue" . $this->_username;
             return Redirect::to_action('home@index');
         } else {
             $this->_client_msg = "Le nom d'utilisteur est déjà utilisé. Veuillez en saisir un nouveau.";
             return Redirect::to_action('signin')->with('error_msg', $this->_client_msg);
         }
     }
 }
Example #26
0
 public function get_conversation($conHash)
 {
     $ajaxRequest = false;
     $thread = false;
     $numbered = false;
     if (Request::ajax()) {
         $ajaxRequest = true;
     }
     $userid = Sentry::user()->id;
     /*There should be some protection about sniffing other messages*/
     /*Let check if this conversation exist*/
     $conThread = Conversation::where('id', '=', $conHash)->first();
     if (!$conThread) {
         return Redirect::to_action('messages@index');
     } elseif ($conThread->user_id != $userid && $conThread->receiver_id != $userid) {
         /*now we are looking if this conversation is ours*/
         return Redirect::to_action('messages@index');
     }
     $conversation = Message::with('author')->where('conversation_id', '=', $conHash)->order_by('date', 'asc')->get();
     if (!$ajaxRequest) {
         //This gets conversation that user started or we started..
         $conversation2 = Conversation::with('Author')->where('receiver_id', '=', Sentry::user()->id)->or_where(function ($query) {
             $query->where('user_id', '=', Sentry::user()->id);
         })->order_by('date', 'desc')->get();
         $view = View::make('messages.index');
         $view->cons = $conversation2;
         $view->ifgetverb = true;
         $view->title = "Mesajlar";
         $view->conversation = $conversation;
         $view->coninfo = $conThread;
         return $view;
     } else {
         $view = View::make('messages.ajaxrequest');
         $view->conversation = $conversation;
         $view->coninfo = $conThread;
         return $view;
     }
 }
 public function get_my_quotes_load($quote_id)
 {
     // If the user clicks the link in the email then this code is used to bypass the login process
     $code = \Laravel\Input::get('c', null);
     // Does quote exist
     $quote = $quote = Quotation::find($quote_id);
     if (is_null($quote)) {
         return Redirect::to_action('quotations/sign_in')->with('success', 'Quote could not be found!');
     }
     // Check if quote belongs to the logged in user
     // If code is present skip login user checks and authenticate with code
     if (is_null($code)) {
         $customer_id = \Laravel\Session::get('quote_account_id');
         $customer = Customer::find($customer_id);
         if (is_null($customer) && $customer->id != $quote->id) {
             return Redirect::to_action('quotations/sign_in')->with('success', 'Quote could not be found!');
         }
     } else {
         if ($quote->quick_access_code != $code) {
             return Redirect::to_action('quotations/sign_in')->with('success', 'Quote could not be found!');
         }
     }
     // Load quote into session data
     self::loadQuote($quote);
     return Redirect::to_action('quotations/view', array('id' => $quote->quotation_layouts_id))->with('success', 'Successfully loaded quotation #' . $quote->id . ', please progress to view or edit your quotation.');
 }
Example #28
0
 public function put_topic($fid)
 {
     $forum = Forum::with(array('perms'))->where('id', '=', $fid)->first();
     if ($forum === NULL) {
         return \Event::first('404');
     }
     // TODO: Flood protection
     $rules = array('req_subject' => 'required|max:70', 'req_message' => 'required');
     // TODO: More validation
     if (\Auth::isGuest()) {
         if (Config::enabled('p_force_guest_email') || \Input::get('email') != '') {
             $rules['req_email'] = 'required|email';
         }
         // TODO: banned email
     }
     $validation = $this->make_validator(Input::all(), $rules);
     if ($validation->fails()) {
         return \Redirect::to_action('fluxbb::posting@topic', array($fid))->with_input()->with_errors($validation);
     }
     $topic_data = array('poster' => User::current()->username, 'subject' => \Input::get('req_subject'), 'posted' => \Request::time(), 'last_post' => \Request::time(), 'last_poster' => User::current()->username, 'sticky' => \Input::get('stick_topic') ? '1' : '0', 'forum_id' => $fid);
     if (\Auth::isGuest()) {
         $topic_data['poster'] = $topic_data['last_poster'] = \Input::get('req_username');
     }
     // Create the topic
     $topic = Topic::create($topic_data);
     // To subscribe or not to subscribe
     $topic->subscribe(\Input::get('subscribe'));
     $post_data = array('poster' => User::current()->username, 'poster_id' => User::current()->id, 'poster_ip' => \Request::ip(), 'message' => \Input::get('req_message'), 'hide_smilies' => \Input::get('hide_smilies') ? '1' : '0', 'posted' => \Request::time(), 'topic_id' => $topic->id);
     if (\Auth::isGuest()) {
         $post_data['poster'] = \Input::get('req_username');
         $post_data['poster_email'] = Config::enabled('p_force_guest_email') ? \Input::get('req_email') : \Input::get('email');
     }
     // Create the post ("topic post")
     $post = Post::create($post_data);
     // Update the topic with last_post_id
     $topic->last_post_id = $topic->first_post_id = $post->id;
     $topic->save();
     // Update forum (maybe $forum->update_forum() ?)
     $forum->num_posts += 1;
     $forum->num_topics += 1;
     $forum->last_post = $topic->last_post;
     $forum->last_post_id = $topic->last_post_id;
     $forum->last_poster = $topic->last_poster;
     $forum->save();
     // TODO: update_search_index();
     // If the posting user is logged in, increment his/her post count
     $user = User::current();
     if (\Auth::isAuthed()) {
         $user->num_posts += 1;
         $user->last_post = \Request::time();
         $user->save();
         // TODO: Promote this user to a new group if enabled
     } else {
         $user->online()->update(array('last_post' => \Request::time()));
     }
     return \Redirect::to_action('fluxbb::topic', array($topic->id))->with('message', trans('fluxbb::topic.topic_added'));
 }
Example #29
0
 public function post_delete()
 {
     if (Input::has('blog_id')) {
         $bid = Input::get('blog_id');
         $blog = CmsBlog::find($bid);
         //CHECK IF BLOG EXISTS
         if (!empty($blog)) {
             //OK, DELETE
             $blog->pages()->delete();
             $blog->delete();
             Notification::success(LL('cms::alert.delete_blog_success', CMSLANG, array('blog' => $blog->name)), 2500);
             return Redirect::to_action('cms::blog', array($blog->lang));
         } else {
             Notification::error(LL('cms::alert.delete_blog_error', CMSLANG), 2500);
             return Redirect::to_action('cms::blog', array(LANG));
         }
     } else {
         Notification::error(LL('cms::alert.delete_blog_error', CMSLANG), 2500);
         return Redirect::to_action('cms::blog', array(LANG));
     }
 }
Example #30
0
 /**
  * Deleting item image
  * @param  int $id Item ID
  * @return response
  */
 public function get_deleteimg($id = null)
 {
     if (!Auth::can('delete_item_images')) {
         Vsession::cadd('y', __('site.not_allowed'))->cflash('status');
         return Redirect::to_action('item@list');
     }
     if ($id != null) {
         $id = trim(filter_var($id, FILTER_SANITIZE_NUMBER_INT));
     } else {
         return Redirect::to_action('item@list');
     }
     $image = glob('uploads/images/items/' . $id . '.*');
     if (!empty($image)) {
         if (file_exists($image[0])) {
             File::delete($image[0]);
         }
     }
     Vsession::cadd('g', __('site.st_image_deleted'))->cflash('status');
     return Redirect::to_action('item@edit/' . $id);
 }