@@ -27,13 +27,13 @@ |
||
| 27 | 27 | try { |
| 28 | 28 | if(@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) { |
| 29 | 29 | $password = Str::random(16); |
| 30 | - }else{ |
|
| 30 | + } else{ |
|
| 31 | 31 | $password = $this->command->option("password"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | if(@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) { |
| 35 | 35 | $username = Str::random(5); |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | $username = $this->command->option("username"); |
| 38 | 38 | } |
| 39 | 39 | } catch (\Exception $e) { |
@@ -15,8 +15,11 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public static function has($key) |
| 17 | 17 | { |
| 18 | - if(file_exists(app_path("CBPlugins/".$key))) return true; |
|
| 19 | - else return false; |
|
| 18 | + if(file_exists(app_path("CBPlugins/".$key))) { |
|
| 19 | + return true; |
|
| 20 | + } else { |
|
| 21 | + return false; |
|
| 22 | + } |
|
| 20 | 23 | } |
| 21 | 24 | |
| 22 | 25 | public static function isNeedUpgrade($pluginKey, $versionToCompare) |
@@ -24,7 +27,7 @@ discard block |
||
| 24 | 27 | $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true); |
| 25 | 28 | if($pluginJson) { |
| 26 | 29 | return version_compare($pluginJson['version'], $versionToCompare,"!="); |
| 27 | - }else{ |
|
| 30 | + } else{ |
|
| 28 | 31 | return false; |
| 29 | 32 | } |
| 30 | 33 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | DB::table("users")->where("id", auth()->id())->update($data); |
| 37 | - }catch (\Exception $e) { |
|
| 37 | + } catch (\Exception $e) { |
|
| 38 | 38 | Log::error($e); |
| 39 | 39 | return cb()->redirectBack(cbLang("something_went_wrong"),"warning"); |
| 40 | 40 | } |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | |
| 33 | 33 | return redirect(cb()->getDeveloperUrl()); |
| 34 | 34 | |
| 35 | - }else{ |
|
| 35 | + } else{ |
|
| 36 | 36 | return cb()->redirectBack( cbLang("password_and_username_is_wrong")); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - }catch (CBValidationException $e) { |
|
| 39 | + } catch (CBValidationException $e) { |
|
| 40 | 40 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function getLogin() |
| 35 | 35 | { |
| 36 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 36 | + if(!auth()->guest()) { |
|
| 37 | + return redirect(cb()->getAdminUrl()); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | cbHook()->hookGetLogin(); |
| 39 | 41 | |
@@ -43,7 +45,9 @@ discard block |
||
| 43 | 45 | public function postLogin() |
| 44 | 46 | { |
| 45 | 47 | try{ |
| 46 | - if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
| 48 | + if($this->isSuspendedLogin()) { |
|
| 49 | + throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
| 50 | + } |
|
| 47 | 51 | |
| 48 | 52 | cb()->validation([ |
| 49 | 53 | 'email'=>'required|email', |
@@ -58,7 +62,7 @@ discard block |
||
| 58 | 62 | $this->incrementFailedLogin(); |
| 59 | 63 | return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']); |
| 60 | 64 | } |
| 61 | - }catch (CBValidationException $e) { |
|
| 65 | + } catch (CBValidationException $e) { |
|
| 62 | 66 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
| 63 | 67 | } |
| 64 | 68 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | if(file_exists(app_path("CBPlugins/".$key))) { |
| 94 | 94 | rrmdir(app_path("CBPlugins/".$key)); |
| 95 | 95 | return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']); |
| 96 | - }else{ |
|
| 96 | + } else{ |
|
| 97 | 97 | return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']); |
| 98 | 98 | } |
| 99 | - }else { |
|
| 99 | + } else { |
|
| 100 | 100 | return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -123,7 +123,9 @@ discard block |
||
| 123 | 123 | fclose($temp); |
| 124 | 124 | |
| 125 | 125 | // Rename |
| 126 | - if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key)); |
|
| 126 | + if(file_exists(app_path("CBPlugins/".$key))) { |
|
| 127 | + rrmdir(app_path("CBPlugins/".$key)); |
|
| 128 | + } |
|
| 127 | 129 | rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key)); |
| 128 | 130 | |
| 129 | 131 | return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']); |
@@ -131,7 +133,7 @@ discard block |
||
| 131 | 133 | } else { |
| 132 | 134 | return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]); |
| 133 | 135 | } |
| 134 | - }else{ |
|
| 136 | + } else{ |
|
| 135 | 137 | return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']); |
| 136 | 138 | } |
| 137 | 139 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | if($err) { |
| 51 | 51 | return $err; |
| 52 | - }else { |
|
| 52 | + } else { |
|
| 53 | 53 | return $response; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if (Request::is(cb()->getAdminPath())) { |
| 59 | 59 | if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
| 60 | 60 | cb()->routeGet("/", $dashboard); |
| 61 | - }else{ |
|
| 61 | + } else{ |
|
| 62 | 62 | cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex"); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | if($resize_width || $resize_height) { |
| 101 | 101 | $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height); |
| 102 | 102 | return $file_path.'/'.$filename; |
| 103 | - }else{ |
|
| 103 | + } else{ |
|
| 104 | 104 | if (Storage::putFileAs($file_path, $file, $filename, 'public')) { |
| 105 | 105 | return $file_path.'/'.$filename; |
| 106 | 106 | } else { |
| 107 | 107 | throw new \Exception("Something went wrong, file can't upload!"); |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - }else{ |
|
| 110 | + } else{ |
|
| 111 | 111 | throw new \Exception("The file format is not allowed!"); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | if($filename && $ext) { |
| 130 | 130 | return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height); |
| 131 | 131 | } |
| 132 | - }else { |
|
| 132 | + } else { |
|
| 133 | 133 | throw new \Exception("Mime type not found"); |
| 134 | 134 | } |
| 135 | - }else{ |
|
| 135 | + } else{ |
|
| 136 | 136 | throw new \Exception("Mime type not found"); |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | Storage::put($fullFilePath, $img, 'public'); |
| 212 | - }else{ |
|
| 212 | + } else{ |
|
| 213 | 213 | throw new \Exception("The file format is not allowed!"); |
| 214 | 214 | } |
| 215 | 215 | } |