diff --git a/.gitignore b/.gitignore index e248f3dd..8f1b205a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ migrates.ini /MythicalDash.zip /mythicaldash_backup.sql /caches/notifications.json -/.mono/ \ No newline at end of file +/.mono/ +public/DEMO_CLIENT diff --git a/MythicalDash64 b/MythicalDash64 index 7b50066d..3168829f 100755 Binary files a/MythicalDash64 and b/MythicalDash64 differ diff --git a/MythicalDashARM32 b/MythicalDashARM32 index 8bea02a3..897c459d 100755 Binary files a/MythicalDashARM32 and b/MythicalDashARM32 differ diff --git a/MythicalDashARM64 b/MythicalDashARM64 index 48753ef6..465afb2f 100755 Binary files a/MythicalDashARM64 and b/MythicalDashARM64 differ diff --git a/app/Logger.php b/app/Logger.php new file mode 100644 index 00000000..085d50fd --- /dev/null +++ b/app/Logger.php @@ -0,0 +1,25 @@ +connectToDatabase(); + + $stmt = $conn->prepare("INSERT INTO mythicaldash_logs (title, text) VALUES (?, ?)"); + $stmt->bind_param("ss", $title, $text); + $stmt->execute(); + $stmt->close(); + } +} \ No newline at end of file diff --git a/app/Pterodactyl/Connection.php b/app/Pterodactyl/Connection.php index 283d6faa..14188bb2 100644 --- a/app/Pterodactyl/Connection.php +++ b/app/Pterodactyl/Connection.php @@ -1,6 +1,7 @@ self::$pterodactyl_url . "/api/application/locations", + CURLOPT_URL => self::$pterodactyl_url . "/api/application/nests", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, @@ -44,10 +45,17 @@ public static function checkConnection() : bool curl_close($curl); if ($err) { + Logger::log("Pterodactyl Panel Connection Error","Failed to connect to the Pterodactyl Panel: ".$err.$response); return false; } else { $responseData = json_decode($response, true); - return isset($responseData['object']) && $responseData['object'] === 'list'; + $check = isset($responseData['object']) && $responseData['object'] === 'list'; + if ($check) { + return true; + } else { + Logger::log("Pterodactyl Panel Connection Error","Failed to connect to the Pterodactyl Panel: ".$response); + return false; + } } } } diff --git a/app/Pterodactyl/User.php b/app/Pterodactyl/User.php index 07213501..00cb6ca4 100644 --- a/app/Pterodactyl/User.php +++ b/app/Pterodactyl/User.php @@ -1,6 +1,7 @@ =8.1.0" }, "replace": { @@ -423,8 +424,8 @@ "authors": [ { "name": "NaysKutzu", - "email": "nayskutzu@mythicalsystems.xyz", - "homepage": "https://mythicalsystems.xyz", + "email": "nayskutzu@mythicalsystems.me", + "homepage": "https://mythicalsystems.me", "role": "Owner" } ], @@ -444,11 +445,11 @@ ], "support": { "chat": "https://discord.gg/Tswkrhreu3", - "docs": "https://docs.mythicalsystems.xyz", + "docs": "https://docs.mythicalsystems.me", "forum": "https://discord.gg/Tswkrhreu3", "issues": "https://github.com/mythicalltd/mythicalcore/issues", - "source": "https://github.com/MythicalLTD/MythicalCore/tree/1.0.0.1", - "wiki": "https://docs.mythicalsystems.xyz" + "source": "https://github.com/MythicalLTD/MythicalCore/tree/1.0.0.11", + "wiki": "https://docs.mythicalsystems.me" }, "funding": [ { @@ -456,7 +457,7 @@ "type": "GitHub" } ], - "time": "2024-03-20T19:35:32+00:00" + "time": "2024-08-23T19:35:43+00:00" }, { "name": "phpmailer/phpmailer", @@ -593,20 +594,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -630,7 +631,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -642,9 +643,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -745,16 +746,16 @@ }, { "name": "stripe/stripe-php", - "version": "v13.14.0", + "version": "v13.18.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "d569265e79dc82329dadea1b1088a0a29c7a8a76" + "reference": "02abb043b103766f4ed920642ae56ffdc58c7467" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/d569265e79dc82329dadea1b1088a0a29c7a8a76", - "reference": "d569265e79dc82329dadea1b1088a0a29c7a8a76", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/02abb043b103766f4ed920642ae56ffdc58c7467", + "reference": "02abb043b103766f4ed920642ae56ffdc58c7467", "shasum": "" }, "require": { @@ -798,22 +799,22 @@ ], "support": { "issues": "https://github.com/stripe/stripe-php/issues", - "source": "https://github.com/stripe/stripe-php/tree/v13.14.0" + "source": "https://github.com/stripe/stripe-php/tree/v13.18.0" }, - "time": "2024-03-14T21:12:02+00:00" + "time": "2024-04-09T21:08:04+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.4.0", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { @@ -822,7 +823,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -851,7 +852,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" }, "funding": [ { @@ -867,20 +868,20 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -930,7 +931,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -946,20 +947,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.3", + "version": "v6.4.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "d75715985f0f94f978e3a8fa42533e10db921b90" + "reference": "52903de178d542850f6f341ba92995d3d63e60c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d75715985f0f94f978e3a8fa42533e10db921b90", - "reference": "d75715985f0f94f978e3a8fa42533e10db921b90", + "url": "https://api.github.com/repos/symfony/yaml/zipball/52903de178d542850f6f341ba92995d3d63e60c9", + "reference": "52903de178d542850f6f341ba92995d3d63e60c9", "shasum": "" }, "require": { @@ -1002,7 +1003,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.3" + "source": "https://github.com/symfony/yaml/tree/v6.4.8" }, "funding": [ { @@ -1018,7 +1019,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-05-31T14:49:08+00:00" } ], "packages-dev": [], diff --git a/migrate/84.sql b/migrate/84.sql new file mode 100644 index 00000000..cd77e9ef --- /dev/null +++ b/migrate/84.sql @@ -0,0 +1 @@ +CREATE TABLE `mythicaldash_logs` (`id` INT NOT NULL AUTO_INCREMENT , `title` TEXT NULL DEFAULT NULL , `text` TEXT NULL DEFAULT NULL , `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file diff --git a/public/FIRST_INSTALL b/public/FIRST_INSTALL new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/public/FIRST_INSTALL @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/public/FIRST_USER b/public/FIRST_USER new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/public/FIRST_USER @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/public/index.php b/public/index.php index 5ed90c67..988bee2d 100644 --- a/public/index.php +++ b/public/index.php @@ -11,6 +11,7 @@ use MythicalDash\Main; use MythicalDash\ErrorHandler; use MythicalDash\AddonsManager; +use MythicalDash\Logger; if (!Main::isHTTPS()) { ErrorHandler::ShowCritical("We are sorry, but the dash can only run on HTTPS, not HTTP."); @@ -56,7 +57,6 @@ } $addonsManager->processAddonRoutes($router); - $router->add("/(.*)", function () { require("../include/main.php"); require("../view/errors/404.php"); diff --git a/public/ping.php b/public/ping.php deleted file mode 100644 index fd3cec96..00000000 --- a/public/ping.php +++ /dev/null @@ -1,10 +0,0 @@ - $ping]); -} - -?> \ No newline at end of file diff --git a/public/wp-admin.php b/public/wp-admin.php deleted file mode 100644 index 1f59eedd..00000000 --- a/public/wp-admin.php +++ /dev/null @@ -1,17 +0,0 @@ -composer install --no-dev --optimize-autoloader". Please run that and refresh the page'); - } -} catch (Exception $e) { - die('Hello, it looks like you did not run: composer install --no-dev --optimize-autoloader Please run that and refresh'); -} -use MythicalSystems\Api\ResponseHandler; - -ResponseHandler::NotFound("Nice try :)"); -?> \ No newline at end of file diff --git a/public/wp-login.php b/public/wp-login.php deleted file mode 100644 index 1f59eedd..00000000 --- a/public/wp-login.php +++ /dev/null @@ -1,17 +0,0 @@ -composer install --no-dev --optimize-autoloader". Please run that and refresh the page'); - } -} catch (Exception $e) { - die('Hello, it looks like you did not run: composer install --no-dev --optimize-autoloader Please run that and refresh'); -} -use MythicalSystems\Api\ResponseHandler; - -ResponseHandler::NotFound("Nice try :)"); -?> \ No newline at end of file diff --git a/view/admin/health.php b/view/admin/health.php index a2aed674..10b27989 100644 --- a/view/admin/health.php +++ b/view/admin/health.php @@ -1,28 +1,12 @@ query($userCountQuery); -$userCount = $userCountResult->fetch_assoc()['user_count']; -$ticketCountQuery = "SELECT COUNT(*) AS ticket_count FROM mythicaldash_tickets"; -$ticketCountResult = $conn->query($ticketCountQuery); -$ticketCount = $ticketCountResult->fetch_assoc()['ticket_count']; -$serverCountQuery = "SELECT COUNT(*) AS servers FROM mythicaldash_servers"; -$serverCountResult = $conn->query($serverCountQuery); -$serverCount = $serverCountResult->fetch_assoc()['servers']; -$serverQueueQuery = "SELECT COUNT(*) AS serversq FROM mythicaldash_servers_queue"; -$serverQueueCountResult = $conn->query($serverQueueQuery); -$serverQueueCount = $serverQueueCountResult->fetch_assoc()['serversq']; -$locationsQuery = "SELECT COUNT(*) AS locations FROM mythicaldash_locations"; -$locationsCountResult = $conn->query($locationsQuery); -$locationsCount = $locationsCountResult->fetch_assoc()['locations']; -$eggsQuery = "SELECT COUNT(*) AS eggs FROM mythicaldash_eggs"; -$eggsCountResult = $conn->query($eggsQuery); -$eggCount = $eggsCountResult->fetch_assoc()['eggs']; -$TotalServers = $serverCount + $serverQueueCount; + ?> @@ -52,9 +36,7 @@

