@@ -103,17 +103,14 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if($userId) { |
| 105 | 105 | $this->adminUserService->updateUser($data, $userId); |
| 106 | - } |
|
| 107 | - else { |
|
| 106 | + } else { |
|
| 108 | 107 | $this->adminUserService->registerNewUser($data); |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | 110 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
| 112 | - } |
|
| 113 | - catch(FilterException $fe) { |
|
| 111 | + } catch(FilterException $fe) { |
|
| 114 | 112 | return $this->edit($fe->getArrayMessages()); |
| 115 | - } |
|
| 116 | - catch(\Exception $e) { |
|
| 113 | + } catch(\Exception $e) { |
|
| 117 | 114 | throw $e; |
| 118 | 115 | } |
| 119 | 116 | } |
@@ -125,8 +122,7 @@ discard block |
||
| 125 | 122 | $this->adminUserService->delete($userId); |
| 126 | 123 | |
| 127 | 124 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
| 128 | - } |
|
| 129 | - catch(\Exception $e) { |
|
| 125 | + } catch(\Exception $e) { |
|
| 130 | 126 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users')); |
| 131 | 127 | } |
| 132 | 128 | } |
@@ -128,8 +128,7 @@ |
||
| 128 | 128 | // We don't want to force user to re-upload image on edit |
| 129 | 129 | if(!$values['main_img']) { |
| 130 | 130 | unset($values['main_img']); |
| 131 | - } |
|
| 132 | - else{ |
|
| 131 | + } else{ |
|
| 133 | 132 | $this->upload->deleteFile($oldCategory->main_img); |
| 134 | 133 | } |
| 135 | 134 | |
@@ -139,15 +139,13 @@ |
||
| 139 | 139 | // We don't want to force user to re-upload image on edit |
| 140 | 140 | if (!$event['featured_img']) { |
| 141 | 141 | unset($event['featured_img']); |
| 142 | - } |
|
| 143 | - else { |
|
| 142 | + } else { |
|
| 144 | 143 | $this->upload->deleteFile($oldArticle->featured_img); |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | 146 | if (!$event['main_img']) { |
| 148 | 147 | unset($event['main_img']); |
| 149 | - } |
|
| 150 | - else { |
|
| 148 | + } else { |
|
| 151 | 149 | $this->upload->deleteFile($oldArticle->main_img); |
| 152 | 150 | } |
| 153 | 151 | |
@@ -146,15 +146,13 @@ |
||
| 146 | 146 | // We don't want to force user to re-upload image on edit |
| 147 | 147 | if (!$post['featured_img']) { |
| 148 | 148 | unset($post['featured_img']); |
| 149 | - } |
|
| 150 | - else { |
|
| 149 | + } else { |
|
| 151 | 150 | $this->upload->deleteFile($oldArticle->featured_img); |
| 152 | 151 | } |
| 153 | 152 | |
| 154 | 153 | if (!$post['main_img']) { |
| 155 | 154 | unset($post['main_img']); |
| 156 | - } |
|
| 157 | - else { |
|
| 155 | + } else { |
|
| 158 | 156 | $this->upload->deleteFile($oldArticle->main_img); |
| 159 | 157 | } |
| 160 | 158 | |
@@ -158,15 +158,13 @@ |
||
| 158 | 158 | // We don't want to force user to re-upload image on edit |
| 159 | 159 | if(!$videos['featured_img']) { |
| 160 | 160 | unset($videos['featured_img']); |
| 161 | - } |
|
| 162 | - else { |
|
| 161 | + } else { |
|
| 163 | 162 | $this->upload->deleteFile($oldArticle->featured_img); |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | 165 | if(!$videos['main_img']) { |
| 167 | 166 | unset($videos['main_img']); |
| 168 | - } |
|
| 169 | - else { |
|
| 167 | + } else { |
|
| 170 | 168 | $this->upload->deleteFile($oldArticle->main_img); |
| 171 | 169 | } |
| 172 | 170 | |
@@ -84,17 +84,14 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | if($id) { |
| 86 | 86 | $this->menuService->updateMenuItem($data, $id); |
| 87 | - } |
|
| 88 | - else{ |
|
| 87 | + } else{ |
|
| 89 | 88 | $this->menuService->addMenuItem($data); |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | 91 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu')); |
| 93 | - } |
|
| 94 | - catch(FilterException $fe){ |
|
| 92 | + } catch(FilterException $fe){ |
|
| 95 | 93 | return $this->edit($fe->getArrayMessages()); |
| 96 | - } |
|
| 97 | - catch(\Exception $e){ |
|
| 94 | + } catch(\Exception $e){ |
|
| 98 | 95 | throw $e; |
| 99 | 96 | } |
| 100 | 97 | } |
@@ -106,8 +103,7 @@ discard block |
||
| 106 | 103 | $this->menuService->delete($id); |
| 107 | 104 | |
| 108 | 105 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu')); |
| 109 | - } |
|
| 110 | - catch(\Exception $e){ |
|
| 106 | + } catch(\Exception $e){ |
|
| 111 | 107 | throw $e; |
| 112 | 108 | } |
| 113 | 109 | } |
@@ -120,15 +120,12 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | if($id) { |
| 122 | 122 | $this->postService->updateArticle($data, $id); |
| 123 | - } |
|
| 124 | - else{ |
|
| 123 | + } else{ |
|
| 125 | 124 | $this->postService->createArticle($user, $data); |
| 126 | 125 | } |
| 127 | - } |
|
| 128 | - catch(FilterException $fe){ |
|
| 126 | + } catch(FilterException $fe){ |
|
| 129 | 127 | return $this->edit($fe->getArrayMessages()); |
| 130 | - } |
|
| 131 | - catch(\Exception $e){ |
|
| 128 | + } catch(\Exception $e){ |
|
| 132 | 129 | throw $e; |
| 133 | 130 | } |
| 134 | 131 | |
@@ -145,8 +142,7 @@ discard block |
||
| 145 | 142 | { |
| 146 | 143 | try{ |
| 147 | 144 | $this->postService->deleteArticle($this->request->getAttribute('id')); |
| 148 | - } |
|
| 149 | - catch(\Exception $e){ |
|
| 145 | + } catch(\Exception $e){ |
|
| 150 | 146 | throw $e; |
| 151 | 147 | } |
| 152 | 148 | |
@@ -103,17 +103,14 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if($id) { |
| 105 | 105 | $this->categoryService->updateCategory($data, $id); |
| 106 | - } |
|
| 107 | - else{ |
|
| 106 | + } else{ |
|
| 108 | 107 | $this->categoryService->createCategory($data); |
| 109 | 108 | } |
| 110 | 109 | |
| 111 | 110 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); |
| 112 | - } |
|
| 113 | - catch(FilterException $fe){ |
|
| 111 | + } catch(FilterException $fe){ |
|
| 114 | 112 | return $this->edit($fe->getArrayMessages()); |
| 115 | - } |
|
| 116 | - catch(\Exception $e){ |
|
| 113 | + } catch(\Exception $e){ |
|
| 117 | 114 | throw $e; |
| 118 | 115 | } |
| 119 | 116 | } |
@@ -125,8 +122,7 @@ discard block |
||
| 125 | 122 | $this->categoryService->delete($id); |
| 126 | 123 | |
| 127 | 124 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); |
| 128 | - } |
|
| 129 | - catch(\Exception $e){ |
|
| 125 | + } catch(\Exception $e){ |
|
| 130 | 126 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories')); |
| 131 | 127 | } |
| 132 | 128 | } |
@@ -104,8 +104,7 @@ |
||
| 104 | 104 | // We don't want to force user to re-upload image on edit |
| 105 | 105 | if(!$data['main_img']){ |
| 106 | 106 | unset($data['main_img']); |
| 107 | - } |
|
| 108 | - else{ |
|
| 107 | + } else{ |
|
| 109 | 108 | $this->upload->deleteFile($page->getMainImg()); |
| 110 | 109 | } |
| 111 | 110 | |