@@ -47,14 +47,14 @@ |
||
| 47 | 47 | $allowedExtension = explode(',', strtolower(cbConfig('UPLOAD_TYPES'))); |
| 48 | 48 | $path = request('path') ? base64_decode(request('path')) : 'uploads'; |
| 49 | 49 | $file = Request::file('userfile'); |
| 50 | - if (! $file) { |
|
| 50 | + if (!$file) { |
|
| 51 | 51 | return null; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $fileName = $file->getClientOriginalName(); |
| 55 | 55 | $isAllowed = in_array($file->getClientOriginalExtension(), $allowedExtension); |
| 56 | 56 | |
| 57 | - if (! $isAllowed) { |
|
| 57 | + if (!$isAllowed) { |
|
| 58 | 58 | backWithMsg('The file '.$fileName.' type is not allowed!', 'warning'); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | $namespace = '\crocodicstudio\crudbooster\controllers'; |
| 6 | 6 | /* ROUTER FOR UPLOADS */ |
| 7 | -Route::group(['middleware' => ['web'], 'namespace' => $namespace], function () { |
|
| 7 | +Route::group(['middleware' => ['web'], 'namespace' => $namespace], function() { |
|
| 8 | 8 | Route::get('uploads/{one?}/{two?}/{three?}/{four?}/{five?}', ['uses' => 'FileController@getPreview', 'as' => 'fileControllerPreview']); |
| 9 | 9 | }); |
| 10 | 10 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | 'middleware' => ['web', CBBackend::class], |
| 14 | 14 | 'prefix' => cbAdminPath(), |
| 15 | 15 | 'namespace' => ctrlNamespace(), |
| 16 | -], function () { |
|
| 16 | +], function() { |
|
| 17 | 17 | CRUDBooster::routeController('users', 'AdminUsersController'); |
| 18 | 18 | try { |
| 19 | 19 | $modules = DB::table('cms_moduls')->where('path', '!=', '')->where('controller', '!=', '')->where('is_protected', 0)->get(); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | /* ROUTER FOR BACKEND CRUDBOOSTER */ |
| 28 | 28 | Route::group([ |
| 29 | - 'middleware' => ['web', CBBackend::class], 'prefix' => cbAdminPath(), 'namespace' => $namespace,], function () use ($namespace){ |
|
| 29 | + 'middleware' => ['web', CBBackend::class], 'prefix' => cbAdminPath(), 'namespace' => $namespace, ], function() use ($namespace){ |
|
| 30 | 30 | CRUDBooster::routeController('notifications', 'AdminNotificationsController', $namespace); |
| 31 | 31 | }); |
| 32 | 32 | |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | 'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBSuperadmin::class], |
| 35 | 35 | 'prefix' => cbAdminPath(), |
| 36 | 36 | 'namespace' => $namespace, |
| 37 | -], function () { |
|
| 38 | - Route::post('{module}/do-upload-import-data', ['uses' => 'FileController@uploadImportData', 'as' => 'UploadImportData',]); |
|
| 39 | - Route::post('{module}/upload-summernote', ['uses' => 'FileController@uploadSummernote', 'as' => 'UploadImportData',]); |
|
| 40 | - Route::post('{module}/upload-file', ['uses' => 'FileController@uploadFile', 'as' => 'UploadImportData',]); |
|
| 41 | - Route::post('{module}/done-import', ['uses' => 'FileController@doneImport', 'as' => 'doneImportData',]); |
|
| 37 | +], function() { |
|
| 38 | + Route::post('{module}/do-upload-import-data', ['uses' => 'FileController@uploadImportData', 'as' => 'UploadImportData', ]); |
|
| 39 | + Route::post('{module}/upload-summernote', ['uses' => 'FileController@uploadSummernote', 'as' => 'UploadImportData', ]); |
|
| 40 | + Route::post('{module}/upload-file', ['uses' => 'FileController@uploadFile', 'as' => 'UploadImportData', ]); |
|
| 41 | + Route::post('{module}/done-import', ['uses' => 'FileController@doneImport', 'as' => 'doneImportData', ]); |
|
| 42 | 42 | }); |
| 43 | 43 | |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | private function handleFile($name, $row_assign) |
| 50 | 50 | { |
| 51 | - if (! Request::hasFile($name)) { |
|
| 51 | + if (!Request::hasFile($name)) { |
|
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | $file = Request::file($name); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $validator = Validator::make(request()->all(), $rules); |
| 21 | 21 | |
| 22 | - if (! $validator->fails()) { |
|
| 22 | + if (!$validator->fails()) { |
|
| 23 | 23 | return null; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | $rules = []; |
| 38 | 38 | foreach ($form as $formInput) { |
| 39 | 39 | $name = $formInput['name']; |
| 40 | - if (! $name) { |
|
| 40 | + if (!$name) { |
|
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $ai = []; |
| 45 | - if ($formInput['required'] && ! Request::hasFile($name)) { |
|
| 45 | + if ($formInput['required'] && !Request::hasFile($name)) { |
|
| 46 | 46 | $ai[] = 'required'; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $exp = explode('|', $di['validation']); |
| 73 | 73 | |
| 74 | - if (! count($exp)) { |
|
| 74 | + if (!count($exp)) { |
|
| 75 | 75 | return ''; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | | ---------------------------------------------- |
| 53 | 53 | | |
| 54 | 54 | */ |
| 55 | - if (! $row_api->method_type) { |
|
| 55 | + if (!$row_api->method_type) { |
|
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | $method_type = $row_api->method_type; |
| 59 | - if ($method_type && ! Request::isMethod($method_type)) { |
|
| 59 | + if ($method_type && !Request::isMethod($method_type)) { |
|
| 60 | 60 | $result['api_status'] = 0; |
| 61 | 61 | $result['api_message'] = "The request method is not allowed !"; |
| 62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | | ---------------------------------------------- |
| 70 | 70 | | |
| 71 | 71 | */ |
| 72 | - if (! $row_api) { |
|
| 72 | + if (!$row_api) { |
|
| 73 | 73 | $result['api_status'] = 0; |
| 74 | 74 | $result['api_message'] = 'Sorry this API is no longer available, maybe has changed by admin, or please make sure api url is correct.'; |
| 75 | 75 | |
@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | $value = $param['config']; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ($required && $type == 'password' && ! Hash::check($value, $rows->{$name})) { |
|
| 175 | + if ($required && $type == 'password' && !Hash::check($value, $rows->{$name})) { |
|
| 176 | 176 | return $this->passwordError($result, $debug_mode_message, $posts); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if (! $required && $used && $value && ! Hash::check($value, $row->{$name})) { |
|
| 179 | + if (!$required && $used && $value && !Hash::check($value, $row->{$name})) { |
|
| 180 | 180 | return $this->passwordError($result, $debug_mode_message, $posts); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | private function filterRows($data, $parameters, $posts, $table, $type_except) |
| 305 | 305 | { |
| 306 | - $data->where(function ($w) use ($parameters, $posts, $table, $type_except) { |
|
| 306 | + $data->where(function($w) use ($parameters, $posts, $table, $type_except) { |
|
| 307 | 307 | foreach ($parameters as $param) { |
| 308 | 308 | $name = $param['name']; |
| 309 | 309 | $type = $param['type']; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $row->$k = asset($v); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if (! in_array($k, $responses_fields)) { |
|
| 398 | + if (!in_array($k, $responses_fields)) { |
|
| 399 | 399 | unset($row[$k]); |
| 400 | 400 | } |
| 401 | 401 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $rows->$k = asset($v); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - if (! in_array($k, $responses_fields)) { |
|
| 461 | + if (!in_array($k, $responses_fields)) { |
|
| 462 | 462 | unset($row[$k]); |
| 463 | 463 | } |
| 464 | 464 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | $subquery = $resp['subquery']; |
| 481 | 481 | $used = intval($resp['used']); |
| 482 | 482 | |
| 483 | - if ($used == 0 && ! CRUDBooster::isForeignKey($name)) { |
|
| 483 | + if ($used == 0 && !CRUDBooster::isForeignKey($name)) { |
|
| 484 | 484 | continue; |
| 485 | 485 | } |
| 486 | 486 | |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | */ |
| 536 | 536 | private function applyLike($data, $search_in, $value) |
| 537 | 537 | { |
| 538 | - $data->where(function ($w) use ($search_in, $value) { |
|
| 538 | + $data->where(function($w) use ($search_in, $value) { |
|
| 539 | 539 | foreach ($search_in as $k => $field) { |
| 540 | 540 | if ($k == 0) { |
| 541 | 541 | $w->where($field, "like", "%$value%"); |
@@ -23,9 +23,9 @@ |
||
| 23 | 23 | |
| 24 | 24 | if (in_array($type, ['unique', 'exists'])) { |
| 25 | 25 | $format_validation[] = $this->existOrUnique($config, $type); |
| 26 | - } elseif (in_array($type, ['date_format','digits_between', 'in', 'mimes', 'min', 'max', 'not_in'])) { |
|
| 26 | + } elseif (in_array($type, ['date_format', 'digits_between', 'in', 'mimes', 'min', 'max', 'not_in'])) { |
|
| 27 | 27 | $format_validation[] = $type.':'.$config; |
| 28 | - } elseif (! in_array($type, $typeExcept)) { |
|
| 28 | + } elseif (!in_array($type, $typeExcept)) { |
|
| 29 | 29 | $format_validation[] = $type; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | public function uploadSummernote() |
| 18 | 18 | { |
| 19 | - echo asset(app( FileUploader::class)->uploadFile('userfile')); |
|
| 19 | + echo asset(app(FileUploader::class)->uploadFile('userfile')); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function uploadFile() |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $import = app(IndexImport::class); |
| 30 | 30 | //$this->cbLoader(); |
| 31 | - if (! Request::hasFile('userfile')) { |
|
| 31 | + if (!Request::hasFile('userfile')) { |
|
| 32 | 32 | return redirect()->back(); |
| 33 | 33 | } |
| 34 | 34 | $file = Request::file('userfile'); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $fullStoragePath = storage_path('app/'.$fullFilePath); |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - if (! Storage::exists($fullFilePath)) { |
|
| 54 | + if (!Storage::exists($fullFilePath)) { |
|
| 55 | 55 | abort(404); |
| 56 | 56 | } |
| 57 | 57 | $hasImageExtension = $this->isImage($fullStoragePath); |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $w = request('w', cbConfig('DEFAULT_THUMBNAIL_WIDTH', 300)); |
| 88 | 88 | $h = request('h', $w); |
| 89 | - $imgRaw = Image::cache(function ($image) use ($fullStoragePath, $w, $h) { |
|
| 89 | + $imgRaw = Image::cache(function($image) use ($fullStoragePath, $w, $h) { |
|
| 90 | 90 | $im = $image->make($fullStoragePath); |
| 91 | - if (! $w) { |
|
| 91 | + if (!$w) { |
|
| 92 | 92 | return $im; |
| 93 | 93 | } |
| 94 | - if (! $h) { |
|
| 94 | + if (!$h) { |
|
| 95 | 95 | $im->fit($w); |
| 96 | 96 | } else { |
| 97 | 97 | $im->fit($w, $h); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $extension = strtolower(File::extension($fullStoragePath)); |
| 113 | 113 | |
| 114 | - return FieldDetector::isWithin($extension, 'IMAGE_EXTENSIONS');; |
|
| 114 | + return FieldDetector::isWithin($extension, 'IMAGE_EXTENSIONS'); ; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $this->cbLoader(); |
| 24 | 24 | $selectedIds = request('checkbox'); |
| 25 | 25 | $btnName = request('button_name'); |
| 26 | - if (! $selectedIds) { |
|
| 26 | + if (!$selectedIds) { |
|
| 27 | 27 | CB::redirect($_SERVER['HTTP_REFERER'], 'Please select at least one row!', 'warning'); |
| 28 | 28 | } |
| 29 | 29 | if ($btnName == 'delete') { |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | $message = cbTrans('alert_action', ['action' => $action]); |
| 48 | 48 | |
| 49 | 49 | if ($this->actionButtonSelected($id_selected, $button_name) === false) { |
| 50 | - $message = ! empty($this->alert['message']) ? $this->alert['message'] : 'Error'; |
|
| 51 | - $type = ! empty($this->alert['type']) ? $this->alert['type'] : 'danger'; |
|
| 50 | + $message = !empty($this->alert['message']) ? $this->alert['message'] : 'Error'; |
|
| 51 | + $type = !empty($this->alert['type']) ? $this->alert['type'] : 'danger'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | backWithMsg($message, $type); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | private function guardView($request) |
| 61 | 61 | { |
| 62 | - if ($request->is($this->url.'*') && ! CRUDBooster::canView()) { |
|
| 62 | + if ($request->is($this->url.'*') && !CRUDBooster::canView()) { |
|
| 63 | 63 | $this->stopIllegalAction('view'); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function guardCreate($request) |
| 71 | 71 | { |
| 72 | - if ($request->is($this->url.'/add*') && ! CRUDBooster::canCreate()) { |
|
| 72 | + if ($request->is($this->url.'/add*') && !CRUDBooster::canCreate()) { |
|
| 73 | 73 | $this->stopIllegalAction('add'); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | private function guardUpdate($request) |
| 81 | 81 | { |
| 82 | - if ($request->is($this->url.'/edit*') && ! CRUDBooster::canUpdate()) { |
|
| 82 | + if ($request->is($this->url.'/edit*') && !CRUDBooster::canUpdate()) { |
|
| 83 | 83 | $this->stopIllegalAction('edit'); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function guardDelete($request) |
| 91 | 91 | { |
| 92 | - if ($request->is($this->url.'/delete*') && ! CRUDBooster::canDelete()) { |
|
| 92 | + if ($request->is($this->url.'/delete*') && !CRUDBooster::canDelete()) { |
|
| 93 | 93 | $this->stopIllegalAction('delete'); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function guardRead($request) |
| 101 | 101 | { |
| 102 | - if ($request->is($this->url.'/detail*') && ! CRUDBooster::canRead()) { |
|
| 102 | + if ($request->is($this->url.'/detail*') && !CRUDBooster::canRead()) { |
|
| 103 | 103 | $this->stopIllegalAction('view'); |
| 104 | 104 | } |
| 105 | 105 | } |