@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // Get image information using getimagesize |
| 53 | 53 | $imageInfo = getimagesize($file); |
| 54 | 54 | if (!$imageInfo) { |
| 55 | - return 'dark'; |
|
| 55 | + return 'dark'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Get the image type |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | // Load the image based on its type |
| 62 | 62 | switch ($type) { |
| 63 | - case IMAGETYPE_JPEG: |
|
| 63 | + case IMAGETYPE_JPEG: |
|
| 64 | 64 | case IMAGETYPE_JPEG2000: |
| 65 | 65 | $img = imagecreatefromjpeg($file); |
| 66 | 66 | break; |
| 67 | - case IMAGETYPE_PNG: |
|
| 67 | + case IMAGETYPE_PNG: |
|
| 68 | 68 | $img = imagecreatefrompng($file); |
| 69 | 69 | break; |
| 70 | - default: |
|
| 70 | + default: |
|
| 71 | 71 | return 'dark'; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -78,29 +78,29 @@ discard block |
||
| 78 | 78 | // Calculate the average brightness of the image |
| 79 | 79 | $total_brightness = 0; |
| 80 | 80 | for ($x=0; $x<$width; $x++) { |
| 81 | - for ($y=0; $y<$height; $y++) { |
|
| 81 | + for ($y=0; $y<$height; $y++) { |
|
| 82 | 82 | $rgb = imagecolorat($img, $x, $y); |
| 83 | 83 | $r = ($rgb >> 16) & 0xFF; |
| 84 | 84 | $g = ($rgb >> 8) & 0xFF; |
| 85 | 85 | $b = $rgb & 0xFF; |
| 86 | 86 | $brightness = (int)(($r + $g + $b) / 3); |
| 87 | 87 | $total_brightness += $brightness; |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | } |
| 90 | 90 | $avg_brightness = $total_brightness / ($width * $height); |
| 91 | 91 | |
| 92 | 92 | // Determine if the image is more dark or light |
| 93 | 93 | if ($avg_brightness < 128) { |
| 94 | - return 'dark'; |
|
| 94 | + return 'dark'; |
|
| 95 | 95 | } else { |
| 96 | - return 'light'; |
|
| 96 | + return 'light'; |
|
| 97 | + } |
|
| 98 | + } catch (\Throwable $th) { |
|
| 99 | + return null; |
|
| 100 | + } |
|
| 97 | 101 | } |
| 98 | - } catch (\Throwable $th) { |
|
| 99 | - return null; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | 102 | |
| 103 | - function infoIcon($tip) { |
|
| 103 | + function infoIcon($tip) { |
|
| 104 | 104 | echo ' |
| 105 | 105 | <div class="d-flex justify-content-center align-items-center"> |
| 106 | 106 | <a data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $tip . '"> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | </a> |
| 111 | 111 | </div> |
| 112 | 112 | '; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | function external_file_get_contents($url) { |
| 116 | 116 | $ch = curl_init(); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | parent::boot(); |
| 17 | 17 | |
| 18 | 18 | static::creating(function ($link) { |
| 19 | - if (config('linkstack.disable_random_link_ids') != 'true') { |
|
| 19 | + if (config('linkstack.disable_random_link_ids') != 'true') { |
|
| 20 | 20 | $numberOfDigits = config('linkstack.link_id_length') ?? 9; |
| 21 | 21 | |
| 22 | 22 | $minIdValue = 10**($numberOfDigits - 1); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } while (Link::find($randomId)); |
| 28 | 28 | |
| 29 | 29 | $link->id = $randomId; |
| 30 | - } |
|
| 30 | + } |
|
| 31 | 31 | }); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -527,7 +527,9 @@ discard block |
||
| 527 | 527 | $text = file_get_contents(base_path('themes') . '/' . $entry . '/readme.md'); |
| 528 | 528 | $pattern = '/Theme Version:.*/'; |
| 529 | 529 | preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE); |
| 530 | - if (!count($matches)) continue; |
|
| 530 | + if (!count($matches)) { |
|
| 531 | + continue; |
|
| 532 | + } |
|
| 531 | 533 | $verNr = substr($matches[0][0], 15); |
| 532 | 534 | |
| 533 | 535 | } |
@@ -625,10 +627,10 @@ discard block |
||
| 625 | 627 | $value = $request->value; |
| 626 | 628 | |
| 627 | 629 | if($type === "toggle"){ |
| 628 | - if($request->toggle != ''){$value = "true";}else{$value = "false";} |
|
| 630 | + if($request->toggle != ''){$value = "true";} else{$value = "false";} |
|
| 629 | 631 | if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 630 | 632 | } elseif($type === "toggle2") { |
| 631 | - if($request->toggle != ''){$value = "verified";}else{$value = "auth";} |
|
| 633 | + if($request->toggle != ''){$value = "verified";} else{$value = "auth";} |
|
| 632 | 634 | if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 633 | 635 | } elseif($type === "text") { |
| 634 | 636 | if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, '"' . $value . '"');} |
@@ -643,10 +645,10 @@ discard block |
||
| 643 | 645 | if(EnvEditor::keyExists('LOG_LEVEL')){EnvEditor::editKey('LOG_LEVEL', 'error');} |
| 644 | 646 | } |
| 645 | 647 | } elseif($type === "register") { |
| 646 | - if($request->toggle != ''){$register = "true";}else{$register = "false";} |
|
| 648 | + if($request->toggle != ''){$register = "true";} else{$register = "false";} |
|
| 647 | 649 | Page::first()->update(['register' => $register]); |
| 648 | 650 | } elseif($type === "smtp") { |
| 649 | - if($request->toggle != ''){$value = "built-in";}else{$value = "smtp";} |
|
| 651 | + if($request->toggle != ''){$value = "built-in";} else{$value = "smtp";} |
|
| 650 | 652 | if(EnvEditor::keyExists('MAIL_MAILER')){EnvEditor::editKey('MAIL_MAILER', $value);} |
| 651 | 653 | |
| 652 | 654 | if(EnvEditor::keyExists('MAIL_HOST')){EnvEditor::editKey('MAIL_HOST', $request->MAIL_HOST);} |
@@ -656,10 +658,10 @@ discard block |
||
| 656 | 658 | if(EnvEditor::keyExists('MAIL_ENCRYPTION')){EnvEditor::editKey('MAIL_ENCRYPTION', $request->MAIL_ENCRYPTION);} |
| 657 | 659 | if(EnvEditor::keyExists('MAIL_FROM_ADDRESS')){EnvEditor::editKey('MAIL_FROM_ADDRESS', $request->MAIL_FROM_ADDRESS);} |
| 658 | 660 | } elseif($type === "homeurl") { |
| 659 | - if($request->value == 'default'){$value = "";}else{$value = '"' . $request->value . '"';} |
|
| 661 | + if($request->value == 'default'){$value = "";} else{$value = '"' . $request->value . '"';} |
|
| 660 | 662 | if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 661 | 663 | } elseif($type === "maintenance") { |
| 662 | - if($request->toggle != ''){$value = "true";}else{$value = "false";} |
|
| 664 | + if($request->toggle != ''){$value = "true";} else{$value = "false";} |
|
| 663 | 665 | if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));} |
| 664 | 666 | if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 665 | 667 | } else { |
@@ -1094,7 +1094,7 @@ |
||
| 1094 | 1094 | $pathinfo = "/img/" . $name. "." . pathinfo($file, PATHINFO_EXTENSION); |
| 1095 | 1095 | }} |
| 1096 | 1096 | return $pathinfo; |
| 1097 | - } |
|
| 1097 | + } |
|
| 1098 | 1098 | |
| 1099 | 1099 | if (file_exists(base_path(findAvatar($userId)))){ |
| 1100 | 1100 | $imagePath = base_path(findAvatar($userId)); |
@@ -209,8 +209,9 @@ discard block |
||
| 209 | 209 | $customParams = []; |
| 210 | 210 | foreach ($request->all() as $key => $param) { |
| 211 | 211 | //echo $key . " = " . $param . "<br />"; |
| 212 | - if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) |
|
| 213 | - continue; |
|
| 212 | + if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) { |
|
| 213 | + continue; |
|
| 214 | + } |
|
| 214 | 215 | |
| 215 | 216 | $customParams[$key] = $param; |
| 216 | 217 | } |
@@ -218,8 +219,9 @@ discard block |
||
| 218 | 219 | $userId = Auth::user()->id; |
| 219 | 220 | $button = Button::where('name', $request->button)->first(); |
| 220 | 221 | |
| 221 | - if ($button && empty($LinkTitle)) |
|
| 222 | - $LinkTitle = $button->alt; |
|
| 222 | + if ($button && empty($LinkTitle)) { |
|
| 223 | + $LinkTitle = $button->alt; |
|
| 224 | + } |
|
| 223 | 225 | |
| 224 | 226 | if ($linkType->typename == 'video' && empty($LinkTitle)) { |
| 225 | 227 | $embed = OEmbed::get($LinkURL); |
@@ -242,44 +244,44 @@ discard block |
||
| 242 | 244 | 'title' => $LinkTitle, |
| 243 | 245 | 'button_id' => "2", |
| 244 | 246 | ]); |
| 245 | - }elseif($linkType->typename == "link"){ |
|
| 247 | + } elseif($linkType->typename == "link"){ |
|
| 246 | 248 | $OrigLink->update([ |
| 247 | 249 | 'link' => $LinkURL, |
| 248 | 250 | 'title' => $LinkTitle, |
| 249 | 251 | 'button_id' => "1", |
| 250 | 252 | ]); |
| 251 | - }elseif($linkType->typename == "spacer"){ |
|
| 253 | + } elseif($linkType->typename == "spacer"){ |
|
| 252 | 254 | $OrigLink->update([ |
| 253 | 255 | 'link' => $LinkURL, |
| 254 | 256 | 'title' => $customParams['height'] ?? null, |
| 255 | 257 | 'button_id' => "43", |
| 256 | 258 | ]); |
| 257 | - }elseif($linkType->typename == "heading"){ |
|
| 259 | + } elseif($linkType->typename == "heading"){ |
|
| 258 | 260 | $OrigLink->update([ |
| 259 | 261 | 'link' => $LinkURL, |
| 260 | 262 | 'title' => $LinkTitle, |
| 261 | 263 | 'button_id' => "42", |
| 262 | 264 | ]); |
| 263 | - }elseif($linkType->typename == "text"){ |
|
| 265 | + } elseif($linkType->typename == "text"){ |
|
| 264 | 266 | $OrigLink->update([ |
| 265 | 267 | 'button_id' => "93", |
| 266 | 268 | 'title' => $request->text, |
| 267 | 269 | ]); |
| 268 | - }elseif($linkType->typename == "email"){ |
|
| 270 | + } elseif($linkType->typename == "email"){ |
|
| 269 | 271 | $LinkURL = "mailto:".$LinkURL; |
| 270 | 272 | $OrigLink->update([ |
| 271 | 273 | 'link' => $LinkURL, |
| 272 | 274 | 'button_id' => $button?->id, |
| 273 | 275 | 'title' => $LinkTitle, |
| 274 | 276 | ]); |
| 275 | - }elseif($linkType->typename == "telephone"){ |
|
| 277 | + } elseif($linkType->typename == "telephone"){ |
|
| 276 | 278 | $LinkURL = "tel:".$LinkURL; |
| 277 | 279 | $OrigLink->update([ |
| 278 | 280 | 'link' => $LinkURL, |
| 279 | 281 | 'button_id' => $button?->id, |
| 280 | 282 | 'title' => $LinkTitle, |
| 281 | 283 | ]); |
| 282 | - }elseif($linkType->typename == "vcard"){ |
|
| 284 | + } elseif($linkType->typename == "vcard"){ |
|
| 283 | 285 | |
| 284 | 286 | $prefix = $request->input('prefix'); |
| 285 | 287 | $firstName = $request->input('first_name'); |
@@ -351,7 +353,7 @@ discard block |
||
| 351 | 353 | 'button_id' => 96, |
| 352 | 354 | 'title' => $LinkTitle, |
| 353 | 355 | ]); |
| 354 | - }else{ |
|
| 356 | + } else{ |
|
| 355 | 357 | $OrigLink->update([ |
| 356 | 358 | 'link' => $LinkURL, |
| 357 | 359 | 'title' => $LinkTitle, |
@@ -372,27 +374,27 @@ discard block |
||
| 372 | 374 | $links->user_id = $userId; |
| 373 | 375 | if($linkType->typename == "spacer"){ |
| 374 | 376 | $links->title = $SpacerHeight; |
| 375 | - }else{ |
|
| 377 | + } else{ |
|
| 376 | 378 | $links->title = $LinkTitle; |
| 377 | 379 | } |
| 378 | 380 | if($linkType->typename == "link" and $isCustomWebsite == "1"){ |
| 379 | 381 | $links->button_id = "2"; |
| 380 | - }elseif($linkType->typename == "link"){ |
|
| 382 | + } elseif($linkType->typename == "link"){ |
|
| 381 | 383 | $links->button_id = "1"; |
| 382 | - }elseif($linkType->typename == "spacer"){ |
|
| 384 | + } elseif($linkType->typename == "spacer"){ |
|
| 383 | 385 | $links->button_id = "43"; |
| 384 | - }elseif($linkType->typename == "heading"){ |
|
| 386 | + } elseif($linkType->typename == "heading"){ |
|
| 385 | 387 | $links->button_id = "42"; |
| 386 | - }elseif($linkType->typename == "text"){ |
|
| 388 | + } elseif($linkType->typename == "text"){ |
|
| 387 | 389 | $links->button_id = "93"; |
| 388 | 390 | $links->title = $request->text; |
| 389 | - }elseif($linkType->typename == "email"){ |
|
| 391 | + } elseif($linkType->typename == "email"){ |
|
| 390 | 392 | $links->link = "mailto:".$links->link; |
| 391 | 393 | $links->button_id = $button?->id; |
| 392 | - }elseif($linkType->typename == "telephone"){ |
|
| 394 | + } elseif($linkType->typename == "telephone"){ |
|
| 393 | 395 | $links->link = "tel:".$links->link; |
| 394 | 396 | $links->button_id = $button?->id; |
| 395 | - }elseif($linkType->typename == "vcard"){ |
|
| 397 | + } elseif($linkType->typename == "vcard"){ |
|
| 396 | 398 | |
| 397 | 399 | $prefix = $request->input('prefix'); |
| 398 | 400 | $firstName = $request->input('first_name'); |
@@ -460,7 +462,7 @@ discard block |
||
| 460 | 462 | $links->link = $json ? $json : null; |
| 461 | 463 | |
| 462 | 464 | $links->button_id = 96; |
| 463 | - }else{ |
|
| 465 | + } else{ |
|
| 464 | 466 | $links->button_id = $button?->id; |
| 465 | 467 | } |
| 466 | 468 | |
@@ -709,14 +711,16 @@ discard block |
||
| 709 | 711 | 'button' => 'required', |
| 710 | 712 | ]); |
| 711 | 713 | |
| 712 | - if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') |
|
| 713 | - $link1 = $request->link; |
|
| 714 | - else |
|
| 715 | - $link1 = 'https://' . $request->link; |
|
| 716 | - if (stringEndsWith($request->link, '/') == 'true') |
|
| 717 | - $link = rtrim($link1, "/ "); |
|
| 718 | - else |
|
| 719 | - $link = $link1; |
|
| 714 | + if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') { |
|
| 715 | + $link1 = $request->link; |
|
| 716 | + } else { |
|
| 717 | + $link1 = 'https://' . $request->link; |
|
| 718 | + } |
|
| 719 | + if (stringEndsWith($request->link, '/') == 'true') { |
|
| 720 | + $link = rtrim($link1, "/ "); |
|
| 721 | + } else { |
|
| 722 | + $link = $link1; |
|
| 723 | + } |
|
| 720 | 724 | $title = $request->title; |
| 721 | 725 | $order = $request->order; |
| 722 | 726 | $button = $request->button; |
@@ -1240,7 +1244,7 @@ discard block |
||
| 1240 | 1244 | if(isset($link)){ |
| 1241 | 1245 | if(searchIcon($icon) != NULL){ |
| 1242 | 1246 | updateIcon($icon, $link); |
| 1243 | - }else{ |
|
| 1247 | + } else{ |
|
| 1244 | 1248 | addIcon($icon, $link);} |
| 1245 | 1249 | } |
| 1246 | 1250 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 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 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 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 | 64 | if(DB::table('users')->count() == '0'){ |
| 65 | 65 | Schema::disableForeignKeyConstraints(); |
@@ -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 | |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | try {$users = DB::table('buttons')->count(); $failed = false;} catch (exception $e) {$failed = true;} |
| 114 | 114 | |
| 115 | 115 | if($failed == true){ |
| 116 | - if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');}else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');} |
|
| 116 | + if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');} else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');} |
|
| 117 | 117 | if(EnvEditor::keyExists('DB_HOST')){EnvEditor::deleteKey('DB_HOST');} |
| 118 | 118 | if(EnvEditor::keyExists('DB_PORT')){EnvEditor::deleteKey('DB_PORT');} |
| 119 | 119 | if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::deleteKey('DB_DATABASE');} |
| 120 | 120 | if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::deleteKey('DB_USERNAME');} |
| 121 | 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 | } |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | $llName = $user->littlelink_name; |
| 133 | 133 | |
| 134 | 134 | if($request->register == 'Yes'){ |
| 135 | - if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'true');}else{EnvEditor::addKey('ALLOW_REGISTRATION', 'true');} |
|
| 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";} |
|
| 140 | + if($request->verify == 'Yes'){$value = "verified";} else{$value = "auth";} |
|
| 141 | 141 | if(EnvEditor::keyExists('REGISTER_AUTH')){EnvEditor::editKey('REGISTER_AUTH', $value);} |
| 142 | 142 | |
| 143 | - if($request->page == 'No'){$value = "";}else{$value = '"' . $llName . '"';} |
|
| 143 | + if($request->page == 'No'){$value = "";} else{$value = '"' . $llName . '"';} |
|
| 144 | 144 | if(EnvEditor::keyExists('HOME_URL')){EnvEditor::editKey('HOME_URL', $value);} |
| 145 | 145 | |
| 146 | 146 | if(EnvEditor::keyExists('APP_NAME')){EnvEditor::editKey('APP_NAME', '"' . $request->app . '"');} |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | // dynamiclly create params for predefined website to fill a select list with available buttons |
| 64 | 64 | if (!empty($linkType) && $linkType->typename === 'predefined') { |
| 65 | 65 | $buttons = Button::select('name')->orderBy('name', 'asc')->get(); |
| 66 | - $pdParams[] = ['tag' => 'select', 'name' => 'button', 'id'=> 'button']; |
|
| 66 | + $pdParams[] = ['tag' => 'select', 'name' => 'button', 'id'=> 'button']; |
|
| 67 | 67 | foreach ($buttons as $btn) { |
| 68 | 68 | $pdParams[0]['value'][] = [ |
| 69 | 69 | 'tag'=>'option', |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $typeParams = json_decode($link['type_params']); |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - //echo "<pre>"; |
|
| 136 | + //echo "<pre>"; |
|
| 137 | 137 | // print_r($typeParams); |
| 138 | - //print_r($params[$idx]); |
|
| 139 | - //echo "</pre>"; |
|
| 138 | + //print_r($params[$idx]); |
|
| 139 | + //echo "</pre>"; |
|
| 140 | 140 | |
| 141 | 141 | if ($typeParams && property_exists($typeParams, $params[$idx]['name'])) { |
| 142 | 142 | if (key_exists('value', $params[$idx]) && is_array($params[$idx]['value'])) { |
@@ -118,11 +118,13 @@ |
||
| 118 | 118 | $params = json_decode($json, true); |
| 119 | 119 | $idx = 0; |
| 120 | 120 | foreach ($params as $p) { |
| 121 | - if (!array_key_exists('for', $p)) |
|
| 122 | - $params[$idx]['for'] = $p['name']; |
|
| 121 | + if (!array_key_exists('for', $p)) { |
|
| 122 | + $params[$idx]['for'] = $p['name']; |
|
| 123 | + } |
|
| 123 | 124 | |
| 124 | - if (!array_key_exists('label', $p)) |
|
| 125 | - $params[$idx]['label'] = ucwords(preg_replace('/[^a-zA-Z0-9-]/', ' ', $p['name'])); |
|
| 125 | + if (!array_key_exists('label', $p)) { |
|
| 126 | + $params[$idx]['label'] = ucwords(preg_replace('/[^a-zA-Z0-9-]/', ' ', $p['name'])); |
|
| 127 | + } |
|
| 126 | 128 | |
| 127 | 129 | if (!array_key_exists('label', $p) || !str_contains($p['class'], 'form-control')) { |
| 128 | 130 | $params[$idx]['class'] = " form-control"; |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
| 66 | 66 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, |
| 67 | 67 | 'link-id' => \App\Http\Middleware\LinkId::class, |
| 68 | - 'admin' => \App\Http\Middleware\admin::class, |
|
| 68 | + 'admin' => \App\Http\Middleware\admin::class, |
|
| 69 | 69 | 'blocked' => \App\Http\Middleware\CheckBlockedUser::class, |
| 70 | 70 | 'max.users' => \App\Http\Middleware\MaxUsers::class, |
| 71 | 71 | 'impersonate' => \App\Http\Middleware\Impersonate::class, |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public function handle($request, Closure $next) |
| 14 | 14 | { |
| 15 | - if(Schema::hasColumn('users', 'auth_as')) { |
|
| 15 | + if(Schema::hasColumn('users', 'auth_as')) { |
|
| 16 | 16 | $adminUser = User::where('role', 'admin')->where(function ($query) { |
| 17 | 17 | $query->where('auth_as', '!=', null) |
| 18 | 18 | ->where('auth_as', '!=', ''); |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | return $next($request); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - } else { |
|
| 162 | + } else { |
|
| 163 | 163 | return $next($request); |
| 164 | - } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | public function handle(Request $request, Closure $next) |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - //check is admin |
|
| 22 | - if (Auth::user() && Auth::user()->role == 'admin') { |
|
| 21 | + //check is admin |
|
| 22 | + if (Auth::user() && Auth::user()->role == 'admin') { |
|
| 23 | 23 | return $next($request); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | return redirect(url('dashboard')); |
| 27 | 27 | } |