Example #1
0
 public function post_edit()
 {
     /* Delete the project */
     if (Input::get('delete')) {
         Project::delete_project(Project::current());
         return Redirect::to('projects')->with('notice', __('tinyissue.project_has_been_deleted'));
     }
     $image = '';
     if (\Laravel\Input::has_file('image')) {
         $img = \Laravel\Input::file('image');
         if ($img['size'] > 100000) {
             return Redirect::to(Project::current()->to('edit'))->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(Project::current()->to('edit'))->with_input()->with('notice-error', __('tinyissue.file_size_errors'));
         }
         $destination = "../uploads/project/";
         $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('image', $destination, $name);
             $image = 'uploads/project/' . $name;
         } else {
             return Redirect::to(Project::current()->to('edit'))->with_input()->with('notice-error', __('tinyissue.file_type_errors'));
         }
     }
     /* Update the project */
     $update = Project::update_project(Input::all(), Project::current(), $image);
     if ($update['success']) {
         return Redirect::to(Project::current()->to('edit'))->with('notice', __('tinyissue.project_has_been_updated'));
     }
     return Redirect::to(Project::current()->to('edit'))->with_errors($update['errors'])->with('notice-error', __('tinyissue.we_have_some_errors'));
 }
Example #2
0
 public function post_edit()
 {
     /* Delete the project */
     if (Input::get('delete')) {
         Project::delete_project(Project::current());
         return Redirect::to('projects')->with('notice', __('tinyissue.project_has_been_deleted'));
     }
     /* Update the project */
     $update = Project::update_project(Input::all(), Project::current());
     if ($update['success']) {
         return Redirect::to(Project::current()->to('edit'))->with('notice', __('tinyissue.project_has_been_updated'));
     }
     return Redirect::to(Project::current()->to('edit'))->with_errors($update['errors'])->with('notice-error', __('tinyissue.we_have_some_errors'));
 }
Example #3
0
 public function post_edit()
 {
     /* Delete the project */
     if (Input::get('delete')) {
         Project::delete_project(Project::current());
         return Redirect::to('projects')->with('notice', 'The project has been deleted.');
     }
     /* Update the project */
     $update = Project::update_project(Input::all(), Project::current());
     if ($update['success']) {
         return Redirect::to(Project::current()->to('edit'))->with('notice', 'Project has been updated!');
     }
     return Redirect::to(Project::current()->to('edit'))->with_errors($update['errors'])->with('notice-error', 'Whoops, we have some errors below.');
 }