From d47baafea327e5f61ff03d874fb8370b2fda43bb Mon Sep 17 00:00:00 2001 From: Galster-dev <46283010+Galster-dev@users.noreply.github.com> Date: Thu, 23 Jun 2022 21:01:49 +0300 Subject: [PATCH] fix code style --- acceptGJFriendRequest20.php | 2 +- accounts/accountManagement.php | 2 +- accounts/backupGJAccount.php | 102 +- accounts/loginGJAccount.php | 60 +- accounts/registerGJAccount.php | 49 +- accounts/syncGJAccount.php | 2 +- accounts/syncGJAccount20.php | 49 +- blockGJUser20.php | 2 +- config/connection.php | 2 +- config/dailyChests.php | 5 +- config/discord.php | 2 +- config/reuploadAcc.php | 6 +- config/security.php | 7 +- config/topArtists.php | 8 +- dashboard/account/unlisted.php | 27 +- dashboard/errors/404.php | 3 +- dashboard/errors/418.php | 3 +- dashboard/incl/dashboardLib.php | 301 ++-- dashboard/incl/lang/localeCS.php | 8 +- dashboard/incl/lang/localeDE.php | 8 +- dashboard/incl/lang/localeEE.php | 8 +- dashboard/incl/lang/localeEN.php | 8 +- dashboard/incl/lang/localeEO.php | 10 +- dashboard/incl/lang/localeES.php | 10 +- dashboard/incl/lang/localeGR.php | 8 +- dashboard/incl/lang/localeHR.php | 8 +- dashboard/incl/lang/localeID.php | 6 +- dashboard/incl/lang/localeIT.php | 8 +- dashboard/incl/lang/localePT.php | 8 +- dashboard/incl/lang/localeRU.php | 12 +- dashboard/incl/lang/localeTH.php | 8 +- dashboard/incl/lang/localeTR.php | 6 +- dashboard/index.php | 72 +- dashboard/lang/switchLang.php | 23 +- dashboard/login/login.php | 62 +- dashboard/login/logout.php | 6 +- dashboard/reupload/songAdd.php | 28 +- dashboard/stats/dailyTable.php | 50 +- dashboard/stats/gauntletTable.php | 52 +- dashboard/stats/modActions.php | 40 +- dashboard/stats/modActionsList.php | 94 +- dashboard/stats/packTable.php | 46 +- database/accounts/backupGJAccountNew.php | 2 +- database/accounts/syncGJAccountNew.php | 2 +- deleteGJAccComment20.php | 2 +- deleteGJComment20.php | 2 +- deleteGJFriendRequests20.php | 2 +- deleteGJLevelUser20.php | 2 +- deleteGJMessages20.php | 2 +- downloadGJLevel.php | 2 +- downloadGJLevel19.php | 2 +- downloadGJLevel20.php | 2 +- downloadGJLevel21.php | 2 +- downloadGJLevel22.php | 2 +- downloadGJMessage20.php | 2 +- getAccountURL.php | 2 +- getGJAccountComments20.php | 2 +- getGJChallenges.php | 2 +- getGJCommentHistory.php | 2 +- getGJComments.php | 2 +- getGJComments19.php | 2 +- getGJComments20.php | 2 +- getGJComments21.php | 2 +- getGJCreators.php | 2 +- getGJCreators19.php | 2 +- getGJDailyLevel.php | 2 +- getGJFriendRequests20.php | 2 +- getGJGauntlets.php | 2 +- getGJGauntlets21.php | 2 +- getGJLevelScores.php | 2 +- getGJLevelScores211.php | 2 +- getGJLevels.php | 2 +- getGJLevels19.php | 2 +- getGJLevels20.php | 2 +- getGJLevels21.php | 2 +- getGJMapPacks.php | 2 +- getGJMapPacks20.php | 2 +- getGJMapPacks21.php | 2 +- getGJMessages20.php | 2 +- getGJRewards.php | 2 +- getGJScores.php | 2 +- getGJScores19.php | 2 +- getGJScores20.php | 2 +- getGJSongInfo.php | 2 +- getGJTopArtists.php | 2 +- getGJUserInfo20.php | 2 +- getGJUserList20.php | 2 +- getGJUsers20.php | 2 +- incl/comments/deleteGJAccComment.php | 15 +- incl/comments/deleteGJComment.php | 19 +- incl/comments/getGJAccountComments.php | 16 +- incl/comments/getGJComments.php | 92 +- incl/comments/uploadGJAccComment.php | 22 +- incl/comments/uploadGJComment.php | 50 +- incl/levelpacks/getGJGauntlets.php | 10 +- incl/levelpacks/getGJMapPacks.php | 16 +- incl/levels/deleteGJLevelUser.php | 10 +- incl/levels/downloadGJLevel.php | 209 +-- incl/levels/getGJDailyLevel.php | 18 +- incl/levels/getGJLevels.php | 398 ++--- incl/levels/rateGJDemon.php | 54 +- incl/levels/rateGJStars.php | 9 +- incl/levels/reportGJLevel.php | 28 +- incl/levels/suggestGJStars.php | 22 +- incl/levels/updateGJDesc.php | 29 +- incl/levels/uploadGJLevel.php | 82 +- incl/lib/Captcha.php | 54 +- incl/lib/GJPCheck.php | 98 +- incl/lib/XORCipher.php | 38 +- incl/lib/commands.php | 548 +++---- incl/lib/connection.php | 13 +- incl/lib/exploitPatch.php | 35 +- incl/lib/generateHash.php | 138 +- incl/lib/generatePass.php | 142 +- incl/lib/ip_in_range.php | 47 +- incl/lib/mainLib.php | 1416 +++++++++-------- incl/lib/songReup.php | 22 +- incl/messages/deleteGJMessages.php | 30 +- incl/messages/downloadGJMessage.php | 22 +- incl/messages/getGJMessages.php | 46 +- incl/messages/uploadGJMessage.php | 6 +- incl/misc/getAccountURL.php | 3 +- incl/misc/getGJSongInfo.php | 160 +- incl/misc/getTopArtists.php | 96 +- incl/misc/likeGJItem.php | 47 +- incl/mods/requestUserAccess.php | 14 +- incl/profiles/getGJUserInfo.php | 163 +- incl/profiles/getGJUsers.php | 10 +- incl/profiles/updateGJAccSettings.php | 2 +- incl/relationships/acceptGJFriendRequest.php | 10 +- incl/relationships/blockGJUser.php | 12 +- incl/relationships/deleteGJFriendRequests.php | 15 +- incl/relationships/getGJFriendRequests.php | 63 +- incl/relationships/getGJUserList.php | 74 +- incl/relationships/readGJFriendRequest.php | 7 +- incl/relationships/removeGJFriend.php | 8 +- incl/relationships/unblockGJUser.php | 8 +- incl/relationships/uploadFriendRequest.php | 20 +- incl/rewards/getGJChallenges.php | 20 +- incl/rewards/getGJRewards.php | 47 +- incl/scores/getGJCreators.php | 18 +- incl/scores/getGJLevelScores.php | 116 +- incl/scores/getGJScores.php | 192 +-- incl/scores/updateGJUserScore.php | 16 +- likeGJItem.php | 2 +- likeGJItem19.php | 2 +- likeGJItem20.php | 2 +- likeGJItem21.php | 2 +- likeGJItem211.php | 2 +- rateGJDemon21.php | 2 +- rateGJStars20.php | 2 +- rateGJStars211.php | 2 +- readGJFriendRequest20.php | 2 +- removeGJFriend20.php | 2 +- reportGJLevel.php | 2 +- requestUserAccess.php | 2 +- suggestGJStars20.php | 2 +- tools/account/activateAccount.php | 42 +- tools/account/changePassword.php | 68 +- tools/account/changeUsername.php | 37 +- tools/account/registerAccount.php | 90 +- tools/addQuests.php | 62 +- tools/bot/dailyLevelBot.php | 78 +- tools/bot/discordLinkReq.php | 22 +- tools/bot/discordLinkResetPass.php | 12 +- tools/bot/discordLinkTransferRoles.php | 20 +- tools/bot/discordLinkUnlink.php | 22 +- tools/bot/latestSongBot.php | 4 +- tools/bot/leaderboardsBot.php | 140 +- tools/bot/levelSearchBot.php | 78 +- tools/bot/modActionsBot.php | 46 +- tools/bot/playerStatsBot.php | 136 +- tools/bot/songAddBot.php | 20 +- tools/bot/songListBot.php | 16 +- tools/bot/songSearchBot.php | 24 +- tools/bot/userLevelSearchBot.php | 18 +- tools/bot/whoRatedBot.php | 20 +- tools/cleanup/deleteUnused.php | 30 +- tools/cron/autoban.php | 12 +- tools/cron/cron.php | 4 +- tools/cron/fixcps.php | 128 +- tools/cron/fixnames.php | 7 +- tools/cron/friendsLeaderboard.php | 26 +- tools/cron/removeBlankLevels.php | 38 +- tools/cron/songsCount.php | 2 +- tools/index.php | 19 +- tools/leaderboardsBan.php | 62 +- tools/leaderboardsUnban.php | 62 +- tools/levelReupload.php | 239 +-- tools/levelToGD.php | 209 +-- tools/linkAcc.php | 130 +- tools/packCreate.php | 172 +- tools/revertLikes.php | 70 +- tools/songAdd.php | 38 +- tools/stats/dailyTable.php | 46 +- tools/stats/modActions.php | 185 ++- tools/stats/noLogIn.php | 30 +- tools/stats/packTable.php | 150 +- tools/stats/reportList.php | 6 +- tools/stats/songList.php | 60 +- tools/stats/stats.php | 83 +- tools/stats/suggestList.php | 58 +- tools/stats/top24h.php | 6 +- tools/stats/unlisted.php | 52 +- tools/stats/vipList.php | 22 +- unblockGJUser20.php | 2 +- updateGJAccSettings20.php | 2 +- updateGJDesc20.php | 2 +- updateGJUserScore.php | 2 +- updateGJUserScore19.php | 2 +- updateGJUserScore20.php | 2 +- updateGJUserScore21.php | 2 +- updateGJUserScore22.php | 2 +- uploadFriendRequest20.php | 2 +- uploadGJAccComment20.php | 2 +- uploadGJComment.php | 2 +- uploadGJComment19.php | 2 +- uploadGJComment20.php | 2 +- uploadGJComment21.php | 2 +- uploadGJLevel.php | 2 +- uploadGJLevel19.php | 2 +- uploadGJLevel20.php | 2 +- uploadGJLevel21.php | 2 +- uploadGJMessage20.php | 2 +- 224 files changed, 4628 insertions(+), 4525 deletions(-) diff --git a/acceptGJFriendRequest20.php b/acceptGJFriendRequest20.php index 8dad437ae..e2a449fbf 100644 --- a/acceptGJFriendRequest20.php +++ b/acceptGJFriendRequest20.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/accounts/accountManagement.php b/accounts/accountManagement.php index 017fe4c01..a6aa16e7f 100644 --- a/accounts/accountManagement.php +++ b/accounts/accountManagement.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/accounts/backupGJAccount.php b/accounts/backupGJAccount.php index 536d8ace1..3b374a92a 100644 --- a/accounts/backupGJAccount.php +++ b/accounts/backupGJAccount.php @@ -1,9 +1,10 @@ 14",$saveData)[1]; - $orbs = explode("",$orbs)[0]; - $lvls = explode("GS_value",$saveData)[1]; - $lvls = explode("4",$lvls)[1]; - $lvls = explode("",$lvls)[0]; - $protected_key_encoded = ""; - //if($cloudSaveEncryption == 0){ - $saveData = str_replace("GJA_002".$password."", "GJA_002password", $saveData); //replacing pass - //file_put_contents($userName, $saveData); - $saveData = gzencode($saveData); //encoding back - $saveData = base64_encode($saveData); - $saveData = str_replace("+","-",$saveData); - $saveData = str_replace("/","_",$saveData); - $saveData = $saveData . ";" . $saveDataArr[1]; //merging ccgamemanager and cclocallevels - /*}else if($cloudSaveEncryption == 1){ - $saveData = ExploitPatch::remove($_POST["saveData"]); - $protected_key = KeyProtectedByPassword::createRandomPasswordProtectedKey($password); - $protected_key_encoded = $protected_key->saveToAsciiSafeString(); - $user_key = $protected_key->unlockKey($password); - $saveData = Crypto::encrypt($saveData, $user_key); - }*/ - //$query = $db->prepare("UPDATE `accounts` SET `saveData` = :saveData WHERE userName = :userName"); - //$query->execute([':saveData' => $saveData, ':userName' => $userName]); - $query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName"); - $query->execute([':userName' => $userName]); - $accountID = $query->fetchColumn(); - if(!is_numeric($accountID)){ - exit("-1"); - } - file_put_contents("../data/accounts/$accountID",$saveData); - file_put_contents("../data/accounts/keys/$accountID",""); - $query = $db->prepare("SELECT extID FROM users WHERE userName = :userName LIMIT 1"); - $query->execute([':userName' => $userName]); - $result = $query->fetchAll(); - $result = $result[0]; - $extID = $result["extID"]; - $query = $db->prepare("UPDATE `users` SET `orbs` = :orbs, `completedLvls` = :lvls WHERE extID = :extID"); - $query->execute([':orbs' => $orbs, ':extID' => $extID, ':lvls' => $lvls]); - echo "1"; + $saveDataArr = explode(";", $saveData); //splitting ccgamemanager and cclocallevels + $saveData = str_replace("-", "+", $saveDataArr[0]); //decoding + $saveData = str_replace("_", "/", $saveData); + $saveData = base64_decode($saveData); + $saveData = gzdecode($saveData); + $orbs = explode("14", $saveData)[1]; + $orbs = explode("", $orbs)[0]; + $lvls = explode("GS_value", $saveData)[1]; + $lvls = explode("4", $lvls)[1]; + $lvls = explode("", $lvls)[0]; + $protected_key_encoded = ""; + //if($cloudSaveEncryption == 0){ + $saveData = str_replace("GJA_002".$password."", "GJA_002password", $saveData); //replacing pass + //file_put_contents($userName, $saveData); + $saveData = gzencode($saveData); //encoding back + $saveData = base64_encode($saveData); + $saveData = str_replace("+", "-", $saveData); + $saveData = str_replace("/", "_", $saveData); + $saveData = $saveData . ";" . $saveDataArr[1]; //merging ccgamemanager and cclocallevels + /*}else if($cloudSaveEncryption == 1){ + $saveData = ExploitPatch::remove($_POST["saveData"]); + $protected_key = KeyProtectedByPassword::createRandomPasswordProtectedKey($password); + $protected_key_encoded = $protected_key->saveToAsciiSafeString(); + $user_key = $protected_key->unlockKey($password); + $saveData = Crypto::encrypt($saveData, $user_key); + }*/ + //$query = $db->prepare("UPDATE `accounts` SET `saveData` = :saveData WHERE userName = :userName"); + //$query->execute([':saveData' => $saveData, ':userName' => $userName]); + $query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName"); + $query->execute([':userName' => $userName]); + $accountID = $query->fetchColumn(); + if (!is_numeric($accountID)) { + exit("-1"); + } + file_put_contents("../data/accounts/$accountID", $saveData); + file_put_contents("../data/accounts/keys/$accountID", ""); + $query = $db->prepare("SELECT extID FROM users WHERE userName = :userName LIMIT 1"); + $query->execute([':userName' => $userName]); + $result = $query->fetchAll(); + $result = $result[0]; + $extID = $result["extID"]; + $query = $db->prepare("UPDATE `users` SET `orbs` = :orbs, `completedLvls` = :lvls WHERE extID = :extID"); + $query->execute([':orbs' => $orbs, ':extID' => $extID, ':lvls' => $lvls]); + echo "1"; +} else { + echo -1; } -else -{ - echo -1; -} -?> \ No newline at end of file diff --git a/accounts/loginGJAccount.php b/accounts/loginGJAccount.php index b8f57a552..a73f21054 100644 --- a/accounts/loginGJAccount.php +++ b/accounts/loginGJAccount.php @@ -1,4 +1,5 @@ prepare("SELECT accountID FROM accounts WHERE userName LIKE :userName"); $query->execute([':userName' => $userName]); -if($query->rowCount() == 0){ - exit("-1"); +if ($query->rowCount() == 0) { + exit("-1"); } $id = $query->fetchColumn(); //rate limiting @@ -21,40 +22,39 @@ /*$query6 = $db->prepare("SELECT count(*) FROM actions WHERE type = '1' AND timestamp > :time AND value2 = :ip"); $query6->execute([':time' => $newtime, ':ip' => $ip]); if($query6->fetchColumn() > 5){ - exit("-12"); + exit("-12"); }*/ //authenticating $pass = GeneratePass::isValidUsrname($userName, $password); if ($pass == 1) { //success - //userID - $query2 = $db->prepare("SELECT userID FROM users WHERE extID = :id"); + //userID + $query2 = $db->prepare("SELECT userID FROM users WHERE extID = :id"); - $query2->execute([':id' => $id]); - if ($query2->rowCount() > 0) { - $userID = $query2->fetchColumn(); - } else { - $query = $db->prepare("INSERT INTO users (isRegistered, extID, userName) + $query2->execute([':id' => $id]); + if ($query2->rowCount() > 0) { + $userID = $query2->fetchColumn(); + } else { + $query = $db->prepare("INSERT INTO users (isRegistered, extID, userName) VALUES (1, :id, :userName)"); - $query->execute([':id' => $id, ':userName' => $userName]); - $userID = $db->lastInsertId(); - } - //logging - $query6 = $db->prepare("INSERT INTO actions (type, value, timestamp, value2) VALUES + $query->execute([':id' => $id, ':userName' => $userName]); + $userID = $db->lastInsertId(); + } + //logging + $query6 = $db->prepare("INSERT INTO actions (type, value, timestamp, value2) VALUES ('2',:username,:time,:ip)"); - $query6->execute([':username' => $userName, ':time' => time(), ':ip' => $ip]); - //result - echo $id.",".$userID; - if(!is_numeric($udid)){ - $query2 = $db->prepare("SELECT userID FROM users WHERE extID = :udid"); - $query2->execute([':udid' => $udid]); - $usrid2 = $query2->fetchColumn(); - $query2 = $db->prepare("UPDATE levels SET userID = :userID, extID = :extID WHERE userID = :usrid2"); - $query2->execute([':userID' => $userID, ':extID' => $id, ':usrid2' => $usrid2]); - } -}elseif ($pass == -1){ //failure - echo -12; -}else{ - echo -1; + $query6->execute([':username' => $userName, ':time' => time(), ':ip' => $ip]); + //result + echo $id.",".$userID; + if (!is_numeric($udid)) { + $query2 = $db->prepare("SELECT userID FROM users WHERE extID = :udid"); + $query2->execute([':udid' => $udid]); + $usrid2 = $query2->fetchColumn(); + $query2 = $db->prepare("UPDATE levels SET userID = :userID, extID = :extID WHERE userID = :usrid2"); + $query2->execute([':userID' => $userID, ':extID' => $id, ':usrid2' => $usrid2]); + } +} elseif ($pass == -1) { //failure + echo -12; +} else { + echo -1; } -?> \ No newline at end of file diff --git a/accounts/registerGJAccount.php b/accounts/registerGJAccount.php index 79d391d85..f322baa54 100644 --- a/accounts/registerGJAccount.php +++ b/accounts/registerGJAccount.php @@ -1,33 +1,34 @@ 20) - exit("-4"); - //checking if name is taken - $query2 = $db->prepare("SELECT count(*) FROM accounts WHERE userName LIKE :userName"); - $query2->execute([':userName' => $userName]); - $regusrs = $query2->fetchColumn(); - if ($regusrs > 0) { - echo "-2"; - }else{ - $hashpass = password_hash($password, PASSWORD_DEFAULT); - $query = $db->prepare("INSERT INTO accounts (userName, password, email, registerDate, isActive) +if ($_POST["userName"] != "") { + //here im getting all the data + $userName = ExploitPatch::remove($_POST["userName"]); + $password = ExploitPatch::remove($_POST["password"]); + $email = ExploitPatch::remove($_POST["email"]); + $secret = ""; + //checking if username is within the GD length limit + if (strlen($userName) > 20) { + exit("-4"); + } + //checking if name is taken + $query2 = $db->prepare("SELECT count(*) FROM accounts WHERE userName LIKE :userName"); + $query2->execute([':userName' => $userName]); + $regusrs = $query2->fetchColumn(); + if ($regusrs > 0) { + echo "-2"; + } else { + $hashpass = password_hash($password, PASSWORD_DEFAULT); + $query = $db->prepare("INSERT INTO accounts (userName, password, email, registerDate, isActive) VALUES (:userName, :password, :email, :time, :isActive)"); - $query->execute([':userName' => $userName, ':password' => $hashpass, ':email' => $email, ':time' => time(), ':isActive' => $preactivateAccounts ? 1 : 0]); - echo "1"; - } + $query->execute([':userName' => $userName, ':password' => $hashpass, ':email' => $email, ':time' => time(), ':isActive' => $preactivateAccounts ? 1 : 0]); + echo "1"; + } } -?> \ No newline at end of file diff --git a/accounts/syncGJAccount.php b/accounts/syncGJAccount.php index 3b46d01b9..724c4565c 100644 --- a/accounts/syncGJAccount.php +++ b/accounts/syncGJAccount.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/accounts/syncGJAccount20.php b/accounts/syncGJAccount20.php index 34aedc29c..b6b64d260 100644 --- a/accounts/syncGJAccount20.php +++ b/accounts/syncGJAccount20.php @@ -1,4 +1,5 @@ prepare("SELECT accountID FROM accounts WHERE userName = :userName"); - $query->execute([':userName' => $userName]); - $accountID = $query->fetchColumn(); - if(!is_numeric($accountID) || !file_exists("../data/accounts/$accountID")){ - exit("-1"); - }else{ - $saveData = file_get_contents("../data/accounts/$accountID"); - if(file_exists("../data/accounts/keys/$accountID") && substr($saveData,0,3) != "H4s"){ - $protected_key_encoded = file_get_contents("../data/accounts/keys/$accountID"); - $protected_key = KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); - $user_key = $protected_key->unlockKey($password); - try { - $saveData = Crypto::decrypt($saveData, $user_key); - file_put_contents("../data/accounts/$accountID",$saveData); - file_put_contents("../data/accounts/keys/$accountID",""); - } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) { - exit("-3"); - } - } - } - echo $saveData.";21;30;a;a"; -}else{ - echo -2; + $query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName"); + $query->execute([':userName' => $userName]); + $accountID = $query->fetchColumn(); + if (!is_numeric($accountID) || !file_exists("../data/accounts/$accountID")) { + exit("-1"); + } else { + $saveData = file_get_contents("../data/accounts/$accountID"); + if (file_exists("../data/accounts/keys/$accountID") && substr($saveData, 0, 3) != "H4s") { + $protected_key_encoded = file_get_contents("../data/accounts/keys/$accountID"); + $protected_key = KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); + $user_key = $protected_key->unlockKey($password); + try { + $saveData = Crypto::decrypt($saveData, $user_key); + file_put_contents("../data/accounts/$accountID", $saveData); + file_put_contents("../data/accounts/keys/$accountID", ""); + } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) { + exit("-3"); + } + } + } + echo $saveData.";21;30;a;a"; +} else { + echo -2; } -?> \ No newline at end of file diff --git a/blockGJUser20.php b/blockGJUser20.php index 503ca626e..ec9f49c89 100644 --- a/blockGJUser20.php +++ b/blockGJUser20.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/config/connection.php b/config/connection.php index 54ddd0784..54c84240c 100644 --- a/config/connection.php +++ b/config/connection.php @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/config/dailyChests.php b/config/dailyChests.php index d696a50fd..8da8993d8 100644 --- a/config/dailyChests.php +++ b/config/dailyChests.php @@ -1,10 +1,10 @@ diff --git a/config/discord.php b/config/discord.php index ba141f7cc..868824e4a 100644 --- a/config/discord.php +++ b/config/discord.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/config/reuploadAcc.php b/config/reuploadAcc.php index 9c81db1d4..09eba430d 100644 --- a/config/reuploadAcc.php +++ b/config/reuploadAcc.php @@ -1,12 +1,12 @@ diff --git a/config/security.php b/config/security.php index c366af826..9fc520fca 100644 --- a/config/security.php +++ b/config/security.php @@ -1,12 +1,13 @@ diff --git a/dashboard/account/unlisted.php b/dashboard/account/unlisted.php index f04e75d2d..d52897c8e 100644 --- a/dashboard/account/unlisted.php +++ b/dashboard/account/unlisted.php @@ -1,4 +1,5 @@ 0){ - $page = ($_GET["page"] - 1) * 10; - $actualpage = $_GET["page"]; -}else{ - $page = 0; - $actualpage = 1; +if (isset($_GET["page"]) and is_numeric($_GET["page"]) and $_GET["page"] > 0) { + $page = ($_GET["page"] - 1) * 10; + $actualpage = $_GET["page"]; +} else { + $page = 0; + $actualpage = 1; } $table = ' @@ -31,8 +32,8 @@ $query = $db->prepare("SELECT levelID, levelName, starStars, coins FROM levels WHERE extID=:extID AND unlisted=1 ORDER BY levelID DESC LIMIT 10 OFFSET $page"); $query->execute([":extID" => $_SESSION["accountID"]]); $result = $query->fetchAll(); -foreach($result as &$level){ - $table .= " +foreach ($result as &$level) { + $table .= " @@ -41,7 +42,7 @@ } $table .= "
".$level["levelID"]." ".$level["levelName"]." ".$level["starStars"]."
"; /* - bottom row + bottom row */ //getting count $query = $db->prepare("SELECT count(*) FROM levels WHERE extID=:extID AND unlisted=1"); @@ -49,4 +50,4 @@ $packcount = $query->fetchColumn(); $pagecount = ceil($packcount / 10); $bottomrow = $dl->generateBottomRow($pagecount, $actualpage); -$dl->printPage($table . $bottomrow, true, "browse"); \ No newline at end of file +$dl->printPage($table . $bottomrow, true, "browse"); diff --git a/dashboard/errors/404.php b/dashboard/errors/404.php index 493f57e9c..3b3044511 100644 --- a/dashboard/errors/404.php +++ b/dashboard/errors/404.php @@ -1,4 +1,5 @@ printBox("-1", "", true); \ No newline at end of file +$dl->printBox("-1", "", true); diff --git a/dashboard/errors/418.php b/dashboard/errors/418.php index b4ff4ab6c..0e330e0f6 100644 --- a/dashboard/errors/418.php +++ b/dashboard/errors/418.php @@ -1,4 +1,5 @@ printBox("

