mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
c1294d48b1
commit
2380381c26
@ -9,6 +9,7 @@
|
||||
class DEBUG {
|
||||
public $Errors = array();
|
||||
public $Flags = array();
|
||||
public $Perf = array();
|
||||
private $LoggedVars = array();
|
||||
|
||||
public function profile($Automatic='') {
|
||||
@ -44,6 +45,15 @@ public function profile($Automatic='') {
|
||||
$Reason[] = 'Requested by '.$LoggedUser['Username'];
|
||||
}
|
||||
|
||||
$this->Perf['Memory usage'] = (($Ram>>10)/1024)." MB";
|
||||
$this->Perf['Page process time'] = (round($Micro)/1000)." s";
|
||||
|
||||
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
global $CPUTimeStart;
|
||||
$RUsage = getrusage();
|
||||
$this->Perf['CPU time'] = (round(($RUsage["ru_utime.tv_sec"]*1000000 + $RUsage['ru_utime.tv_usec'] - $CPUTimeStart)/1000)/1000)." s";
|
||||
}
|
||||
|
||||
if (isset($Reason[0])) {
|
||||
$this->analysis(implode(', ', $Reason));
|
||||
return true;
|
||||
@ -68,7 +78,8 @@ public function analysis($Message, $Report='', $Time=43200) {
|
||||
'flags' => $this->get_flags(),
|
||||
'includes' => $this->get_includes(),
|
||||
'cache' => $this->get_cache_keys(),
|
||||
'vars' => $this->get_logged_vars()
|
||||
'vars' => $this->get_logged_vars(),
|
||||
'perf' => $this->get_perf()
|
||||
),
|
||||
$Time
|
||||
);
|
||||
@ -187,6 +198,10 @@ public function php_error_handler($Level, $Error, $File, $Line) {
|
||||
|
||||
/* Data wrappers */
|
||||
|
||||
public function get_perf() {
|
||||
return $this->Perf;
|
||||
}
|
||||
|
||||
public function get_flags() {
|
||||
return $this->Flags;
|
||||
}
|
||||
@ -272,6 +287,34 @@ public function get_logged_vars() {
|
||||
|
||||
/* Output Formatting */
|
||||
|
||||
public function perf_table($Perf=false) {
|
||||
if (!is_array($Perf)) {
|
||||
$Perf = $this->get_perf();
|
||||
}
|
||||
if (empty($Perf)) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table class="layout" width="100%">
|
||||
<tr>
|
||||
<td align="left"><strong><a href="#" onclick="$('#debug_perf').toggle();return false;">(View)</a> Performance stats:</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="debug_perf" class="debug_table hidden" width="100%">
|
||||
<?
|
||||
foreach ($Perf as $Stat => $Value) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="debug_perf_stat"><?=$Stat?></td>
|
||||
<td class="debug_perf_data"><?=$Value?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
public function include_table($Includes=false) {
|
||||
if (!is_array($Includes)) {
|
||||
$Includes = $this->get_includes();
|
||||
|
@ -126,9 +126,6 @@ public function header ()
|
||||
<div class="header">
|
||||
<h2><?=display_str($this->Heading)?></h2>
|
||||
</div>
|
||||
<script src="static/functions/jquery-ui.js" type="text/javascript"></script>
|
||||
<script src="static/functions/jquery.tablesorter.min.js" type="text/javascript"></script>
|
||||
<script src="static/functions/sort.js" type="text/javascript"></script>
|
||||
|
||||
<table width="100%" class="layout">
|
||||
<tr class="colhead"><td id="sorting_head">Sorting</td></tr>
|
||||
@ -157,8 +154,8 @@ public function header ()
|
||||
<th style="width:1%"><span>Year</span></th>
|
||||
<th style="width:15%"><span>Artist</span></th>
|
||||
<th><span>Torrent</span></th>
|
||||
<th style="width:1%"><span>User</span></th>
|
||||
<th style="width:3%" id="check_all"><span>Remove</span></th>
|
||||
<th style="width:5%"><span>Bookmarked</span></th>
|
||||
<th style="width:1%" id="check_all"><span>Remove</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -171,7 +168,7 @@ public function header ()
|
||||
*/
|
||||
public function footer ()
|
||||
{
|
||||
if ($this->HasTorrents) :
|
||||
if ($this->HasTorrents) :
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
@ -200,6 +197,7 @@ public function body ()
|
||||
if ($this->HasTorrents)
|
||||
foreach ($this->TorrentList as $GroupID => $Group) {
|
||||
$Artists = array();
|
||||
|
||||
extract($Group);
|
||||
extract($this->CollageDataList[$GroupID]);
|
||||
|
||||
@ -208,8 +206,9 @@ public function body ()
|
||||
$DisplayName = self::display_name($ExtendedArtists, $Artists, $VanityHouse);
|
||||
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$Name.'</a>';
|
||||
$Year = $Year > 0 ? $Year : '';
|
||||
$DateAdded = date($Time);
|
||||
|
||||
$this->row($Sort, $GroupID, $Year, $DisplayName, $TorrentLink);
|
||||
$this->row($Sort, $GroupID, $Year, $DisplayName, $TorrentLink, $DateAdded);
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +221,7 @@ public function body ()
|
||||
* @param string $DisplayName
|
||||
* @param string $TorrentLink
|
||||
*/
|
||||
public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink)
|
||||
public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink, $DateAdded)
|
||||
{
|
||||
$CSS = $this->NumGroups % 2 === 0 ? 'rowa' : 'rowb';
|
||||
?>
|
||||
@ -232,10 +231,10 @@ public function row ($Sort, $GroupID, $GroupYear, $DisplayName, $TorrentLink)
|
||||
<input class="sort_numbers" type="text" name="sort[<?=$GroupID?>]" value="<?=$Sort?>" id="sort_<?=$GroupID?>" size="4" />
|
||||
</td>
|
||||
<td><?=$this->NumGroups?></td>
|
||||
<td><?=trim($GroupYear)?></td>
|
||||
<td><?=trim($DisplayName)?></td>
|
||||
<td><?=trim($TorrentLink)?></td>
|
||||
<td class="nobr"><?=Users::format_username($this->UserID, false, false, false)?></td>
|
||||
<td><?=$GroupYear?trim($GroupYear):' '?></td>
|
||||
<td><?=$DisplayName?trim($DisplayName):' '?></td>
|
||||
<td><?=$TorrentLink?trim($TorrentLink):' '?></td>
|
||||
<td class="nobr" title="<?=$DateAdded?>"><?=$DateAdded?time_diff($DateAdded):' '?></td>
|
||||
<td class="center"><input type="checkbox" name="remove[<?=$GroupID?>]" value="" /></td>
|
||||
</tr>
|
||||
<?
|
||||
|
@ -47,7 +47,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_';
|
||||
|
||||
foreach ($GroupIDs as $GroupID) {
|
||||
$Data = $Cache->get_value($Key.$GroupID);
|
||||
$Data = $Cache->get_value($Key.$GroupID, true);
|
||||
if (!empty($Data) && (@$Data['ver'] >= 4)) {
|
||||
unset($NotFound[$GroupID]);
|
||||
$Found[$GroupID] = $Data['d'];
|
||||
@ -93,11 +93,14 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
|
||||
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
|
||||
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
|
||||
|
||||
$Cache->cache_value('torrent_group_'.$Torrent['GroupID'],
|
||||
array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||
$Cache->cache_value('torrent_group_light_'.$Torrent['GroupID'],
|
||||
array('ver'=>4, 'd'=>$Found[$Torrent['GroupID']]), 0);
|
||||
}
|
||||
|
||||
// Cache it all
|
||||
foreach ($Found as $GroupID=>$GroupInfo) {
|
||||
$Cache->cache_value('torrent_group_'.$GroupID,
|
||||
array('ver'=>4, 'd'=>$GroupInfo), 0);
|
||||
$Cache->cache_value('torrent_group_light_'.$GroupID,
|
||||
array('ver'=>4, 'd'=>$GroupInfo), 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -580,37 +583,36 @@ public static function has_snatched($TorrentID) {
|
||||
// This bucket hasn't been checked before
|
||||
$CurSnatchedTorrents = $Cache->get_value('users_snatched_'.$UserID.'_'.$BucketID, true);
|
||||
if ($CurSnatchedTorrents === false || $CurTime - $LastUpdate > 1800) {
|
||||
if ($CurSnatchedTorrents === false) {
|
||||
$Updated = array();
|
||||
if ($CurSnatchedTorrents === false || $LastUpdate == 0) {
|
||||
for ($i = 0; $i < $Buckets; $i++) {
|
||||
$SnatchedTorrents[$i] = array();
|
||||
}
|
||||
// Not found in cache. Since we don't have a suitable index, it's faster to update everything
|
||||
$DB->query("SELECT fid, tstamp AS TorrentID FROM xbt_snatched WHERE uid='$UserID'");
|
||||
while (list($ID) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||
$SnatchedTorrents[$ID & $LastBucket][(int)$ID] = true;
|
||||
}
|
||||
$Updated = array_fill(0, $Buckets, true);
|
||||
} elseif (isset($CurSnatchedTorrents[$TorrentID])) {
|
||||
// Old cache, but torrent is snatched, so no need to update
|
||||
return true;
|
||||
} else {
|
||||
// Old cache, check if torrent has been snatched recently
|
||||
$DB->query("SELECT fid AS TorrentID FROM xbt_snatched WHERE uid='$UserID' AND tstamp>=".$LastUpdate);
|
||||
}
|
||||
$Updated = array();
|
||||
while (list($ID) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||
$CurBucketID = $ID & $LastBucket;
|
||||
if ($SnatchedTorrents[$CurBucketID] === false) {
|
||||
$SnatchedTorrents[$CurBucketID] = $Cache->get_value('users_snatched_'.$UserID.'_'.$CurBucketID, true);
|
||||
$DB->query("SELECT fid FROM xbt_snatched WHERE uid='$UserID' AND tstamp>=$LastUpdate");
|
||||
while (list($ID) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||
$CurBucketID = $ID & $LastBucket;
|
||||
if ($SnatchedTorrents[$CurBucketID] === false) {
|
||||
$SnatchedTorrents[$CurBucketID] = array();
|
||||
$SnatchedTorrents[$CurBucketID] = $Cache->get_value('users_snatched_'.$UserID.'_'.$CurBucketID, true);
|
||||
if ($SnatchedTorrents[$CurBucketID] === false) {
|
||||
$SnatchedTorrents[$CurBucketID] = array();
|
||||
}
|
||||
}
|
||||
$SnatchedTorrents[$CurBucketID][(int)$ID] = true;
|
||||
$Updated[$CurBucketID] = true;
|
||||
}
|
||||
$SnatchedTorrents[$CurBucketID][(int)$ID] = true;
|
||||
$Updated[$CurBucketID] = true;
|
||||
}
|
||||
for ($i = 0; $i < $Buckets; $i++) {
|
||||
if (empty($SnatchedTorrents[$i])) {
|
||||
$SnatchedTorrents[$i] = $Cache->get_value('users_snatched_'.$UserID.'_'.$i, true);
|
||||
if ($SnatchedTorrents[$i] === false) {
|
||||
// No snatched torrents with this bucket number
|
||||
$SnatchedTorrents[$i] = array();
|
||||
$Updated[$i] = true;
|
||||
}
|
||||
}
|
||||
if ($Updated[$i]) {
|
||||
$Cache->cache_value('users_snatched_'.$UserID.'_'.$i, $SnatchedTorrents[$i], 0);
|
||||
}
|
||||
|
@ -50,8 +50,11 @@
|
||||
|
||||
|
||||
|
||||
$ScriptStartTime=microtime(true); //To track how long a page takes to create
|
||||
|
||||
$ScriptStartTime = microtime(true); //To track how long a page takes to create
|
||||
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
$RUsage = getrusage();
|
||||
$CPUTimeStart = $RUsage["ru_utime.tv_sec"]*1000000 + $RUsage['ru_utime.tv_usec'];
|
||||
}
|
||||
ob_start(); //Start a buffer, mainly in case there is a mysql error
|
||||
|
||||
|
||||
|
@ -205,10 +205,10 @@
|
||||
$DB->query($sql);
|
||||
list($QuoteNotificationsCount) = $DB->next_record();
|
||||
$Cache->cache_value('forums_quotes_'.$LoggedUser['ID'], $QuoteNotificationsCount, 0);
|
||||
}
|
||||
if($QuoteNotificationsCount > 0) {
|
||||
$Alerts[] = '<a href="userhistory.php?action=quote_notifications">'. 'New Quote'. ($QuoteNotificationsCount > 1 ? 's' : '');
|
||||
$Alerts[] = '<a href="userhistory.php?action=quote_notifications">'. 'New Quote'. ($QuoteNotificationsCount > 1 ? 's' : '') . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// News
|
||||
|
@ -516,6 +516,8 @@ function compare($X, $Y){
|
||||
<a href="artist.php?action=edit&artistid=<?=$ArtistID?>">[Edit]</a>
|
||||
<? } ?>
|
||||
<a href="artist.php?action=history&artistid=<?=$ArtistID?>">[View history]</a>
|
||||
<a href="artist.php?id=<?=$ArtistID?>#info">[Info]</a>
|
||||
<a href="artist.php?id=<?=$ArtistID?>#artistcomments">[Comments]</a>
|
||||
<? if (check_perms('site_delete_artist') && check_perms('torrents_delete')) { ?>
|
||||
<a href="artist.php?action=delete&artistid=<?=$ArtistID?>&auth=<?=$LoggedUser['AuthKey']?>">[Delete]</a>
|
||||
<? }
|
||||
@ -891,8 +893,11 @@ function require(file, callback) {
|
||||
|
||||
<? } // if $NumSimilar>0 ?>
|
||||
<div class="box">
|
||||
<div class="head"><strong>Artist info</strong></div>
|
||||
<div class="body"><?=$Text->full_format($Body)?></div>
|
||||
<div id="info" class="head">
|
||||
<strong>Artist info</strong>
|
||||
<a href="#" onclick="$('#body').toggle(); return false;">[Toggle]</a>
|
||||
</div>
|
||||
<div id="body" class="body"><?=$Text->full_format($Body)?></div>
|
||||
</div>
|
||||
<?php
|
||||
// --- Comments ---
|
||||
@ -945,7 +950,7 @@ function require(file, callback) {
|
||||
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
|
||||
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)%THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
|
||||
?>
|
||||
<div class="linkbox">
|
||||
<div id="artistcomments" class="linkbox">
|
||||
<a name="comments"></a>
|
||||
<?
|
||||
$Pages = Format::get_pages($Page,$Results,TORRENT_COMMENTS_PER_PAGE,9,'#comments');
|
||||
|
@ -79,6 +79,57 @@
|
||||
include(SERVER_ROOT.'/sections/artist/take_warn.php');
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
error(0);
|
||||
}
|
||||
} elseif(!empty($_GET['action'])) {
|
||||
switch ($_GET['action']) {
|
||||
case 'get_post':
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) { error(0); }
|
||||
$DB->query("SELECT Body FROM artist_comments WHERE ID='".db_string($_GET['post'])."'");
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
echo trim($Body);
|
||||
break;
|
||||
|
||||
case 'delete_comment':
|
||||
authorize();
|
||||
|
||||
// Quick SQL injection check
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) { error(0); }
|
||||
|
||||
// Make sure they are moderators
|
||||
if (!check_perms('site_moderate_forums')) { error(403); }
|
||||
|
||||
// Get topicid, forumid, number of pages
|
||||
$DB->query("SELECT
|
||||
ArtistID,
|
||||
CEIL(COUNT(ac.ID)/".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
|
||||
CEIL(SUM(IF(ac.ID<=".$_GET['postid'].",1,0))/".TORRENT_COMMENTS_PER_PAGE.") AS Page
|
||||
FROM artist_comments AS ac
|
||||
WHERE ac.ArtistID=(SELECT ArtistID FROM artist_comments WHERE ID=".$_GET['postid'].")
|
||||
GROUP BY ac.ArtistID");
|
||||
list($ArtistID,$Pages,$Page)=$DB->next_record();
|
||||
|
||||
// $Pages = number of pages in the thread
|
||||
// $Page = which page the post is on
|
||||
// These are set for cache clearing.
|
||||
|
||||
$DB->query("DELETE FROM artist_comments WHERE ID='".db_string($_GET['postid'])."'");
|
||||
|
||||
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
|
||||
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Pages-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
for($i=$ThisCatalogue;$i<=$LastCatalogue;$i++) {
|
||||
$Cache->delete('artist_comments_'.$ArtistID.'_catalogue_'.$i);
|
||||
}
|
||||
|
||||
// Delete thread info cache (eg. number of pages)
|
||||
$Cache->delete('artist_comments_'.$ArtistID);
|
||||
|
||||
break;
|
||||
|
||||
case 'takeedit_post':
|
||||
authorize();
|
||||
|
||||
@ -132,55 +183,6 @@
|
||||
// This gets sent to the browser, which echoes it in place of the old body
|
||||
echo $Text->full_format($_POST['body']);
|
||||
break;
|
||||
|
||||
default:
|
||||
error(0);
|
||||
}
|
||||
} elseif(!empty($_GET['action'])) {
|
||||
switch ($_GET['action']) {
|
||||
case 'get_post':
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) { error(0); }
|
||||
$DB->query("SELECT Body FROM artist_comments WHERE ID='".db_string($_GET['post'])."'");
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
echo trim($Body);
|
||||
break;
|
||||
|
||||
case 'delete_comment':
|
||||
authorize();
|
||||
|
||||
// Quick SQL injection check
|
||||
if (!$_GET['postid'] || !is_number($_GET['postid'])) { error(0); }
|
||||
|
||||
// Make sure they are moderators
|
||||
if (!check_perms('site_moderate_forums')) { error(403); }
|
||||
|
||||
// Get topicid, forumid, number of pages
|
||||
$DB->query("SELECT
|
||||
ArtistID,
|
||||
CEIL(COUNT(ac.ID)/".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
|
||||
CEIL(SUM(IF(ac.ID<=".$_GET['postid'].",1,0))/".TORRENT_COMMENTS_PER_PAGE.") AS Page
|
||||
FROM artist_comments AS ac
|
||||
WHERE ac.ArtistID=(SELECT ArtistID FROM artist_comments WHERE ID=".$_GET['postid'].")
|
||||
GROUP BY ac.ArtistID");
|
||||
list($ArtistID,$Pages,$Page)=$DB->next_record();
|
||||
|
||||
// $Pages = number of pages in the thread
|
||||
// $Page = which page the post is on
|
||||
// These are set for cache clearing.
|
||||
|
||||
$DB->query("DELETE FROM artist_comments WHERE ID='".db_string($_GET['postid'])."'");
|
||||
|
||||
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
|
||||
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Pages-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
for($i=$ThisCatalogue;$i<=$LastCatalogue;$i++) {
|
||||
$Cache->delete('artist_comments_'.$ArtistID.'_catalogue_'.$i);
|
||||
}
|
||||
|
||||
// Delete thread info cache (eg. number of pages)
|
||||
$Cache->delete('artist_comments_'.$ArtistID);
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
require(SERVER_ROOT.'/sections/artist/edit.php');
|
||||
|
@ -1,29 +1,29 @@
|
||||
<?php
|
||||
// ugly UserID code that should be turned into a function . . .
|
||||
if(!empty($_GET['userid'])) {
|
||||
if(!check_perms('users_override_paranoia')) {
|
||||
error(403);
|
||||
}
|
||||
$UserID = $_GET['userid'];
|
||||
if(!is_number($UserID)) { error(404); }
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
|
||||
list($Username) = $DB->next_record();
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
|
||||
// Finally we start
|
||||
|
||||
//Require the table class
|
||||
// require_once SERVER_ROOT . '/classes/class_mass_user_torrents_table_view.php';
|
||||
|
||||
View::show_header('Organize Bookmarks', 'browse,jquery');
|
||||
|
||||
$EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents';
|
||||
|
||||
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
|
||||
|
||||
$TT = new MASS_USER_TORRENTS_TABLE_VIEW($TorrentList, $CollageDataList, $EditType, 'Organize Torrent Bookmarks');
|
||||
$TT->render_all();
|
||||
|
||||
<?php
|
||||
// ugly UserID code that should be turned into a function . . .
|
||||
if(!empty($_GET['userid'])) {
|
||||
if(!check_perms('users_override_paranoia')) {
|
||||
error(403);
|
||||
}
|
||||
$UserID = $_GET['userid'];
|
||||
if(!is_number($UserID)) { error(404); }
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
|
||||
list($Username) = $DB->next_record();
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
}
|
||||
|
||||
// Finally we start
|
||||
|
||||
//Require the table class
|
||||
// require_once SERVER_ROOT . '/classes/class_mass_user_torrents_table_view.php';
|
||||
|
||||
View::show_header('Organize Bookmarks', 'browse,jquery,jquery-ui,jquery.tablesorter,sort');
|
||||
|
||||
$EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents';
|
||||
|
||||
list($K, $GroupIDs, $CollageDataList, $TorrentList) = Users::bookmark_data($UserID);
|
||||
|
||||
$TT = new MASS_USER_TORRENTS_TABLE_VIEW($TorrentList, $CollageDataList, $EditType, 'Organize Torrent Bookmarks');
|
||||
$TT->render_all();
|
||||
|
||||
View::show_footer();
|
@ -3,7 +3,7 @@
|
||||
$OtherLink = '';
|
||||
|
||||
$Title = 'Artist comments made by '.($Self?'you':$Username);
|
||||
$Header = 'Artist comments left by '.($Self?'you':format_username($UserID, false, false, false)).'';
|
||||
$Header = 'Artist comments left by '.($Self?'you':Users::format_username($UserID, false, false, false)).'';
|
||||
|
||||
$Comments = $DB->query("SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
|
@ -137,8 +137,17 @@
|
||||
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
|
||||
|
||||
$DB->query("UPDATE users_notify_quoted SET Unread = '0' WHERE UserID = '$LoggedUser[ID]' AND TopicID = '$ThreadID'");
|
||||
|
||||
$QuoteNotifiactionsCount = $Cache->get_value('forums_quotes_'.$LoggedUser['ID']);
|
||||
if($QuoteNotificationsCount > 0) {
|
||||
$Cache->cache_value('forums_quotes_'.$LoggedUser['ID'], $QuoteNotificationsCount - 1, 0);
|
||||
}
|
||||
else {
|
||||
$Cache->delete_value('forums_quotes_'.$LoggedUser['ID']);
|
||||
}
|
||||
|
||||
// Start printing
|
||||
View::show_header($ThreadInfo['Title'] . ' < '.$Forums[$ForumID]['Name'].' < '. 'Forums','comments,subscriptions,bbcode,jquery');
|
||||
?>
|
||||
|
@ -10,6 +10,7 @@
|
||||
</div>
|
||||
<pre id="#debug_report"><?=display_str($Analysis['message'])?></pre>
|
||||
<?
|
||||
$Debug->perf_table($Analysis['perf']);
|
||||
$Debug->flag_table($Analysis['flags']);
|
||||
$Debug->include_table($Analysis['includes']);
|
||||
$Debug->error_table($Analysis['errors']);
|
||||
|
@ -51,6 +51,41 @@
|
||||
View::show_footer();
|
||||
} else {
|
||||
authorize();
|
||||
|
||||
// Votes ninjutsu. This is so annoyingly complicated.
|
||||
// 1. Get a list of everybody who voted on the old group and clear their cache keys
|
||||
$DB->query("SELECT UserID FROM users_votes WHERE GroupID='$GroupID'");
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$Cache->delete_value('voted_albums_'.$UserID);
|
||||
}
|
||||
// 2. Update the existing votes where possible, clear out the duplicates left by key
|
||||
// conflicts, and update the torrents_votes table
|
||||
$DB->query("UPDATE IGNORE users_votes SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
|
||||
$DB->query("DELETE FROM users_votes WHERE GroupID='$GroupID'");
|
||||
$DB->query("INSERT INTO torrents_votes (GroupID, Ups, Total, Score)
|
||||
SELECT $NewGroupID, UpVotes, TotalVotes, VoteScore
|
||||
FROM (SELECT IFNULL(SUM(IF(Type='Up',1,0)),0) As UpVotes,
|
||||
COUNT(1) AS TotalVotes,
|
||||
binomial_ci(IFNULL(SUM(IF(Type='Up',1,0)),0), COUNT(1)) AS VoteScore
|
||||
FROM users_votes
|
||||
WHERE GroupID = $NewGroupID
|
||||
GROUP BY GroupID) AS a
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Ups = a.UpVotes,
|
||||
Total = a.TotalVotes,
|
||||
Score = a.VoteScore;");
|
||||
// 3. Clear the votes_pairs keys!
|
||||
$DB->query("SELECT v2.GroupID
|
||||
FROM users_votes AS v1
|
||||
INNER JOIN users_votes AS v2 USING (UserID)
|
||||
WHERE (v1.Type = 'Up' OR v2.Type='Up')
|
||||
AND (v1.GroupID IN($GroupID, $NewGroupID))
|
||||
AND (v2.GroupID NOT IN($GroupID, $NewGroupID));");
|
||||
while (list($CacheGroupID) = $DB->next_record()) {
|
||||
$Cache->delete_value('vote_pairs_'.$CacheGroupID);
|
||||
}
|
||||
// 4. Clear the new groups vote keys
|
||||
|
||||
|
||||
$DB->query("UPDATE torrents SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
|
||||
$DB->query("UPDATE wiki_torrents SET PageID='$NewGroupID' WHERE PageID='$GroupID'");
|
||||
|
@ -114,7 +114,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
|
||||
|
||||
// Get the relevant filter labels
|
||||
$DB->query("SELECT ID, Label, Artists FROM users_notify_filters WHERE ID IN (".implode(',', $FilterIDs).")");
|
||||
$Filters = $DB->to_array('ID', MYSQLI_ASSOC, array(2));
|
||||
$Filters = $DB->to_array('ID', MYSQLI_ASSOC, array('Artists'));
|
||||
foreach ($Filters as &$Filter) {
|
||||
$Filter['Artists'] = explode('|', trim($Filter['Artists'], '|'));
|
||||
}
|
||||
@ -216,7 +216,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
|
||||
foreach ($GroupInfo['ExtendedArtists'] as $GroupArtists) {
|
||||
foreach ($GroupArtists as $GroupArtist) {
|
||||
foreach ($Filters[$FilterID]['Artists'] as $FilterArtist) {
|
||||
if (!strcasecmp($FilterArtist, $GroupArtist['name'])) {
|
||||
if (mb_strtolower($FilterArtist, 'UTF-8') == mb_strtolower($GroupArtist['name'], 'UTF-8')) {
|
||||
$MatchingArtists[] = $GroupArtist['name'];
|
||||
}
|
||||
}
|
||||
@ -259,7 +259,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
|
||||
|
||||
// print row
|
||||
?>
|
||||
<tr class="torrent" id="torrent<?=$TorrentID?>"<?=$MatchingArtistsText ? 'title="'.$MatchingArtistsText.'"' : ''?>>
|
||||
<tr class="torrent" id="torrent<?=$TorrentID?>"<?=$MatchingArtistsText ? 'title="'.display_str($MatchingArtistsText).'"' : ''?>>
|
||||
<td style="text-align: center"><input type="checkbox" value="<?=$TorrentID?>" id="clear_<?=$TorrentID?>" /></td>
|
||||
<td class="center cats_col"><div title="<?=ucfirst(str_replace('_',' ',$MainTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1])).' tags_'.str_replace('.','_',$MainTag)?>"></div></td>
|
||||
<td>
|
||||
|
@ -22,7 +22,7 @@
|
||||
$Voted = isset($UserVotes[$GroupID])?$UserVotes[$GroupID]['Type']:false;
|
||||
?>
|
||||
<div class="box" id="votes">
|
||||
<div class="head"><strong>Favorite Album Votes</strong></div>
|
||||
<div class="head"><strong>Album Votes</strong></div>
|
||||
<div class="album_votes body">
|
||||
This has <span id="upvotes" class="favoritecount"><?=$UpVotes?></span> <?=(($UpVotes==1)?'upvote':'upvotes')?> out of <span id="totalvotes" class="favoritecount"><?=$TotalVotes?></span> total<span id="upvoted" <?=($Voted!='Up'?'class="hidden"':'')?>>, including your upvote</span><span id="downvoted" <?=($Voted!='Down'?'class="hidden"':'')?>>, including your downvote</span>.
|
||||
<br /><br />
|
||||
|
@ -163,6 +163,7 @@ function checked($Checked) {
|
||||
|
||||
<a href="#" id="toggle_sortable" onclick="return false;">Expand</a>
|
||||
<div id="sortable_container" style="display: none;">
|
||||
<a href="#" id="reset_sortable" onclick="return false;">Reset to Default</a>
|
||||
<ul class="sortable_list" id="sortable">
|
||||
|
||||
<?
|
||||
@ -204,36 +205,6 @@ function checked($Checked) {
|
||||
<input type="hidden" id="sorthide" name="sorthide" value=""/>
|
||||
|
||||
<?
|
||||
/*
|
||||
for($i = 0; list($Key,$Val) = each($ReleaseTypes); $i++) {
|
||||
if(!($i % 7)) {
|
||||
if($i) {
|
||||
?>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<tr style="border:none;">
|
||||
<?
|
||||
}
|
||||
if(!empty($SiteOptions['HideTypes']) && in_array($Key, $SiteOptions['HideTypes'])) {
|
||||
$Checked = 'checked="checked" ';
|
||||
} else {
|
||||
$Checked='';
|
||||
}
|
||||
?>
|
||||
<td style="border:none;">
|
||||
<label><input type="checkbox" id="hide_type_<?=$Key?>" name="hidetypes[]=" value="<?=$Key?>" <?=$Checked?>/>
|
||||
<?=$Val?></label>
|
||||
</td>
|
||||
<?
|
||||
}
|
||||
if($i % 7) {
|
||||
?>
|
||||
<td style="border:none;" colspan="<?=7 - ($i % 7)?>"></td>
|
||||
<?
|
||||
}
|
||||
*/
|
||||
unset($ReleaseTypes[1023], $ReleaseTypes[1024], $ReleaseTypes[1022]);
|
||||
?>
|
||||
</tr>
|
||||
|
1031
static/functions/jquery.tablesorter.js
Normal file
1031
static/functions/jquery.tablesorter.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
//Couldn't use an associative array because javascript sorting is stupid http://dev-answers.blogspot.com/2012/03/javascript-object-keys-being-sorted-in.html
|
||||
|
||||
(function($) {
|
||||
var DEFAULT = '\x3Cul class=\"sortable_list ui-sortable\" id=\"sortable\" style=\"\"\x3E\n\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1_0\"\x3EAlbum\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"3_0\"\x3ESoundtrack\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"5_0\"\x3EEP\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"6_0\"\x3EAnthology\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"7_0\"\x3ECompilation\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"9_0\"\x3ESingle\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"11_0\"\x3ELive album\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"13_0\"\x3ERemix\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"14_0\"\x3EBootleg\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"15_0\"\x3EInterview\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"16_0\"\x3EMixtape\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"21_0\"\x3EUnknown\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1024_0\"\x3EGuest Appearance\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1023_0\"\x3ERemixed By\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1022_0\"\x3EComposition\x3C\x2Fli\x3E\n\t\t\x3Cli class=\"sortable_item\" style=\"\"\x3E\x3Cinput type=\"checkbox\" id=\"1021_0\"\x3EProduced By\x3C\x2Fli\x3E\n\t\t\x3C\x2Ful\x3E';
|
||||
$(document).ready(function() {
|
||||
serialize();
|
||||
$("#sortable").sortable({
|
||||
@ -14,6 +15,10 @@
|
||||
$("#toggle_sortable").text($(this).is(":visible") ? "Collapse" : "Expand");
|
||||
});
|
||||
});
|
||||
$("#reset_sortable").click(function () {
|
||||
$('#sortable').html(DEFAULT);
|
||||
serialize();
|
||||
});
|
||||
});
|
||||
function serialize() {
|
||||
var a = new Array();
|
||||
|
@ -1,5 +1,17 @@
|
||||
var sortableTable;
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'relative_time',
|
||||
is: function (s) {
|
||||
return false;
|
||||
},
|
||||
format: function(str, table, td) {
|
||||
return td.title;
|
||||
},
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
sortableTable = {
|
||||
container : $('#manage_collage_table'),
|
||||
form : $('#drag_drop_collage_form'),
|
||||
@ -57,17 +69,14 @@ jQuery(document).ready(function ($) {
|
||||
});
|
||||
},
|
||||
tableSorter : function () {
|
||||
var obj = { 0: { sorter : false }, 6: { sorter : false } };
|
||||
if (this.check.length !== 0) {
|
||||
obj[5] = { sorter : 'relative_time' };
|
||||
}
|
||||
this.container.tablesorter({
|
||||
cssHeader : 'headerSort',
|
||||
textExtraction: sortableTable.extractor,
|
||||
headers : {
|
||||
0: {
|
||||
sorter : false
|
||||
},
|
||||
6: {
|
||||
sorter : false
|
||||
}
|
||||
}
|
||||
headers : obj
|
||||
}).on('sortEnd', sortableTable.postSort);
|
||||
},
|
||||
extractor : function (node) {
|
||||
@ -81,7 +90,7 @@ jQuery(document).ready(function ($) {
|
||||
var span = $('<a href="#" title="Toggle Note">(Hide)</a>').click(function (e) {
|
||||
e.preventDefault();
|
||||
$('#drag_drop_textnote > :first-child').toggle();
|
||||
$this = $(this);
|
||||
var $this = $(this);
|
||||
$this.text($this.text() === '(Hide)' ? '(Show)' : '(Hide)');
|
||||
});
|
||||
$('#sorting_head').append(' ', span);
|
||||
|
Loading…
Reference in New Issue
Block a user