From dc035fbc0db0ba737892eb15e9dbe1d8088563b7 Mon Sep 17 00:00:00 2001 From: Git Date: Sat, 25 May 2013 08:01:03 +0000 Subject: [PATCH] Empty commit --- classes/class_artists_similar.php | 27 +- classes/class_collages.php | 12 + .../class_mass_user_torrents_table_view.php | 15 +- classes/class_text2.php | 12 +- classes/class_torrent_form.php | 2 +- classes/class_votes.php | 2 +- design/privatefooter.php | 10 +- gazelle.sql | 13 + sections/artist/artist.php | 53 +- sections/better/better.php | 8 +- sections/bookmarks/torrents.php | 15 +- sections/collages/add_artist.php | 141 +++++ sections/collages/add_torrent.php | 8 +- sections/collages/artist_collage.php | 291 +++++++++ sections/collages/browse.php | 16 +- sections/collages/collage.php | 560 +---------------- sections/collages/index.php | 20 + sections/collages/manage.php | 13 +- sections/collages/manage_artists.php | 115 ++++ sections/collages/manage_artists_handle.php | 59 ++ sections/collages/manage_handle.php | 1 + sections/collages/torrent_collage.php | 561 ++++++++++++++++++ sections/donate/cancel.php | 4 +- sections/donate/complete.php | 4 +- sections/login/disabled.php | 32 +- sections/login/recover_step2.php | 6 +- sections/register/step2.php | 2 +- sections/reportsv2/ajax_new_report.php | 1 - sections/reportsv2/index.php | 3 - sections/reportsv2/views.php | 22 +- sections/rules/chat.php | 6 +- sections/rules/collages.php | 2 +- sections/rules/jump.php | 6 +- sections/rules/ratio.php | 2 +- sections/rules/requests.php | 2 +- sections/rules/rules.php | 2 +- sections/rules/tag.php | 4 +- sections/tools/managers/news.php | 12 +- sections/top10/torrents.php | 32 +- sections/torrents/browse2.php | 2 +- sections/torrents/delete.php | 6 +- sections/torrents/details.php | 2 +- sections/torrents/notify.php | 92 +-- sections/user/edit.php | 2 +- sections/user/notify_edit.php | 6 +- sections/userhistory/collage_subscribe.php | 13 +- static/styles/postmod/map.html | 4 +- templates/error.tpl | 22 +- 48 files changed, 1487 insertions(+), 758 deletions(-) create mode 100644 sections/collages/add_artist.php create mode 100644 sections/collages/artist_collage.php create mode 100644 sections/collages/manage_artists.php create mode 100644 sections/collages/manage_artists_handle.php create mode 100644 sections/collages/torrent_collage.php diff --git a/classes/class_artists_similar.php b/classes/class_artists_similar.php index d55a22f9..92acb540 100644 --- a/classes/class_artists_similar.php +++ b/classes/class_artists_similar.php @@ -73,8 +73,8 @@ function set_up() { } $this->Artists[$ArtistID] = new ARTIST($ArtistID, $Name); $this->Similar[$ArtistID] = array('ID'=>$ArtistID,'Score'=>$Score); - $this->TotalScore+=$Score; - $ArtistIDs[]=$ArtistID; + $this->TotalScore += $Score; + $ArtistIDs[] = $ArtistID; } // Get similarities between artists on the map @@ -86,9 +86,8 @@ function set_up() { JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID JOIN artists_group AS a ON a.ArtistID=s2.ArtistID - WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).") - AND s2.ArtistID IN(".implode(',',$ArtistIDs).") - "); + WHERE s1.ArtistID IN(".implode(',',$ArtistIDs).') + AND s2.ArtistID IN('.implode(',',$ArtistIDs).')'); // Build into array while (list($Artist1ID, $Artist2ID) = $DB->next_record()) { @@ -149,7 +148,7 @@ function set_positions() { // $xValues[$Minus - 30] = $Minus - 30; } - $Offset = $Offset + rand(5,20); // Increase offset, and go again + $Offset = $Offset + rand(5, 20); // Increase offset, and go again } foreach ($this->Artists as $Artist) { @@ -304,8 +303,8 @@ function scan_array_range($Array, $Start, $Finish) { function write_artists() { ?> -
- Name?> +
+ Name)?>
Artists as $Artist) { @@ -330,8 +329,8 @@ function write_artists() { $FontSize = 12; } ?> -
- Name?> +
+ Name)?>
Similar[$ArtistID]['Decimal']; $Width = ceil($Decimal * 4) + 1; - $Img->line($this->x, $this->y, $Artist->x, $Artist->y,$Img->color(199,218,255), $Width); + $Img->line($this->x, $this->y, $Artist->x, $Artist->y, $Img->color(199, 218, 255), $Width); unset($Artist->Similar[$this->ID]); reset($Artist->Similar); @@ -355,7 +354,7 @@ function background_image() { list($Artist2ID) = array_values($SimilarArtist2); if ($this->Artists[$Artist2ID]) { $Artist2 = $this->Artists[$Artist2ID]; - $Img->line($Artist->x, $Artist->y, $Artist2->x, $Artist2->y,$Img->color(173,201,255)); + $Img->line($Artist->x, $Artist->y, $Artist2->x, $Artist2->y, $Img->color(173, 201, 255)); unset($Artist2->Similar[$ArtistID]); } } @@ -371,8 +370,8 @@ function dump() { echo ' - '; echo $Artist->Name; echo "\n"; - echo "x - ".$Artist->x."\n"; - echo "y - ".$Artist->y."\n"; + echo 'x - ' . $Artist->x . "\n"; + echo 'y - ' . $Artist->y . "\n"; print_r($this->Similar[$Artist->ID]); //print_r($Artist->Similar); echo "\n\n---\n\n"; diff --git a/classes/class_collages.php b/classes/class_collages.php index 9f22e86e..4f5bf93e 100644 --- a/classes/class_collages.php +++ b/classes/class_collages.php @@ -30,4 +30,16 @@ public static function get_comment_catalogue($CollageID, $CatalogueID) { } return $Catalogue; } + + public static function increase_subscriptions($CollageID) { + global $DB; + $DB->query("UPDATE collages SET Subscribers = Subscribers + 1 WHERE ID = '$CollageID'"); + + } + + public static function decrease_subscriptions($CollageID) { + global $DB; + $DB->query("UPDATE collages SET Subscribers = IF(Subscribers < 1, 0, Subscribers - 1) WHERE ID = '$CollageID'"); + } + } \ No newline at end of file diff --git a/classes/class_mass_user_torrents_table_view.php b/classes/class_mass_user_torrents_table_view.php index 96f60546..69ab9863 100644 --- a/classes/class_mass_user_torrents_table_view.php +++ b/classes/class_mass_user_torrents_table_view.php @@ -10,8 +10,7 @@ * * It can be used for Bookmarks, Collages, or anywhere where torrents are managed. */ -class MASS_USER_TORRENTS_TABLE_VIEW -{ +class MASS_USER_TORRENTS_TABLE_VIEW { /** * Used to set text the page heading (h2 tag) * @var string $Heading @@ -147,13 +146,13 @@ public function header () { - - - - + + + + - - + + diff --git a/classes/class_text2.php b/classes/class_text2.php index 27ffda6a..2b5ad179 100644 --- a/classes/class_text2.php +++ b/classes/class_text2.php @@ -319,8 +319,8 @@ function parse($Str) { $i = $CloseTag; // 5d) Move the pointer past the end of the [/close] tag. } else { //5b) If it's a normal tag, it may have versions of itself nested inside - $CloseTag = $i-1; - $InTagPos = $i-1; + $CloseTag = $i - 1; + $InTagPos = $i - 1; $NumInOpens = 0; $NumInCloses = -1; @@ -466,7 +466,7 @@ function to_html($Array) { $Str.=''.$this->to_html($Block['Val']).""; break; case 's': - $Str.=''.$this->to_html($Block['Val']).''; + $Str.=''.$this->to_html($Block['Val']).''; break; case 'user': $Str.=''.$Block['Val'].''; @@ -478,7 +478,7 @@ function to_html($Array) { $Str.=''.$Block['Val'].''; break; case 'tex': - $Str.=''; + $Str.=''; break; case 'plain': $Str.=$Block['Val']; @@ -502,7 +502,7 @@ function to_html($Array) { if (!in_array($Block['Attr'], $ValidAttribs)) { $Str.='[align='.$Block['Attr'].']'.$this->to_html($Block['Val']).'[/align]'; } else { - $Str.='
'.$this->to_html($Block['Val']).'
'; + $Str.='
'.$this->to_html($Block['Val']).'
'; } break; case 'color': @@ -511,7 +511,7 @@ function to_html($Array) { if (!in_array($Block['Attr'], $ValidAttribs) && !preg_match('/^#[0-9a-f]{6}$/', $Block['Attr'])) { $Str.='[color='.$Block['Attr'].']'.$this->to_html($Block['Val']).'[/color]'; } else { - $Str.=''.$this->to_html($Block['Val']).''; + $Str.=''.$this->to_html($Block['Val']).''; } break; case 'inlinesize': diff --git a/classes/class_torrent_form.php b/classes/class_torrent_form.php index 7dc359ae..075abaec 100644 --- a/classes/class_torrent_form.php +++ b/classes/class_torrent_form.php @@ -472,7 +472,7 @@ function show() { NewTorrent) { ?> - + diff --git a/classes/class_votes.php b/classes/class_votes.php index 5f2cfbf1..3ac84605 100644 --- a/classes/class_votes.php +++ b/classes/class_votes.php @@ -9,7 +9,7 @@ class Votes { public static function vote_link($GroupID, $Vote = '') { global $LoggedUser; if (!$LoggedUser['NoVoteLinks'] && check_perms('site_album_votes')) { ?> - + Vote: diff --git a/design/privatefooter.php b/design/privatefooter.php index 29aeded7..e818458b 100644 --- a/design/privatefooter.php +++ b/design/privatefooter.php @@ -3,12 +3,12 @@
Order#YearArtistOrder#YearArtist TorrentBookmarkedRemoveBookmarkedRemove
Multi-format uploader:
+ + + + + + + + + + + + + + + +
 This artists is in collage1) ? 's' : '')?># artists
