@@ -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 | } |
@@ -118,49 +118,49 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | if(!function_exists('assetThumbnail')) { |
121 | - function assetThumbnail($path) { |
|
122 | - $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
123 | - return asset($path); |
|
124 | - } |
|
121 | + function assetThumbnail($path) { |
|
122 | + $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
123 | + return asset($path); |
|
124 | + } |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | if(!function_exists('assetResize')) { |
128 | - function assetResize($path,$width,$height=null,$quality=70) { |
|
129 | - $basename = basename($path); |
|
130 | - $pathWithoutName = str_replace($basename, '', $path); |
|
131 | - $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
|
132 | - if(Storage::exists($newLocation)) { |
|
133 | - return asset($newLocation); |
|
134 | - }else{ |
|
135 | - $img = Image::make(storage_path($path))->fit($width,$height); |
|
136 | - $img->save(storage_path($newLocation),$quality); |
|
137 | - return asset($newLocation); |
|
138 | - } |
|
139 | - } |
|
128 | + function assetResize($path,$width,$height=null,$quality=70) { |
|
129 | + $basename = basename($path); |
|
130 | + $pathWithoutName = str_replace($basename, '', $path); |
|
131 | + $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
|
132 | + if(Storage::exists($newLocation)) { |
|
133 | + return asset($newLocation); |
|
134 | + }else{ |
|
135 | + $img = Image::make(storage_path($path))->fit($width,$height); |
|
136 | + $img->save(storage_path($newLocation),$quality); |
|
137 | + return asset($newLocation); |
|
138 | + } |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if(!function_exists('extract_unit')) { |
143 | - /* |
|
143 | + /* |
|
144 | 144 | Credits: Bit Repository |
145 | 145 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
146 | 146 | */ |
147 | - function extract_unit($string, $start, $end) |
|
148 | - { |
|
149 | - $pos = stripos($string, $start); |
|
150 | - $str = substr($string, $pos); |
|
151 | - $str_two = substr($str, strlen($start)); |
|
152 | - $second_pos = stripos($str_two, $end); |
|
153 | - $str_three = substr($str_two, 0, $second_pos); |
|
154 | - $unit = trim($str_three); // remove whitespaces |
|
155 | - return $unit; |
|
156 | - } |
|
147 | + function extract_unit($string, $start, $end) |
|
148 | + { |
|
149 | + $pos = stripos($string, $start); |
|
150 | + $str = substr($string, $pos); |
|
151 | + $str_two = substr($str, strlen($start)); |
|
152 | + $second_pos = stripos($str_two, $end); |
|
153 | + $str_three = substr($str_two, 0, $second_pos); |
|
154 | + $unit = trim($str_three); // remove whitespaces |
|
155 | + return $unit; |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
160 | 160 | if(!function_exists('now')) { |
161 | - function now() { |
|
162 | - return date('Y-m-d H:i:s'); |
|
163 | - } |
|
161 | + function now() { |
|
162 | + return date('Y-m-d H:i:s'); |
|
163 | + } |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /* |
@@ -324,22 +324,22 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | if(!function_exists('rrmdir')) { |
327 | - /* |
|
327 | + /* |
|
328 | 328 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
329 | 329 | */ |
330 | - function rrmdir($dir) { |
|
331 | - if (is_dir($dir)) { |
|
332 | - $objects = scandir($dir); |
|
333 | - foreach ($objects as $object) { |
|
334 | - if ($object != "." && $object != "..") { |
|
335 | - if (is_dir($dir."/".$object)) |
|
336 | - rrmdir($dir."/".$object); |
|
337 | - else |
|
338 | - unlink($dir."/".$object); |
|
339 | - } |
|
340 | - } |
|
341 | - rmdir($dir); |
|
342 | - } |
|
343 | - } |
|
330 | + function rrmdir($dir) { |
|
331 | + if (is_dir($dir)) { |
|
332 | + $objects = scandir($dir); |
|
333 | + foreach ($objects as $object) { |
|
334 | + if ($object != "." && $object != "..") { |
|
335 | + if (is_dir($dir."/".$object)) |
|
336 | + rrmdir($dir."/".$object); |
|
337 | + else |
|
338 | + unlink($dir."/".$object); |
|
339 | + } |
|
340 | + } |
|
341 | + rmdir($dir); |
|
342 | + } |
|
343 | + } |
|
344 | 344 | } |
345 | 345 |
@@ -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 |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | namespace crocodicstudio\crudbooster\fonts; |
3 | 3 | |
4 | 4 | class Fontawesome { |
5 | - public static function getIcons() { |
|
6 | - return [ |
|
5 | + public static function getIcons() { |
|
6 | + return [ |
|
7 | 7 | "glass", |
8 | 8 | "music", |
9 | 9 | "search", |
@@ -699,5 +699,5 @@ discard block |
||
699 | 699 | "bluetooth-b", |
700 | 700 | "percent", |
701 | 701 | ]; |
702 | - } |
|
702 | + } |
|
703 | 703 | } |
704 | 704 | \ No newline at end of file |
@@ -4,7 +4,7 @@ |
||
4 | 4 | interface CBHook { |
5 | 5 | |
6 | 6 | public function hookGetLogin(); |
7 | - public function hookPostLogin(); |
|
8 | - public function beforeBackendMiddleware($request); |
|
7 | + public function hookPostLogin(); |
|
8 | + public function beforeBackendMiddleware($request); |
|
9 | 9 | public function afterBackendMiddleware($request, $response); |
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -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); |