@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | private function existsPrivilege($cb_roles_id, $cb_menus_id) { |
| 81 | 81 | if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) { |
| 82 | 82 | return $row->id; |
| 83 | - }else{ |
|
| 83 | + } else{ |
|
| 84 | 84 | return null; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $privilege["can_delete"] = $menu['can_delete']?:0; |
| 103 | 103 | if($privilege_id = $this->existsPrivilege($id, $menus_id)) { |
| 104 | 104 | DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege); |
| 105 | - }else{ |
|
| 105 | + } else{ |
|
| 106 | 106 | DB::table("cb_role_privileges")->insert($privilege); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $data['photo'] = cb()->uploadFile('photo', true, 200, 200); |
| 32 | 32 | } |
| 33 | 33 | DB::table("users")->where("id", auth()->id())->update($data); |
| 34 | - }catch (\Exception $e) { |
|
| 34 | + } catch (\Exception $e) { |
|
| 35 | 35 | Log::error($e); |
| 36 | 36 | return cb()->redirectBack("Something went wrong!","warning"); |
| 37 | 37 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
| 132 | 132 | if(Storage::exists($newLocation)) { |
| 133 | 133 | return asset($newLocation); |
| 134 | - }else{ |
|
| 134 | + } else{ |
|
| 135 | 135 | $img = Image::make(storage_path($path))->fit($width,$height); |
| 136 | 136 | $img->save(storage_path($newLocation),$quality); |
| 137 | 137 | return asset($newLocation); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if(file_exists(storage_path('.cbconfig'))) { |
| 178 | 178 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 179 | 179 | $settings = unserialize($settings); |
| 180 | - }else{ |
|
| 180 | + } else{ |
|
| 181 | 181 | $settings = []; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | if(file_exists(storage_path('.cbconfig'))) { |
| 195 | 195 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 196 | 196 | $settings = unserialize($settings); |
| 197 | - }else{ |
|
| 197 | + } else{ |
|
| 198 | 198 | $settings = []; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | if(isset($settings[$key])) { |
| 202 | 202 | return $settings[$key]?:$default; |
| 203 | - }else{ |
|
| 203 | + } else{ |
|
| 204 | 204 | return $default; |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $url = request($name); |
| 287 | 287 | if(filter_var($url, FILTER_VALIDATE_URL)) { |
| 288 | 288 | return $url; |
| 289 | - }else{ |
|
| 289 | + } else{ |
|
| 290 | 290 | return request()->url(); |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -298,14 +298,14 @@ discard block |
||
| 298 | 298 | $response = request($name); |
| 299 | 299 | if(is_string($response)) { |
| 300 | 300 | $response = sanitizeXSS($response); |
| 301 | - }elseif (is_array($response)) { |
|
| 301 | + } elseif (is_array($response)) { |
|
| 302 | 302 | array_walk_recursive($response, function(&$response) { |
| 303 | 303 | $response = sanitizeXSS($response); |
| 304 | 304 | }); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | return $response; |
| 308 | - }else{ |
|
| 308 | + } else{ |
|
| 309 | 309 | return Request::get($name); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -315,11 +315,13 @@ discard block |
||
| 315 | 315 | function min_var_export($input) { |
| 316 | 316 | if(is_array($input)) { |
| 317 | 317 | $buffer = []; |
| 318 | - foreach($input as $key => $value) |
|
| 319 | - $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
| 318 | + foreach($input as $key => $value) { |
|
| 319 | + $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
| 320 | + } |
|
| 320 | 321 | return "[".implode(",",$buffer)."]"; |
| 321 | - } else |
|
| 322 | - return var_export($input, true); |
|
| 322 | + } else { |
|
| 323 | + return var_export($input, true); |
|
| 324 | + } |
|
| 323 | 325 | } |
| 324 | 326 | } |
| 325 | 327 | |
@@ -332,10 +334,11 @@ discard block |
||
| 332 | 334 | $objects = scandir($dir); |
| 333 | 335 | foreach ($objects as $object) { |
| 334 | 336 | if ($object != "." && $object != "..") { |
| 335 | - if (is_dir($dir."/".$object)) |
|
| 336 | - rrmdir($dir."/".$object); |
|
| 337 | - else |
|
| 338 | - unlink($dir."/".$object); |
|
| 337 | + if (is_dir($dir."/".$object)) { |
|
| 338 | + rrmdir($dir."/".$object); |
|
| 339 | + } else { |
|
| 340 | + unlink($dir."/".$object); |
|
| 341 | + } |
|
| 339 | 342 | } |
| 340 | 343 | } |
| 341 | 344 | rmdir($dir); |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | } else { |
| 104 | 104 | throw new \Exception("Something went wrong, file can't upload!"); |
| 105 | 105 | } |
| 106 | - }else{ |
|
| 106 | + } else{ |
|
| 107 | 107 | throw new \Exception("The file format is not allowed!"); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | if (Request::is(cbConfig('ADMIN_PATH'))) { |
| 52 | 52 | if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
| 53 | 53 | cb()->routeGet("/", $dashboard); |
| 54 | - }else{ |
|
| 54 | + } else{ |
|
| 55 | 55 | cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex"); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -71,7 +71,9 @@ |
||
| 71 | 71 | $user = []; |
| 72 | 72 | $user['name'] = request('name'); |
| 73 | 73 | $user['email'] = request('email'); |
| 74 | - if(request('password')) $user['password'] = Hash::make(request('password')); |
|
| 74 | + if(request('password')) { |
|
| 75 | + $user['password'] = Hash::make(request('password')); |
|
| 76 | + } |
|
| 75 | 77 | $user['cb_roles_id'] = request('cb_roles_id'); |
| 76 | 78 | DB::table('users')->where('id',$id)->update($user); |
| 77 | 79 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | $menu['type'] = request('type'); |
| 55 | 55 | if(request('type') == 'module') { |
| 56 | 56 | $menu['cb_modules_id'] = request('cb_modules_id'); |
| 57 | - }elseif (request('type') == 'url') { |
|
| 57 | + } elseif (request('type') == 'url') { |
|
| 58 | 58 | $menu['path'] = request('url_value'); |
| 59 | - }elseif (request('type') == 'path') { |
|
| 59 | + } elseif (request('type') == 'path') { |
|
| 60 | 60 | $menu['path'] = request('path_value'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | $menu['type'] = request('type'); |
| 80 | 80 | if(request('type') == 'module') { |
| 81 | 81 | $menu['cb_modules_id'] = request('cb_modules_id'); |
| 82 | - }elseif (request('type') == 'url') { |
|
| 82 | + } elseif (request('type') == 'url') { |
|
| 83 | 83 | $menu['path'] = request('url_value'); |
| 84 | - }elseif (request('type') == 'path') { |
|
| 84 | + } elseif (request('type') == 'path') { |
|
| 85 | 85 | $menu['path'] = request('path_value'); |
| 86 | 86 | } |
| 87 | 87 | DB::table("cb_menus")->where("id",$id)->update($menu); |
@@ -7,7 +7,9 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function getLogin() |
| 9 | 9 | { |
| 10 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 10 | + if(!auth()->guest()) { |
|
| 11 | + return redirect(cb()->getAdminUrl()); |
|
| 12 | + } |
|
| 11 | 13 | |
| 12 | 14 | cbHook()->hookGetLogin(); |
| 13 | 15 | |
@@ -28,7 +30,7 @@ discard block |
||
| 28 | 30 | } else { |
| 29 | 31 | return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']); |
| 30 | 32 | } |
| 31 | - }catch (CBValidationException $e) { |
|
| 33 | + } catch (CBValidationException $e) { |
|
| 32 | 34 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
| 33 | 35 | } |
| 34 | 36 | } |
@@ -57,11 +59,11 @@ discard block |
||
| 57 | 59 | |
| 58 | 60 | return redirect(cb()->getDeveloperUrl()); |
| 59 | 61 | |
| 60 | - }else{ |
|
| 62 | + } else{ |
|
| 61 | 63 | return cb()->redirectBack("Username and or password is wrong!"); |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | - }catch (CBValidationException $e) { |
|
| 66 | + } catch (CBValidationException $e) { |
|
| 65 | 67 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
| 66 | 68 | } |
| 67 | 69 | } |
@@ -76,45 +76,60 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | public function canBrowse() { |
| 78 | 78 | if($this->privilege) { |
| 79 | - if($this->privilege->can_browse) return true; |
|
| 80 | - else return false; |
|
| 81 | - }else{ |
|
| 79 | + if($this->privilege->can_browse) { |
|
| 80 | + return true; |
|
| 81 | + } else { |
|
| 82 | + return false; |
|
| 83 | + } |
|
| 84 | + } else{ |
|
| 82 | 85 | return true; |
| 83 | 86 | } |
| 84 | 87 | } |
| 85 | 88 | |
| 86 | 89 | public function canCreate() { |
| 87 | 90 | if($this->privilege) { |
| 88 | - if($this->privilege->can_create) return true; |
|
| 89 | - else return false; |
|
| 90 | - }else{ |
|
| 91 | + if($this->privilege->can_create) { |
|
| 92 | + return true; |
|
| 93 | + } else { |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + } else{ |
|
| 91 | 97 | return true; |
| 92 | 98 | } |
| 93 | 99 | } |
| 94 | 100 | |
| 95 | 101 | public function canRead() { |
| 96 | 102 | if($this->privilege) { |
| 97 | - if($this->privilege->can_read) return true; |
|
| 98 | - else return false; |
|
| 99 | - }else{ |
|
| 103 | + if($this->privilege->can_read) { |
|
| 104 | + return true; |
|
| 105 | + } else { |
|
| 106 | + return false; |
|
| 107 | + } |
|
| 108 | + } else{ |
|
| 100 | 109 | return true; |
| 101 | 110 | } |
| 102 | 111 | } |
| 103 | 112 | |
| 104 | 113 | public function canUpdate() { |
| 105 | 114 | if($this->privilege) { |
| 106 | - if($this->privilege->can_update) return true; |
|
| 107 | - else return false; |
|
| 108 | - }else{ |
|
| 115 | + if($this->privilege->can_update) { |
|
| 116 | + return true; |
|
| 117 | + } else { |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | + } else{ |
|
| 109 | 121 | return true; |
| 110 | 122 | } |
| 111 | 123 | } |
| 112 | 124 | |
| 113 | 125 | public function canDelete() { |
| 114 | 126 | if($this->privilege) { |
| 115 | - if($this->privilege->can_delete) return true; |
|
| 116 | - else return false; |
|
| 117 | - }else{ |
|
| 127 | + if($this->privilege->can_delete) { |
|
| 128 | + return true; |
|
| 129 | + } else { |
|
| 130 | + return false; |
|
| 131 | + } |
|
| 132 | + } else{ |
|
| 118 | 133 | return true; |
| 119 | 134 | } |
| 120 | 135 | } |
@@ -123,7 +138,7 @@ discard block |
||
| 123 | 138 | { |
| 124 | 139 | if($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
| 125 | 140 | return action($this->controller.'@getAdd'); |
| 126 | - }else{ |
|
| 141 | + } else{ |
|
| 127 | 142 | return null; |
| 128 | 143 | } |
| 129 | 144 | } |
@@ -132,7 +147,7 @@ discard block |
||
| 132 | 147 | { |
| 133 | 148 | if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
| 134 | 149 | return action($this->controller.'@postAddSave'); |
| 135 | - }else{ |
|
| 150 | + } else{ |
|
| 136 | 151 | return null; |
| 137 | 152 | } |
| 138 | 153 | } |
@@ -141,7 +156,7 @@ discard block |
||
| 141 | 156 | { |
| 142 | 157 | if($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
| 143 | 158 | return action($this->controller.'@getEdit',['id'=>$id]); |
| 144 | - }else{ |
|
| 159 | + } else{ |
|
| 145 | 160 | return null; |
| 146 | 161 | } |
| 147 | 162 | } |
@@ -150,7 +165,7 @@ discard block |
||
| 150 | 165 | { |
| 151 | 166 | if(method_exists($this->controller_class, 'postEditSave')) { |
| 152 | 167 | return action($this->controller.'@postEditSave',['id'=>$id]); |
| 153 | - }else{ |
|
| 168 | + } else{ |
|
| 154 | 169 | return null; |
| 155 | 170 | } |
| 156 | 171 | } |
@@ -159,7 +174,7 @@ discard block |
||
| 159 | 174 | { |
| 160 | 175 | if($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
| 161 | 176 | return action($this->controller.'@getDetail',['id'=>$id]); |
| 162 | - }else{ |
|
| 177 | + } else{ |
|
| 163 | 178 | return null; |
| 164 | 179 | } |
| 165 | 180 | } |
@@ -168,7 +183,7 @@ discard block |
||
| 168 | 183 | { |
| 169 | 184 | if($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
| 170 | 185 | return action($this->controller.'@getDelete',['id'=>$id]); |
| 171 | - }else{ |
|
| 186 | + } else{ |
|
| 172 | 187 | return null; |
| 173 | 188 | } |
| 174 | 189 | } |
@@ -177,7 +192,7 @@ discard block |
||
| 177 | 192 | { |
| 178 | 193 | if($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
| 179 | 194 | return trim(action($this->controller.'@getIndex').'/'.$path,'/'); |
| 180 | - }else{ |
|
| 195 | + } else{ |
|
| 181 | 196 | return null; |
| 182 | 197 | } |
| 183 | 198 | } |