+ 0) { ?> @@ -792,7 +841,7 @@ function compare($X, $Y) { include(SERVER_ROOT.'/classes/class_image.php'); $Img = new IMAGE; $Img->create(WIDTH, HEIGHT); - $Img->color(255,255,255, 127); + $Img->color(255, 255, 255, 127); $Similar = new ARTISTS_SIMILAR($ArtistID, $Name); $Similar->set_up(); @@ -810,7 +859,7 @@ function compare($X, $Y) { Similar artist map Switch to cloud
-
+
write_artists(); ?> diff --git a/sections/better/better.php b/sections/better/better.php index 3a9c6c4c..84245bbd 100644 --- a/sections/better/better.php +++ b/sections/better/better.php @@ -4,15 +4,15 @@ ?>

Pursuit of Perfection

-
+

Here at What.CD, we believe that there's always room for improvement. To aid our effort in the pursuit of perfection, we've put together a few simple lists that can help you build ratio and help us improve our overall quality. Most lists feature 100 torrents at a time and update every 15 minutes.

Lists

-
+
- - + +
  • - + <?=$DisplayName?> -
    +
  • query("SELECT MAX(Sort) FROM collages_artists WHERE CollageID='$CollageID'"); + list($Sort) = $DB->next_record(); + $Sort+=10; + + $DB->query("SELECT ArtistID FROM collages_artists WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'"); + if ($DB->record_count() == 0) { + $DB->query("INSERT IGNORE INTO collages_artists + (CollageID, ArtistID, UserID, Sort, AddedOn) + VALUES + ('$CollageID', '$ArtistID', '$LoggedUser[ID]', '$Sort', NOW())"); + + $DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'"); + + $Cache->delete_value('collage_'.$CollageID); + $Cache->delete_value('artists_collages_'.$ArtistID); + $Cache->delete_value('artists_collages_personal_'.$ArtistID); + + $DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID"); + while (list($CacheUserID) = $DB->next_record()) { + $Cache->delete_value('collage_subs_user_new_'.$CacheUserID); + } + } +} + +$CollageID = $_POST['collageid']; +if (!is_number($CollageID)) { + error(404); +} +$DB->query("SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'"); +list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record(); + +if (!check_perms('site_collages_delete')) { + if ($Locked) { + $Err = "This collage is locked"; + } + if ($CategoryID == 0 && $UserID != $LoggedUser['ID']) { + $Err = "You cannot edit someone else's personal collage"; + } + if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) { + $Err = "This collage already holds its maximum allowed number of artists"; + } + + if (isset($Err)) { + error($Err); + } +} + +if ($MaxGroupsPerUser > 0) { + $DB->query("SELECT COUNT(*) FROM collages_artists WHERE CollageID='$CollageID' AND UserID='$LoggedUser[ID]'"); + list($GroupsForUser) = $DB->next_record(); + if (!check_perms('site_collages_delete') && $GroupsForUser >= $MaxGroupsPerUser) { + error(403); + } +} + +if ($_REQUEST['action'] == 'add_artist') { + $URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.preg_quote(NONSSL_SITE_URL, '/').'\/artist\.php\?(page=[0-9]+&)?id=([0-9]+)/i'; + $Val->SetFields('url', '1','regex','The URL must be a link to a artist on the site.',array('regex'=>$URLRegex)); + $Err = $Val->ValidateForm($_POST); + + if ($Err) { + error($Err); + } + + $URL = $_POST['url']; + + // Get artist ID + $URLRegex = '/artist\.php\?(page=[0-9]+&)?id=([0-9]+)/i'; + preg_match($URLRegex, $URL, $Matches); + $ArtistID = $Matches[2]; + if (!$ArtistID || (int) $ArtistID == 0) { + error(404); + } + + $DB->query("SELECT ArtistID FROM artists_group WHERE ArtistID='$ArtistID'"); + list($ArtistID) = $DB->next_record(); + if (!$ArtistID) { + error('The artist was not found in the database.'); + } + + add_artist($CollageID, $ArtistID); +} else { + $URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/artist\.php\?(page=[0-9]+&)?id=([0-9]+)/i'; + + $URLs = explode("\n",$_REQUEST['urls']); + $ArtistIDs = array(); + $Err = ''; + foreach ($URLs as $Key => &$URL) { + $URL = trim($URL); + if ($URL == '') { + unset($URLs[$Key]); + } + } + unset($URL); + + if (!check_perms('site_collages_delete')) { + if ($MaxGroups > 0 && ($NumTorrents + count($URLs) > $MaxGroups)) { + $Err = "This collage can only hold $MaxGroups artists."; + } + if ($MaxGroupsPerUser > 0 && ($GroupsForUser + count($URLs) > $MaxGroupsPerUser)) { + $Err = "You may only have $MaxGroupsPerUser artists in this collage."; + } + } + + foreach ($URLs as $URL) { + $Matches = array(); + if (preg_match($URLRegex, $URL, $Matches)) { + $ArtistIDs[] = $Matches[3]; + $ArtistID = $Matches[3]; + } else { + $Err = "One of the entered URLs ($URL) does not correspond to an artist on the site."; + break; + } + + $DB->query("SELECT ArtistID FROM artists_group WHERE ArtistID='$ArtistID'"); + if (!$DB->record_count()) { + $Err = "One of the entered URLs ($URL) does not correspond to an artist on the site."; + break; + } + } + + if ($Err) { + error($Err); + } + + foreach ($ArtistIDs as $ArtistID) { + add_artist($CollageID, $ArtistID); + } +} +header('Location: collages.php?id='.$CollageID); diff --git a/sections/collages/add_torrent.php b/sections/collages/add_torrent.php index 3d9a72ac..8b53ac5f 100644 --- a/sections/collages/add_torrent.php +++ b/sections/collages/add_torrent.php @@ -5,7 +5,7 @@ include(SERVER_ROOT.'/classes/class_validate.php'); $Val = new VALIDATE; -function AddTorrent($CollageID, $GroupID) { +function add_torrent($CollageID, $GroupID) { global $Cache, $LoggedUser, $DB; $DB->query("SELECT MAX(Sort) FROM collages_torrents WHERE CollageID='$CollageID'"); @@ -19,7 +19,7 @@ function AddTorrent($CollageID, $GroupID) { VALUES ('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())"); - $DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'"); + $DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = NOW() WHERE ID='$CollageID'"); $Cache->delete_value('collage_'.$CollageID); $Cache->delete_value('torrents_details_'.$GroupID); @@ -89,7 +89,7 @@ function AddTorrent($CollageID, $GroupID) { error('The torrent was not found in the database.'); } - AddTorrent($CollageID, $GroupID); + add_torrent($CollageID, $GroupID); } else { $URLRegex = '/^https?:\/\/(www\.|ssl\.)?'.NONSSL_SITE_URL.'\/torrents\.php\?(page=[0-9]+&)?id=([0-9]+)/i'; @@ -135,7 +135,7 @@ function AddTorrent($CollageID, $GroupID) { } foreach ($GroupIDs as $GroupID) { - AddTorrent($CollageID, $GroupID); + add_torrent($CollageID, $GroupID); } } header('Location: collages.php?id='.$CollageID); diff --git a/sections/collages/artist_collage.php b/sections/collages/artist_collage.php new file mode 100644 index 00000000..1ca1cc83 --- /dev/null +++ b/sections/collages/artist_collage.php @@ -0,0 +1,291 @@ +query("SELECT + ca.ArtistID, + ag.Name, + aw.Image, + um.ID AS UserID, + um.Username + FROM collages_artists AS ca + JOIN artists_group AS ag ON ag.ArtistID=ca.ArtistID + LEFT JOIN wiki_artists AS aw ON aw.RevisionID = ag.RevisionID + LEFT JOIN users_main AS um ON um.ID=ca.UserID + WHERE ca.CollageID='$CollageID' + ORDER BY ca.Sort"); + + +$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC); + +// Loop through the result set, building up $Collage and $TorrentTable +// Then we print them. +$Collage = array(); +$TorrentTable = ''; + +$NumArtists = 0; +$NumArtistsByUser = 0; +$Users = array(); + +foreach($Artists as $Artist) { + $UserID = $Artist['UserID']; + $Username = $Artist['Username']; + $NumArtists++; + if ($UserID == $LoggedUser['ID']) { + $NumArtistsByUser++; + } + + if ($Username) { + if (!isset($Users[$UserID])) { + $Users[$UserID] = array('name'=>$Username, 'count'=>1); + } else { + $Users[$UserID]['count']++; + } + } + + ob_start(); + ?> + + + + +
  • + + + <?=$Artist['Name']?> + + + + +
  • + 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) { + $PreventAdditions = true; +} + +// Silly hack for people who are on the old setting +$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1)); +$CollagePages = array(); + +// Pad it out +if ($NumGroups > $CollageCovers) { + for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) { + $Collage[] = '
  • '; + } +} + + +for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { + $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers); + $CollagePage = ''; + foreach ($Groups as $Group) { + $CollagePage .= $Group; + } + $CollagePages[] = $CollagePage; +} + +View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend'); + +?> +
    +
    +

    + +
    + + +
    + +
    +
    Cover art
    +
      + +
    +
    + $CollageCovers) { ?> + + + +
    MethodAdditional informationMethodAdditional information
    diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index f694f6ca..5943e4df 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -196,7 +196,7 @@ function compare($X, $Y) {
    + +
    + + + + +
    Artists
    +
    +
    +cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600); +?> diff --git a/sections/collages/browse.php b/sections/collages/browse.php index 61be33c8..b8c3331d 100644 --- a/sections/collages/browse.php +++ b/sections/collages/browse.php @@ -7,9 +7,9 @@ list($Page,$Limit) = Format::page_limit(COLLAGES_PER_PAGE); -$OrderVals = array('Time', 'Name', 'Torrents'); +$OrderVals = array('Time', 'Name', 'Subscribers', 'Torrents', 'Updated'); $WayVals = array('Ascending', 'Descending'); -$OrderTable = array('Time'=>'ID', 'Name'=>'c.Name', 'Torrents'=>'NumTorrents'); +$OrderTable = array('Time'=>'ID', 'Name'=>'c.Name', 'Subscribers'=> 'c.Subscribers', 'Torrents'=>'NumTorrents', 'Updated' => 'c.Updated'); $WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC'); // Are we searching in bodies, or just names? @@ -45,7 +45,7 @@ } $Categories = array_keys($Categories); } else { - $Categories = array(1,2,3,4,5,6); + $Categories = array(1,2,3,4,5,6,7); } // Ordering @@ -77,7 +77,9 @@ c.NumTorrents, c.TagList, c.CategoryID, - c.UserID + c.UserID, + c.Subscribers, + c.Updated FROM collages AS c $BookmarkJoin WHERE Deleted = '0'"; @@ -286,12 +288,14 @@ Category Collage Torrents + Subscribers + Updated Author format('collages.php?action=search&tags=')?>
    + + query("UPDATE users_collage_subs SET LastVisit=NOW() WHERE UserID = ".$LoggedUser['ID']." AND CollageID=$CollageID"); - -// Build the data for the collage and the torrent list -$DB->query("SELECT ct.GroupID, - tg.WikiImage, - tg.CategoryID, - um.ID, - um.Username - 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"); - -$GroupIDs = $DB->collect('GroupID'); -$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC); -if (count($GroupIDs) > 0) { - $TorrentList = Torrents::get_groups($GroupIDs); - $TorrentList = $TorrentList['matches']; +if($CollageCategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) { + include(SERVER_ROOT.'/sections/collages/artist_collage.php'); } else { - $TorrentList = array(); + include(SERVER_ROOT.'/sections/collages/torrent_collage.php'); } - -// Loop through the result set, building up $Collage and $TorrentTable -// Then we print them. -$Collage = array(); -$TorrentTable = ''; - -$NumGroups = 0; -$NumGroupsByUser = 0; -$TopArtists = array(); -$Users = array(); -$Number = 0; - -foreach ($TorrentList as $GroupID => $Group) { - extract(Torrents::array_group($Group)); - - list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]); - $TorrentTags = new Tags($TagList); - - // Handle stats and stuff - $Number++; - $NumGroups++; - if ($UserID == $LoggedUser['ID']) { - $NumGroupsByUser++; - } - - if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { - $CountArtists = array_merge((array)$ExtendedArtists[1], (array)$ExtendedArtists[4], (array)$ExtendedArtists[5], (array)$ExtendedArtists[6]); - } else { - $CountArtists = $GroupArtists; - } - - if ($CountArtists) { - foreach ($CountArtists as $Artist) { - if (!isset($TopArtists[$Artist['id']])) { - $TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1); - } else { - $TopArtists[$Artist['id']]['count']++; - } - } - } - - if ($Username) { - if (!isset($Users[$UserID])) { - $Users[$UserID] = array('name'=>$Username, 'count'=>1); - } else { - $Users[$UserID]['count']++; - } - } - - $DisplayName = $Number.' - '; - - if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) { - unset($ExtendedArtists[2]); - unset($ExtendedArtists[3]); - $DisplayName .= Artists::display_artists($ExtendedArtists); - } elseif (count($GroupArtists) > 0) { - $DisplayName .= Artists::display_artists(array('1'=>$GroupArtists)); - } - - $DisplayName .= ''.$GroupName.''; - if ($GroupYear > 0) { - $DisplayName = "$DisplayName [$GroupYear]"; - } - if ($GroupVanityHouse) { - $DisplayName .= ' [VH]'; - } - $SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : ''; - // Start an output buffer, so we can store this output in $TorrentTable - ob_start(); - - if (count($Torrents) > 1 || $GroupCategoryID == 1) { - // Grouped torrents - $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1); -?> - - -
    - -
    - - -
    - - - -
    format()?>
    - - - $Torrent) { - - if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) { - $FirstUnknown = !isset($FirstUnknown); - } - $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; - - if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear || - $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) { - $EditionID++; -?> - - - - - - - - DL - - | FL - - | RP - -   »  - - - - > - - -'.$GroupName.''; - - if ($Torrent['IsSnatched']) { - $DisplayName .= ' ' . Format::torrent_label('Snatched!'); - } - if ($Torrent['FreeTorrent'] == '1') { - $DisplayName .= ' ' . Format::torrent_label('Freeleech!'); - } elseif ($Torrent['FreeTorrent'] == '2') { - $DisplayName .= ' ' . Format::torrent_label('Neutral Leech!'); - } elseif ($Torrent['PersonalFL']) { - $DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!'); - } - $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; -?> - - - -
    -
    - - - - DL - - | FL - - | RP - - -
    format()?>
    - - - - > - - - 0) { - $DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false); - } - $DisplayName .= $GroupName; - if ($GroupYear > 0) { - $DisplayName = $DisplayName. " [$GroupYear]"; - } -?> -
  • - - - <?=$DisplayName?> - - - - -
  • - 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) { - $PreventAdditions = true; -} - -// Silly hack for people who are on the old setting -$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1)); -$CollagePages = array(); - -// Pad it out -if ($NumGroups > $CollageCovers) { - for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) { - $Collage[] = '
  • '; - } -} - - -for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { - $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers); - $CollagePage = ''; - foreach ($Groups as $Group) { - $CollagePage .= $Group; - } - $CollagePages[] = $CollagePage; -} - -View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend'); -?> -
    -
    -

    - -
    - - -
    - -
    -
    Cover art
    -
      - -
    -
    - $CollageCovers) { ?> - - - - - - - - - - - - - - -
    TorrentsSizeSnatchesSeedersLeechers
    -
    -
    -cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600); -?> diff --git a/sections/collages/index.php b/sections/collages/index.php index 487bcbfe..b894eb6e 100644 --- a/sections/collages/index.php +++ b/sections/collages/index.php @@ -1,4 +1,5 @@ query(" SELECT ct.GroupID, @@ -69,13 +68,13 @@ - - - - - + + + + + - + diff --git a/sections/collages/manage_artists.php b/sections/collages/manage_artists.php new file mode 100644 index 00000000..9986d081 --- /dev/null +++ b/sections/collages/manage_artists.php @@ -0,0 +1,115 @@ +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); +} +if($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) { + error(403); +} + +$DB->query("SELECT + ca.ArtistID, + ag.Name, + um.ID AS UserID, + um.Username, + ca.Sort + FROM collages_artists AS ca + JOIN artists_group AS ag ON ag.ArtistID=ca.ArtistID + LEFT JOIN users_main AS um ON um.ID=ca.UserID + WHERE ca.CollageID='$CollageID' + ORDER BY ca.Sort"); + +$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC); + + +View::show_header('Manage collage '.$Name); + +?> + + + + + + +
    +
    +

    Manage collage

    +
    +
    Order#Cat #YearArtistOrder#Cat #YearArtist TorrentUserUser Tweak
    + + + + +
    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#ArtistUserTweak
    + + + + + + + + +
    + + +
    + diff --git a/sections/collages/manage_artists_handle.php b/sections/collages/manage_artists_handle.php new file mode 100644 index 00000000..2ba5b979 --- /dev/null +++ b/sections/collages/manage_artists_handle.php @@ -0,0 +1,59 @@ +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); +} +if($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) { + error(403); +} + +$ArtistID = $_POST['artistid']; +if (!is_number($ArtistID)) { + error(404); +} + +if ($_POST['submit'] == 'Remove') { + $DB->query("DELETE FROM collages_artists WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'"); + $Rows = $DB->affected_rows(); + $DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'"); + $Cache->delete_value('artists_collages_'.$ArtistID); + $Cache->delete_value('artists_collages_personal_'.$ArtistID); +} 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 => $ArtistID) { + if (is_number($Sort) && is_number($ArtistID)) { + $Sort = ($Sort + 1) * 10; + $SQL[] = sprintf('(%d, %d, %d)', $ArtistID, $Sort, $CollageID); + } + } + + $SQL = 'INSERT INTO collages_artists (ArtistID, 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_artists SET Sort='$Sort' WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'"); +} + +$Cache->delete_value('collage_'.$CollageID); +header('Location: collages.php?action=manage_artists&collageid='.$CollageID); diff --git a/sections/collages/manage_handle.php b/sections/collages/manage_handle.php index 91bcf4ae..6243b002 100644 --- a/sections/collages/manage_handle.php +++ b/sections/collages/manage_handle.php @@ -13,6 +13,7 @@ error(403); } + $GroupID = $_POST['groupid']; if (!is_number($GroupID)) { error(404); diff --git a/sections/collages/torrent_collage.php b/sections/collages/torrent_collage.php new file mode 100644 index 00000000..daae53f6 --- /dev/null +++ b/sections/collages/torrent_collage.php @@ -0,0 +1,561 @@ +query("SELECT + ct.GroupID, + tg.WikiImage, + tg.CategoryID, + um.ID, + um.Username + 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"); + +$GroupIDs = $DB->collect('GroupID'); +$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC); +if (count($GroupIDs) > 0) { + $TorrentList = Torrents::get_groups($GroupIDs); + $TorrentList = $TorrentList['matches']; +} else { + $TorrentList = array(); +} + + +// Loop through the result set, building up $Collage and $TorrentTable +// Then we print them. +$Collage = array(); +$TorrentTable = ''; + +$NumGroups = 0; +$NumGroupsByUser = 0; +$TopArtists = array(); +$Users = array(); +$Number = 0; + +foreach ($TorrentList as $GroupID => $Group) { + extract(Torrents::array_group($Group)); + + list( , , , $UserID, $Username) = array_values($CollageDataList[$GroupID]); + $TorrentTags = new Tags($TagList); + + // Handle stats and stuff + $Number++; + $NumGroups++; + if ($UserID == $LoggedUser['ID']) { + $NumGroupsByUser++; + } + + if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) { + $CountArtists = array_merge((array)$ExtendedArtists[1], (array)$ExtendedArtists[4], (array)$ExtendedArtists[5], (array)$ExtendedArtists[6]); + } else { + $CountArtists = $GroupArtists; + } + + if ($CountArtists) { + foreach ($CountArtists as $Artist) { + if (!isset($TopArtists[$Artist['id']])) { + $TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1); + } else { + $TopArtists[$Artist['id']]['count']++; + } + } + } + + if ($Username) { + if (!isset($Users[$UserID])) { + $Users[$UserID] = array('name'=>$Username, 'count'=>1); + } else { + $Users[$UserID]['count']++; + } + } + + $DisplayName = $Number.' - '; + + if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) { + unset($ExtendedArtists[2]); + unset($ExtendedArtists[3]); + $DisplayName .= Artists::display_artists($ExtendedArtists); + } elseif (count($GroupArtists) > 0) { + $DisplayName .= Artists::display_artists(array('1'=>$GroupArtists)); + } + + $DisplayName .= ''.$GroupName.''; + if ($GroupYear > 0) { + $DisplayName = "$DisplayName [$GroupYear]"; + } + if ($GroupVanityHouse) { + $DisplayName .= ' [VH]'; + } + $SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : ''; + // Start an output buffer, so we can store this output in $TorrentTable + ob_start(); + + if (count($Torrents) > 1 || $GroupCategoryID == 1) { + // Grouped torrents + $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1); +?> + + +
    + +
    + + +
    + + + +
    format()?>
    + + + $Torrent) { + + if ($Torrent['Remastered'] && !$Torrent['RemasterYear']) { + $FirstUnknown = !isset($FirstUnknown); + } + $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; + + if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear || + $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) { + $EditionID++; +?> + + + + + + + + DL + + | FL + + | RP + +   »  + + + + > + + +'.$GroupName.''; + + if ($Torrent['IsSnatched']) { + $DisplayName .= ' ' . Format::torrent_label('Snatched!'); + } + if ($Torrent['FreeTorrent'] == '1') { + $DisplayName .= ' ' . Format::torrent_label('Freeleech!'); + } elseif ($Torrent['FreeTorrent'] == '2') { + $DisplayName .= ' ' . Format::torrent_label('Neutral Leech!'); + } elseif ($Torrent['PersonalFL']) { + $DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!'); + } + $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; +?> + + + +
    +
    + + + + DL + + | FL + + | RP + + +
    format()?>
    + + + + > + + + 0) { + $DisplayName .= Artists::display_artists(array('1'=>$GroupArtists), false); + } + $DisplayName .= $GroupName; + if ($GroupYear > 0) { + $DisplayName = $DisplayName. " [$GroupYear]"; + } +?> +
  • + + + <?=$DisplayName?> + + + + +
  • + 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) { + $PreventAdditions = true; +} + +// Silly hack for people who are on the old setting +$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1)); +$CollagePages = array(); + +// Pad it out +if ($NumGroups > $CollageCovers) { + for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) { + $Collage[] = '
  • '; + } +} + + +for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { + $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers); + $CollagePage = ''; + foreach ($Groups as $Group) { + $CollagePage .= $Group; + } + $CollagePages[] = $CollagePage; +} + +View::show_header($Name,'browse,collage,bbcode,voting,jquery,recommend'); +?> +
    +
    +

    + +
    + + +
    + +
    +
    Cover art
    +
      + +
    +
    + $CollageCovers) { ?> + + + + + + + + + + + + + + +
    TorrentsSizeSnatchesSeedersLeechers
    +
    +
    +cache_value('collage_'.$CollageID, array(array($Name, $Description, array(), array(), $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600); +?> diff --git a/sections/donate/cancel.php b/sections/donate/cancel.php index 7c37bd55..32b3bde7 100644 --- a/sections/donate/cancel.php +++ b/sections/donate/cancel.php @@ -6,8 +6,8 @@

    Donation Canceled

    -
    +

    It's the thought that counts. Please reconsider donating in the future.

    - \ No newline at end of file + diff --git a/sections/donate/complete.php b/sections/donate/complete.php index 04fdf4ab..0a09f938 100644 --- a/sections/donate/complete.php +++ b/sections/donate/complete.php @@ -6,8 +6,8 @@

    Donation Complete

    -
    -

    Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a Donor.

    +
    +

    Thank you for your donation! If this is your first time donating you will now have received 2 invitations and a Donor.

    diff --git a/sections/login/disabled.php b/sections/login/disabled.php index 0790b2b8..96486ca9 100644 --- a/sections/login/disabled.php +++ b/sections/login/disabled.php @@ -13,16 +13,16 @@ Before joining the disabled channel, please read our
    Golden Rules which can be found here.


    -