diff --git a/.gitignore b/.gitignore index 98a8ecb3..6101a5ef 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,6 @@ migrates.ini /cli/logs /public/pma.zip /cli/*.yml -/caches/github.json -/MythicalDash \ No newline at end of file +/MythicalDash +/MythicalDash.zip +/mythicaldash_backup.sql \ No newline at end of file diff --git a/MythicalDash64 b/MythicalDash64 index f3a4c298..61409551 100755 Binary files a/MythicalDash64 and b/MythicalDash64 differ diff --git a/MythicalDashARM32 b/MythicalDashARM32 index 5233adfa..86bcedec 100755 Binary files a/MythicalDashARM32 and b/MythicalDashARM32 differ diff --git a/MythicalDashARM64 b/MythicalDashARM64 index 9adf3680..098dcf77 100755 Binary files a/MythicalDashARM64 and b/MythicalDashARM64 differ diff --git a/app/Database/Connect.php b/app/Database/Connect.php index ecc66b62..f13ac509 100644 --- a/app/Database/Connect.php +++ b/app/Database/Connect.php @@ -25,5 +25,22 @@ public function connectToDatabase() { return $conn; } + + public static function getUserInfo(string $userToken, string $info) { + $connclass = new Connect(); + $conn = $connclass->connectToDatabase(); + $session_id = mysqli_real_escape_string($conn, $userToken); + $safeInfo = $conn->real_escape_string($info); + $query = "SELECT `$safeInfo` FROM mythicaldash_users WHERE api_key='$session_id' LIMIT 1"; + $result = $conn->query($query); + + if ($result && $result->num_rows > 0) { + $row = $result->fetch_assoc(); + return $row[$info]; + } else { + return null; + } + + } } ?> \ No newline at end of file diff --git a/app/Pterodactyl/Connection.php b/app/Pterodactyl/Connection.php index cf84908e..283d6faa 100644 --- a/app/Pterodactyl/Connection.php +++ b/app/Pterodactyl/Connection.php @@ -20,6 +20,7 @@ public static function initializeSettings() { */ public static function checkConnection() : bool { + self::initializeSettings(); $curl = curl_init(); curl_setopt_array($curl, array( diff --git a/app/Pterodactyl/User.php b/app/Pterodactyl/User.php new file mode 100644 index 00000000..f881b3fc --- /dev/null +++ b/app/Pterodactyl/User.php @@ -0,0 +1,76 @@ + $email, + 'username' => $username, + 'first_name' => $first_name, + 'last_name' => $last_name, + 'password' => $password + ); + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + + $response = curl_exec($ch); + $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + curl_close($ch); + + if ($statusCode == 201) { + $responseData = json_decode($response, true); + return $responseData['attributes']['id']; + } elseif ($statusCode == 422) { + $errorResponse = json_decode($response, true); + $errorMessages = array(); + + foreach ($errorResponse['errors'] as $error) { + $errorMessages[] = $error['detail']; + } + + return implode("|", $errorMessages); + } else { + return "Unexpected error: " . $statusCode; + } + } else { + return false; + } + } + + + /** + * Delete a user from inside pterodactyl panel! + */ + public static function Delete(string $id): bool + { + return false; + } +} +?> \ No newline at end of file diff --git a/caches/github.json b/caches/github.json new file mode 100644 index 00000000..e10a1cc2 --- /dev/null +++ b/caches/github.json @@ -0,0 +1 @@ +{"url":"https://api.github.com/repos/MythicalLTD/MythicalDash/releases/137880538","assets_url":"https://api.github.com/repos/MythicalLTD/MythicalDash/releases/137880538/assets","upload_url":"https://uploads.github.com/repos/MythicalLTD/MythicalDash/releases/137880538/assets{?name,label}","html_url":"https://github.com/MythicalLTD/MythicalDash/releases/tag/3.1.3","id":137880538,"author":{"login":"NaysKutzu","id":87282334,"node_id":"MDQ6VXNlcjg3MjgyMzM0","avatar_url":"https://avatars.githubusercontent.com/u/87282334?v=4","gravatar_id":"","url":"https://api.github.com/users/NaysKutzu","html_url":"https://github.com/NaysKutzu","followers_url":"https://api.github.com/users/NaysKutzu/followers","following_url":"https://api.github.com/users/NaysKutzu/following{/other_user}","gists_url":"https://api.github.com/users/NaysKutzu/gists{/gist_id}","starred_url":"https://api.github.com/users/NaysKutzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NaysKutzu/subscriptions","organizations_url":"https://api.github.com/users/NaysKutzu/orgs","repos_url":"https://api.github.com/users/NaysKutzu/repos","events_url":"https://api.github.com/users/NaysKutzu/events{/privacy}","received_events_url":"https://api.github.com/users/NaysKutzu/received_events","type":"User","site_admin":false},"node_id":"RE_kwDOJGZssM4IN-Pa","tag_name":"3.1.3","target_commitish":"develop","name":"3.1.3","draft":false,"prerelease":false,"created_at":"2024-01-20T21:34:54Z","published_at":"2024-01-21T11:13:12Z","assets":[{"url":"https://api.github.com/repos/MythicalLTD/MythicalDash/releases/assets/147116321","id":147116321,"node_id":"RA_kwDOJGZssM4IxNEh","name":"MythicalDash.zip","label":null,"uploader":{"login":"NaysKutzu","id":87282334,"node_id":"MDQ6VXNlcjg3MjgyMzM0","avatar_url":"https://avatars.githubusercontent.com/u/87282334?v=4","gravatar_id":"","url":"https://api.github.com/users/NaysKutzu","html_url":"https://github.com/NaysKutzu","followers_url":"https://api.github.com/users/NaysKutzu/followers","following_url":"https://api.github.com/users/NaysKutzu/following{/other_user}","gists_url":"https://api.github.com/users/NaysKutzu/gists{/gist_id}","starred_url":"https://api.github.com/users/NaysKutzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NaysKutzu/subscriptions","organizations_url":"https://api.github.com/users/NaysKutzu/orgs","repos_url":"https://api.github.com/users/NaysKutzu/repos","events_url":"https://api.github.com/users/NaysKutzu/events{/privacy}","received_events_url":"https://api.github.com/users/NaysKutzu/received_events","type":"User","site_admin":false},"content_type":"application/x-zip-compressed","state":"uploaded","size":109762342,"download_count":8,"created_at":"2024-01-22T17:34:32Z","updated_at":"2024-01-22T17:36:37Z","browser_download_url":"https://github.com/MythicalLTD/MythicalDash/releases/download/3.1.3/MythicalDash.zip"}],"tarball_url":"https://api.github.com/repos/MythicalLTD/MythicalDash/tarball/3.1.3","zipball_url":"https://api.github.com/repos/MythicalLTD/MythicalDash/zipball/3.1.3","body":"-> Added a landing page\r\n-> Fresh theme for 2024\r\n-> Fixed update checker\r\n-> Bump CLI to net8.0\r\n-> Added a method to delete servers in database if they don't exist anymore in panel\r\n-> Added a translation system\r\n-> Added a confirmation for delete server\r\n-> Optimized some code\r\n-> Rewrote how the dash connects to the panel\r\n-> Fixed some minor bugs\r\n-> Added more things into README\r\n-> Now the dash has a default landing page theme\r\n-> Bump the build script to 8.0\r\n-> Bump composer packages to the latest version\r\n-> Added an option to change the background picture in dash!"} \ No newline at end of file diff --git a/cli/Program.cs b/cli/Program.cs index 7217b073..8406895a 100644 --- a/cli/Program.cs +++ b/cli/Program.cs @@ -254,6 +254,11 @@ public static void Main(string[] args) sh.DisableTurnstile(); Environment.Exit(0x0); } + else if (args.Contains("-environment:lang")) + { + sh.SetEnglish(); + Environment.Exit(0x0); + } else if (args.Contains("-help")) { Console.Clear(); @@ -266,6 +271,7 @@ public static void Main(string[] args) Console.WriteLine("‖ -environment:down ‖ Enter maintenance mode. ‖"); Console.WriteLine("‖ -environment:up ‖ Exit maintenance mode. ‖"); Console.WriteLine("‖ -environment:setup ‖ This is a command to help you setup your dashboard! ‖"); + Console.WriteLine("‖ -environment:lang ‖ Resets the dashboard language to en_US ‖"); Console.WriteLine("‖ -turnstile:disable ‖ Stops turnstile from running! ‖"); Console.WriteLine("‖ -vpn:disable ‖ Stops anti vpn from running! ‖"); Console.WriteLine("‖ -key:generate ‖ Generate a new encryption key for MythicalDash. ‖"); diff --git a/cli/scripts/SettingsHandler.cs b/cli/scripts/SettingsHandler.cs index 0b9dea95..6d2cf35b 100644 --- a/cli/scripts/SettingsHandler.cs +++ b/cli/scripts/SettingsHandler.cs @@ -85,10 +85,30 @@ public void Setup() Program.logger.Log(LogType.Error, "It looks like the config file does not exist!"); } } - public void setLang(string lang) { + public void SetEnglish() { if (fm.ConfigExists() == true) { - + try + { + getConnection(); + using (var connection = new MySqlConnection(connectionString)) + { + connection.Open(); + ExecuteSQLScript(connection, "UPDATE `mythicaldash_settings` SET `lang` = 'en_US' WHERE `mythicaldash_settings`.`id` = 1;"); + connection.Close(); + } + string logDirectory = "logs"; + string[] logFiles = Directory.GetFiles(logDirectory); + foreach (string logFile in logFiles) + { + File.Delete(logFile); + } + Program.logger.Log(LogType.Info, "Done"); + } + catch (Exception ex) + { + Program.logger.Log(LogType.Error, "Sorry but the auto settings throws this error: " + ex.Message); + } } else { diff --git a/lang/en_US.php b/lang/en_US.php index e386c7d9..ed2105bb 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -1,26 +1,51 @@ "Home", "dashboard" => "Dashboard", "store" => "Shop", "help_center" => "Help-Center", "login" => "Login", "register" => "Register", + "create_server" => "Create server", + "buy_coins" => "Buy coins", "or" => "or", + "earn" => "Earn", + "afk" => "AFK", + "profile" => "Profile", + "users" => "Users", + "back" => "Back", + "search" => "Search", + "payments" => "Payments", "leaderboard" => "Leaderboard", - "forgot_passowrd" => "Forgot passowrd", + "account" => "Account", + "connections" => "Connections", + "forgot_password" => "Forgot password", + "danger_zone" => "Danger Zone", + "danger_zone_read" => "Make sure you read what the button does!", + "danger_zone_warn" => "Once you press a button, there is no going back. Please be certain.", "terms_of_service" => "Terms of service", + "reset_password" => "Reset your password", + "reset_key" => "Reset your secret key", + "reset_pwd_desc" => "After updating the key, the user will stay logged in!!", + "reset_key_desc" => "After updating the key, the user will have to login again.", + "delete_account" => "Delete your account", + "delete_account_danger" => "When you choose to delete this user, please be aware that all associated user data will be permanently wiped. This action is irreversible, so proceed with caution!", "privacy_policy" => "Privacy policy", + "show_key_description" => "Here is your secret key that can be used to access our client API and this is your login security token, so make sure not to share it!", "email" => "Email", + "save" => "Save", + "secret_key" => "Secret key", "password" => "Password", + "show" => "Show", "username" => "Username", + "new_password" => "New password", "first_name" => "First name", "last_name" => "Last name", "send" => "Send", "back_to_login" => "Back to login", "store_need_more_coins" => "You need more coins to buy this!", - "store_thanks_for_buying" => "Thank you for your purchase. We updated your resources!", + "store_thanks_for_buying" => "We updated your resources!", "store_wana_buy_coins" => "Would you like to buy more coins?", "store_not_have_enough_coins" => "You don't have enough coins.", "store_buy" => "Purchase", @@ -38,7 +63,7 @@ "disk" => "Disk", "server_slot" => "Server Slot(s)", "backup_slot" => "Server Backup(s)", - "server_allocation" => "Server Allocation(Server Allocation)", + "server_allocation" => "Server Allocation(s)", "mysql" => "Server Database(s)", "coins" => "Coin(s)", "statistics" => "Statistics", @@ -52,12 +77,12 @@ "server_type" => "Server type", "actions" => "Actions", "help_center_help" => "Hello, how can we help?", - "help_center_subhelp"=> "Common topics:", + "help_center_subhelp" => "Common topics:", "help_center_popular_articles" => "Popular Articles", "help_center_tos_desc" => "Read and agree to our Terms of Service before using our platforms.", "help_center_pp_desc" => "Discover how we safeguard your personal information through our Privacy Policy.", "help_center_read_more" => "Read more", - "help_center_support" => "Support", + "help_center_support" => "Support", "help_center_feel_help" => "You feel like you need more help?", "help_center_open_ticket" => "Open a ticket", "help_center_still_need_help" => "Still need help?", @@ -66,15 +91,19 @@ "leaderboard_place" => "Place", "leaderboard_username" => "Username", "leaderboard_role" => "Role", - "leaderboard_minutes" => "Minutes", - //Auth related things + "leaderboard_minutes" => "Minute(s)", + // Auth related things + "joined_at" => "Joined", + "gift_coins" => "Gift coins", + "gift_coins_2" => "Gift user coins!", + "gift_coins_3" => "Remember, once you send a user coins, you cannot take this action back! Please do not open a ticket to get your coins back! We won't help you!!!", "discord_oath2_link_failed" => "We are sorry but we don't provide support for discord link right now", "discord_oath2_no_acc_found" => "No accounts were found under this discord account.", "login_please_no_alts" => "Using multiple accounts is really sad when using free services!", "login_please_no_vpn" => "Hmmm it looks like you are trying to abuse. You are trying to use a VPN, which is not allowed.", "login_banned" => "We are sorry but you are banned from using our system!", "login_mail_server_not_setup" => "We are sorry but we have no mail server by default", - "login_erorr_unknown" => "We are sorry but we do not know what happened there was an internal system error!.", + "login_error_unknown" => "We are sorry but we do not know what happened there was an internal system error!", "csrf_failed" => "CSRF Verification Failed", "forgot_password_info" => "Enter your email and we'll send you instructions to reset your password", "welcome_to" => "Welcome to", @@ -86,10 +115,111 @@ "login_invalid_password" => "Invalid password", "login_please_use" => "Please only use characters from A-Z in your", "username_or_email_exists" => "Username or email already exists. Please choose a different one", - "please_fill_in_all_required_info" => "please fill in all the required info", + "please_fill_in_all_required_info" => "Please fill in all the required info", "register_subtitle" => "Please create an account and embark on your adventure!", "terms_agree" => "I agree to the", "register_have_an_account" => "Already have an account?", "close" => "Close", + "updated_user_info_in_db" => "We updated the user settings in the database", + "pterodactyl_failed_to_update_info" => "Failed to update the user settings inside the panel", + "error_not_found_in_database" => "Sorry but I cant find this inside the database", + "error_while_drop_database" => "Failed to delete this from the database please logout!", + "linked_accounts" => "Linked accounts", + "linked_accounts_2" => "Here you can link your accounts so you won't have to worry about using a password or a email to login!", + "linked_accounts_not_connected" => "Not connected!", + "linked_accounts_disabled" => "Disabled by the host", + "avatar" => "Avatar", + "list" => "List", + "table_id" => "ID", + "ticket" => "Ticket", + "code" => "Code", + "getaway" => "Getaway", + "status" => "Status", + "ticket_deleted" => "We are sorry, but this ticket is archived. You can't access it anymore!", + "no_data_found_in_this_table" => "We are sorry but we did not find any data in this table!", + "buy_again" => "Buy again", + "input_not_valid" => "Please enter an valid value", + "you_cant_send_coins_to_yourself" => "Hey??? You cannot send coins to yourself!", + // Ticket related stuff + "reopen_ticket" => "Reopen ticket", + "delete_ticket" => "Delete ticket", + "export_ticket" => "Export ticket", + "reply_ticket" => "Reply", + "reply_ticket_2" => "Reply to the user inside the ticket!", + "close_ticket" => "Close Ticket", + "ticket_open_msg_1" => "Hi, and welcome to", + "ticket_open_msg_2" => "This is an automated message + from the + system to inform you that your ticket is now open.
Please do not spam any + staff member by any chance; this will not help you get support, and please + be respectful and make sure you read our terms of service and our rules. +
If you feel like you need help quickly, make sure to join our community", + "ticket_subject" => "Ticket Subject:", + "ticket_status" => "Ticket Status: ", + "ticket_priority" => "Ticket Priority:", + "ticket_message" => "Message", + "ticket_attachment" => "Attachment", + "ticket_new" => "Create a new ticket", + "you_not_paid_for_this" => "Sorry but you did not pay for this!", + "already_claimed" => "The user already got his coins!", + "payment_request_cancel" => "We canceled the payment code", + "code_not_valid" => "This code is not valid", + "stripe_title" => "Buy Coins Using Stripe", + "stripe_subtitle" => "

Welcome to our billing system. Here you can buy coins, so you can use them inside our dashboard

The prices are '%PLACEHOLDER_1%' in %PLACEHOLDER_2% for 1 coin

", + "server_active" => "We've updated your server settings. Your server will now skip the next purge.", + "server_not_own" => "Sorry but you don't own this server!", + "server_deleted" => "Done, we deleted your server!", + "server_no_longer_in_wait_list" => "Your server is no longer in queue!", + "server_no_changes_made" => "No changes made.", + "server_minimum_is" => "Minimum %PLACEHOLDER_1% is %PLACEHOLDER_2%", + "server_you_not_have" => "You don't have enough %PLACEHOLDER_1%", + "server_updated" => "Done we updated your server settings!", + "server" => "Server", + "invalid_field" => "Some fields are empty or invalid.", + "server_location_does_not_exist" => "That location does not exist in our database!", + "server_egg_does_not_exist" => "That egg does not exist in our database!", + "server_created" => "Done, thanks for using %PLACEHOLDER_1%", + "name" => "Name", + "location" => "Location", + "slots" => "slots", + "egg" => "Egg", + "server_no_nodes" => "No nodes are available at the moment; Server creation might currently be disabled.", + "401_title" => "Not Authorized", + "401_subtitle" => "You are not authorized!", + "401_description" => "You do not have permission to view this page using the credentials that you have provided while login.
Please contact your site administrator.", + "404_title" => "Not found", + "404_subtitle" => "Page Not Found :(", + "404_description" => "Oops! 😖 The requested URL was not found on this server.", + "maintenance_subtitle" => "Under Maintenance!", + "maintenance_description" => "Sorry for the inconvenience but we're performing some maintenance at the moment", + "adblocker_subtitle" => "Please disable your Adblock!", + "adblocker_description" => "You do not have permission to view this page. It is really sad when you try to use an Adblock on a free host!", + "afk_text" => "For every minute you idle here, you get one coin. With those coins that you earn, you can purchase things from the shop.", + "you_currently_have" => "You currently have", + "afk_text_2" => "You have been idling for", + "afk_text_3" => "You will get more coins in", + "second" => "second(s)", + "link" => "Link", + "ready" => "Ready", + "linkvertise" => "Please click the continue button to continue", + "continue" => "Continue", + "redeem" => "Redeem", + "redeem_title" => "Redeem a coupon code", + "redeem_subtitle" => "Please enter the coupon code you would like to redeem below!", + "copyright" => "Copyright", + "made_with_love_by" => "made with ❤️ by", + "new_ticket_title" => "Create a new ticket", + "go" => "Go", + "new_ticket_subtitle" => "In order to be able to create a ticket, we need some information!", + "subject" => "Subject", + "priority" => "Priority", + "select" => "Select", + "low" => "Low", + "medium" => "Medium", + "high" => "High", + "description" => "Description", + "notification" => "Notification", + "view_all_notification" => "View all notifications", + "logout" => "Logout", ]; ?> \ No newline at end of file diff --git a/logs/README b/logs/README deleted file mode 100644 index 843926e6..00000000 --- a/logs/README +++ /dev/null @@ -1,2 +0,0 @@ -!!DO NOT DELETE THIS!! -This folder is required for the webserver to save the error logs \ No newline at end of file diff --git a/migrate/56.sql b/migrate/56.sql new file mode 100644 index 00000000..f2351be0 --- /dev/null +++ b/migrate/56.sql @@ -0,0 +1 @@ +ALTER TABLE `mythicaldash_settings` ADD `landingpage` ENUM('true','false') NOT NULL DEFAULT 'true' AFTER `show_snow`; \ No newline at end of file diff --git a/migrate/57.sql b/migrate/57.sql new file mode 100644 index 00000000..f9007192 --- /dev/null +++ b/migrate/57.sql @@ -0,0 +1,13 @@ +ALTER TABLE `mythicaldash_settings` + DROP `FEEDBACK_1_NAME`, + DROP `FEEDBACK_1_ROLE`, + DROP `FEEDBACK_1_AVATAR`, + DROP `FEEDBACK_1_DESCRIPTION`, + DROP `FEEDBACK_2_NAME`, + DROP `FEEDBACK_2_ROLE`, + DROP `FEEDBACK_2_AVATAR`, + DROP `FEEDBACK_2_DESCRIPTION`, + DROP `FEEDBACK_3_NAME`, + DROP `FEEDBACK_3_ROLE`, + DROP `FEEDBACK_3_AVATAR`, + DROP `FEEDBACK_3_DESCRIPTION`; \ No newline at end of file diff --git a/migrate/58.sql b/migrate/58.sql new file mode 100644 index 00000000..c93c2f48 --- /dev/null +++ b/migrate/58.sql @@ -0,0 +1 @@ +ALTER TABLE `mythicaldash_locations` ADD `host` TEXT NOT NULL DEFAULT '1.1.1.1' AFTER `name`; \ No newline at end of file diff --git a/migrate/59.sql b/migrate/59.sql new file mode 100644 index 00000000..1cb21088 --- /dev/null +++ b/migrate/59.sql @@ -0,0 +1 @@ +UPDATE `mythicaldash_settings` SET `enable_stripe` = 'false' WHERE `mythicaldash_settings`.`id` = 1; diff --git a/migrate/60.sql b/migrate/60.sql new file mode 100644 index 00000000..61856997 --- /dev/null +++ b/migrate/60.sql @@ -0,0 +1 @@ +UPDATE `mythicaldash_settings` SET `linkvertise_enabled` = 'false' WHERE `mythicaldash_settings`.`id` = 1; diff --git a/migrate/61.sql b/migrate/61.sql new file mode 100644 index 00000000..2f9c84f6 --- /dev/null +++ b/migrate/61.sql @@ -0,0 +1 @@ +UPDATE `mythicaldash_settings` SET `version` = '3.1.4' WHERE `mythicaldash_settings`.`id` = 1; diff --git a/public/index.php b/public/index.php index 48c7ba4f..5ed90c67 100644 --- a/public/index.php +++ b/public/index.php @@ -41,36 +41,20 @@ $router->route(); } else { - //Default routes and static routes - include(__DIR__ . '/../routes/index.php'); - //Default api routes and static routes - include(__DIR__ . '/../routes/api/index.php'); - //Default admin routes and static routes - include(__DIR__ . '/../routes/admin/index.php'); - //Routes for /auth/ - include(__DIR__ . '/../routes/auth.php'); - //Routes for /server/ - include(__DIR__ . '/../routes/server.php'); - //Routes for /help-center/ - include(__DIR__ . '/../routes/help-center.php'); - //Routes for /user/ - include(__DIR__ . '/../routes/user.php'); - //Routes for /earn/ - include(__DIR__ . '/../routes/earn.php'); - //Routes for /admin/api/ - include(__DIR__ . '/../routes/admin/api.php'); - //Routes for /admin/servers/ - include(__DIR__ . '/../routes/admin/servers.php'); - //Routes for /admin/settings/ - include(__DIR__ . '/../routes/admin/settings.php'); - //Routes for /admin/redeem/ - include(__DIR__ . '/../routes/admin/redeem.php'); - //Routes for /admin/users/ - include(__DIR__ . '/../routes/admin/users.php'); - //Routes for /admin/eggs/ - include(__DIR__ . '/../routes/admin/eggs.php'); - //Routes for /admin/locations/ - include(__DIR__ . '/../routes/admin/locations.php'); + $routesViewDirectory = __DIR__ . '/../routes/'; + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($routesViewDirectory)); + $phpViewFiles = new RegexIterator($iterator, '/\.php$/'); + + foreach ($phpViewFiles as $phpViewFile) { + try { + http_response_code(200); + include $phpViewFile->getPathname(); + } catch (Exception $ex) { + http_response_code(500); + ErrorHandler::ShowCritical('Failed to start app: ' . $ex->getMessage()); + } + } + $addonsManager->processAddonRoutes($router); $router->add("/(.*)", function () { diff --git a/public/ping.php b/public/ping.php new file mode 100644 index 00000000..fd3cec96 --- /dev/null +++ b/public/ping.php @@ -0,0 +1,10 @@ + $ping]); +} + +?> \ No newline at end of file diff --git a/routes/admin/settings.php b/routes/admin/settings.php index 5b54f24a..2f2baf9e 100644 --- a/routes/admin/settings.php +++ b/routes/admin/settings.php @@ -29,6 +29,11 @@ require("../view/admin/settings/recaptcha.php"); }); +$router->add("/admin/settings/landingpage", function () { + require("../include/main.php"); + require("../view/admin/settings/landingpage.php"); +}); + $router->add("/admin/settings/ads", function () { require("../include/main.php"); require("../view/admin/settings/ads.php"); diff --git a/routes/index.php b/routes/index.php index 30e5f9fe..dac6f8af 100644 --- a/routes/index.php +++ b/routes/index.php @@ -14,26 +14,47 @@ $router->add('/', function() { + require("../include/main.php"); + if (SettingsManager::getSetting("landingpage") == "false") { + if (isset($_GET['e'])) { + header('location: /dashboard?e='. $_GET['e']); + } else if (isset($_GET['s'])) { + header('location: /dashboard?s='. $_GET['s']); + } else { + header('location: /dashboard'); + } + } if (isset($_GET['e'])) { header('location: /dashboard?e='. $_GET['e']); } else if (isset($_GET['s'])) { header('location: /dashboard?s='. $_GET['s']); } else { $template = file_get_contents('../templates/landing/index.html'); - $placeholders = array('%APP_LOGO%', '%APP_NAME%', '%APP_URL%', '%APP_BG%', '%SEO_TITLE%','%SEO_DESCRIPTION%','%SEO_IMAGE%','%SEO_KEYWORDS%','%DISCORD_INVITE%',"%LANDING_DESCRIPTION%",'%LANDING_SUPPORT_EMAIL%','%FEEDBACK_1_NAME%' ,'%FEEDBACK_1_ROLE%' ,'%FEEDBACK_1_AVATAR%' ,'%FEEDBACK_1_DESCRIPTION%', '%FEEDBACK_2_NAME%', '%FEEDBACK_2_ROLE%', '%FEEDBACK_2_AVATAR%', '%FEEDBACK_2_DESCRIPTION%' ,'%FEEDBACK_3_NAME%' ,'%FEEDBACK_3_ROLE%' ,'%FEEDBACK_3_AVATAR%' ,'%FEEDBACK_3_DESCRIPTION%'); - $values = array(SettingsManager::getSetting("logo"),SettingsManager::getSetting("name"),Main::getAppUrl(),SettingsManager::getSetting("bg"),SettingsManager::getSetting("name"),SettingsManager::getSetting("seo_description"),SettingsManager::getSetting("logo"),SettingsManager::getSetting("seo_keywords"),SettingsManager::getSetting("discord_invite"),SettingsManager::getSetting("seo_description"),SettingsManager::getSetting("fromEmail"), - SettingsManager::getSetting("FEEDBACK_1_NAME"), - SettingsManager::getSetting("FEEDBACK_1_ROLE"), - SettingsManager::getSetting("FEEDBACK_1_AVATAR"), - SettingsManager::getSetting("FEEDBACK_1_DESCRIPTION"), - SettingsManager::getSetting("FEEDBACK_2_NAME"), - SettingsManager::getSetting("FEEDBACK_2_ROLE"), - SettingsManager::getSetting("FEEDBACK_2_AVATAR"), - SettingsManager::getSetting("FEEDBACK_2_DESCRIPTION"), - SettingsManager::getSetting("FEEDBACK_3_NAME"), - SettingsManager::getSetting("FEEDBACK_3_ROLE"), - SettingsManager::getSetting("FEEDBACK_3_AVATAR"), - SettingsManager::getSetting("FEEDBACK_3_DESCRIPTION")); + $placeholders = array( + '%APP_LOGO%', + '%APP_NAME%', + '%APP_URL%', + '%APP_BG%', + '%SEO_TITLE%', + '%SEO_DESCRIPTION%', + '%SEO_IMAGE%', + '%SEO_KEYWORDS%', + '%DISCORD_INVITE%', + "%LANDING_DESCRIPTION%", + '%LANDING_SUPPORT_EMAIL%' + ); + $values = array( + SettingsManager::getSetting("logo"), + SettingsManager::getSetting("name"), + Main::getAppUrl(), + SettingsManager::getSetting("bg"), + SettingsManager::getSetting("name"), + SettingsManager::getSetting("seo_description"), + SettingsManager::getSetting("logo"), + SettingsManager::getSetting("seo_keywords"), + SettingsManager::getSetting("discord_invite"), + SettingsManager::getSetting("seo_description"), + SettingsManager::getSetting("fromEmail"),); $templateView = str_replace($placeholders, $values, $template); die($templateView); } diff --git a/templates/landing/index.html b/templates/landing/index.html index 295bec9f..6591f0a9 100644 --- a/templates/landing/index.html +++ b/templates/landing/index.html @@ -38,7 +38,7 @@ %APP_NAME% | Home - + @@ -217,12 +217,12 @@

- %FEEDBACK_1_NAME%
-

%FEEDBACK_1_DESCRIPTION% 

+

Change this into /templates/landing/index.html!!! 

%FEEDBACK_1_NAME% @@ -234,12 +234,12 @@

- %FEEDBACK_2_NAME%
-

%FEEDBACK_2_DESCRIPTION% 

+

Change this into /templates/landing/index.html!!! 

%FEEDBACK_2_NAME% @@ -252,12 +252,12 @@

- %FEEDBACK_3_NAME%
-

%FEEDBACK_3_DESCRIPTION% 

+

Change this into /templates/landing/index.html!!! 

%FEEDBACK_3_NAME% @@ -335,7 +335,7 @@
  • Client Area
  • -
  • Status Page
  • Discord Server
  • diff --git a/view/admin/locations/main.php b/view/admin/locations/main.php index ae336732..1917f8fa 100644 --- a/view/admin/locations/main.php +++ b/view/admin/locations/main.php @@ -73,7 +73,7 @@ class="btn btn-primary float-end">Add a new Location Name - Status + Host Location id Slots Action @@ -85,7 +85,7 @@ class="btn btn-primary float-end">Add a new Location while ($row = $result->fetch_assoc()) { echo ""; echo "" . $row['name'] . ""; - echo "" . $row['status'] . ""; + echo "" . $row['host'] . ""; echo "" . $row['locationid'] . ""; echo "" . $row['slots'] . ""; echo " Delete"; diff --git a/view/admin/settings/general.php b/view/admin/settings/general.php index 94ea507d..1e08714b 100644 --- a/view/admin/settings/general.php +++ b/view/admin/settings/general.php @@ -8,18 +8,13 @@ $logo = mysqli_real_escape_string($conn, $_GET['app:logo']); $snow = mysqli_real_escape_string($conn, $_GET['app:snow']); $bg = mysqli_real_escape_string($conn, $_GET['app:bg']); - + $langg = mysqli_real_escape_string($conn, $_GET['app:lang']); mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `name` = '" . $name . "' WHERE `mythicaldash_settings`.`id` = 1;"); mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `logo` = '" . $logo . "' WHERE `mythicaldash_settings`.`id` = 1;"); mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `show_snow` = '" . $snow . "' WHERE `mythicaldash_settings`.`id` = 1;"); mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `bg` = '" . $bg . "' WHERE `mythicaldash_settings`.`id` = 1;"); - - - if ($snow == "false") { - header('location: /admin/settings?e=Well it looks like you are grinch!'); - } else { - header('location: /admin/settings?s=We updated the settings inside the database'); - } + mysqli_query($conn, "UPDATE `mythicaldash_settings` SET `lang` = '" . $langg . "' WHERE `mythicaldash_settings`.`id` = 1;"); + header('location: /admin/settings?s=We updated the settings inside the database'); $conn->close(); die(); } else { diff --git a/view/admin/settings/landingpage.php b/view/admin/settings/landingpage.php new file mode 100644 index 00000000..df3ca190 --- /dev/null +++ b/view/admin/settings/landingpage.php @@ -0,0 +1,21 @@ +close(); + die (); + } else { + header('location: /admin/settings?e=Failed to update the settings inside the database'); + die(); + } +} catch (Exception $ex) { + ErrorHandler::Critical("Failed to update settings ",$ex); + header('location: /admin/settings?e=Failed to update the settings inside the database'.$ex->getMessage()); + die (); +} +?> \ No newline at end of file diff --git a/view/admin/settings/main.php b/view/admin/settings/main.php index c06c2c28..cc1f2b34 100644 --- a/view/admin/settings/main.php +++ b/view/admin/settings/main.php @@ -1,8 +1,8 @@ @@ -14,9 +14,9 @@ - + - <?= SettingsManager::getSetting("name") ?> - Settings + <?= SettingsManager::getSetting('name') ?> - Settings @@ -26,22 +26,22 @@
    - +
    - +

    Admin / Settings

    - + + if (isset($_GET['sqlr'])) { + ?>
    General
    @@ -52,42 +52,50 @@
    -
    +
    " + value="" placeholder="MythicalSystems">
    +
    " autofocus=""> + value="" autofocus="">
    " autofocus=""> + value="" autofocus="">
    -
    + +
    + + +
    +
    + if (SettingsManager::getSetting('show_snow') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -116,14 +124,14 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save " + value="" placeholder="MythicalSystems">
    " autofocus=""> + value="" autofocus="">
    @@ -153,14 +161,14 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save " + value="" placeholder="https://panel.example.com">
    " + value="" autofocus="">
    @@ -181,7 +189,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save href="https://stripe.com/docs/currencies#presentment-currencies">Here you can find a list).


    @@ -197,22 +205,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_stripe') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -221,7 +229,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">
    @@ -229,7 +237,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">
    @@ -237,7 +245,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">
    @@ -245,7 +253,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">

    @@ -285,63 +293,63 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_discord_link') == 'true') { + ?> + } else if (SettingsManager::getSetting('enable_discord_link') == 'false') { + ?> + } else { + ?> + } + ?>
    " + value="" placeholder="000000000000">
    " + value="" placeholder="MythicalSystems">
    "> + value="">
    " + value="" placeholder="000000000000">
    "> + value="">
    @@ -367,89 +375,89 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save " + value="" placeholder="15">
    " + value="" placeholder="1024">
    " + value="" placeholder="1024">
    " placeholder="100"> + value="" placeholder="100">
    " + value="" placeholder="2">
    " placeholder="2"> + value="" placeholder="2">
    " placeholder="2"> + value="" placeholder="2">
    " + value="" placeholder="2">
    + if (SettingsManager::getSetting('enable_afk') == 'true') { + ?> + } else if (SettingsManager::getSetting('enable_afk') == 'false') { + ?> + } else { + ?> + } + ?>
    " + value="" placeholder="2">
    @@ -477,46 +485,46 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    " + value="" placeholder="400">
    " + value="" placeholder="300">
    " + value="" placeholder="450">
    " + value="" placeholder="1200">
    " + value="" placeholder="900">
    " + value="" placeholder="150">
    " + value="" placeholder="200">
    @@ -544,22 +552,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_smtp') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -567,36 +575,36 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('smtpSecure') == 'ssl') { + ?> + } else if (SettingsManager::getSetting('smtpSecure') == 'tls') { + ?> + } else { + ?> + } + ?>
    "> + value="">

    Enter the SMTP server address that mail should be sent through.

    @@ -605,7 +613,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">

    Enter the SMTP server port that mail should be sent through.

    @@ -615,7 +623,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save class="field-optional">
    "> + value="">

    The username to use when connecting to the SMTP server.

    @@ -625,7 +633,7 @@ class="field-optional"> class="field-optional">
    " + value="" class="form-control" name="mail:password">

    The password to use in conjunction with the SMTP username. @@ -637,7 +645,7 @@ class="form-control" name="mail:password"> class="field-optional">

    "> + value="">

    The email address where you send emails from.

    @@ -671,22 +679,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_turnstile') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -695,7 +703,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">
    @@ -703,7 +711,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">
    @@ -734,22 +742,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_ads') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -759,7 +767,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + value="">

    @@ -790,22 +798,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('linkvertise_enabled') == 'true') { + ?> + } else { + ?> + } + ?>

    @@ -813,14 +821,14 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    "> + value="">
    "> + value="">

    @@ -853,22 +861,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('customcss_enabled') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -878,7 +886,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + value="">
    @@ -907,22 +915,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('customhead_enabled') == 'true') { + ?> + } else { + ?> + } + ?>
    @@ -932,7 +940,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + value="">
    @@ -964,7 +972,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + value="">
    @@ -992,22 +1000,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_adblocker_detection') == 'true') { + ?> + } else { + ?> + } + ?>

    @@ -1015,22 +1023,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_anti_vpn') == 'true') { + ?> + } else { + ?> + } + ?>

    @@ -1038,22 +1046,22 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('enable_alting') == 'true') { + ?> + } else { + ?> + } + ?>

    @@ -1086,7 +1094,7 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + value="">
    @@ -1114,28 +1122,28 @@ class="btn btn-primary me-2 waves-effect waves-light" value="true">Save
    + if (SettingsManager::getSetting('server_purge') == 'true') { + ?> + } else { + ?> + } + ?>
    + if (SettingsManager::getSetting('server_purge') == 'true') { + ?>

    +
    +
    Landing Page
    +
    +
    +

    +
    +
    +
    +
    +
    +
    + +
    + + + + + +
    +
    + + +
    +
    +
    + + Cancel +
    +
    +
    +
    Developer Options
    @@ -1247,14 +1300,14 @@ functions work or how to use them! If you want to continue, please press
    - +
    - + diff --git a/view/auth/forgot-password.php b/view/auth/forgot-password.php index 0f97dffc..e9bee404 100644 --- a/view/auth/forgot-password.php +++ b/view/auth/forgot-password.php @@ -225,7 +225,7 @@ } } catch (Exception $e) { ErrorHandler::Critical("Failed to update settings ", $e); - $error_message = $lang['login_erorr_unknown']; + $error_message = $lang['login_error_unknown']; header("location: /auth/forgot-password?error=" . urlencode($error_message)); die(); } @@ -239,12 +239,12 @@ die(); } } else { - header("location: /auth/forgot-password?e=".$lang['login_erorr_unknown']); + header("location: /auth/forgot-password?e=".$lang['login_error_unknown']); die(); } } } catch (Exception $e) { - header("location: /auth/forgot-password?e=".$lang['login_erorr_unknown']); + header("location: /auth/forgot-password?e=".$lang['login_error_unknown']); ErrorHandler::Error("Forgot-Password ", $e); die(); } @@ -259,7 +259,7 @@ - <?= SettingsManager::getSetting("name") ?> - <?= $lang['forgot_passowrd']?> + <?= SettingsManager::getSetting("name") ?> - <?= $lang['forgot_password']?> @@ -289,7 +289,7 @@
    -

    ? 🔒

    +

    ? 🔒

    ".$e->getMessage().""); die(); } ?> @@ -173,7 +173,7 @@ class="platform-bg" data-app-light-img="illustrations/bg-shape-image-light.png" ?>
    - +
    diff --git a/view/auth/logout.php b/view/auth/logout.php index a6cbff21..1bcc498c 100644 --- a/view/auth/logout.php +++ b/view/auth/logout.php @@ -12,7 +12,7 @@ } header('location: /auth/login'); } catch (Exception $e) { - header("location: /auth/login?e=".$lang['login_erorr_unknown']); + header("location: /auth/login?e=".$lang['login_error_unknown']); ErrorHandler::Error("Logout ", $e); die(); } diff --git a/view/auth/register.php b/view/auth/register.php index 4980b86e..30cc1e9a 100644 --- a/view/auth/register.php +++ b/view/auth/register.php @@ -1,6 +1,9 @@ 0) { - $aquery = "SELECT * FROM mythicaldash_login_logs WHERE ipaddr = '" . mysqli_real_escape_string($conn,$session->getIP()) . "'"; + $aquery = "SELECT * FROM mythicaldash_login_logs WHERE ipaddr = '" . mysqli_real_escape_string($conn, $session->getIP()) . "'"; $aresult = mysqli_query($conn, $aquery); $acount = mysqli_num_rows($aresult); if (SettingsManager::getSetting("enable_alting") == "true") { if ($acount >= 1) { - header('location: /auth/register?e='.$lang['login_please_no_alts']); + header('location: /auth/register?e=' . $lang['login_please_no_alts']); die(); } } @@ -82,101 +85,28 @@ } if (SettingsManager::getSetting("enable_anti_vpn") == "true") { if ($vpn == true) { - header('location: /auth/register?e='.$lang['login_please_no_vpn']); + header('location: /auth/register?e=' . $lang['login_please_no_vpn']); die(); } } - $pterodactyl_url = SettingsManager::getSetting("PterodactylURL"); - $pterodactyl_api = SettingsManager::getSetting("PterodactylAPIKey"); - - $panelapi = curl_init($pterodactyl_url . "/api/application/users"); - $headers = array( - 'Accept: application/json', - 'Content-Type: application/json', - 'Authorization: Bearer ' . $pterodactyl_api - ); - $postfields = array( - 'username' => $username, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'email' => $email, - 'password' => $upassword - ); - curl_setopt($panelapi, CURLOPT_HTTPHEADER, $headers); - curl_setopt($panelapi, CURLOPT_POST, 1); - curl_setopt($panelapi, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($panelapi, CURLOPT_POSTFIELDS, json_encode($postfields)); - $result = curl_exec($panelapi); - curl_close($panelapi); - $result = json_decode($result, true); - $panel_id = null; - - if (!isset($result['object'])) { - $error = $result['errors'][0]['detail']; - if ($error == "The email has already been taken.") { - $ch = curl_init($pterodactyl_url . "/api/application/users?filter%5Bemail%5D=$email"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $pterodactyl_api, - 'Content-Type: application/json', - 'Accept: application/json' - ) - ); - $result12 = curl_exec($ch); - curl_close($ch); - $result13 = json_decode($result12, true); - if (!isset($result13['object'])) { - header("location: /auth/login?e=".$lang['login_erorr_unknown']); - $conn->close(); - die(); - } - $panel_id = $result13['data'][0]['attributes']['id']; - $ch = curl_init($pterodactyl_url . "/api/application/users/$panel_id"); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH"); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - 'Authorization: Bearer ' . $pterodactyl_api, - 'Content-Type: application/json', - 'Accept: application/json' - ) - ); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( - array( - 'username' => $username, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'email' => $email, - 'password' => $upassword, - 'language' => 'en' - ) - )); - $updateUserResult = curl_exec($ch); - curl_close($ch); - $updateUserResult = json_decode($updateUserResult, true); - if (!isset($updateUserResult['object'])) { - header('location: /auth/login?e='.$lang['login_erorr_unknown']); - $conn->close(); - die(); - } + if (Connection::checkConnection()) { + $pterodactyl = User::Create($first_name, $last_name, $username, $email, $upassword); + if (is_numeric($pterodactyl)) { + $panel_id = $pterodactyl; } else { - header("location: /auth/login?e=".$lang['login_erorr_unknown']); + header('location: /auth/register?e=' . $pterodactyl); + $conn->close(); die(); } - - } else { - $panel_id = $result['attributes']['id']; - } - - $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); - if (file_exists("FIRST_USER")) { - $role = "Administrator"; - } else { - $role = "User"; - } - $conn->query("INSERT INTO `mythicaldash_users` + $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); + if (file_exists("FIRST_USER")) { + $role = "Administrator"; + } else { + $role = "User"; + } + $conn->query("INSERT INTO `mythicaldash_users` (`panel_id`, `email`, `username`, @@ -196,60 +126,66 @@ `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()) . "' + '" . 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"); + $conn->close(); + if (file_exists("FIRST_USER")) { + unlink("FIRST_USER"); + } + Telemetry::NewUser(); + header('location: /auth/login'); + die(); + } else { + header('location: /auth/register?e=' . $lang['pterodactyl_connection_error']); + $conn->close(); + die(); } - Telemetry::NewUser(); - header('location: /auth/login'); - die(); + } else { - header('location: /auth/register?e='.$lang['username_or_email_exists']); + header('location: /auth/register?e=' . $lang['username_or_email_exists']); $conn->close(); die(); } } else { - header('location: /auth/register?e='.$lang['please_fill_in_all_required_info']); + header('location: /auth/register?e=' . $lang['please_fill_in_all_required_info']); $conn->close(); die(); } } else { - header("location: /auth/register?e=".$lang['login_erorr_unknown']); + header("location: /auth/register?e=" . $lang['login_error_unknown']); $conn->close(); die(); } } else { - header("location: /auth/register?e=".$lang['captcha_failed']); + header("location: /auth/register?e=" . $lang['captcha_failed']); $conn->close(); die(); } } } else { // CSRF validation failed - header('location: /auth/register?e='.$lang['csrf_failed']); + header('location: /auth/register?e=' . $lang['csrf_failed']); } } } catch (Exception $e) { - header("location: /auth/register?e=".$lang['login_erorr_unknown']); + header("location: /auth/register?e=" . $lang['login_error_unknown']."
    ".$e->getMessage().""); ErrorHandler::Error("Register ", $e); die(); } @@ -264,17 +200,18 @@ content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /> - <?= SettingsManager::getSetting("name") ?> - <?= $lang['register']?> + <?= SettingsManager::getSetting("name") ?> - + <?= $lang['register'] ?> - +
    @@ -294,33 +231,46 @@
    -

    +

    + !

    -

    +

    + +

    - +
    - +
    - +
    - +
    - +
    @@ -350,7 +304,9 @@ class="text-primary" data-bs-toggle="modal" data-bs-target="#pp"> input('register-form'); ?> - +

    - + + + - + + +

    @@ -378,15 +338,21 @@ class="text-primary" data-bs-toggle="modal" data-bs-target="#pp">
    -

    +

    + +

    + class="btn btn-primary me-sm-3 me-1"> + + + aria-label="Close"> + +
    @@ -398,15 +364,21 @@ class="btn btn-primary me-sm-3 me-1"> diff --git a/view/components/footer.php b/view/components/footer.php index 759c8a19..23f0848d 100644 --- a/view/components/footer.php +++ b/view/components/footer.php @@ -8,16 +8,16 @@ class="footer-container d-flex align-items-center justify-content-between py-2 flex-md-row flex-column" >
    - Copyright © 2019 - + © 2019 - - made with ❤️ by MythicalSystems theme by Roido + MythicalSystems
    " target="_blank" class="footer-link me-4">Pterodactyl - Terms of Service - Privacy Policy + +
    diff --git a/view/components/modals.php b/view/components/modals.php index 632d85d6..e34ddd30 100644 --- a/view/components/modals.php +++ b/view/components/modals.php @@ -5,36 +5,36 @@ @@ -153,8 +157,8 @@ class="dropdown-item d-flex justify-content-center text-primary p-2 h-px-40 mb-1 \ No newline at end of file diff --git a/view/components/sidebar.php b/view/components/sidebar.php index 72e5af29..a9b010cf 100644 --- a/view/components/sidebar.php +++ b/view/components/sidebar.php @@ -25,31 +25,31 @@ function is_active_page($page_urls)