Empty commit

This commit is contained in:
Git 2013-06-28 08:01:04 +00:00
parent defe05e12a
commit 4747554353
16 changed files with 282 additions and 180 deletions

View File

@ -64,7 +64,7 @@ public static function init_connection($Server, $Port, $Socket) {
/** /**
* Connect the Sphinxql object to the Sphinx server * Connect the Sphinxql object to the Sphinx server
*/ */
public function connect() { public function sphconnect() {
if (!$this->Connected) { if (!$this->Connected) {
global $Debug; global $Debug;
$Debug->set_flag('Connecting to Sphinx server '.$this->Ident); $Debug->set_flag('Connecting to Sphinx server '.$this->Ident);

View File

@ -282,7 +282,7 @@ private function send_query($GetMeta) {
if (!$this->QueryString) { if (!$this->QueryString) {
return false; return false;
} }
$this->Sphinxql->connect(); $this->Sphinxql->sphconnect();
$Result = $this->Sphinxql->query($this->QueryString); $Result = $this->Sphinxql->query($this->QueryString);
if ($Result === false) { if ($Result === false) {
$Errno = $this->Sphinxql->errno; $Errno = $this->Sphinxql->errno;

View File

@ -707,17 +707,17 @@ function compare($X, $Y) {
echo $TorrentDisplayList; echo $TorrentDisplayList;
$Collages = $Cache->get_value('artists_collages_'.$ArtistID); $Collages = $Cache->get_value("artists_collages_$ArtistID");
if (!is_array($Collages)) { if (!is_array($Collages)) {
$DB->query(" $DB->query("
SELECT c.Name, c.NumTorrents, c.ID SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c FROM collages AS c
JOIN collages_artists AS ca ON ca.CollageID=c.ID JOIN collages_artists AS ca ON ca.CollageID = c.ID
WHERE ca.ArtistID='$ArtistID' WHERE ca.ArtistID = '$ArtistID'
AND Deleted='0' AND Deleted = '0'
AND CategoryID = '7'"); AND CategoryID = '7'");
$Collages = $DB->to_array(); $Collages = $DB->to_array();
$Cache->cache_value('artists_collages_'.$ArtistID, $Collages, 3600 * 6); $Cache->cache_value("artists_collages_$ArtistID", $Collages, 3600 * 6);
} }
if (count($Collages) > 0) { if (count($Collages) > 0) {
if (count($Collages) > MAX_COLLAGES) { if (count($Collages) > MAX_COLLAGES) {
@ -733,7 +733,7 @@ function compare($X, $Y) {
?> ?>
<table class="collage_table" id="collages"> <table class="collage_table" id="collages">
<tr class="colhead"> <tr class="colhead">
<td width="85%"><a href="#">&uarr;</a>&nbsp;This artists is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td> <td width="85%"><a href="#">&uarr;</a>&nbsp;This artist is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
<td># artists</td> <td># artists</td>
</tr> </tr>
<? foreach ($Indices as $i) { <? foreach ($Indices as $i) {
@ -785,11 +785,11 @@ function compare($X, $Y) {
if ($CategoryName == 'Music') { if ($CategoryName == 'Music') {
$ArtistForm = Requests::get_artists($RequestID); $ArtistForm = Requests::get_artists($RequestID);
$ArtistLink = Artists::display_artists($ArtistForm, true, true); $ArtistLink = Artists::display_artists($ArtistForm, true, true);
$FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>"; $FullName = $ArtistLink."<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title [$Year]</a>";
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') { } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
$FullName = "<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title [$Year]</a>"; $FullName = "<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title [$Year]</a>";
} else { } else {
$FullName ="<a href=\"requests.php?action=view&amp;id=".$RequestID."\">$Title</a>"; $FullName ="<a href=\"requests.php?action=view&amp;id=$RequestID\">$Title</a>";
} }
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';
@ -797,7 +797,7 @@ function compare($X, $Y) {
$Tags = Requests::get_tags($RequestID); $Tags = Requests::get_tags($RequestID);
$ReqTagList = array(); $ReqTagList = array();
foreach ($Tags as $TagID => $TagName) { foreach ($Tags as $TagID => $TagName) {
$ReqTagList[] = "<a href=\"requests.php?tags=".$TagName.'">'.display_str($TagName).'</a>'; $ReqTagList[] = "<a href=\"requests.php?tags=$TagName\">".display_str($TagName).'</a>';
} }
$ReqTagList = implode(', ', $ReqTagList); $ReqTagList = implode(', ', $ReqTagList);
?> ?>
@ -828,7 +828,7 @@ function compare($X, $Y) {
// Similar artist map // Similar artist map
if ($NumSimilar > 0) { if ($NumSimilar > 0) {
if ($SimilarData = $Cache->get_value('similar_positions_'.$ArtistID)) { if ($SimilarData = $Cache->get_value("similar_positions_$ArtistID")) {
$Similar = new ARTISTS_SIMILAR($ArtistID, $Name); $Similar = new ARTISTS_SIMILAR($ArtistID, $Name);
$Similar->load_data($SimilarData); $Similar->load_data($SimilarData);
if (!(current($Similar->Artists)->NameLength)) { if (!(current($Similar->Artists)->NameLength)) {
@ -848,7 +848,7 @@ function compare($X, $Y) {
$SimilarData = $Similar->dump_data(); $SimilarData = $Similar->dump_data();
$Cache->cache_value('similar_positions_'.$ArtistID, $SimilarData, 3600 * 24); $Cache->cache_value("similar_positions_$ArtistID", $SimilarData, 3600 * 24);
} }
?> ?>
<div id="similar_artist_map" class="box"> <div id="similar_artist_map" class="box">
@ -878,8 +878,8 @@ function flipView() {
var state = document.getElementById('flip_view_1').style.display == 'block'; var state = document.getElementById('flip_view_1').style.display == 'block';
if (state) { if (state) {
document.getElementById('flip_view_1').style.display='none'; document.getElementById('flip_view_1').style.display = 'none';
document.getElementById('flip_view_2').style.display='block'; document.getElementById('flip_view_2').style.display = 'block';
document.getElementById('flipper_title').innerHTML = 'Similar artist cloud'; document.getElementById('flipper_title').innerHTML = 'Similar artist cloud';
document.getElementById('flip_to').innerHTML = 'Switch to map'; document.getElementById('flip_to').innerHTML = 'Switch to map';
@ -892,8 +892,8 @@ function flipView() {
} }
} }
else { else {
document.getElementById('flip_view_1').style.display='block'; document.getElementById('flip_view_1').style.display = 'block';
document.getElementById('flip_view_2').style.display='none'; document.getElementById('flip_view_2').style.display = 'none';
document.getElementById('flipper_title').innerHTML = 'Similar artist map'; document.getElementById('flipper_title').innerHTML = 'Similar artist map';
document.getElementById('flip_to').innerHTML = 'Switch to cloud'; document.getElementById('flip_to').innerHTML = 'Switch to cloud';
} }
@ -968,7 +968,7 @@ function require(file, callback) {
//---------- Get some data to start processing //---------- Get some data to start processing
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page // Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID); $Catalogue = $Cache->get_value("artist_comments_{$ArtistID}_catalogue_$CatalogueID");
if ($Catalogue === false) { if ($Catalogue === false) {
$DB->query(" $DB->query("
SELECT SELECT
@ -980,12 +980,12 @@ function require(file, callback) {
c.EditedTime, c.EditedTime,
u.Username u.Username
FROM artist_comments as c FROM artist_comments as c
LEFT JOIN users_main AS u ON u.ID=c.EditedUserID LEFT JOIN users_main AS u ON u.ID = c.EditedUserID
WHERE c.ArtistID = '$ArtistID' WHERE c.ArtistID = '$ArtistID'
ORDER BY c.ID ORDER BY c.ID
LIMIT $CatalogueLimit"); LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false, MYSQLI_ASSOC); $Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
$Cache->cache_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID, $Catalogue, 0); $Cache->cache_value("artist_comments_{$ArtistID}_catalogue_$CatalogueID", $Catalogue, 0);
} }
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue //This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
@ -1019,14 +1019,16 @@ function require(file, callback) {
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a>
<? if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?> <? if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?>
- <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');" class="brackets">Edit</a> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');" class="brackets">Edit</a>
<? } <?
}
if (check_perms('site_moderate_forums')) { ?> if (check_perms('site_moderate_forums')) { ?>
- <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a>
<? } ?> <? } ?>
</div> </div>
<div id="bar<?=$PostID?>" style="float: right;"> <div id="bar<?=$PostID?>" style="float: right;">
<a href="reports.php?action=report&amp;type=artist_comment&amp;id=<?=$PostID?>" class="brackets">Report</a> <a href="reports.php?action=report&amp;type=artist_comment&amp;id=<?=$PostID?>" class="brackets">Report</a>
<? if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) { <?
if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
$AuthorInfo = Users::user_info($AuthorID); $AuthorInfo = Users::user_info($AuthorID);
if ($LoggedUser['Class'] >= $AuthorInfo['Class']) { if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
?> ?>
@ -1038,7 +1040,8 @@ function require(file, callback) {
<input type="hidden" name="key" value="<?=$Key?>" /> <input type="hidden" name="key" value="<?=$Key?>" />
</form> </form>
- <a href="#" onclick="$('#warn<?=$PostID?>').raw().submit(); return false;" class="brackets">Warn</a> - <a href="#" onclick="$('#warn<?=$PostID?>').raw().submit(); return false;" class="brackets">Warn</a>
<? } <?
}
} }
?> ?>
&nbsp; &nbsp;
@ -1062,7 +1065,7 @@ function require(file, callback) {
<a href="#content<?=$PostID?>" onclick="LoadEdit('artist', <?=$PostID?>, 1); return false;">&laquo;</a> <a href="#content<?=$PostID?>" onclick="LoadEdit('artist', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?> <? } ?>
Last edited by Last edited by
<?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?> <?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime, 2, true, true)?>
<? } ?> <? } ?>
</div> </div>
</td> </td>

View File

@ -9,26 +9,40 @@
function add_artist($CollageID, $ArtistID) { function add_artist($CollageID, $ArtistID) {
global $Cache, $LoggedUser, $DB; global $Cache, $LoggedUser, $DB;
$DB->query("SELECT MAX(Sort) FROM collages_artists WHERE CollageID='$CollageID'"); $DB->query("
SELECT MAX(Sort)
FROM collages_artists
WHERE CollageID = '$CollageID'");
list($Sort) = $DB->next_record(); list($Sort) = $DB->next_record();
$Sort+=10; $Sort += 10;
$DB->query("SELECT ArtistID FROM collages_artists WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'"); $DB->query("
SELECT ArtistID
FROM collages_artists
WHERE CollageID = '$CollageID'
AND ArtistID = '$ArtistID'");
if ($DB->record_count() == 0) { if ($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO collages_artists $DB->query("
(CollageID, ArtistID, UserID, Sort, AddedOn) INSERT IGNORE INTO collages_artists
(CollageID, ArtistID, UserID, Sort, AddedOn)
VALUES VALUES
('$CollageID', '$ArtistID', '$LoggedUser[ID]', '$Sort', '" . sqltime() . "')"); ('$CollageID', '$ArtistID', '$LoggedUser[ID]', '$Sort', '" . sqltime() . "')");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = '" . sqltime() . "' WHERE ID='$CollageID'"); $DB->query("
UPDATE collages
SET NumTorrents = NumTorrents + 1, Updated = '" . sqltime() . "'
WHERE ID = '$CollageID'");
$Cache->delete_value('collage_'.$CollageID); $Cache->delete_value("collage_$CollageID");
$Cache->delete_value('artists_collages_'.$ArtistID); $Cache->delete_value("artists_collages_$ArtistID");
$Cache->delete_value('artists_collages_personal_'.$ArtistID); $Cache->delete_value("artists_collages_personal_$ArtistID");
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID"); $DB->query("
SELECT UserID
FROM users_collage_subs
WHERE CollageID = $CollageID");
while (list($CacheUserID) = $DB->next_record()) { while (list($CacheUserID) = $DB->next_record()) {
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID); $Cache->delete_value("collage_subs_user_new_$CacheUserID");
} }
} }
} }
@ -37,18 +51,21 @@ function add_artist($CollageID, $ArtistID) {
if (!is_number($CollageID)) { if (!is_number($CollageID)) {
error(404); error(404);
} }
$DB->query("SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'"); $DB->query("
SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser
FROM collages
WHERE ID = '$CollageID'");
list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record(); list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
if (!check_perms('site_collages_delete')) { if (!check_perms('site_collages_delete')) {
if ($Locked) { if ($Locked) {
$Err = "This collage is locked"; $Err = 'This collage is locked';
} }
if ($CategoryID == 0 && $UserID != $LoggedUser['ID']) { if ($CategoryID == 0 && $UserID != $LoggedUser['ID']) {
$Err = "You cannot edit someone else's personal collage"; $Err = 'You cannot edit someone else\'s personal collage.';
} }
if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) { if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) {
$Err = "This collage already holds its maximum allowed number of artists"; $Err = 'This collage already holds its maximum allowed number of artists.';
} }
if (isset($Err)) { if (isset($Err)) {
@ -57,7 +74,11 @@ function add_artist($CollageID, $ArtistID) {
} }
if ($MaxGroupsPerUser > 0) { if ($MaxGroupsPerUser > 0) {
$DB->query("SELECT COUNT(*) FROM collages_artists WHERE CollageID='$CollageID' AND UserID='$LoggedUser[ID]'"); $DB->query("
SELECT COUNT(*)
FROM collages_artists
WHERE CollageID = '$CollageID'
AND UserID = '$LoggedUser[ID]'");
list($GroupsForUser) = $DB->next_record(); list($GroupsForUser) = $DB->next_record();
if (!check_perms('site_collages_delete') && $GroupsForUser >= $MaxGroupsPerUser) { if (!check_perms('site_collages_delete') && $GroupsForUser >= $MaxGroupsPerUser) {
error(403); error(403);
@ -65,7 +86,7 @@ function add_artist($CollageID, $ArtistID) {
} }
if ($_REQUEST['action'] == 'add_artist') { if ($_REQUEST['action'] == 'add_artist') {
$Val->SetFields('url', '1','regex','The URL must be a link to a artist on the site.',array('regex' => '/^'.ARTIST_REGEX.'/i')); $Val->SetFields('url', '1', 'regex', 'The URL must be a link to a artist on the site.', array('regex' => '/^'.ARTIST_REGEX.'/i'));
$Err = $Val->ValidateForm($_POST); $Err = $Val->ValidateForm($_POST);
if ($Err) { if ($Err) {
@ -81,7 +102,10 @@ function add_artist($CollageID, $ArtistID) {
error(404); error(404);
} }
$DB->query("SELECT ArtistID FROM artists_group WHERE ArtistID='$ArtistID'"); $DB->query("
SELECT ArtistID
FROM artists_group
WHERE ArtistID = '$ArtistID'");
list($ArtistID) = $DB->next_record(); list($ArtistID) = $DB->next_record();
if (!$ArtistID) { if (!$ArtistID) {
error('The artist was not found in the database.'); error('The artist was not found in the database.');
@ -89,7 +113,7 @@ function add_artist($CollageID, $ArtistID) {
add_artist($CollageID, $ArtistID); add_artist($CollageID, $ArtistID);
} else { } else {
$URLs = explode("\n",$_REQUEST['urls']); $URLs = explode("\n", $_REQUEST['urls']);
$ArtistIDs = array(); $ArtistIDs = array();
$Err = ''; $Err = '';
foreach ($URLs as $Key => &$URL) { foreach ($URLs as $Key => &$URL) {
@ -119,7 +143,10 @@ function add_artist($CollageID, $ArtistID) {
break; break;
} }
$DB->query("SELECT ArtistID FROM artists_group WHERE ArtistID='$ArtistID'"); $DB->query("
SELECT ArtistID
FROM artists_group
WHERE ArtistID = '$ArtistID'");
if (!$DB->record_count()) { if (!$DB->record_count()) {
$Err = "One of the entered URLs ($URL) does not correspond to an artist on the site."; $Err = "One of the entered URLs ($URL) does not correspond to an artist on the site.";
break; break;

View File

@ -12,23 +12,26 @@
$DB->query(" $DB->query("
SELECT SELECT
CEIL(( CEIL(
SELECT COUNT(ID)+1 (
SELECT COUNT(ID) + 1
FROM collages_comments FROM collages_comments
WHERE CollageID='".db_string($CollageID)."')/".TORRENT_COMMENTS_PER_PAGE." WHERE CollageID = '".db_string($CollageID)."'
) / ".TORRENT_COMMENTS_PER_PAGE."
) AS Pages"); ) AS Pages");
list($Pages) = $DB->next_record(); list($Pages) = $DB->next_record();
$DB->query("INSERT INTO collages_comments $DB->query("
(CollageID, Body, UserID, Time) INSERT INTO collages_comments
(CollageID, Body, UserID, Time)
VALUES VALUES
('$CollageID', '".db_string($_POST['body'])."', '$LoggedUser[ID]', '".sqltime()."')"); ('$CollageID', '".db_string($_POST['body'])."', '$LoggedUser[ID]', '".sqltime()."')");
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE); $CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$Cache->delete_value('collage_'.$CollageID); $Cache->delete_value("collage_$CollageID");
$Cache->delete_value('collage_comments_'.$CollageID.'_catalogue_'.$CatalogueID); $Cache->delete_value("collage_comments_{$CollageID}_catalogue_$CatalogueID");
$Cache->increment('collage_comments_'.$CollageID); $Cache->increment("collage_comments_$CollageID");
header('Location: collages.php?id='.$CollageID); header('Location: collages.php?id='.$CollageID);
?> ?>

View File

@ -8,27 +8,41 @@
function add_torrent($CollageID, $GroupID) { function add_torrent($CollageID, $GroupID) {
global $Cache, $LoggedUser, $DB; global $Cache, $LoggedUser, $DB;
$DB->query("SELECT MAX(Sort) FROM collages_torrents WHERE CollageID='$CollageID'"); $DB->query("
SELECT MAX(Sort)
FROM collages_torrents
WHERE CollageID = '$CollageID'");
list($Sort) = $DB->next_record(); list($Sort) = $DB->next_record();
$Sort+=10; $Sort += 10;
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'"); $DB->query("
SELECT GroupID
FROM collages_torrents
WHERE CollageID = '$CollageID'
AND GroupID = '$GroupID'");
if ($DB->record_count() == 0) { if ($DB->record_count() == 0) {
$DB->query("INSERT IGNORE INTO collages_torrents $DB->query("
(CollageID, GroupID, UserID, Sort, AddedOn) INSERT IGNORE INTO collages_torrents
(CollageID, GroupID, UserID, Sort, AddedOn)
VALUES VALUES
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', '" . sqltime() . "')"); ('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', '" . sqltime() . "')");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = '" . sqltime() . "' WHERE ID='$CollageID'"); $DB->query("
UPDATE collages
SET NumTorrents = NumTorrents + 1, Updated = '" . sqltime() . "'
WHERE ID = '$CollageID'");
$Cache->delete_value('collage_'.$CollageID); $Cache->delete_value("collage_$CollageID");
$Cache->delete_value('torrents_details_'.$GroupID); $Cache->delete_value("torrents_details_$GroupID");
$Cache->delete_value('torrent_collages_'.$GroupID); $Cache->delete_value("torrent_collages_$GroupID");
$Cache->delete_value('torrent_collages_personal_'.$GroupID); $Cache->delete_value("torrent_collages_personal_$GroupID");
$DB->query("SELECT UserID FROM users_collage_subs WHERE CollageID=$CollageID"); $DB->query("
SELECT UserID
FROM users_collage_subs
WHERE CollageID = $CollageID");
while (list($CacheUserID) = $DB->next_record()) { while (list($CacheUserID) = $DB->next_record()) {
$Cache->delete_value('collage_subs_user_new_'.$CacheUserID); $Cache->delete_value("collage_subs_user_new_$CacheUserID");
} }
} }
} }
@ -37,18 +51,21 @@ function add_torrent($CollageID, $GroupID) {
if (!is_number($CollageID)) { if (!is_number($CollageID)) {
error(404); error(404);
} }
$DB->query("SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'"); $DB->query("
SELECT UserID, CategoryID, Locked, NumTorrents, MaxGroups, MaxGroupsPerUser
FROM collages
WHERE ID = '$CollageID'");
list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record(); list($UserID, $CategoryID, $Locked, $NumTorrents, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
if (!check_perms('site_collages_delete')) { if (!check_perms('site_collages_delete')) {
if ($Locked) { if ($Locked) {
$Err = "This collage is locked"; $Err = 'This collage is locked';
} }
if ($CategoryID == 0 && $UserID != $LoggedUser['ID']) { if ($CategoryID == 0 && $UserID != $LoggedUser['ID']) {
$Err = "You cannot edit someone else's personal collage"; $Err = 'You cannot edit someone else\'s personal collage.';
} }
if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) { if ($MaxGroups > 0 && $NumTorrents >= $MaxGroups) {
$Err = "This collage already holds its maximum allowed number of torrents"; $Err = 'This collage already holds its maximum allowed number of torrents.';
} }
if (isset($Err)) { if (isset($Err)) {
@ -57,7 +74,11 @@ function add_torrent($CollageID, $GroupID) {
} }
if ($MaxGroupsPerUser > 0) { if ($MaxGroupsPerUser > 0) {
$DB->query("SELECT COUNT(*) FROM collages_torrents WHERE CollageID='$CollageID' AND UserID='$LoggedUser[ID]'"); $DB->query("
SELECT COUNT(*)
FROM collages_torrents
WHERE CollageID = '$CollageID'
AND UserID = '$LoggedUser[ID]'");
list($GroupsForUser) = $DB->next_record(); list($GroupsForUser) = $DB->next_record();
if (!check_perms('site_collages_delete') && $GroupsForUser >= $MaxGroupsPerUser) { if (!check_perms('site_collages_delete') && $GroupsForUser >= $MaxGroupsPerUser) {
error(403); error(403);
@ -65,7 +86,7 @@ function add_torrent($CollageID, $GroupID) {
} }
if ($_REQUEST['action'] == 'add_torrent') { if ($_REQUEST['action'] == 'add_torrent') {
$Val->SetFields('url', '1','regex','The URL must be a link to a torrent on the site.',array('regex' => '/^'.TORRENT_GROUP_REGEX.'/i')); $Val->SetFields('url', '1', 'regex', 'The URL must be a link to a torrent on the site.', array('regex' => '/^'.TORRENT_GROUP_REGEX.'/i'));
$Err = $Val->ValidateForm($_POST); $Err = $Val->ValidateForm($_POST);
if ($Err) { if ($Err) {
@ -81,7 +102,10 @@ function add_torrent($CollageID, $GroupID) {
error(404); error(404);
} }
$DB->query("SELECT ID FROM torrents_group WHERE ID='$TorrentID'"); $DB->query("
SELECT ID
FROM torrents_group
WHERE ID = '$TorrentID'");
list($GroupID) = $DB->next_record(); list($GroupID) = $DB->next_record();
if (!$GroupID) { if (!$GroupID) {
error('The torrent was not found in the database.'); error('The torrent was not found in the database.');
@ -89,7 +113,7 @@ function add_torrent($CollageID, $GroupID) {
add_torrent($CollageID, $GroupID); add_torrent($CollageID, $GroupID);
} else { } else {
$URLs = explode("\n",$_REQUEST['urls']); $URLs = explode("\n", $_REQUEST['urls']);
$GroupIDs = array(); $GroupIDs = array();
$Err = ''; $Err = '';
foreach ($URLs as $Key => &$URL) { foreach ($URLs as $Key => &$URL) {
@ -115,13 +139,16 @@ function add_torrent($CollageID, $GroupID) {
$GroupIDs[] = $Matches[4]; $GroupIDs[] = $Matches[4];
$GroupID = $Matches[4]; $GroupID = $Matches[4];
} else { } else {
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site."; $Err = "One of the entered URLs ($URL) does not correspond to a torrent group on the site.";
break; break;
} }
$DB->query("SELECT ID FROM torrents_group WHERE ID='$GroupID'"); $DB->query("
SELECT ID
FROM torrents_group
WHERE ID = '$GroupID'");
if (!$DB->record_count()) { if (!$DB->record_count()) {
$Err = "One of the entered URLs ($URL) does not correspond to a torrent on the site."; $Err = "One of the entered URLs ($URL) does not correspond to a torrent group on the site.";
break; break;
} }
} }

View File

@ -175,9 +175,12 @@
<input type="hidden" name="action" value="add_artist" /> <input type="hidden" name="action" value="add_artist" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="text" size="20" name="url" /> <div class="field_div">
<input type="submit" value="+" /> <input type="text" size="20" name="url" />
<br /> </div>
<div class="submit_div">
<input type="submit" value="Add" />
</div>
<span style="font-style: italic;">Enter the URL of an artist on the site.</span> <span style="font-style: italic;">Enter the URL of an artist on the site.</span>
</form> </form>
</div> </div>
@ -186,9 +189,12 @@
<input type="hidden" name="action" value="add_artist_batch" /> <input type="hidden" name="action" value="add_artist_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea><br /> <div class="field_div">
<input type="submit" value="Add" /> <textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea>
<br /> </div>
<div class="submit_div">
<input type="submit" value="Add" />
</div>
<span style="font-style: italic;">Enter the URLs of artists on the site, one per line.</span> <span style="font-style: italic;">Enter the URLs of artists on the site, one per line.</span>
</form> </form>
</div> </div>
@ -205,8 +211,8 @@
um.Username, um.Username,
cc.Time cc.Time
FROM collages_comments AS cc FROM collages_comments AS cc
LEFT JOIN users_main AS um ON um.ID=cc.UserID LEFT JOIN users_main AS um ON um.ID = cc.UserID
WHERE CollageID='$CollageID' WHERE CollageID = '$CollageID'
ORDER BY ID DESC ORDER BY ID DESC
LIMIT 15"); LIMIT 15");
$CommentList = $DB->to_array(false, MYSQLI_NUM); $CommentList = $DB->to_array(false, MYSQLI_NUM);
@ -233,14 +239,17 @@
?> ?>
<div class="box box_addcomment"> <div class="box box_addcomment">
<div class="head"><strong>Add comment</strong></div> <div class="head"><strong>Add comment</strong></div>
<form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled=true;" action="collages.php" method="post"> <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;" action="collages.php" method="post">
<input type="hidden" name="action" value="add_comment" /> <input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<div class="pad"> <div class="pad">
<textarea name="body" cols="24" rows="5"></textarea> <div class="field_div">
<br /> <textarea name="body" cols="24" rows="5"></textarea>
<input type="submit" id="submit_button" value="Add comment" /> </div>
<div class="submit_div">
<input type="submit" id="submit_button" value="Add comment" />
</div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -5,7 +5,10 @@
error(404); error(404);
} }
$DB->query("SELECT Name, UserID FROM collages WHERE ID='$CollageID'"); $DB->query("
SELECT Name, UserID
FROM collages
WHERE ID = '$CollageID'");
list($Name, $UserID) = $DB->next_record(); list($Name, $UserID) = $DB->next_record();
if (!check_perms('site_collages_delete') && $UserID != $LoggedUser['ID']) { if (!check_perms('site_collages_delete') && $UserID != $LoggedUser['ID']) {
@ -24,9 +27,13 @@
<input type="hidden" name="action" value="take_delete" /> <input type="hidden" name="action" value="take_delete" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<strong>Reason: </strong> <div class="field_div">
<input type="text" name="reason" size="30" /> <strong>Reason: </strong>
<input value="Delete" type="submit" /> <input type="text" name="reason" size="40" />
</div>
<div class="submit_div">
<input value="Delete" type="submit" />
</div>
</form> </form>
</div> </div>
</div> </div>

View File

@ -19,7 +19,10 @@
$PostID = $_GET['post']; $PostID = $_GET['post'];
// Mainly // Mainly
$DB->query("SELECT Body FROM collages_comments WHERE ID='$PostID'"); $DB->query("
SELECT Body
FROM collages_comments
WHERE ID = '$PostID'");
list($Body) = $DB->next_record(MYSQLI_NUM); list($Body) = $DB->next_record(MYSQLI_NUM);
// This gets sent to the browser, which echoes it wherever // This gets sent to the browser, which echoes it wherever

View File

@ -4,7 +4,10 @@
error(0); error(0);
} }
$DB->query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'"); $DB->query("
SELECT Name, UserID, CategoryID
FROM collages
WHERE ID = '$CollageID'");
list($Name, $UserID, $CategoryID) = $DB->next_record(); list($Name, $UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) { if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403); error(403);
@ -17,9 +20,9 @@
ct.Sort, ct.Sort,
tg.CatalogueNumber tg.CatalogueNumber
FROM collages_torrents AS ct FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID JOIN torrents_group AS tg ON tg.ID = ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID LEFT JOIN users_main AS um ON um.ID = ct.UserID
WHERE ct.CollageID='$CollageID' WHERE ct.CollageID = '$CollageID'
ORDER BY ct.Sort"); ORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID'); $GroupIDs = $DB->collect('GroupID');
@ -32,7 +35,7 @@
$TorrentList = array(); $TorrentList = array();
} }
View::show_header('Manage collage '.$Name, 'jquery-ui,jquery.tablesorter.min,sort'); View::show_header("Manage collage: $Name", 'jquery-ui,jquery.tablesorter.min,sort');
?> ?>
<div class="thin"> <div class="thin">
@ -63,10 +66,10 @@
<tr class="colhead"> <tr class="colhead">
<th style="width: 7%;">Order</th> <th style="width: 7%;">Order</th>
<th style="width: 1%;"><span><abbr title="Current rank">#</abbr></span></th> <th style="width: 1%;"><span><abbr title="Current rank">#</abbr></span></th>
<th style="width: 7%;"><span>Cat #</span></th> <th style="width: 7%;"><span>Cat.&nbsp;#</span></th>
<th style="width: 1%;"><span>Year</span></th> <th style="width: 1%;"><span>Year</span></th>
<th style="width: 15%;"><span>Artist</span></th> <th style="width: 15%;"><span>Artist</span></th>
<th><span>Torrent</span></th> <th><span>Torrent group</span></th>
<th style="width: 1%;"><span>User</span></th> <th style="width: 1%;"><span>User</span></th>
<th style="width: 1%; text-align: right;" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th> <th style="width: 1%; text-align: right;" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th>
</tr> </tr>
@ -87,15 +90,15 @@
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists, true, false); $DisplayName .= Artists::display_artists($ExtendedArtists, true, false);
} elseif (count($Artists) > 0) { } elseif (count($Artists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$Artists), true, false); $DisplayName .= Artists::display_artists(array('1' => $Artists), true, false);
} }
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>'; $TorrentLink = "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\">$GroupName</a>";
$GroupYear = $GroupYear > 0 ? $GroupYear : ''; $GroupYear = $GroupYear > 0 ? $GroupYear : '';
if ($GroupVanityHouse) { if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]'; $DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
} }
$AltCSS = $Number % 2 === 0 ? 'rowa' : 'rowb'; $AltCSS = ($Number % 2 === 0) ? 'rowa' : 'rowb';
?> ?>
<tr class="drag <?=$AltCSS?>" id="li_<?=$GroupID?>"> <tr class="drag <?=$AltCSS?>" id="li_<?=$GroupID?>">
<form class="manage_form" name="collage" action="collages.php" method="post"> <form class="manage_form" name="collage" action="collages.php" method="post">

View File

@ -7,12 +7,18 @@
authorize(); authorize();
$CollageID = $_POST['collage_id']; $CollageID = $_POST['collage_id'];
$DB->query("SELECT Name FROM collages WHERE ID = ".$CollageID); $DB->query("
SELECT Name
FROM collages
WHERE ID = $CollageID");
if ($DB->record_count() == 0) { if ($DB->record_count() == 0) {
error('Collage is completely deleted'); error('Collage is completely deleted');
} else { } else {
$DB->query("UPDATE collages SET Deleted = '0' WHERE ID=$CollageID"); $DB->query("
$Cache->delete_value('collage_'.$CollageID); UPDATE collages
SET Deleted = '0'
WHERE ID = $CollageID");
$Cache->delete_value("collage_$CollageID");
Misc::write_log("Collage $CollageID was recovered by ".$LoggedUser['Username']); Misc::write_log("Collage $CollageID was recovered by ".$LoggedUser['Username']);
header("Location: collages.php?id=$CollageID"); header("Location: collages.php?id=$CollageID");
} }
@ -28,9 +34,13 @@
<form class="undelete_form" name="collage" action="collages.php" method="post"> <form class="undelete_form" name="collage" action="collages.php" method="post">
<input type="hidden" name="action" value="recover" /> <input type="hidden" name="action" value="recover" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<strong>ID: </strong> <div class="field_div">
<input type="text" name="collage_id" size="8" /> <strong>ID: </strong>
<input value="Recover!" type="submit" /> <input type="text" name="collage_id" size="8" />
</div>
<div class="submit_div">
<input value="Recover!" type="submit" />
</div>
</form> </form>
</div> </div>
</div> </div>

View File

@ -8,9 +8,9 @@
um.ID, um.ID,
um.Username um.Username
FROM collages_torrents AS ct FROM collages_torrents AS ct
JOIN torrents_group AS tg ON tg.ID=ct.GroupID JOIN torrents_group AS tg ON tg.ID = ct.GroupID
LEFT JOIN users_main AS um ON um.ID=ct.UserID LEFT JOIN users_main AS um ON um.ID = ct.UserID
WHERE ct.CollageID='$CollageID' WHERE ct.CollageID = '$CollageID'
ORDER BY ct.Sort"); ORDER BY ct.Sort");
$GroupIDs = $DB->collect('GroupID'); $GroupIDs = $DB->collect('GroupID');
@ -56,7 +56,7 @@
if ($CountArtists) { if ($CountArtists) {
foreach ($CountArtists as $Artist) { foreach ($CountArtists as $Artist) {
if (!isset($TopArtists[$Artist['id']])) { if (!isset($TopArtists[$Artist['id']])) {
$TopArtists[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1); $TopArtists[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
} else { } else {
$TopArtists[$Artist['id']]['count']++; $TopArtists[$Artist['id']]['count']++;
} }
@ -65,23 +65,23 @@
if ($Username) { if ($Username) {
if (!isset($Users[$UserID])) { if (!isset($Users[$UserID])) {
$Users[$UserID] = array('name'=>$Username, 'count'=>1); $Users[$UserID] = array('name' => $Username, 'count' => 1);
} else { } else {
$Users[$UserID]['count']++; $Users[$UserID]['count']++;
} }
} }
$DisplayName = $Number.' - '; $DisplayName = "$Number - ";
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) { if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])|| !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]); unset($ExtendedArtists[3]);
$DisplayName .= Artists::display_artists($ExtendedArtists); $DisplayName .= Artists::display_artists($ExtendedArtists);
} elseif (count($GroupArtists) > 0) { } elseif (count($GroupArtists) > 0) {
$DisplayName .= Artists::display_artists(array('1'=>$GroupArtists)); $DisplayName .= Artists::display_artists(array('1' => $GroupArtists));
} }
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>'; $DisplayName .= "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\" dir=\"ltr\">$GroupName</a>";
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName = "$DisplayName [$GroupYear]"; $DisplayName = "$DisplayName [$GroupYear]";
} }
@ -109,9 +109,9 @@
<strong><?=$DisplayName?></strong> <strong><?=$DisplayName?></strong>
<? // PHP start tag is indented for proper formatting of generated HTML <? // PHP start tag is indented for proper formatting of generated HTML
if (Bookmarks::has_bookmarked('torrent', $GroupID)) { if (Bookmarks::has_bookmarked('torrent', $GroupID)) {
echo "<a style = \"float: right;\" href=\"#\" id=\"bookmarklink_torrent_$GroupID\" class=\"remove_bookmark brackets\" title=\"Unbookmark\" onclick=\"Unbookmark('torrent',$GroupID,'Bookmark');return false;\">Unbookmark</a>"; echo "<a style = \"float: right;\" href=\"#\" id=\"bookmarklink_torrent_$GroupID\" class=\"remove_bookmark brackets\" title=\"Unbookmark\" onclick=\"Unbookmark('torrent', $GroupID, 'Bookmark'); return false;\">Unbookmark</a>";
} else { } else {
echo "<a style = \"float: right;\" href=\"#\" id=\"bookmarklink_torrent_$GroupID\" class=\"add_bookmark brackets\" title=\"Bookmark\" onclick=\"Bookmark('torrent',$GroupID,'Unbookmark');return false;\">Bookmark</a>"; echo "<a style = \"float: right;\" href=\"#\" id=\"bookmarklink_torrent_$GroupID\" class=\"add_bookmark brackets\" title=\"Bookmark\" onclick=\"Bookmark('torrent', $GroupID, 'Unbookmark'); return false;\">Bookmark</a>";
} }
echo "\n"; echo "\n";
echo Votes::vote_link($GroupID, $UserVotes[$GroupID]['Type']); ?> echo Votes::vote_link($GroupID, $UserVotes[$GroupID]['Type']); ?>
@ -173,7 +173,7 @@
list($TorrentID, $Torrent) = each($Torrents); list($TorrentID, $Torrent) = each($Torrents);
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>'; $DisplayName = "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\" dir=\"ltr\">$GroupName</a>";
if ($Torrent['IsSnatched']) { if ($Torrent['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!'); $DisplayName .= ' ' . Format::torrent_label('Snatched!');
@ -228,7 +228,7 @@
} }
$DisplayName .= $GroupName; $DisplayName .= $GroupName;
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName = $DisplayName. " [$GroupYear]"; $DisplayName = "$DisplayName [$GroupYear]";
} }
?> ?>
<li class="image_group_<?=$GroupID?>"> <li class="image_group_<?=$GroupID?>">
@ -270,7 +270,7 @@
$CollagePages[] = $CollagePage; $CollagePages[] = $CollagePage;
} }
View::show_header($Name,'browse,collage,bbcode,voting,recommend'); View::show_header($Name, 'browse,collage,bbcode,voting,recommend');
?> ?>
<div class="thin"> <div class="thin">
<div class="header"> <div class="header">
@ -282,7 +282,7 @@
<? } ?> <? } ?>
<br /><br /> <br /><br />
<? if (check_perms('site_collages_subscribe')) { ?> <? if (check_perms('site_collages_subscribe')) { ?>
<a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>);return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a> <a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
<? } <? }
if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?> if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) { ?>
<a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a> <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
@ -291,9 +291,9 @@
<? } <? }
if (Bookmarks::has_bookmarked('collage', $CollageID)) { if (Bookmarks::has_bookmarked('collage', $CollageID)) {
?> ?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>,'Bookmark');return false;">Remove bookmark</a> <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove bookmark</a>
<? } else { ?> <? } else { ?>
<a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>,'Remove bookmark');return false;">Bookmark</a> <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
<? } <? }
?> ?>
<!-- <a href="#" id="recommend" class="brackets">Recommend</a> --> <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
@ -339,7 +339,7 @@
<li id="list<?=$ListItem?>"> <li id="list<?=$ListItem?>">
<input type="hidden" name="list[]" value="<?=$ListItem?>" /> <input type="hidden" name="list[]" value="<?=$ListItem?>" />
<span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span> <span class="float_left"><?=$ZIPOptions[$ListItem]['2']?></span>
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" class="float_right brackets">X</a></span> <span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" class="float_right brackets">X</a></span>
<br style="clear: all;" /> <br style="clear: all;" />
</li> </li>
<? } ?> <? } ?>
@ -358,10 +358,11 @@
</optgroup> </optgroup>
<? } ?> <? } ?>
<optgroup label="<?=$ZIPGroups[$GroupID]?>"> <optgroup label="<?=$ZIPGroups[$GroupID]?>">
<? $OpenGroup = true; <?
$OpenGroup = true;
} }
?> ?>
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option> <option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID, $ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
<? <?
} }
?> ?>
@ -444,16 +445,19 @@
</div> </div>
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?> <? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
<div class="box box_addtorrent"> <div class="box box_addtorrent">
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div> <div class="head"><strong>Add torrent group</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
<div class="pad add_torrent_container"> <div class="pad add_torrent_container">
<form class="add_form" name="torrent" action="collages.php" method="post"> <form class="add_form" name="torrent" action="collages.php" method="post">
<input type="hidden" name="action" value="add_torrent" /> <input type="hidden" name="action" value="add_torrent" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="text" size="20" name="url" /> <div class="field_div">
<input type="submit" value="+" /> <input type="text" size="20" name="url" />
<br /> </div>
<span style="font-style: italic;">Enter the URL of a torrent on the site.</span> <div class="submit_div">
<input type="submit" value="Add" />
</div>
<span style="font-style: italic;">Enter the URL of a torrent group on the site.</span>
</form> </form>
</div> </div>
<div class="pad hidden add_torrent_container"> <div class="pad hidden add_torrent_container">
@ -461,10 +465,13 @@
<input type="hidden" name="action" value="add_torrent_batch" /> <input type="hidden" name="action" value="add_torrent_batch" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea><br /> <div class="field_div">
<input type="submit" value="Add" /> <textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea>
<br /> </div>
<span style="font-style: italic;">Enter the URLs of torrents on the site, one per line.</span> <div class="submit_div">
<input type="submit" value="Add" />
</div>
<span style="font-style: italic;">Enter the URLs of torrent groups on the site, one per line.</span>
</form> </form>
</div> </div>
</div> </div>
@ -480,8 +487,8 @@
um.Username, um.Username,
cc.Time cc.Time
FROM collages_comments AS cc FROM collages_comments AS cc
LEFT JOIN users_main AS um ON um.ID=cc.UserID LEFT JOIN users_main AS um ON um.ID = cc.UserID
WHERE CollageID='$CollageID' WHERE CollageID = '$CollageID'
ORDER BY ID DESC ORDER BY ID DESC
LIMIT 15"); LIMIT 15");
$CommentList = $DB->to_array(false, MYSQLI_NUM); $CommentList = $DB->to_array(false, MYSQLI_NUM);
@ -508,14 +515,17 @@
?> ?>
<div class="box box_addcomment"> <div class="box box_addcomment">
<div class="head"><strong>Add comment</strong></div> <div class="head"><strong>Add comment</strong></div>
<form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled=true;" action="collages.php" method="post"> <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;" action="collages.php" method="post">
<input type="hidden" name="action" value="add_comment" /> <input type="hidden" name="action" value="add_comment" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" /> <input type="hidden" name="collageid" value="<?=$CollageID?>" />
<div class="pad"> <div class="pad">
<textarea name="body" cols="24" rows="5"></textarea> <div class="field_div">
<br /> <textarea name="body" cols="24" rows="5"></textarea>
<input type="submit" id="submit_button" value="Add comment" /> </div>
<div class="submit_div">
<input type="submit" id="submit_button" value="Add comment" />
</div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -152,29 +152,23 @@ function checked($Checked) {
<tr> <tr>
<td class="label"><strong>Torrent grouping</strong></td> <td class="label"><strong>Torrent grouping</strong></td>
<td> <td>
<ul class="options_list nobullet"> <div class="option_group">
<li> <input type="checkbox" name="disablegrouping" id="disablegrouping"<?Format::selected('DisableGrouping2', 0, 'checked', $SiteOptions);?> />
<div class="field_div"> <label for="disablegrouping">Group torrents by default</label>
<input type="checkbox" name="disablegrouping" id="disablegrouping"<?Format::selected('DisableGrouping2', 0, 'checked', $SiteOptions);?> /> </div>
<label for="disablegrouping">Group torrents by default</label> <div class="option_group">
</div> <p>By default, torrent groups are:</p>
</li> <ul class="options_list nobullet">
<li> <li>
<div class="field_div"> <input type="radio" name="torrentgrouping" id="torrent_grouping_open" value="0" <? if ($SiteOptions['TorrentGrouping'] == 0) { ?>checked="checked" <? } ?>/>
<p>By default, torrent groups are:</p> <label for="torrent_grouping_open">Open</label>
<ul class="options_list nobullet"> </li>
<li> <li>
<input type="radio" name="torrentgrouping" id="torrent_grouping_open" value="0" <? if ($SiteOptions['TorrentGrouping'] == 0) { ?>checked="checked" <? } ?>/> <input type="radio" name="torrentgrouping" id="torrent_grouping_closed" value="1" <? if ($SiteOptions['TorrentGrouping'] == 1) { ?>checked="checked" <? } ?>/>
<label for="torrent_grouping_open">Open</label> <label for="torrent_grouping_closed">Closed</label>
</li> </li>
<li> </ul>
<input type="radio" name="torrentgrouping" id="torrent_grouping_closed" value="1" <? if ($SiteOptions['TorrentGrouping'] == 1) { ?>checked="checked" <? } ?>/> </div>
<label for="torrent_grouping_closed">Closed</label>
</li>
</ul>
</div>
</li>
</ul>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -7,8 +7,8 @@ function clearItem(torrentId) {
function clearSelected(filterId) { function clearSelected(filterId) {
var checkBoxes, checkedBoxes = []; var checkBoxes, checkedBoxes = [];
if (filterId) { if (filterId) {
var filterForm = $('#notificationform_'+filterId); var filterForm = $('#notificationform_' + filterId);
checkBoxes = $('.notify_box_'+filterId, filterForm); checkBoxes = $('.notify_box_' + filterId, filterForm);
} else { } else {
checkBoxes = $('.notify_box'); checkBoxes = $('.notify_box');
} }
@ -25,8 +25,8 @@ function clearSelected(filterId) {
} }
function toggleBoxes(filterId, value) { function toggleBoxes(filterId, value) {
var filterForm = $('#notificationform_'+filterId); var filterForm = $('#notificationform_' + filterId);
var checkBoxes = $('.notify_box_'+filterId, filterForm); var checkBoxes = $('.notify_box_' + filterId, filterForm);
for (var i = checkBoxes.length - 1; i >= 0; i--) { for (var i = checkBoxes.length - 1; i >= 0; i--) {
$(checkBoxes[i]).prop('checked', value); $(checkBoxes[i]).prop('checked', value);
} }

View File

@ -214,7 +214,7 @@ jQuery.extend(jQuery.prototype, {
return this; return this;
}, },
listen: function (event, callback) { listen: function (event, callback) {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
var object = this[i]; var object = this[i];
if (document.addEventListener) { if (document.addEventListener) {
object.addEventListener(event, callback, false); object.addEventListener(event, callback, false);
@ -225,7 +225,7 @@ jQuery.extend(jQuery.prototype, {
return this; return this;
}, },
add_class: function (class_name, force) { add_class: function (class_name, force) {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
var object = this[i]; var object = this[i];
if (object.className === '') { if (object.className === '') {
object.className = class_name; object.className = class_name;
@ -236,7 +236,7 @@ jQuery.extend(jQuery.prototype, {
return this; return this;
}, },
remove_class: function (class_name) { remove_class: function (class_name) {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
var object = this[i]; var object = this[i];
var classes = object.className.split(' '); var classes = object.className.split(' ');
var result = array_search(class_name, classes); var result = array_search(class_name, classes);
@ -248,7 +248,7 @@ jQuery.extend(jQuery.prototype, {
return this; return this;
}, },
has_class: function(class_name) { has_class: function(class_name) {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
var object = this[i]; var object = this[i];
var classes = object.className.split(' '); var classes = object.className.split(' ');
if (array_search(class_name, classes)) { if (array_search(class_name, classes)) {
@ -258,7 +258,7 @@ jQuery.extend(jQuery.prototype, {
return false; return false;
}, },
toggle_class: function(class_name) { toggle_class: function(class_name) {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
var object = this[i]; var object = this[i];
var classes = object.className.split(' '); var classes = object.className.split(' ');
var result = array_search(class_name, classes); var result = array_search(class_name, classes);
@ -276,13 +276,13 @@ jQuery.extend(jQuery.prototype, {
return this; return this;
}, },
disable : function () { disable : function () {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
this[i].disabled = true; this[i].disabled = true;
} }
return this; return this;
}, },
enable : function () { enable : function () {
for (var i=0,il=this.size();i<il;i++) { for (var i = 0, il = this.size(); i < il; i++) {
if (this[i].disabled == true) { if (this[i].disabled == true) {
this[i].disabled = false; this[i].disabled = false;
} }

View File

@ -494,3 +494,9 @@ tr.torrent .bookmark>a:after {
font-size: 85%; font-size: 85%;
font-weight: normal; font-weight: normal;
} }
.option_group {
margin-bottom: 10px;
}
.option_group:last-child {
margin-bottom: 0px;
}