diff --git a/classes/class_image_tools.php b/classes/class_image_tools.php
index e4240a94..e8eb8b32 100644
--- a/classes/class_image_tools.php
+++ b/classes/class_image_tools.php
@@ -4,6 +4,23 @@
*
**/
+ $blacklist = array("tinypic", "dsimg");
+
+ /**
+ * Checks if image host is good, otherwise displays an error.
+ */
+ function check_imagehost($url) {
+ global $blacklist;
+
+ foreach ($blacklist as &$value) {
+ if(contains(strtolower($url), $value)) {
+ $parsed_url = parse_url($url);
+ error($parsed_url['host'] . " is not an allowed imagehost. Please use a different imagehost.");
+ break;
+ }
+ }
+ }
+
/**
* The main function, called to get the thumbnail url.
*/
diff --git a/sections/artist/takeedit.php b/sections/artist/takeedit.php
index aaf0d2b8..a139e1ec 100644
--- a/sections/artist/takeedit.php
+++ b/sections/artist/takeedit.php
@@ -3,6 +3,7 @@
The page that handles the backend of the 'edit artist' function.
\*********************************************************************/
+include(SERVER_ROOT.'/classes/class_image_tools.php');
authorize();
if(!$_REQUEST['artistid'] || !is_number($_REQUEST['artistid'])) {
@@ -27,6 +28,7 @@
$Body = db_string($_POST['body']);
$Summary = db_string($_POST['summary']);
$Image = db_string($_POST['image']);
+ check_imagehost($Image);
// Trickery
if(!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
$Image = '';
@@ -55,4 +57,4 @@
// There we go, all done!
$Cache->delete_value('artist_'.$ArtistID); // Delete artist cache
header('Location: artist.php?id='.$ArtistID);
-?>
\ No newline at end of file
+?>
diff --git a/sections/collages/add_torrent.php b/sections/collages/add_torrent.php
index 73082286..ef28da15 100644
--- a/sections/collages/add_torrent.php
+++ b/sections/collages/add_torrent.php
@@ -1,4 +1,5 @@
+
authorize();
include(SERVER_ROOT.'/classes/class_validate.php');
@@ -110,6 +111,4 @@ function AddTorrent($CollageID, $GroupID) {
}
}
-header('Location: collages.php?id='.$CollageID);
-
-?>
+header('Location: collages.php?id='.$CollageID);
\ No newline at end of file
diff --git a/sections/collages/manage.php b/sections/collages/manage.php
index 493c2733..cfc78ef2 100644
--- a/sections/collages/manage.php
+++ b/sections/collages/manage.php
@@ -1,88 +1,132 @@
-
-$CollageID = $_GET['collageid'];
-if(!is_number($CollageID)) { error(0); }
+query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'");
-list($Name, $UserID, $CategoryID) = $DB->next_record();
-if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
+ $CollageID = $_GET['collageid'];
+ if(!is_number($CollageID)) { error(0); }
-$DB->query("SELECT ct.GroupID,
- ct.UserID,
- ct.Sort
- FROM collages_torrents AS ct
- JOIN torrents_group AS tg ON tg.ID=ct.GroupID
- WHERE ct.CollageID='$CollageID'
- ORDER BY ct.Sort");
+ $DB->query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'");
+ list($Name, $UserID, $CategoryID) = $DB->next_record();
+ if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
-$GroupIDs = $DB->collect('GroupID');
+ $DB->query("SELECT ct.GroupID,
+ um.ID,
+ um.Username,
+ ct.Sort
+ FROM collages_torrents AS ct
+ JOIN torrents_group AS tg ON tg.ID=ct.GroupID
+ LEFT JOIN users_main AS um ON um.ID=ct.UserID
+ WHERE ct.CollageID='$CollageID'
+ ORDER BY ct.Sort");
-$CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
-if(count($GroupIDs)>0) {
- $TorrentList = get_groups($GroupIDs);
- $TorrentList = $TorrentList['matches'];
-} else {
- $TorrentList = array();
-}
+ $GroupIDs = $DB->collect('GroupID');
+
+ $CollageDataList=$DB->to_array('GroupID', MYSQLI_ASSOC);
+ if(count($GroupIDs)>0) {
+ $TorrentList = get_groups($GroupIDs);
+ $TorrentList = $TorrentList['matches'];
+ } else {
+ $TorrentList = array();
+ }
+
+ show_header('Manage collage '.$Name);
-show_header('Manage collage '.$Name);
?>
+
+
+
+
+
+
-
-
- Sort |
- Torrent |
- User |
- Submit |
+
+ Sorting |
+
+
+
+ - Click on the headings to organize columns automatically.
+ - Sort multiple columns simultaneously by holding down the shift key and clicking other column headers.
+ - Click and drag any row to change its order.
+ - Press Save All Changes when you are finished sorting.
+ - Press Edit or Remove to simply modify one entry.
+
+
+ |
-
+
+
+
+
+
+
+
+ Order |
+ Δ |
+ Year |
+ Artist |
+ Torrent |
+ User |
+ Tweak |
+
+
+
+$Group) {
- list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group);
- list($GroupID2, $UserID, $Sort) = array_values($CollageDataList[$GroupID]);
-
-
- $Number++;
+ $Number = 0;
+ foreach ($TorrentList as $GroupID=>$Group) {
+ list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $GroupArtists, $ExtendedArtists) = array_values($Group);
+ list($GroupID2, $UserID, $Username, $Sort) = array_values($CollageDataList[$GroupID]);
- $DisplayName = $Number.' - ';
- if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
+ $Number++;
+
+ $DisplayName = '';
+ if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
- $DisplayName .= display_artists($ExtendedArtists);
- } elseif(count($GroupArtists)>0) {
- $DisplayName .= display_artists(array('1'=>$GroupArtists));
- }
- $DisplayName .= ''.$GroupName.'';
- if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
- if($GroupVanityHouse) { $DisplayName .= ' [VH]'; }
-
-?>
-
-
-
-
-}
+ $DisplayName .= display_artists($ExtendedArtists, true, false);
+ } elseif(count($GroupArtists)>0) {
+ $DisplayName .= display_artists(array('1'=>$GroupArtists), true, false);
+ }
+ $TorrentLink = ''.$GroupName.'';
+ $GroupYear = $GroupYear > 0 ? $GroupYear : '';
+ if($GroupVanityHouse) { $DisplayName .= ' [VH]'; }
+
+ $AltCSS = $Number % 2 === 0 ? 'rowa' : 'rowb';
?>
+
+
+
+
+
+
+
+
+
- show_footer() ?>
+
\ No newline at end of file
diff --git a/sections/collages/manage_handle.php b/sections/collages/manage_handle.php
index 3eda8e76..b2aff75a 100644
--- a/sections/collages/manage_handle.php
+++ b/sections/collages/manage_handle.php
@@ -1,29 +1,49 @@
-
-authorize();
+query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
-list($UserID, $CategoryID) = $DB->next_record();
-if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
+ $CollageID = $_POST['collageid'];
+ if(!is_number($CollageID)) { error(404); }
-$GroupID = $_POST['groupid'];
-if(!is_number($GroupID)) { error(404); }
+ $DB->query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
+ list($UserID, $CategoryID) = $DB->next_record();
+ if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
+ $GroupID = $_POST['groupid'];
+ if(!is_number($GroupID)) { error(404); }
-if($_POST['submit'] == 'Remove') {
- $DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
- $Rows = $DB->affected_rows();
- $DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
- $Cache->delete_value('torrents_details_'.$GroupID);
- $Cache->delete_value('torrent_collages_'.$GroupID);
- $Cache->delete_value('torrent_collages_personal_'.$GroupID);
-} else {
- $Sort = $_POST['sort'];
- if(!is_number($Sort)) { error(404); }
- $DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
-}
-$Cache->delete_value('collage_'.$CollageID);
-header('Location: collages.php?action=manage&collageid='.$CollageID);
-?>
+ if($_POST['submit'] == 'Remove') {
+ $DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
+ $Rows = $DB->affected_rows();
+ $DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
+ $Cache->delete_value('torrents_details_'.$GroupID);
+ $Cache->delete_value('torrent_collages_'.$GroupID);
+ $Cache->delete_value('torrent_collages_personal_'.$GroupID);
+ } elseif(isset($_POST['drag_drop_collage_sort_order'])) {
+
+ @parse_str($_POST['drag_drop_collage_sort_order'], $Series);
+ $Series = @array_shift($Series);
+ if(is_array($Series)){
+ $SQL = array();
+ foreach($Series as $Sort => $GroupID){
+ if(is_number($Sort) && is_number($GroupID)){
+ $Sort = ($Sort+1) * 10;
+ $SQL[] = sprintf('(%d, %d, %d)', $GroupID, $Sort, $CollageID);
+ }
+ }
+
+ $SQL = 'INSERT INTO collages_torrents (GroupID, Sort, CollageID) VALUES '
+ . implode(', ', $SQL)
+ . ' ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
+
+ $DB->query($SQL);
+ }
+
+ } else {
+ $Sort = $_POST['sort'];
+ if(!is_number($Sort)) { error(404); }
+ $DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
+ }
+
+ $Cache->delete_value('collage_'.$CollageID);
+ header('Location: collages.php?action=manage&collageid='.$CollageID);
diff --git a/sections/inbox/inbox.php b/sections/inbox/inbox.php
index 91647634..4fdcfa20 100644
--- a/sections/inbox/inbox.php
+++ b/sections/inbox/inbox.php
@@ -111,6 +111,10 @@