Admin / Health

- + = '8.1' && $phpVersion <= '8.3') { - ?> + ?> - + ?> - - + ?> - + ?> - - + ?> - + ?> - - + - + ?> - - + ?> - + ?> - - + ?> - + ?> - - + ?> - + ?> - + +
+
+ Latest Error Logs + +
+
+ + + + + + + + + + + query("SELECT * FROM mythicaldash_logs LIMIT 15"); + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + } else { + echo ""; + } + ?> + +
IDTitleTextDate
' . $row['id'] . '' . $row['title'] . '' . $row['text'] . '' . $row['date'] . '
No users found.
+
+
+
+ +
- -
+
+
-
-
- - - + + \ No newline at end of file diff --git a/view/admin/main.php b/view/admin/main.php index 36b2d6a3..3df1f4d4 100644 --- a/view/admin/main.php +++ b/view/admin/main.php @@ -53,10 +53,7 @@

Admin / Statistics

- +
diff --git a/view/auth/login.php b/view/auth/login.php index 0f2fc105..3353e4fc 100644 --- a/view/auth/login.php +++ b/view/auth/login.php @@ -2,7 +2,7 @@ use MythicalDash\SettingsManager; use MythicalDash\SessionManager; use MythicalDash\Database\Connect; -use MythicalSystems\CloudFlare\TurnStile; + try { $conn = new Connect(); $conn = $conn->connectToDatabase(); @@ -15,7 +15,7 @@ if (SettingsManager::getSetting("enable_turnstile") == "false") { $captcha_success = 1; } else { - $captcha_success = TurnStile::validate($_POST["cf-turnstile-response"], $session->getIP(), SettingsManager::getSetting("turnstile_secretkey")); + $captcha_success = \MythicalSystems\CloudFlare\Turnstile::validate($_POST["cf-turnstile-response"], $session->getIP(), SettingsManager::getSetting("turnstile_secretkey")); } if ($captcha_success) { $email = mysqli_real_escape_string($conn, $_POST['email']); diff --git a/view/auth/register.php b/view/auth/register.php index c3a6ecee..bbbe4a2e 100644 --- a/view/auth/register.php +++ b/view/auth/register.php @@ -1,8 +1,8 @@ +?> - getIP(), SettingsManager::getSetting("turnstile_secretkey")); + $captcha_success = \MythicalSystems\CloudFlare\Turnstile::validate($_POST["cf-turnstile-response"], $session->getIP(), SettingsManager::getSetting("turnstile_secretkey")); } if ($captcha_success) { if (!SettingsManager::getSetting("PterodactylURL") == "" && !SettingsManager::getSetting("PterodactylAPIKey") == "") { @@ -118,45 +118,7 @@ $conn->query("INSERT INTO mythicaldash_login_logs (ipaddr, userkey) VALUES ('" . mysqli_real_escape_string($conn, $session->getIP()) . "', '" . mysqli_real_escape_string($conn, $skey) . "')"); $default = "https://www.gravatar.com/avatar/00000000000000000000000000000000"; $grav_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?d=" . urlencode($default); - $conn->query("INSERT INTO `mythicaldash_users` - (`panel_id`, - `email`, - `username`, - `first_name`, - `last_name`, - `password`, - `api_key`, - `avatar`, - `role`, - `coins`, - `ram`, - `disk`, - `cpu`, - `server_limit`, - `ports`, - `databases`, - `backups`, - `first_ip` - ) VALUES ( - '" . mysqli_real_escape_string($conn, $panel_id) . "', - '" . mysqli_real_escape_string($conn, $email) . "', - '" . mysqli_real_escape_string($conn, $username) . "', - '" . mysqli_real_escape_string($conn, Encryption::encrypt($first_name, $ekey)) . "', - '" . mysqli_real_escape_string($conn, Encryption::encrypt($last_name, $ekey)) . "', - '" . mysqli_real_escape_string($conn, $password) . "', - '" . mysqli_real_escape_string($conn, $skey) . "', - '" . mysqli_real_escape_string($conn, $grav_url) . "', - '" . mysqli_real_escape_string($conn, $role) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_coins")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_memory")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_disk_space")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_cpu")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_server_limit")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_port")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_db")) . "', - '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_backups")) . "', - '" . mysqli_real_escape_string($conn, $session->getIP()) . "' - );"); + $conn->query("INSERT INTO `mythicaldash_users` (`panel_id`, `email`, `username`, `first_name`, `last_name`, `password`, `api_key`, `avatar`, `role`, `coins`, `ram`, `disk`, `cpu`, `server_limit`, `ports`, `databases`, `backups`, `first_ip` ) VALUES ( '" . mysqli_real_escape_string($conn, $panel_id) . "', '" . mysqli_real_escape_string($conn, $email) . "', '" . mysqli_real_escape_string($conn, $username) . "', '" . mysqli_real_escape_string($conn, Encryption::encrypt($first_name, $ekey)) . "', '" . mysqli_real_escape_string($conn, Encryption::encrypt($last_name, $ekey)) . "', '" . mysqli_real_escape_string($conn, $password) . "', '" . mysqli_real_escape_string($conn, $skey) . "', '" . mysqli_real_escape_string($conn, $grav_url) . "', '" . mysqli_real_escape_string($conn, $role) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_coins")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_memory")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_disk_space")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_cpu")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_server_limit")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_port")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_db")) . "', '" . mysqli_real_escape_string($conn, SettingsManager::getSetting("def_backups")) . "', '" . mysqli_real_escape_string($conn, $session->getIP()) . "' );"); $conn->close(); if (file_exists("FIRST_USER")) { unlink("FIRST_USER"); @@ -169,7 +131,6 @@ $conn->close(); die(); } - } else { header('location: /auth/register?e=' . $lang['username_or_email_exists']); $conn->close(); @@ -210,7 +171,7 @@ - + <?= SettingsManager::getSetting("name") ?> - <?= $lang['register'] ?> @@ -273,13 +234,13 @@
+ ?>
">
  - input('register-form'); ?> @@ -288,13 +249,12 @@ + ?> -

@@ -347,7 +307,7 @@ class="btn btn-primary me-sm-3 me-1">

- + diff --git a/view/components/sidebar.php b/view/components/sidebar.php index c716c1fb..208f2604 100644 --- a/view/components/sidebar.php +++ b/view/components/sidebar.php @@ -1,4 +1,5 @@ - - + ?> - getUserInfo("role") == "Administrator") { - ?> + ?> @@ -220,15 +221,13 @@ function is_active_page($page_urls)
Application API
- - - getUserInfo("role") == "Support" || $session->getUserInfo("role") == "Administrator") { - ?> + ?> @@ -301,7 +300,7 @@ class="menu-item Tickets - diff --git a/view/install/servercheck.php b/view/install/servercheck.php index 297e578b..e3cf25a4 100644 --- a/view/install/servercheck.php +++ b/view/install/servercheck.php @@ -134,7 +134,7 @@ class="h-auto rounded-circle" />