@@ -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 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | public function getIndex() { |
| 12 | 12 | $data = []; |
| 13 | 13 | $data['page_title'] = cbLang("profile"); |
| 14 | - return view(getThemePath('profile'),$data); |
|
| 14 | + return view(getThemePath('profile'), $data); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function postUpdate() { |
| 18 | - validator(request()->all(),[ |
|
| 18 | + validator(request()->all(), [ |
|
| 19 | 19 | 'name'=>'required|max:255|min:3', |
| 20 | 20 | 'email'=>'required|email', |
| 21 | 21 | 'photo'=>'image', |
@@ -26,20 +26,20 @@ discard block |
||
| 26 | 26 | $data = []; |
| 27 | 27 | $data['name'] = request('name'); |
| 28 | 28 | $data['email'] = request('email'); |
| 29 | - if(request('password')) { |
|
| 29 | + if (request('password')) { |
|
| 30 | 30 | $data['password'] = Hash::make(request('password')); |
| 31 | 31 | } |
| 32 | - if(request()->hasFile('photo')) { |
|
| 32 | + if (request()->hasFile('photo')) { |
|
| 33 | 33 | $data['photo'] = cb()->uploadFile('photo', true, 200, 200); |
| 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 | - return cb()->redirectBack(cbLang("something_went_wrong"),"warning"); |
|
| 39 | + return cb()->redirectBack(cbLang("something_went_wrong"), "warning"); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - return cb()->redirectBack("The profile data has been updated!","success"); |
|
| 42 | + return cb()->redirectBack("The profile data has been updated!", "success"); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | } |
@@ -19,25 +19,25 @@ |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function postLoginDeveloper() { |
| 22 | - try{ |
|
| 22 | + try { |
|
| 23 | 23 | cb()->validation([ |
| 24 | 24 | 'username'=>'required', |
| 25 | 25 | 'password'=>'required' |
| 26 | 26 | ]); |
| 27 | 27 | |
| 28 | - if(request('username') == getSetting('developer_username') |
|
| 28 | + if (request('username') == getSetting('developer_username') |
|
| 29 | 29 | && request('password') == getSetting("developer_password")) { |
| 30 | 30 | |
| 31 | 31 | session(['developer'=>getSetting('developer_username')]); |
| 32 | 32 | |
| 33 | 33 | return redirect(cb()->getDeveloperUrl()); |
| 34 | 34 | |
| 35 | - }else{ |
|
| 36 | - return cb()->redirectBack( cbLang("password_and_username_is_wrong")); |
|
| 35 | + } else { |
|
| 36 | + return cb()->redirectBack(cbLang("password_and_username_is_wrong")); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - }catch (CBValidationException $e) { |
|
| 40 | - return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
|
| 39 | + } catch (CBValidationException $e) { |
|
| 40 | + return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning'); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
@@ -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 | } |
@@ -132,9 +132,9 @@ |
||
| 132 | 132 | |
| 133 | 133 | // Update Login At |
| 134 | 134 | cb()->update("users", auth()->id(), [ |
| 135 | - "login_at"=>now()->format("Y-m-d H:i:s"), |
|
| 136 | - "ip_address"=>request()->ip(), |
|
| 137 | - "user_agent"=>request()->userAgent() |
|
| 135 | + "login_at"=>now()->format("Y-m-d H:i:s"), |
|
| 136 | + "ip_address"=>request()->ip(), |
|
| 137 | + "user_agent"=>request()->userAgent() |
|
| 138 | 138 | ]); |
| 139 | 139 | |
| 140 | 140 | // When login user success, clear suspend attempt |
@@ -20,32 +20,32 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function getLogin() |
| 22 | 22 | { |
| 23 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 23 | + if (!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 24 | 24 | |
| 25 | 25 | cbHook()->hookGetLogin(); |
| 26 | 26 | |
| 27 | 27 | $data = []; |
| 28 | - $data['no1'] = rand(1,10); |
|
| 29 | - $data['no2'] = rand(1,10); |
|
| 30 | - Session::put("captcha_result", $data['no1']+$data['no2']); |
|
| 28 | + $data['no1'] = rand(1, 10); |
|
| 29 | + $data['no2'] = rand(1, 10); |
|
| 30 | + Session::put("captcha_result", $data['no1'] + $data['no2']); |
|
| 31 | 31 | |
| 32 | 32 | $themeView = getThemePath("login"); |
| 33 | - $loginView = str_replace(".blade.php", "", getSetting('login_page_view',$themeView)); |
|
| 34 | - return view($loginView, $data ); |
|
| 33 | + $loginView = str_replace(".blade.php", "", getSetting('login_page_view', $themeView)); |
|
| 34 | + return view($loginView, $data); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | private function loginNotification() { |
| 38 | - if($isLoginNotification = getSetting("LOGIN_NOTIFICATION")) { |
|
| 38 | + if ($isLoginNotification = getSetting("LOGIN_NOTIFICATION")) { |
|
| 39 | 39 | $user = auth()->user(); |
| 40 | - if($user->ip_address && $user->user_agent) { |
|
| 40 | + if ($user->ip_address && $user->user_agent) { |
|
| 41 | 41 | |
| 42 | - if( request()->ip() != $user->ip_address || request()->userAgent() != $user->user_agent) { |
|
| 42 | + if (request()->ip() != $user->ip_address || request()->userAgent() != $user->user_agent) { |
|
| 43 | 43 | $code = Str::random(5); |
| 44 | 44 | session(["login_verification_code"=>$code]); |
| 45 | 45 | $mail = new MailHelper(); |
| 46 | 46 | $mail->to($user->email); |
| 47 | - $mail->sender("noreply@".$_SERVER['SERVER_NAME'],cb()->getAppName()); |
|
| 48 | - $mail->content("Please verify that it's you?"," |
|
| 47 | + $mail->sender("noreply@".$_SERVER['SERVER_NAME'], cb()->getAppName()); |
|
| 48 | + $mail->content("Please verify that it's you?", " |
|
| 49 | 49 | Hi $user->name,<br/><br> |
| 50 | 50 | |
| 51 | 51 | Your sign in attempt seems a little different than usual. This could be because you are signing in from a different device or a different location.<br/> |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | try { |
| 87 | 87 | cb()->validation(["code"]); |
| 88 | 88 | |
| 89 | - if(session()->has("login_verification_code")) { |
|
| 89 | + if (session()->has("login_verification_code")) { |
|
| 90 | 90 | $sessCode = session("login_verification_code"); |
| 91 | - if(request("code") == $sessCode) { |
|
| 91 | + if (request("code") == $sessCode) { |
|
| 92 | 92 | // Update Login At |
| 93 | 93 | cb()->update("users", auth()->id(), [ |
| 94 | 94 | "login_at"=>now()->format("Y-m-d H:i:s"), |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return cb()->redirectBack("The code is invalid!","warning"); |
|
| 108 | + return cb()->redirectBack("The code is invalid!", "warning"); |
|
| 109 | 109 | |
| 110 | 110 | } catch (CBValidationException $e) { |
| 111 | 111 | return cb()->redirectBack($e->getMessage()); |
@@ -114,20 +114,20 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | public function postLogin() |
| 116 | 116 | { |
| 117 | - try{ |
|
| 118 | - if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
| 117 | + try { |
|
| 118 | + if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
| 119 | 119 | |
| 120 | 120 | cb()->validation([ |
| 121 | 121 | 'email'=>'required|email', |
| 122 | 122 | 'password'=>'required' |
| 123 | 123 | ]); |
| 124 | 124 | |
| 125 | - $credential = request()->only(['email','password']); |
|
| 125 | + $credential = request()->only(['email', 'password']); |
|
| 126 | 126 | if (auth()->attempt($credential)) { |
| 127 | 127 | |
| 128 | 128 | // Check if login notification is enabled |
| 129 | - if($this->loginNotification()) { |
|
| 130 | - return cb()->redirect(route("AdminAuthControllerGetLoginVerification"),"We have sent you a code verification, please enter to this box"); |
|
| 129 | + if ($this->loginNotification()) { |
|
| 130 | + return cb()->redirect(route("AdminAuthControllerGetLoginVerification"), "We have sent you a code verification, please enter to this box"); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // Update Login At |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | return redirect(cb()->getAdminUrl()); |
| 146 | 146 | } else { |
| 147 | 147 | $this->incrementFailedLogin(); |
| 148 | - return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']); |
|
| 148 | + return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']); |
|
| 149 | 149 | } |
| 150 | - }catch (CBValidationException $e) { |
|
| 151 | - return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
|
| 150 | + } catch (CBValidationException $e) { |
|
| 151 | + return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning'); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
@@ -220,20 +220,20 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if(!function_exists('extract_unit')) { |
| 223 | - /* |
|
| 223 | + /* |
|
| 224 | 224 | Credits: Bit Repository |
| 225 | 225 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
| 226 | 226 | */ |
| 227 | - function extract_unit($string, $start, $end) |
|
| 228 | - { |
|
| 229 | - $pos = stripos($string, $start); |
|
| 230 | - $str = substr($string, $pos); |
|
| 231 | - $str_two = substr($str, strlen($start)); |
|
| 232 | - $second_pos = stripos($str_two, $end); |
|
| 233 | - $str_three = substr($str_two, 0, $second_pos); |
|
| 234 | - $unit = trim($str_three); // remove whitespaces |
|
| 235 | - return $unit; |
|
| 236 | - } |
|
| 227 | + function extract_unit($string, $start, $end) |
|
| 228 | + { |
|
| 229 | + $pos = stripos($string, $start); |
|
| 230 | + $str = substr($string, $pos); |
|
| 231 | + $str_two = substr($str, strlen($start)); |
|
| 232 | + $second_pos = stripos($str_two, $end); |
|
| 233 | + $str_three = substr($str_two, 0, $second_pos); |
|
| 234 | + $unit = trim($str_three); // remove whitespaces |
|
| 235 | + return $unit; |
|
| 236 | + } |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /* |
@@ -407,22 +407,22 @@ discard block |
||
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | if(!function_exists('rrmdir')) { |
| 410 | - /* |
|
| 410 | + /* |
|
| 411 | 411 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
| 412 | 412 | */ |
| 413 | - function rrmdir($dir) { |
|
| 414 | - if (is_dir($dir)) { |
|
| 415 | - $objects = scandir($dir); |
|
| 416 | - foreach ($objects as $object) { |
|
| 417 | - if ($object != "." && $object != "..") { |
|
| 418 | - if (is_dir($dir."/".$object)) |
|
| 419 | - rrmdir($dir."/".$object); |
|
| 420 | - else |
|
| 421 | - unlink($dir."/".$object); |
|
| 422 | - } |
|
| 423 | - } |
|
| 424 | - rmdir($dir); |
|
| 425 | - } |
|
| 426 | - } |
|
| 413 | + function rrmdir($dir) { |
|
| 414 | + if (is_dir($dir)) { |
|
| 415 | + $objects = scandir($dir); |
|
| 416 | + foreach ($objects as $object) { |
|
| 417 | + if ($object != "." && $object != "..") { |
|
| 418 | + if (is_dir($dir."/".$object)) |
|
| 419 | + rrmdir($dir."/".$object); |
|
| 420 | + else |
|
| 421 | + unlink($dir."/".$object); |
|
| 422 | + } |
|
| 423 | + } |
|
| 424 | + rmdir($dir); |
|
| 425 | + } |
|
| 426 | + } |
|
| 427 | 427 | } |
| 428 | 428 | |
@@ -2,8 +2,11 @@ discard block |
||
| 2 | 2 | if(!function_exists("isConfigCached")) { |
| 3 | 3 | function isConfigCached() |
| 4 | 4 | { |
| 5 | - if(env("APP_NAME")=="" || env("APP_NAME")==null) return true; |
|
| 6 | - else return false; |
|
| 5 | + if(env("APP_NAME")=="" || env("APP_NAME")==null) { |
|
| 6 | + return true; |
|
| 7 | + } else { |
|
| 8 | + return false; |
|
| 9 | + } |
|
| 7 | 10 | } |
| 8 | 11 | } |
| 9 | 12 | |
@@ -113,7 +116,9 @@ discard block |
||
| 113 | 116 | } |
| 114 | 117 | |
| 115 | 118 | $str = substr($str, 0, -1); |
| 116 | - if (!file_put_contents($envFile, $str)) return false; |
|
| 119 | + if (!file_put_contents($envFile, $str)) { |
|
| 120 | + return false; |
|
| 121 | + } |
|
| 117 | 122 | return true; |
| 118 | 123 | } |
| 119 | 124 | } |
@@ -316,7 +321,7 @@ discard block |
||
| 316 | 321 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 317 | 322 | $settings = decrypt($settings); |
| 318 | 323 | $settings = unserialize($settings); |
| 319 | - }else{ |
|
| 324 | + } else{ |
|
| 320 | 325 | $settings = []; |
| 321 | 326 | } |
| 322 | 327 | |
@@ -341,14 +346,14 @@ discard block |
||
| 341 | 346 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 342 | 347 | $settings = decrypt($settings); |
| 343 | 348 | $settings = unserialize($settings); |
| 344 | - }else{ |
|
| 349 | + } else{ |
|
| 345 | 350 | $settings = []; |
| 346 | 351 | } |
| 347 | 352 | |
| 348 | 353 | if(isset($settings[$key])) { |
| 349 | 354 | \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]); |
| 350 | 355 | return $settings[$key]?:$default; |
| 351 | - }else{ |
|
| 356 | + } else{ |
|
| 352 | 357 | return $default; |
| 353 | 358 | } |
| 354 | 359 | } |
@@ -434,7 +439,7 @@ discard block |
||
| 434 | 439 | $url = request($name); |
| 435 | 440 | if(filter_var($url, FILTER_VALIDATE_URL)) { |
| 436 | 441 | return $url; |
| 437 | - }else{ |
|
| 442 | + } else{ |
|
| 438 | 443 | return request()->url(); |
| 439 | 444 | } |
| 440 | 445 | } |
@@ -446,14 +451,14 @@ discard block |
||
| 446 | 451 | $response = request($name); |
| 447 | 452 | if(is_string($response)) { |
| 448 | 453 | $response = sanitizeXSS($response); |
| 449 | - }elseif (is_array($response)) { |
|
| 454 | + } elseif (is_array($response)) { |
|
| 450 | 455 | array_walk_recursive($response, function(&$response) { |
| 451 | 456 | $response = sanitizeXSS($response); |
| 452 | 457 | }); |
| 453 | 458 | } |
| 454 | 459 | |
| 455 | 460 | return $response; |
| 456 | - }else{ |
|
| 461 | + } else{ |
|
| 457 | 462 | return Request::get($name); |
| 458 | 463 | } |
| 459 | 464 | } |
@@ -463,11 +468,13 @@ discard block |
||
| 463 | 468 | function min_var_export($input) { |
| 464 | 469 | if(is_array($input)) { |
| 465 | 470 | $buffer = []; |
| 466 | - foreach($input as $key => $value) |
|
| 467 | - $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
| 471 | + foreach($input as $key => $value) { |
|
| 472 | + $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
| 473 | + } |
|
| 468 | 474 | return "[".implode(",",$buffer)."]"; |
| 469 | - } else |
|
| 470 | - return var_export($input, true); |
|
| 475 | + } else { |
|
| 476 | + return var_export($input, true); |
|
| 477 | + } |
|
| 471 | 478 | } |
| 472 | 479 | } |
| 473 | 480 | |
@@ -480,10 +487,11 @@ discard block |
||
| 480 | 487 | $objects = scandir($dir); |
| 481 | 488 | foreach ($objects as $object) { |
| 482 | 489 | if ($object != "." && $object != "..") { |
| 483 | - if (is_dir($dir."/".$object)) |
|
| 484 | - rrmdir($dir."/".$object); |
|
| 485 | - else |
|
| 486 | - unlink($dir."/".$object); |
|
| 490 | + if (is_dir($dir."/".$object)) { |
|
| 491 | + rrmdir($dir."/".$object); |
|
| 492 | + } else { |
|
| 493 | + unlink($dir."/".$object); |
|
| 494 | + } |
|
| 487 | 495 | } |
| 488 | 496 | } |
| 489 | 497 | rmdir($dir); |
@@ -3,64 +3,64 @@ discard block |
||
| 3 | 3 | /* |
| 4 | 4 | * Theme Helper |
| 5 | 5 | */ |
| 6 | -if(!function_exists("themeLoginBackground")) { |
|
| 6 | +if (!function_exists("themeLoginBackground")) { |
|
| 7 | 7 | function themeLoginBackground() { |
| 8 | 8 | return "crudbooster::layouts.login_background_css"; |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | -if(!function_exists("themeFlashMessageAlert")) { |
|
| 11 | +if (!function_exists("themeFlashMessageAlert")) { |
|
| 12 | 12 | function themeFlashMessageAlert() { |
| 13 | 13 | return "crudbooster::layouts.flash_message_alert"; |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if(!function_exists("themeFlashMessage")) { |
|
| 17 | +if (!function_exists("themeFlashMessage")) { |
|
| 18 | 18 | function themeFlashMessage() { |
| 19 | 19 | return "crudbooster::layouts.flash_message"; |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if(!function_exists("themeAlertMessage")) { |
|
| 23 | +if (!function_exists("themeAlertMessage")) { |
|
| 24 | 24 | function themeAlertMessage() { |
| 25 | 25 | return "crudbooster::layouts.alert_message"; |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if(!function_exists("themeLayoutPageTitleAndButton")) { |
|
| 29 | +if (!function_exists("themeLayoutPageTitleAndButton")) { |
|
| 30 | 30 | function themeLayoutPageTitleAndButton() { |
| 31 | 31 | return 'crudbooster::module.index.index_head_buttons'; |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -if(!function_exists("themeLayoutHead")) { |
|
| 35 | +if (!function_exists("themeLayoutHead")) { |
|
| 36 | 36 | function themeLayoutHead() { |
| 37 | 37 | return "crudbooster::layouts.head"; |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | -if(!function_exists("themeTitle")) { |
|
| 40 | +if (!function_exists("themeTitle")) { |
|
| 41 | 41 | function themeTitle($page_title) { |
| 42 | - $page_title = isset($page_title)?$page_title:module()->getPageTitle(); |
|
| 43 | - return (isset($page_title))?cb()->getAppName().': '.strip_tags($page_title):"Admin Area"; |
|
| 42 | + $page_title = isset($page_title) ? $page_title : module()->getPageTitle(); |
|
| 43 | + return (isset($page_title)) ?cb()->getAppName().': '.strip_tags($page_title) : "Admin Area"; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if(!function_exists("getThemePath")) { |
|
| 47 | +if (!function_exists("getThemePath")) { |
|
| 48 | 48 | function getThemePath($path = null) { |
| 49 | - return getSetting("theme_path", "crudbooster::themes.adminlte").(($path)?".".$path:null); |
|
| 49 | + return getSetting("theme_path", "crudbooster::themes.adminlte").(($path) ? ".".$path : null); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // End Theme Helper |
| 54 | 54 | |
| 55 | -if(!function_exists("isConfigCached")) { |
|
| 55 | +if (!function_exists("isConfigCached")) { |
|
| 56 | 56 | function isConfigCached() |
| 57 | 57 | { |
| 58 | - if(env("APP_NAME")=="" || env("APP_NAME")==null) return true; |
|
| 58 | + if (env("APP_NAME") == "" || env("APP_NAME") == null) return true; |
|
| 59 | 59 | else return false; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -if(!function_exists("miscellanousSingleton")) { |
|
| 63 | +if (!function_exists("miscellanousSingleton")) { |
|
| 64 | 64 | /** |
| 65 | 65 | * @return \crocodicstudio\crudbooster\helpers\MiscellanousSingleton |
| 66 | 66 | */ |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | -if(!function_exists("makeReferalUrl")) { |
|
| 72 | +if (!function_exists("makeReferalUrl")) { |
|
| 73 | 73 | function makeReferalUrl($name = null) { |
| 74 | 74 | $ref = []; |
| 75 | 75 | $ref['url'] = request()->fullUrl(); |
| 76 | 76 | $ref['name'] = $name; |
| 77 | 77 | $md5Hash = md5(serialize($ref)); |
| 78 | 78 | |
| 79 | - if($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) { |
|
| 79 | + if ($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) { |
|
| 80 | 80 | return $exist['id']; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | -if(!function_exists("getReferalUrl")) { |
|
| 91 | +if (!function_exists("getReferalUrl")) { |
|
| 92 | 92 | function getReferalUrl($key = null) { |
| 93 | - if(verifyReferalUrl()) { |
|
| 93 | + if (verifyReferalUrl()) { |
|
| 94 | 94 | $md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref")); |
| 95 | 95 | $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash); |
| 96 | - if($key) { |
|
| 96 | + if ($key) { |
|
| 97 | 97 | return @$ref[$key]; |
| 98 | 98 | } else { |
| 99 | 99 | return $ref; |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | -if(!function_exists("verifyReferalUrl")) { |
|
| 106 | +if (!function_exists("verifyReferalUrl")) { |
|
| 107 | 107 | function verifyReferalUrl() |
| 108 | 108 | { |
| 109 | - if(request("ref")) { |
|
| 110 | - if($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) { |
|
| 109 | + if (request("ref")) { |
|
| 110 | + if ($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) { |
|
| 111 | 111 | $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash); |
| 112 | - if(filter_var($ref['url'], FILTER_VALIDATE_URL)) { |
|
| 112 | + if (filter_var($ref['url'], FILTER_VALIDATE_URL)) { |
|
| 113 | 113 | return true; |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -if(!function_exists("putHtaccess")) { |
|
| 121 | +if (!function_exists("putHtaccess")) { |
|
| 122 | 122 | function putHtaccess($stringToPut) |
| 123 | 123 | { |
| 124 | 124 | file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND); |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | -if(!function_exists("checkHtaccess")) { |
|
| 129 | +if (!function_exists("checkHtaccess")) { |
|
| 130 | 130 | function checkHtaccess($stringToCheck) |
| 131 | 131 | { |
| 132 | - if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) { |
|
| 132 | + if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) { |
|
| 133 | 133 | $htaccess = file_get_contents(base_path(".htaccess")); |
| 134 | - $htaccess2= file_get_contents(public_path(".htaccess")); |
|
| 135 | - if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) { |
|
| 134 | + $htaccess2 = file_get_contents(public_path(".htaccess")); |
|
| 135 | + if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) { |
|
| 136 | 136 | return true; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | -if(!function_exists("setEnvironmentValue")) { |
|
| 144 | +if (!function_exists("setEnvironmentValue")) { |
|
| 145 | 145 | function setEnvironmentValue(array $values) |
| 146 | 146 | { |
| 147 | 147 | $envFile = app()->environmentFilePath(); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
| 175 | -if(!function_exists("cbLang")) { |
|
| 175 | +if (!function_exists("cbLang")) { |
|
| 176 | 176 | /** |
| 177 | 177 | * @param string $key |
| 178 | 178 | * @param array $replace |
@@ -184,17 +184,17 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | -if(!function_exists('rglob')) { |
|
| 187 | +if (!function_exists('rglob')) { |
|
| 188 | 188 | function rglob($pattern, $flags = 0) { |
| 189 | 189 | $files = glob($pattern, $flags); |
| 190 | - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { |
|
| 190 | + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { |
|
| 191 | 191 | $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags)); |
| 192 | 192 | } |
| 193 | 193 | return $files; |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | -if(!function_exists('convertPHPToMomentFormat')) { |
|
| 197 | +if (!function_exists('convertPHPToMomentFormat')) { |
|
| 198 | 198 | function convertPHPToMomentFormat($format) |
| 199 | 199 | { |
| 200 | 200 | $replacements = [ |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | -if(!function_exists('slug')) { |
|
| 244 | +if (!function_exists('slug')) { |
|
| 245 | 245 | function slug($string, $separator = '-') { |
| 246 | 246 | return \Illuminate\Support\Str::slug($string, $separator); |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -if(!function_exists('columnSingleton')) { |
|
| 250 | +if (!function_exists('columnSingleton')) { |
|
| 251 | 251 | /** |
| 252 | 252 | * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton |
| 253 | 253 | */ |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | -if(!function_exists('cbHook')) |
|
| 259 | +if (!function_exists('cbHook')) |
|
| 260 | 260 | { |
| 261 | 261 | /** |
| 262 | 262 | * @return crocodicstudio\crudbooster\hooks\CBHook |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | -if(!function_exists('getTypeHook')) |
|
| 271 | +if (!function_exists('getTypeHook')) |
|
| 272 | 272 | { |
| 273 | 273 | /** |
| 274 | 274 | * @param string $type |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | -if(!function_exists('getPrimaryKey')) |
|
| 284 | +if (!function_exists('getPrimaryKey')) |
|
| 285 | 285 | { |
| 286 | 286 | function getPrimaryKey($table_name) |
| 287 | 287 | { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | -if(!function_exists('cb')) |
|
| 292 | +if (!function_exists('cb')) |
|
| 293 | 293 | { |
| 294 | 294 | function cb() |
| 295 | 295 | { |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | -if(!function_exists("cbAssetPath")) { |
|
| 300 | +if (!function_exists("cbAssetPath")) { |
|
| 301 | 301 | function cbAssetPath($path = null) { |
| 302 | - return "cb_asset".(($path)?"/".$path:null); |
|
| 302 | + return "cb_asset".(($path) ? "/".$path : null); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | -if(!function_exists('cbAsset')) { |
|
| 305 | +if (!function_exists('cbAsset')) { |
|
| 306 | 306 | function cbAsset($path, $secure = null) { |
| 307 | 307 | return asset(cbAssetPath()."/".$path, $secure); |
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | -if(!function_exists("cbConfig")) { |
|
| 311 | +if (!function_exists("cbConfig")) { |
|
| 312 | 312 | function cbConfig($name, $default = null) { |
| 313 | 313 | return config("crudbooster.".$name, $default); |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | -if(!function_exists("strRandom")) { |
|
| 317 | +if (!function_exists("strRandom")) { |
|
| 318 | 318 | function strRandom($length = 5) { |
| 319 | 319 | return \Illuminate\Support\Str::random($length); |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | -if(!function_exists('module')) { |
|
| 323 | +if (!function_exists('module')) { |
|
| 324 | 324 | function module() |
| 325 | 325 | { |
| 326 | 326 | $module = new \crocodicstudio\crudbooster\helpers\Module(); |
@@ -328,21 +328,21 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | -if(!function_exists('getAdminLoginURL')) { |
|
| 331 | +if (!function_exists('getAdminLoginURL')) { |
|
| 332 | 332 | function getAdminLoginURL() |
| 333 | 333 | { |
| 334 | 334 | return cb()->getAdminUrl("login"); |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | -if(!function_exists('dummyPhoto')) { |
|
| 338 | +if (!function_exists('dummyPhoto')) { |
|
| 339 | 339 | function dummyPhoto() |
| 340 | 340 | { |
| 341 | - return getSetting("dummy_photo","cb_asset/images/user8-128x128.jpg"); |
|
| 341 | + return getSetting("dummy_photo", "cb_asset/images/user8-128x128.jpg"); |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | -if(!function_exists('extract_unit')) { |
|
| 345 | +if (!function_exists('extract_unit')) { |
|
| 346 | 346 | /* |
| 347 | 347 | Credits: Bit Repository |
| 348 | 348 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
@@ -367,14 +367,14 @@ discard block |
||
| 367 | 367 | | |
| 368 | 368 | */ |
| 369 | 369 | |
| 370 | -if(!function_exists('putSetting')) { |
|
| 370 | +if (!function_exists('putSetting')) { |
|
| 371 | 371 | function putSetting($key, $value) |
| 372 | 372 | { |
| 373 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 373 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 374 | 374 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 375 | 375 | $settings = decrypt($settings); |
| 376 | 376 | $settings = unserialize($settings); |
| 377 | - }else{ |
|
| 377 | + } else { |
|
| 378 | 378 | $settings = []; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -388,31 +388,31 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | -if(!function_exists('getSetting')) { |
|
| 391 | +if (!function_exists('getSetting')) { |
|
| 392 | 392 | function getSetting($key, $default = null) |
| 393 | 393 | { |
| 394 | - if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) { |
|
| 394 | + if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) { |
|
| 395 | 395 | return $cache; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 398 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 399 | 399 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 400 | 400 | $settings = decrypt($settings); |
| 401 | 401 | $settings = unserialize($settings); |
| 402 | - }else{ |
|
| 402 | + } else { |
|
| 403 | 403 | $settings = []; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if(isset($settings[$key])) { |
|
| 406 | + if (isset($settings[$key])) { |
|
| 407 | 407 | \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]); |
| 408 | - return $settings[$key]?:$default; |
|
| 409 | - }else{ |
|
| 408 | + return $settings[$key] ?: $default; |
|
| 409 | + } else { |
|
| 410 | 410 | return $default; |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | -if(!function_exists('timeAgo')) { |
|
| 415 | +if (!function_exists('timeAgo')) { |
|
| 416 | 416 | function timeAgo($datetime_to, $datetime_from = null, $full = false) |
| 417 | 417 | { |
| 418 | 418 | $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s'); |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - if (! $full) { |
|
| 446 | + if (!$full) { |
|
| 447 | 447 | $string = array_slice($string, 0, 1); |
| 448 | 448 | } |
| 449 | 449 | |
@@ -451,22 +451,22 @@ discard block |
||
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | -if(!function_exists("array_map_r")) { |
|
| 455 | - function array_map_r( $func, $arr ) |
|
| 454 | +if (!function_exists("array_map_r")) { |
|
| 455 | + function array_map_r($func, $arr) |
|
| 456 | 456 | { |
| 457 | 457 | $newArr = array(); |
| 458 | 458 | |
| 459 | - foreach( $arr as $key => $value ) |
|
| 459 | + foreach ($arr as $key => $value) |
|
| 460 | 460 | { |
| 461 | 461 | $key = $func($key); |
| 462 | - $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) ); |
|
| 462 | + $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value))); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return $newArr; |
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | -if(!function_exists("sanitizeXSS")) |
|
| 469 | +if (!function_exists("sanitizeXSS")) |
|
| 470 | 470 | { |
| 471 | 471 | function sanitizeXSS($value) |
| 472 | 472 | { |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | -if(!function_exists("requestAll")) { |
|
| 481 | +if (!function_exists("requestAll")) { |
|
| 482 | 482 | function requestAll() { |
| 483 | 483 | $all = array_map_r("sanitizeXSS", request()->all()); |
| 484 | 484 | return $all; |
@@ -487,22 +487,22 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | |
| 489 | 489 | |
| 490 | -if(!function_exists('getURLFormat')) { |
|
| 490 | +if (!function_exists('getURLFormat')) { |
|
| 491 | 491 | function getURLFormat($name) { |
| 492 | 492 | $url = request($name); |
| 493 | - if(filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 493 | + if (filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 494 | 494 | return $url; |
| 495 | - }else{ |
|
| 495 | + } else { |
|
| 496 | 496 | return request()->url(); |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | -if(!function_exists('g')) { |
|
| 501 | +if (!function_exists('g')) { |
|
| 502 | 502 | function g($name, $safe = true) { |
| 503 | - if($safe == true) { |
|
| 503 | + if ($safe == true) { |
|
| 504 | 504 | $response = request($name); |
| 505 | - if(is_string($response)) { |
|
| 505 | + if (is_string($response)) { |
|
| 506 | 506 | $response = sanitizeXSS($response); |
| 507 | 507 | }elseif (is_array($response)) { |
| 508 | 508 | array_walk_recursive($response, function(&$response) { |
@@ -511,25 +511,25 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | return $response; |
| 514 | - }else{ |
|
| 514 | + } else { |
|
| 515 | 515 | return Request::get($name); |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | -if(!function_exists('min_var_export')) { |
|
| 520 | +if (!function_exists('min_var_export')) { |
|
| 521 | 521 | function min_var_export($input) { |
| 522 | - if(is_array($input)) { |
|
| 522 | + if (is_array($input)) { |
|
| 523 | 523 | $buffer = []; |
| 524 | - foreach($input as $key => $value) |
|
| 524 | + foreach ($input as $key => $value) |
|
| 525 | 525 | $buffer[] = var_export($key, true)."=>".min_var_export($value); |
| 526 | - return "[".implode(",",$buffer)."]"; |
|
| 526 | + return "[".implode(",", $buffer)."]"; |
|
| 527 | 527 | } else |
| 528 | 528 | return var_export($input, true); |
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | -if(!function_exists('rrmdir')) { |
|
| 532 | +if (!function_exists('rrmdir')) { |
|
| 533 | 533 | /* |
| 534 | 534 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
| 535 | 535 | */ |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function headers(array $headers) { |
| 27 | 27 | $newHeaders = []; |
| 28 | - foreach($headers as $key=>$val) { |
|
| 28 | + foreach ($headers as $key=>$val) { |
|
| 29 | 29 | $newHeaders[] = $key.": ".$val; |
| 30 | 30 | } |
| 31 | 31 | $this->headers = $newHeaders; |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | $err = curl_error($ch); |
| 48 | 48 | curl_close($ch); |
| 49 | 49 | |
| 50 | - if($err) { |
|
| 50 | + if ($err) { |
|
| 51 | 51 | return $err; |
| 52 | - }else { |
|
| 52 | + } else { |
|
| 53 | 53 | return $response; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -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 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | if ($this->confirm('Do you have setting the database configuration at .env ?')) { |
| 41 | 41 | |
| 42 | - if (! file_exists(public_path('vendor')) ) { |
|
| 42 | + if (!file_exists(public_path('vendor'))) { |
|
| 43 | 43 | mkdir(public_path('vendor')); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /* |
| 53 | 53 | * Create CBPlugins |
| 54 | 54 | */ |
| 55 | - if(!file_exists(app_path("CBPlugins"))) { |
|
| 55 | + if (!file_exists(app_path("CBPlugins"))) { |
|
| 56 | 56 | mkdir(app_path("CBPlugins")); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | * We need it to change default laravel local filesystem from storage to public |
| 62 | 62 | * We won't use symlink because of a security issue in many server |
| 63 | 63 | */ |
| 64 | - if(!file_exists(public_path("storage"))) { |
|
| 64 | + if (!file_exists(public_path("storage"))) { |
|
| 65 | 65 | $this->info("Create storage directory on /public"); |
| 66 | 66 | mkdir(public_path("storage")); |
| 67 | - file_put_contents(public_path("storage/.gitignore"),"!.gitignore"); |
|
| 68 | - file_put_contents(public_path("storage/index.html")," "); |
|
| 67 | + file_put_contents(public_path("storage/.gitignore"), "!.gitignore"); |
|
| 68 | + file_put_contents(public_path("storage/index.html"), " "); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /* |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | * Disable php execution on /vendor/* |
| 75 | 75 | */ |
| 76 | 76 | $this->info("Tweak some security for your laravel"); |
| 77 | - file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
| 78 | - file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
| 77 | + file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
| 78 | + file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | $this->info('Dumping the autoloaded files and reloading all new files...'); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $data['name'] = $name; |
| 26 | 26 | $data['label'] = $label; |
| 27 | 27 | $data['required'] = $required; |
| 28 | - $data['encrypt'] = isset($options['encrypt'])?$options['encrypt']:true; |
|
| 28 | + $data['encrypt'] = isset($options['encrypt']) ? $options['encrypt'] : true; |
|
| 29 | 29 | return view("crudbooster::html_helper.file_uploader.index", $data); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $data['name'] = $name; |
| 43 | 43 | $data['label'] = $label; |
| 44 | 44 | $data['required'] = $required; |
| 45 | - $data['encrypt'] = isset($options['encrypt'])?$options['encrypt']:true; |
|
| 45 | + $data['encrypt'] = isset($options['encrypt']) ? $options['encrypt'] : true; |
|
| 46 | 46 | @$data['resizeWidth'] = $options['resize_width']; |
| 47 | 47 | @$data['resizeHeight'] = $options['resize_height']; |
| 48 | 48 | return view("crudbooster::html_helper.image_uploader.index", $data); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -cb()->routeGroupBackend(function () { |
|
| 4 | - cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile'); |
|
| 3 | +cb()->routeGroupBackend(function() { |
|
| 4 | + cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile'); |
|
| 5 | 5 | }); |
| 6 | 6 | |
| 7 | -cb()->routeGroupDeveloper(function () { |
|
| 8 | - cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile'); |
|
| 7 | +cb()->routeGroupDeveloper(function() { |
|
| 8 | + cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile'); |
|
| 9 | 9 | }); |
| 10 | 10 | \ No newline at end of file |
@@ -19,15 +19,15 @@ |
||
| 19 | 19 | try { |
| 20 | 20 | |
| 21 | 21 | cb()->validation([ |
| 22 | - 'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED')) |
|
| 22 | + 'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED')) |
|
| 23 | 23 | ]); |
| 24 | 24 | |
| 25 | 25 | $file = cb()->uploadFile('userfile', request("encrypt")); |
| 26 | 26 | |
| 27 | 27 | } catch (CBValidationException $e) { |
| 28 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
| 28 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
| 29 | 29 | } catch (\Exception $e) { |
| 30 | - return response()->json(['status'=>false,'message'=>$e->getMessage()]); |
|
| 30 | + return response()->json(['status'=>false, 'message'=>$e->getMessage()]); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return response()->json([ |