Error 418

image by Tygrysek", "", true); \ No newline at end of file +$dl->printBox("

Error 418

image by Tygrysek", "", true); diff --git a/dashboard/incl/dashboardLib.php b/dashboard/incl/dashboardLib.php index 799064fe5..fa5a2e11e 100644 --- a/dashboard/incl/dashboardLib.php +++ b/dashboard/incl/dashboardLib.php @@ -1,15 +1,18 @@ handleLangStart(); - echo ' + +class dashboardLib +{ + public function printHeader($isSubdirectory = true) + { + $this->handleLangStart(); + echo ' '; - if($isSubdirectory){ - echo ''; - } - echo ' + if ($isSubdirectory) { + echo ''; + } + echo ' @@ -18,64 +21,72 @@ public function printHeader($isSubdirectory = true){ [Beta] GDPS Dashboard '; - echo ' + echo ' '; - } - public function printBoxBody(){ - echo '
+ } + public function printBoxBody() + { + echo '
'; - } - public function printBox($content, $active = "", $isSubdirectory = true){ - $this->printHeader($isSubdirectory); - $this->printNavbar($active); - $this->printBoxBody(); - echo "$content"; - $this->printBoxFooter(); - $this->printFooter(); - } - public function printBoxFooter(){ - echo '
'; - } - public function printFooter(){ - echo ' + } + public function printBox($content, $active = "", $isSubdirectory = true) + { + $this->printHeader($isSubdirectory); + $this->printNavbar($active); + $this->printBoxBody(); + echo "$content"; + $this->printBoxFooter(); + $this->printFooter(); + } + public function printBoxFooter() + { + echo '
'; + } + public function printFooter() + { + echo ' '; - } - public function printLoginBox($content){ - $this->printBox("

Login

".$content); - } - public function printLoginBoxInvalid(){ - $this->printLoginBox("

Invalid username or password. Click here to try again."); - } - public function printLoginBoxError($content){ - $this->printLoginBox("

An error has occured: $content. Click here to try again."); - } - public function printNavbar($active){ - require_once __DIR__."/../../incl/lib/mainLib.php"; - $gs = new mainLib(); - $homeActive = ""; - $accountActive = ""; - $modActive = ""; - $reuploadActive = ""; - $statsActive = ""; - switch($active){ - case "home": - $homeActive = "active"; - break; - case "account": - $accountActive = "active"; - break; - case "mod": - $modActive = "active"; - break; - case "reupload": - $reuploadActive = "active"; - break; - case "stats": - $statsActive = "active"; - break; - } - echo '