From da793ee33490f741bf75ec2a6ae3505abe9684b5 Mon Sep 17 00:00:00 2001 From: Git Date: Mon, 13 Feb 2012 08:00:23 +0000 Subject: [PATCH] Empty commit --- classes/class_torrent_form.php | 5 +++++ classes/config.template | 2 +- gazelle.sql | 18 ++++++++++++++++++ sections/forums/index.php | 16 +++++++++++++++- sections/forums/main.php | 1 + sections/tools/managers/forum_list.php | 11 +++++++++++ sections/torrents/details.php | 2 +- sections/user/linkedfunctions.php | 2 +- 8 files changed, 53 insertions(+), 4 deletions(-) diff --git a/classes/class_torrent_form.php b/classes/class_torrent_form.php index 960f9354..73811a14 100644 --- a/classes/class_torrent_form.php +++ b/classes/class_torrent_form.php @@ -196,6 +196,7 @@ function music_form($GenreTags) { $Artists) { foreach($Artists as $Artist) { ?> @@ -208,6 +209,10 @@ function music_form($GenreTags) { + + [+] [-] +
'Personal', 1=>'Theme', 2=>'Genre introduction', 3=>'Discography', 4=>'Label', 5=>'Staff picks', 6=>'Charts'); $ReleaseTypes = array(1=>'Album', 3=>'Soundtrack', 5=>'EP', 6=>'Anthology', 7=>'Compilation', 9=>'Single', 11=>'Live album', 13=>'Remix', 14=>'Bootleg', 15=>'Interview', 16=>'Mixtape', 21=>'Unknown'); -$ForumCats = array(1=>'Site', 5=>'Community', 10=>'Help', 8=>'Music', 20=>'Trash'); +//$ForumCats = array(1=>'Site', 5=>'Community', 10=>'Help', 8=>'Music', 20=>'Trash'); //No longer needed $ZIPGroups = array( 0 => 'MP3 (VBR) - High Quality', diff --git a/gazelle.sql b/gazelle.sql index e1f51598..c046d71b 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -250,6 +250,14 @@ CREATE TABLE `forums` ( KEY `MinClassRead` (`MinClassRead`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `forums_categories` ( + `ID` tinyint(2) NOT NULL AUTO_INCREMENT, + `Name` varchar(40) NOT NULL DEFAULT '', + `Sort` int(6) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`), + KEY `Sort` (`Sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CREATE TABLE `forums_last_read_topics` ( `UserID` int(10) NOT NULL, `TopicID` int(10) NOT NULL, @@ -1562,3 +1570,13 @@ INSERT INTO tags (ID, Name, TagType, Uses, UserID) VALUES (1, 'rock', 'genre', 0 INSERT INTO schedule (NextHour, NextDay, NextBiWeekly) VALUES (0,0,0); +INSERT INTO forums_categories (ID, Sort, Name) VALUES (1,1,'Site'); + +INSERT INTO forums_categories (ID, Sort, Name) VALUES (5,5,'Community'); + +INSERT INTO forums_categories (ID, Sort, Name) VALUES (10,10,'Help'); + +INSERT INTO forums_categories (ID, Sort, Name) VALUES (8,8,'Music'); + +INSERT INTO forums_categories (ID, Sort, Name) VALUES (20,20,'Trash'); + diff --git a/sections/forums/index.php b/sections/forums/index.php index 8c8c8aed..2930de19 100644 --- a/sections/forums/index.php +++ b/sections/forums/index.php @@ -7,6 +7,19 @@ } include(SERVER_ROOT.'/sections/forums/functions.php'); + +// Replace the old hard-coded forum categories +unset($ForumCats); +$ForumCats = $Cache->get_value('forums_categories'); +if ($ForumCats === false) { + $DB->query("SELECT ID, Name FROM forums_categories"); + $ForumCats = array(); + while (list($ID, $Name) = $DB->next_record()) { + $ForumCats[$ID] = $Name; + } + $Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache. +} + //This variable contains all our lovely forum data if(!$Forums = $Cache->get_value('forums_list')) { $DB->query("SELECT @@ -29,11 +42,12 @@ t.IsLocked, t.IsSticky FROM forums AS f + JOIN forums_categories AS fc ON fc.ID = f.CategoryID LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID LEFT JOIN users_main AS um ON um.ID=f.LastPostAuthorID LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID GROUP BY f.ID - ORDER BY f.CategoryID, f.Sort"); + ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort"); $Forums = $DB->to_array('ID', MYSQLI_ASSOC, false); foreach($Forums as $ForumID => $Forum) { if(count($Forum['SpecificRules'])) { diff --git a/sections/forums/main.php b/sections/forums/main.php index adbcb77c..20d3bf2c 100644 --- a/sections/forums/main.php +++ b/sections/forums/main.php @@ -49,6 +49,7 @@ $ForumDescription = display_str($ForumDescription); if($CategoryID!=$LastCategoryID) { + $Row = 'b'; $LastCategoryID=$CategoryID; if($OpenTable) { ?> diff --git a/sections/tools/managers/forum_list.php b/sections/tools/managers/forum_list.php index bf323170..58f69982 100644 --- a/sections/tools/managers/forum_list.php +++ b/sections/tools/managers/forum_list.php @@ -21,6 +21,17 @@ function class_list($Selected=0){ $DB->query('SELECT ID, Name FROM forums ORDER BY Sort'); $ForumArray = $DB->to_array(); // used for generating the 'parent' drop down list +// Replace the old hard-coded forum categories +unset($ForumCats); +$ForumCats = $Cache->get_value('forums_categories'); +if ($ForumCats === false) { + $DB->query("SELECT ID, Name FROM forums_categories"); + $ForumCats = array(); + while (list($ID, $Name) = $DB->next_record()) { + $ForumCats[$ID] = $Name; + } + $Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache. +} $DB->query('SELECT ID, diff --git a/sections/torrents/details.php b/sections/torrents/details.php index ec0518be..dcfd8693 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -42,7 +42,7 @@ function compare($X, $Y){ } if($GroupVanityHouse){ $DisplayName.=' [Vanity House]'; - $AltName.=' [VanityHouse]'; + $AltName.=' [Vanity House]'; } if($GroupCategoryID == 1) { $DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']'; diff --git a/sections/user/linkedfunctions.php b/sections/user/linkedfunctions.php index e7ffe869..ddcdaa61 100644 --- a/sections/user/linkedfunctions.php +++ b/sections/user/linkedfunctions.php @@ -1 +1 @@ -query("SELECT 1 FROM users_main WHERE ID IN ($UserID, $TargetID)"); if ($DB->record_count() != 2) { error(403); } $DB->query("SELECT GroupID FROM users_dupes WHERE UserID = $TargetID"); list($TargetGroupID) = $DB->next_record(); $DB->query("SELECT u.GroupID, d.Comments FROM users_dupes AS u JOIN dupe_groups AS d ON d.ID = u.GroupID WHERE UserID = $UserID"); list($UserGroupID, $Comments) = $DB->next_record(); $UserInfo = user_info($UserID); $TargetInfo = user_info($TargetID); if (!$UserInfo || !$TargetInfo) { return; } if ($TargetGroupID) { if ($TargetGroupID == $UserGroupID) { return; } if ($UserGroupID) { $DB->query("UPDATE users_dupes SET GroupID = $TargetGroupID WHERE GroupID = $UserGroupID"); $DB->query("UPDATE dupe_groups SET Comments = CONCAT('".db_string($Comments)."\n\n',Comments) WHERE ID = $TargetGroupID"); $DB->query("DELETE FROM dupe_groups WHERE ID = $UserGroupID"); $GroupID = $UserGroupID; } else { $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($UserID, $TargetGroupID)"); $GroupID = $TargetGroupID; } } elseif ($UserGroupID) { $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($TargetID, $UserGroupID)"); $GroupID = $UserGroupID; } else { $DB->query("INSERT INTO dupe_groups () VALUES ()"); $GroupID = $DB->inserted_id(); $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($TargetID, $GroupID)"); $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($UserID, $GroupID)"); } $AdminComment = sqltime()." - Linked accounts updated: [user]".$UserInfo['Username']."[/user] and [user]".$TargetInfo['Username']."[/user] linked by ".$LoggedUser['Username']; $DB->query("UPDATE users_info AS i JOIN users_dupes AS d ON d.UserID = i.UserID SET i.AdminComment = CONCAT('".db_string($AdminComment)."\n\n', i.AdminComment) WHERE d.GroupID = $GroupID"); } function unlink_user($UserID) { global $DB, $LoggedUser; authorize(); if (!check_perms('users_mod')) { error(403); } if (!is_number($UserID)) { error(403); } $UserInfo = user_info($UserID); if ($UserInfo === FALSE) { return; } $AdminComment = sqltime()." - Linked accounts updated: [user]".$UserInfo['Username']."[/user] unlinked by ".$LoggedUser['Username']; $DB->query("UPDATE users_info AS i JOIN users_dupes AS d1 ON d1.UserID = i.UserID JOIN users_dupes AS d2 ON d2.GroupID = d1.GroupID SET i.AdminComment = CONCAT('".db_string($AdminComment)."\n\n', i.AdminComment) WHERE d2.UserID = $UserID"); $DB->query("DELETE FROM users_dupes WHERE UserID='$UserID'"); $DB->query("DELETE g.* FROM dupe_groups AS g LEFT JOIN users_dupes AS u ON u.GroupID = g.ID WHERE u.GroupID IS NULL"); } function delete_dupegroup($GroupID) { global $DB; authorize(); if (!check_perms('users_mod')) { error(403); } if (!is_number($GroupID)) { error(403); } $DB->query("DELETE FROM dupe_groups WHERE ID = '$GroupID'"); } function dupe_comments($GroupID, $Comments) { global $DB, $Text, $LoggedUser; authorize(); if (!check_perms('users_mod')) { error(403); } if (!is_number($GroupID)) { error(403); } $DB->query("SELECT SHA1(Comments) AS CommentHash FROM dupe_groups WHERE ID = $GroupID"); list($OldCommentHash) = $DB->next_record(); if ($OldCommentHash != sha1($Comments)) { $AdminComment = sqltime()." - Linked accounts updated: Comments updated by ".$LoggedUser['Username']; $DB->query("UPDATE dupe_groups SET Comments = '".db_string($Comments)."' WHERE ID = '$GroupID'"); $DB->query("UPDATE users_info AS i JOIN users_dupes AS d ON d.UserID = i.UserID SET i.AdminComment = CONCAT('".db_string($AdminComment)."\n\n', i.AdminComment) WHERE d.GroupID = $GroupID"); } } function user_dupes_table($UserID) { global $DB, $LoggedUser; $Text = new TEXT; if (!check_perms('users_mod')) { error(403); } if (!is_number($UserID)) { error(403); } $DB->query("SELECT d.ID, d.Comments FROM dupe_groups AS d JOIN users_dupes AS u ON u.GroupID = d.ID WHERE u.UserID = $UserID"); if (list($GroupID, $Comments) = $DB->next_record()) { $DB->query("SELECT m.ID FROM users_main AS m JOIN users_dupes AS d ON m.ID = d.UserID WHERE d.GroupID = $GroupID ORDER BY m.ID ASC"); $DupeCount = $DB->record_count(); $Dupes = $DB->to_array(); } else { $DupeCount = 0; $Dupes = array(); } ?>
Linked Account (View)
':''?> "; } } if ($DupeCount) { for ($j = $i; $j < 5; $j++) { echo ''; } ?>
\ No newline at end of file +query("SELECT 1 FROM users_main WHERE ID IN ($UserID, $TargetID)"); if ($DB->record_count() != 2) { error(403); } $DB->query("SELECT GroupID FROM users_dupes WHERE UserID = $TargetID"); list($TargetGroupID) = $DB->next_record(); $DB->query("SELECT u.GroupID, d.Comments FROM users_dupes AS u JOIN dupe_groups AS d ON d.ID = u.GroupID WHERE UserID = $UserID"); list($UserGroupID, $Comments) = $DB->next_record(); $UserInfo = user_info($UserID); $TargetInfo = user_info($TargetID); if (!$UserInfo || !$TargetInfo) { return; } if ($TargetGroupID) { if ($TargetGroupID == $UserGroupID) { return; } if ($UserGroupID) { $DB->query("UPDATE users_dupes SET GroupID = $TargetGroupID WHERE GroupID = $UserGroupID"); $DB->query("UPDATE dupe_groups SET Comments = CONCAT('".db_string($Comments)."\n\n',Comments) WHERE ID = $TargetGroupID"); $DB->query("DELETE FROM dupe_groups WHERE ID = $UserGroupID"); $GroupID = $UserGroupID; } else { $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($UserID, $TargetGroupID)"); $GroupID = $TargetGroupID; } } elseif ($UserGroupID) { $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($TargetID, $UserGroupID)"); $GroupID = $UserGroupID; } else { $DB->query("INSERT INTO dupe_groups () VALUES ()"); $GroupID = $DB->inserted_id(); $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($TargetID, $GroupID)"); $DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($UserID, $GroupID)"); } $AdminComment = sqltime()." - Linked accounts updated: [user]".$UserInfo['Username']."[/user] and [user]".$TargetInfo['Username']."[/user] linked by ".$LoggedUser['Username']; $DB->query("UPDATE users_info AS i JOIN users_dupes AS d ON d.UserID = i.UserID SET i.AdminComment = CONCAT('".db_string($AdminComment)."\n\n', i.AdminComment) WHERE d.GroupID = $GroupID"); } function unlink_user($UserID) { global $DB, $LoggedUser; authorize(); if (!check_perms('users_mod')) { error(403); } if (!is_number($UserID)) { error(403); } $UserInfo = user_info($UserID); if ($UserInfo === FALSE) { return; } $AdminComment = sqltime()." - Linked accounts updated: [user]".$UserInfo['Username']."[/user] unlinked by ".$LoggedUser['Username']; $DB->query("UPDATE users_info AS i JOIN users_dupes AS d1 ON d1.UserID = i.UserID JOIN users_dupes AS d2 ON d2.GroupID = d1.GroupID SET i.AdminComment = CONCAT('".db_string($AdminComment)."\n\n', i.AdminComment) WHERE d2.UserID = $UserID"); $DB->query("DELETE FROM users_dupes WHERE UserID='$UserID'"); $DB->query("DELETE g.* FROM dupe_groups AS g LEFT JOIN users_dupes AS u ON u.GroupID = g.ID WHERE u.GroupID IS NULL"); } function delete_dupegroup($GroupID) { global $DB; authorize(); if (!check_perms('users_mod')) { error(403); } if (!is_number($GroupID)) { error(403); } $DB->query("DELETE FROM dupe_groups WHERE ID = '$GroupID'"); } function dupe_comments($GroupID, $Comments) { global $DB, $Text, $LoggedUser; authorize(); if (!check_perms('users_mod')) { error(403); } if (!is_number($GroupID)) { error(403); } $DB->query("SELECT SHA1(Comments) AS CommentHash FROM dupe_groups WHERE ID = $GroupID"); list($OldCommentHash) = $DB->next_record(); if ($OldCommentHash != sha1($Comments)) { $AdminComment = sqltime()." - Linked accounts updated: Comments updated by ".$LoggedUser['Username']; if ($_POST['form_comment_hash'] == $OldCommentHash) { $DB->query("UPDATE dupe_groups SET Comments = '".db_string($Comments)."' WHERE ID = '$GroupID'"); } else { $DB->query("UPDATE dupe_groups SET Comments = CONCAT('".db_string($Comments)."\n\n',Comments) WHERE ID = '$GroupID'"); } $DB->query("UPDATE users_info AS i JOIN users_dupes AS d ON d.UserID = i.UserID SET i.AdminComment = CONCAT('".db_string($AdminComment)."\n\n', i.AdminComment) WHERE d.GroupID = $GroupID"); } } function user_dupes_table($UserID) { global $DB, $LoggedUser; $Text = new TEXT; if (!check_perms('users_mod')) { error(403); } if (!is_number($UserID)) { error(403); } $DB->query("SELECT d.ID, d.Comments, SHA1(d.Comments) AS CommentHash FROM dupe_groups AS d JOIN users_dupes AS u ON u.GroupID = d.ID WHERE u.UserID = $UserID"); if (list($GroupID, $Comments, $CommentHash) = $DB->next_record()) { $DB->query("SELECT m.ID FROM users_main AS m JOIN users_dupes AS d ON m.ID = d.UserID WHERE d.GroupID = $GroupID ORDER BY m.ID ASC"); $DupeCount = $DB->record_count(); $Dupes = $DB->to_array(); } else { $DupeCount = 0; $Dupes = array(); } ?>
Linked Account (View)
':''?> "; } } if ($DupeCount) { for ($j = $i; $j < 5; $j++) { echo ''; } ?>
\ No newline at end of file