@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function boot() |
| 28 | 28 | { |
| 29 | 29 | Paginator::useBootstrap(); |
| 30 | - Validator::extend('isunique', function ($attribute, $value, $parameters, $validator) { |
|
| 30 | + Validator::extend('isunique', function($attribute, $value, $parameters, $validator) { |
|
| 31 | 31 | $value = strtolower($value); |
| 32 | 32 | $query = DB::table($parameters[0])->whereRaw("LOWER({$attribute}) = ?", [$value]); |
| 33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | return $query->count() === 0; |
| 39 | 39 | }); |
| 40 | - Validator::extend('exturl', function ($attribute, $value, $parameters, $validator) { |
|
| 40 | + Validator::extend('exturl', function($attribute, $value, $parameters, $validator) { |
|
| 41 | 41 | $allowed_schemes = ['http', 'https', 'mailto', 'tel']; |
| 42 | 42 | return in_array(parse_url($value, PHP_URL_SCHEME), $allowed_schemes, true); |
| 43 | 43 | }); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function db(request $request) |
| 40 | 40 | { |
| 41 | - if($request->database == 'MySQL'){ |
|
| 41 | + if ($request->database == 'MySQL') { |
|
| 42 | 42 | return redirect(url('?mysql')); |
| 43 | - }else{ |
|
| 43 | + } else { |
|
| 44 | 44 | return redirect(url('?4')); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $file = base_path('INSTALLERLOCK'); |
| 57 | 57 | if (!file_exists($file)) { |
| 58 | - $handleFile = fopen($file, 'w') or die('Cannot create file: '.$file); |
|
| 58 | + $handleFile = fopen($file, 'w') or die('Cannot create file: ' . $file); |
|
| 59 | 59 | fclose($handleFile); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - try{EnvEditor::addKey('ADMIN_EMAIL', $email);}catch(Exception $e){} |
|
| 62 | + try {EnvEditor::addKey('ADMIN_EMAIL', $email); } catch (Exception $e) {} |
|
| 63 | 63 | |
| 64 | - if(DB::table('users')->count() == '0'){ |
|
| 64 | + if (DB::table('users')->count() == '0') { |
|
| 65 | 65 | Schema::disableForeignKeyConstraints(); |
| 66 | 66 | DB::table('users')->delete(); |
| 67 | 67 | DB::table('users')->truncate(); |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | $DB_USERNAME = $request->username; |
| 93 | 93 | $DB_PASSWORD = $request->password; |
| 94 | 94 | |
| 95 | - if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', $DB_CONNECTION);}else{EnvEditor::addKey('DB_CONNECTION', $DB_CONNECTION);} |
|
| 96 | - if(EnvEditor::keyExists('DB_HOST')){EnvEditor::editKey('DB_HOST', $DB_HOST);}else{EnvEditor::addKey('DB_HOST', $DB_HOST);} |
|
| 97 | - if(EnvEditor::keyExists('DB_PORT')){EnvEditor::editKey('DB_PORT', $DB_PORT);}else{EnvEditor::addKey('DB_PORT', $DB_PORT);} |
|
| 98 | - if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::editKey('DB_DATABASE', $DB_DATABASE);}else{EnvEditor::addKey('DB_DATABASE', $DB_DATABASE);} |
|
| 99 | - if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::editKey('DB_USERNAME', $DB_USERNAME);}else{EnvEditor::addKey('DB_USERNAME', $DB_USERNAME);} |
|
| 100 | - if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::editKey('DB_PASSWORD', $DB_PASSWORD);}else{EnvEditor::addKey('DB_PASSWORD', $DB_PASSWORD);} |
|
| 95 | + if (EnvEditor::keyExists('DB_CONNECTION')) {EnvEditor::editKey('DB_CONNECTION', $DB_CONNECTION); } else {EnvEditor::addKey('DB_CONNECTION', $DB_CONNECTION); } |
|
| 96 | + if (EnvEditor::keyExists('DB_HOST')) {EnvEditor::editKey('DB_HOST', $DB_HOST); } else {EnvEditor::addKey('DB_HOST', $DB_HOST); } |
|
| 97 | + if (EnvEditor::keyExists('DB_PORT')) {EnvEditor::editKey('DB_PORT', $DB_PORT); } else {EnvEditor::addKey('DB_PORT', $DB_PORT); } |
|
| 98 | + if (EnvEditor::keyExists('DB_DATABASE')) {EnvEditor::editKey('DB_DATABASE', $DB_DATABASE); } else {EnvEditor::addKey('DB_DATABASE', $DB_DATABASE); } |
|
| 99 | + if (EnvEditor::keyExists('DB_USERNAME')) {EnvEditor::editKey('DB_USERNAME', $DB_USERNAME); } else {EnvEditor::addKey('DB_USERNAME', $DB_USERNAME); } |
|
| 100 | + if (EnvEditor::keyExists('DB_PASSWORD')) {EnvEditor::editKey('DB_PASSWORD', $DB_PASSWORD); } else {EnvEditor::addKey('DB_PASSWORD', $DB_PASSWORD); } |
|
| 101 | 101 | |
| 102 | 102 | return redirect(url('mysql-test')); |
| 103 | 103 | |
@@ -105,22 +105,22 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function mysqlTest(request $request) |
| 107 | 107 | { |
| 108 | - try {Artisan::call('migrate');} catch (exception $e) {$failed = "true";} |
|
| 109 | - try {Artisan::call('db:seed --force');} catch (exception $e) {$failed = "true";} |
|
| 110 | - try {Artisan::call('db:seed --class="PageSeeder" --force');} catch (exception $e) {$failed = "true";} |
|
| 111 | - try {Artisan::call('db:seed --class="ButtonSeeder" --force');} catch (exception $e) {$failed = "true";} |
|
| 112 | - |
|
| 113 | - try {$users = DB::table('buttons')->count(); $failed = false;} catch (exception $e) {$failed = true;} |
|
| 114 | - |
|
| 115 | - if($failed == true){ |
|
| 116 | - if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');}else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');} |
|
| 117 | - if(EnvEditor::keyExists('DB_HOST')){EnvEditor::deleteKey('DB_HOST');} |
|
| 118 | - if(EnvEditor::keyExists('DB_PORT')){EnvEditor::deleteKey('DB_PORT');} |
|
| 119 | - if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::deleteKey('DB_DATABASE');} |
|
| 120 | - if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::deleteKey('DB_USERNAME');} |
|
| 121 | - if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::deleteKey('DB_PASSWORD');} |
|
| 108 | + try {Artisan::call('migrate'); } catch (exception $e) {$failed = "true"; } |
|
| 109 | + try {Artisan::call('db:seed --force'); } catch (exception $e) {$failed = "true"; } |
|
| 110 | + try {Artisan::call('db:seed --class="PageSeeder" --force'); } catch (exception $e) {$failed = "true"; } |
|
| 111 | + try {Artisan::call('db:seed --class="ButtonSeeder" --force'); } catch (exception $e) {$failed = "true"; } |
|
| 112 | + |
|
| 113 | + try {$users = DB::table('buttons')->count(); $failed = false; } catch (exception $e) {$failed = true; } |
|
| 114 | + |
|
| 115 | + if ($failed == true) { |
|
| 116 | + if (EnvEditor::keyExists('DB_CONNECTION')) {EnvEditor::editKey('DB_CONNECTION', 'sqlite'); } else {EnvEditor::addKey('DB_CONNECTION', 'sqlite'); } |
|
| 117 | + if (EnvEditor::keyExists('DB_HOST')) {EnvEditor::deleteKey('DB_HOST'); } |
|
| 118 | + if (EnvEditor::keyExists('DB_PORT')) {EnvEditor::deleteKey('DB_PORT'); } |
|
| 119 | + if (EnvEditor::keyExists('DB_DATABASE')) {EnvEditor::deleteKey('DB_DATABASE'); } |
|
| 120 | + if (EnvEditor::keyExists('DB_USERNAME')) {EnvEditor::deleteKey('DB_USERNAME'); } |
|
| 121 | + if (EnvEditor::keyExists('DB_PASSWORD')) {EnvEditor::deleteKey('DB_PASSWORD'); } |
|
| 122 | 122 | return redirect(url('?error')); |
| 123 | - }else{ |
|
| 123 | + } else { |
|
| 124 | 124 | return redirect(url('?4')); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -131,25 +131,25 @@ discard block |
||
| 131 | 131 | $user = User::find(1); |
| 132 | 132 | $llName = $user->littlelink_name; |
| 133 | 133 | |
| 134 | - if($request->register == 'Yes'){ |
|
| 135 | - if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'true');}else{EnvEditor::addKey('ALLOW_REGISTRATION', 'true');} |
|
| 134 | + if ($request->register == 'Yes') { |
|
| 135 | + if (EnvEditor::keyExists('ALLOW_REGISTRATION')) {EnvEditor::editKey('ALLOW_REGISTRATION', 'true'); } else {EnvEditor::addKey('ALLOW_REGISTRATION', 'true'); } |
|
| 136 | 136 | } else { |
| 137 | - if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'false');}else{EnvEditor::addKey('ALLOW_REGISTRATION', 'false');} |
|
| 137 | + if (EnvEditor::keyExists('ALLOW_REGISTRATION')) {EnvEditor::editKey('ALLOW_REGISTRATION', 'false'); } else {EnvEditor::addKey('ALLOW_REGISTRATION', 'false'); } |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if($request->verify == 'Yes'){$value = "verified";}else{$value = "auth";} |
|
| 141 | - if(EnvEditor::keyExists('REGISTER_AUTH')){EnvEditor::editKey('REGISTER_AUTH', $value);} |
|
| 140 | + if ($request->verify == 'Yes') {$value = "verified"; } else {$value = "auth"; } |
|
| 141 | + if (EnvEditor::keyExists('REGISTER_AUTH')) {EnvEditor::editKey('REGISTER_AUTH', $value); } |
|
| 142 | 142 | |
| 143 | - if($request->page == 'No'){$value = "";}else{$value = '"' . $llName . '"';} |
|
| 144 | - if(EnvEditor::keyExists('HOME_URL')){EnvEditor::editKey('HOME_URL', $value);} |
|
| 143 | + if ($request->page == 'No') {$value = ""; } else {$value = '"' . $llName . '"'; } |
|
| 144 | + if (EnvEditor::keyExists('HOME_URL')) {EnvEditor::editKey('HOME_URL', $value); } |
|
| 145 | 145 | |
| 146 | - if(EnvEditor::keyExists('APP_NAME')){EnvEditor::editKey('APP_NAME', '"' . $request->app . '"');} |
|
| 146 | + if (EnvEditor::keyExists('APP_NAME')) {EnvEditor::editKey('APP_NAME', '"' . $request->app . '"'); } |
|
| 147 | 147 | |
| 148 | - if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));} |
|
| 148 | + if (file_exists(base_path("INSTALLING"))) {unlink(base_path("INSTALLING")); } |
|
| 149 | 149 | |
| 150 | 150 | $file = base_path('INSTALLERLOCK'); |
| 151 | 151 | if (file_exists($file)) { |
| 152 | - unlink($file) or die('Cannot delete file: '.$file); |
|
| 152 | + unlink($file) or die('Cannot delete file: ' . $file); |
|
| 153 | 153 | sleep(1); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $value = $request->value; |
| 165 | 165 | $value = '"' . $request->value . '"'; |
| 166 | 166 | |
| 167 | - if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
|
| 167 | + if (EnvEditor::keyExists($entry)) {EnvEditor::editKey($entry, $value); } |
|
| 168 | 168 | |
| 169 | 169 | return Redirect(url('dashboard')); |
| 170 | 170 | } |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function handle(Request $request, Closure $next) |
| 13 | 13 | { |
| 14 | - $cookiesAlreadySet = $request->hasCookie(strtolower(config('app.name')).'_session') || $request->hasCookie('XSRF-TOKEN'); |
|
| 14 | + $cookiesAlreadySet = $request->hasCookie(strtolower(config('app.name')) . '_session') || $request->hasCookie('XSRF-TOKEN'); |
|
| 15 | 15 | |
| 16 | 16 | if ($cookiesAlreadySet) { |
| 17 | 17 | return $next($request); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - Cookie::queue(Cookie::forget(str_replace(' ', '_', strtolower(config('app.name')).'_session'))); |
|
| 20 | + Cookie::queue(Cookie::forget(str_replace(' ', '_', strtolower(config('app.name')) . '_session'))); |
|
| 21 | 21 | Cookie::queue(Cookie::forget('XSRF-TOKEN')); |
| 22 | 22 | config(['session.driver' => 'array']); |
| 23 | 23 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | //Show littlelink page. example => http://127.0.0.1:8000/+admin |
| 85 | 85 | public function littlelink(request $request) |
| 86 | 86 | { |
| 87 | - if(isset($request->useif)){ |
|
| 87 | + if (isset($request->useif)) { |
|
| 88 | 88 | $littlelink_name = User::select('littlelink_name')->where('id', $request->littlelink)->value('littlelink_name'); |
| 89 | 89 | $id = $request->littlelink; |
| 90 | 90 | } else { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | return abort(404); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return redirect(url('@'.$user)); |
|
| 143 | + return redirect(url('@' . $user)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | //Show add/update form |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | if (substr($linkId, -1) == '+') { |
| 301 | 301 | $linkWithoutPlus = str_replace('+', '', $linkId); |
| 302 | - return redirect(url('info/'.$linkWithoutPlus)); |
|
| 302 | + return redirect(url('info/' . $linkWithoutPlus)); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | $link = Link::find($linkId); |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | $directory = base_path("assets/favicon/icons"); |
| 392 | 392 | $files = scandir($directory); |
| 393 | - foreach($files as $file) { |
|
| 394 | - if (strpos($file, $linkId.".") !== false) { |
|
| 395 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 393 | + foreach ($files as $file) { |
|
| 394 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 395 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 396 | 396 | if (isset($pathinfo)) { |
| 397 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 397 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | return redirect('/studio/links'); |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $directory = base_path("assets/favicon/icons"); |
| 409 | 409 | $files = scandir($directory); |
| 410 | - foreach($files as $file) { |
|
| 411 | - if (strpos($file, $linkId.".") !== false) { |
|
| 412 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 410 | + foreach ($files as $file) { |
|
| 411 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 412 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 413 | 413 | if (isset($pathinfo)) { |
| 414 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 414 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | return redirect('/studio/links'); |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | 'sometimes', |
| 536 | 536 | 'max:255', |
| 537 | 537 | 'string', |
| 538 | - 'isunique:users,id,'.$userId, |
|
| 538 | + 'isunique:users,id,' . $userId, |
|
| 539 | 539 | ], |
| 540 | 540 | 'name' => 'sometimes|max:255|string', |
| 541 | 541 | 'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | $sharebtn = $request->sharebtn; |
| 561 | 561 | $tablinks = $request->tablinks; |
| 562 | 562 | |
| 563 | - if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){ |
|
| 563 | + if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) { |
|
| 564 | 564 | EnvEditor::editKey('HOME_URL', $pageName); |
| 565 | 565 | } |
| 566 | 566 | |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | // echo Auth::id(); |
| 795 | 795 | $id = $request->id; |
| 796 | 796 | |
| 797 | - if($id == Auth::id() and $id != "1") { |
|
| 797 | + if ($id == Auth::id() and $id != "1") { |
|
| 798 | 798 | |
| 799 | 799 | Link::where('user_id', $id)->delete(); |
| 800 | 800 | |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | $fileName = "links-$domain-$date.json"; |
| 842 | 842 | $headers = [ |
| 843 | 843 | 'Content-Type' => 'application/json', |
| 844 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 844 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 845 | 845 | ]; |
| 846 | 846 | return response()->json($userData, 200, $headers); |
| 847 | 847 | |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | $userData = $user->toArray(); |
| 864 | 864 | $userData['links'] = $links->toArray(); |
| 865 | 865 | |
| 866 | - if (file_exists(base_path(findAvatar($userId)))){ |
|
| 866 | + if (file_exists(base_path(findAvatar($userId)))) { |
|
| 867 | 867 | $imagePath = base_path(findAvatar($userId)); |
| 868 | 868 | $imageData = base64_encode(file_get_contents($imagePath)); |
| 869 | 869 | $userData['image_data'] = $imageData; |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | $fileName = "user_data-$domain-$date.json"; |
| 878 | 878 | $headers = [ |
| 879 | 879 | 'Content-Type' => 'application/json', |
| 880 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 880 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 881 | 881 | ]; |
| 882 | 882 | return response()->json($userData, 200, $headers); |
| 883 | 883 | |