From 505bbfbc255833a98f5673b8a0b79f88e8e9b68d Mon Sep 17 00:00:00 2001 From: lera2od <119118688+lera2od@users.noreply.github.com> Date: Thu, 11 May 2023 23:08:06 +0300 Subject: [PATCH] 2.0 update --- .gitignore | 8 +++---- src/leravel/admin/views/stats.php | 3 ++- src/leravel/commonErrors.json | 5 ++++ src/leravel/error.php | 39 ++++++++++++++++++++++--------- src/leravel/index.php | 1 + src/leravel/leravel.json | 5 +--- src/leravel/leravelVar.php | 4 ++-- 7 files changed, 43 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index a4f6026..d9256f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -src/app/settings.json -README.md +src/leravel/leravel.json +src/leravel/admin/statRenders/lastUpdated.json +src/leravel/admin/statRenders/mostVisitedPages.json +src/leravel/admin/statRenders/weeklyVisits.json src/app/stats.json -src/leravel/admin/statRenders -.gitignore \ No newline at end of file diff --git a/src/leravel/admin/views/stats.php b/src/leravel/admin/views/stats.php index cb0eea7..987bdf9 100644 --- a/src/leravel/admin/views/stats.php +++ b/src/leravel/admin/views/stats.php @@ -10,6 +10,7 @@ if ($render == "true") { $weeklyVisits = array(); + foreach ($stats as $stat) { $date = $stat["date"]; $visits = 0; @@ -60,7 +61,7 @@ if (in_array($ip, array_column($visitors, "ip"))) { continue; } - if ($ip == "127.0.0.1") { + if ($ip == "127.0.0.1" || $ip == "::1") { continue; } $country = json_decode(file_get_contents("http://ip-api.com/json/" . $ip), true)["country"]; diff --git a/src/leravel/commonErrors.json b/src/leravel/commonErrors.json index 1f3748b..4ec685f 100644 --- a/src/leravel/commonErrors.json +++ b/src/leravel/commonErrors.json @@ -13,5 +13,10 @@ "error" : "parse_ini_file(", "file" : "\\admin\\admin.php", "solution" : "account.ini moved into /app/adminAccount.ini
For more info : leravel v1.3 changelog" + }, + { + "error" : "Uncaught mysqli_sql_exception", + "file" : "leravelVar.php", + "solution" : "The default MySQLI connection having trouble connecting to the MySQL server
Check if your MySQL server is on. Or disable the database entirely from settings.json" } ] \ No newline at end of file diff --git a/src/leravel/error.php b/src/leravel/error.php index 1be7a71..d90cc2b 100644 --- a/src/leravel/error.php +++ b/src/leravel/error.php @@ -16,7 +16,23 @@ function customError($errno, $errstr, $errfile, $errline) } - echo ""; + echo ""; echo '
'; echo "
"; echo "

ERROR

"; @@ -26,15 +42,6 @@ function customError($errno, $errstr, $errfile, $errline) echo "
"; $extra = ""; if (strpos($errfile, "leravel") !== false) { - if($solution != null) { - echo "
"; - echo "

There is a solution for this error

"; - echo ""; - echo ""; - echo "
Solution" . $solution . "
"; - echo "
"; - $extra = "If the solution didn't help."; - } echo ""; echo ""; echo ""; @@ -43,9 +50,19 @@ function customError($errno, $errstr, $errfile, $errline) echo ""; echo "
Error TypeLeravel Error
Error" . $errno . "
Line" . $errline . "
"; echo "
"; + if($solution != null) { + echo "
"; + echo "
"; + echo "

There is a solution for this error

"; + echo ""; + echo ""; + echo "
Solution" . $solution . "
"; + echo "
"; + echo "
"; + } echo "
"; echo "Report The Error"; - echo ''. $extra . 'Report the error using Github'; + echo ' Report the error using Github'; echo "
"; } else { echo ""; diff --git a/src/leravel/index.php b/src/leravel/index.php index ba14c81..e15690f 100644 --- a/src/leravel/index.php +++ b/src/leravel/index.php @@ -1,5 +1,6 @@ connect_error) { - die("Connection failed: " . $Leravel["conn"]->connect_error); + if ( $Leravel["conn"]->connect_errno ) { + die('Connect Error: ' . $db->connect_errno); } } \ No newline at end of file