diff --git a/classes/script_start.php b/classes/script_start.php index 5fedae2ea..0b7c236da 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -148,8 +148,6 @@ if (isset($LoginCookie)) { list($SessionID, $LoggedUser['ID']) = explode('|~|', Crypto::decrypt($LoginCookie, ENCKEY)); $LoggedUser['ID'] = (int)$LoggedUser['ID']; - $UserID = $LoggedUser['ID']; // TODO: convert all usages of this shit to $LoggedUser['ID']. - if (!$LoggedUser['ID'] || !$SessionID) { logout($LoggedUser['ID'], $SessionID); } diff --git a/sections/ajax/announcements.php b/sections/ajax/announcements.php index 3167b7ebc..e089d14e5 100644 --- a/sections/ajax/announcements.php +++ b/sections/ajax/announcements.php @@ -15,13 +15,15 @@ if (!$News = $Cache->get_value('news')) { } if ($LoggedUser['LastReadNews'] != $News[0][0]) { - $Cache->begin_transaction("user_info_heavy_$UserID"); + $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']); $Cache->update_row(false, ['LastReadNews' => $News[0][0]]); $Cache->commit_transaction(0); - $DB->query(" + $DB->prepared_query(' UPDATE users_info - SET LastReadNews = '".$News[0][0]."' - WHERE UserID = $UserID"); + SET LastReadNews = ? + WHERE UserID = ? + ', $News[0][0], $LoggedUser['ID'] + ); $LoggedUser['LastReadNews'] = $News[0][0]; } diff --git a/sections/bookmarks/add.php b/sections/bookmarks/add.php index 17a5f0cd3..5ba48093d 100644 --- a/sections/bookmarks/add.php +++ b/sections/bookmarks/add.php @@ -60,7 +60,7 @@ if (!$DB->has_results()) { list($GroupTitle, $Year, $Body, $TagList) = $DB->next_record(); $TagList = str_replace('_', '.', $TagList); - $DB->query(' + $DB->prepared_query(' SELECT ID, Format, Encoding, HasLog, HasCue, HasLogDB, LogScore, LogChecksum, Media, Scene, FreeTorrent, UserID FROM torrents WHERE GroupID = ? diff --git a/sections/contest/admin.php b/sections/contest/admin.php index dcc02dc14..228d2d33d 100644 --- a/sections/contest/admin.php +++ b/sections/contest/admin.php @@ -225,7 +225,7 @@ if ($Contest['BonusPool']) { - + diff --git a/sections/index/private.php b/sections/index/private.php index f480cef22..357b0cb44 100644 --- a/sections/index/private.php +++ b/sections/index/private.php @@ -23,14 +23,14 @@ if (!$News = $Cache->get_value('news')) { } if (count($News) > 0 && $LoggedUser['LastReadNews'] != $News[0][0]) { - $Cache->begin_transaction("user_info_heavy_$UserID"); + $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']); $Cache->update_row(false, ['LastReadNews' => $News[0][0]]); $Cache->commit_transaction(0); $DB->prepared_query(' UPDATE users_info SET LastReadNews = ? WHERE UserID = ? - ', $News[0][0], $UserID + ', $News[0][0], $LoggedUser['ID'] ); $LoggedUser['LastReadNews'] = $News[0][0]; } diff --git a/sections/staffpm/staff_inbox.php b/sections/staffpm/staff_inbox.php index 32e56b6c1..2337bf330 100644 --- a/sections/staffpm/staff_inbox.php +++ b/sections/staffpm/staff_inbox.php @@ -160,7 +160,6 @@ if (!$DB->has_results()) { $Row = $Row === 'a' ? 'b' : 'a'; $RowClass = "row$Row"; - //$UserInfo = Users::user_info($UserID); $UserStr = Users::format_username($UserID, true, true, true, true); // Get assigned @@ -174,14 +173,12 @@ if (!$DB->has_results()) { } else { // Assigned to user - // $UserInfo = Users::user_info($AssignedToUser); $Assigned = Users::format_username($AssignedToUser, true, true, true, true); } // Get resolver if ($ViewString == 'Resolved') { - //$UserInfo = Users::user_info($ResolverID); $ResolverStr = Users::format_username($ResolverID, true, true, true, true); } diff --git a/sections/torrents/browse.php b/sections/torrents/browse.php index 86537ca67..c9c337f31 100644 --- a/sections/torrents/browse.php +++ b/sections/torrents/browse.php @@ -56,7 +56,7 @@ if (!empty($_GET['setdefault'])) { UPDATE users_info SET SiteOptions = '".db_string(serialize($SiteOptions))."' WHERE UserID = '".db_string($LoggedUser['ID'])."'"); - $Cache->begin_transaction("user_info_heavy_$UserID"); + $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']); $Cache->update_row(false, ['DefaultSearch' => $SiteOptions['DefaultSearch']]); $Cache->commit_transaction(0); @@ -73,7 +73,7 @@ if (!empty($_GET['setdefault'])) { UPDATE users_info SET SiteOptions = '".db_string(serialize($SiteOptions))."' WHERE UserID = '".db_string($LoggedUser['ID'])."'"); - $Cache->begin_transaction("user_info_heavy_$UserID"); + $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']); $Cache->update_row(false, ['DefaultSearch' => '']); $Cache->commit_transaction(0); diff --git a/sections/user/community_stats.php b/sections/user/community_stats.php index bfdbc6ee5..3e24706d9 100644 --- a/sections/user/community_stats.php +++ b/sections/user/community_stats.php @@ -1,4 +1,5 @@ get_value('user_nrcomment_' . $UserID)) === false) { $DB->prepared_query(" SELECT Page, count(*) as n diff --git a/sections/user/donor_stats.php b/sections/user/donor_stats.php index 83196ac6a..a871a55ae 100644 --- a/sections/user/donor_stats.php +++ b/sections/user/donor_stats.php @@ -1,16 +1,16 @@ +if (check_perms('users_mod') || $OwnProfile || Donations::is_visible($LoggedUser['ID'])) { ?>