diff --git a/sections/user/linkedfunctions.php b/sections/user/linkedfunctions.php index ddcdaa61..2acf57ae 100644 --- a/sections/user/linkedfunctions.php +++ b/sections/user/linkedfunctions.php @@ -1 +1,215 @@ -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 +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 ''; + } +?> + + + + + + + + + + +
+
+ diff --git a/static/styles/minimal/style.css b/static/styles/minimal/style.css index 0870f2e9..dc0f6390 100644 --- a/static/styles/minimal/style.css +++ b/static/styles/minimal/style.css @@ -482,8 +482,8 @@ ul.collage_images { } -#user .main_column td img{width:130px !important; height:130px !important} -#user .main_column td img:hover{width:300px !important; height:300px !important; margin:-75px; z-index:100} +#user .main_column td img{max-width:130px !important; max-height:130px !important} +#user .main_column td img:hover{max-width:300px !important; max-height:300px !important; width:300px !important; height:300px !important; margin:-75px; z-index:100} .collage_images{width:645px} #requests .tags{color:#656565} diff --git a/static/styles/minimal_mod_alt.css b/static/styles/minimal_mod_alt.css index ec0392ff..e19aeb85 100644 --- a/static/styles/minimal_mod_alt.css +++ b/static/styles/minimal_mod_alt.css @@ -1223,12 +1223,14 @@ ul.collage_images { } #user .main_column td img { - height: 130px!important; - width: 130px!important; + max-height: 130px!important; + max-width: 130px!important; } #user .main_column td img:hover { + max-height: 280px!important; height: 280px!important; + max-width: 280px!important; width: 280px!important; z-index: 100; margin: -75px;