예제 #1
0
 public function post_settings()
 {
     $avatar = '';
     if (\Laravel\Input::has_file('avatar')) {
         $img = \Laravel\Input::file('avatar');
         if ($img['size'] > 100000) {
             return Redirect::to('user/settings')->with_input()->with('notice-error', __('tinyissue.file_sizes_errors'));
         }
         $arr_size = getimagesize($img['tmp_name']);
         if ($arr_size[0] > 200 && $arr_size[1] > 200) {
             return Redirect::to('user/settings')->with_input()->with('notice-error', __('tinyissue.file_size_errors'));
         }
         $destination = "../uploads/avatar/";
         $extensions = array('image/png', 'image/jpg', 'image/jpeg');
         if (in_array($img['type'], $extensions)) {
             $name = md5($img['name'] . rand(11111, 99999)) . "." . $this->extensions($img['type']);
             \Laravel\Input::upload('avatar', $destination, $name);
             $avatar = 'uploads/avatar/' . $name;
         } else {
             return Redirect::to('user/settings')->with_input()->with('notice-error', __('tinyissue.file_type_errors'));
         }
     }
     $settings = User\Setting::update_user_settings(Input::all(), Auth::user()->id, $avatar);
     if (!$settings['success']) {
         return Redirect::to('user/settings')->with_input()->with_errors($settings['errors'])->with('notice-error', __('tinyissue.we_have_some_errors'));
     }
     return Redirect::to('user/settings')->with('notice', __('tinyissue.settings_updated'));
 }
예제 #2
0
 public function post_settings()
 {
     $settings = User\Setting::update_user_settings(Input::all(), Auth::user()->id);
     if (!$settings['success']) {
         return Redirect::to('settings')->with_input()->with_errors($settings['errors'])->with('notice-error', __('tinyissue.we_have_some_errors'));
     }
     return Redirect::to('user/settings')->with('notice', __('tinyissue.settings_updated'));
 }
예제 #3
0
파일: user.php 프로젝트: neosin/tinyissue
 public function post_settings()
 {
     $settings = User\Setting::update_user_settings(Input::all(), Auth::user()->id);
     if (!$settings['success']) {
         return Redirect::to('settings')->with_input()->with_errors($settings['errors'])->with('notice-error', 'Whoops, we have some errors below.');
     }
     return Redirect::to('user/settings')->with('notice', 'Settings Updated');
 }