Empty commit

This commit is contained in:
Git 2013-05-07 08:00:23 +00:00
parent 0c3c009079
commit 2973742f7b
6 changed files with 94 additions and 62 deletions

View File

@ -77,31 +77,34 @@ function compare($X, $Y) {
ob_start();
// Requests
$Requests = $Cache->get_value('artists_requests_'.$ArtistID);
if (!is_array($Requests)) {
$DB->query("
SELECT
r.ID,
r.CategoryID,
r.Title,
r.Year,
r.TimeAdded,
COUNT(rv.UserID) AS Votes,
SUM(rv.Bounty) AS Bounty
FROM requests AS r
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
WHERE ra.ArtistID = ".$ArtistID."
AND r.TorrentID = 0
GROUP BY r.ID
ORDER BY Votes DESC");
$Requests = array();
if (empty($LoggedUser['DisableRequests'])) {
$Requests = $Cache->get_value('artists_requests_'.$ArtistID);
if (!is_array($Requests)) {
$DB->query("
SELECT
r.ID,
r.CategoryID,
r.Title,
r.Year,
r.TimeAdded,
COUNT(rv.UserID) AS Votes,
SUM(rv.Bounty) AS Bounty
FROM requests AS r
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
WHERE ra.ArtistID = ".$ArtistID."
AND r.TorrentID = 0
GROUP BY r.ID
ORDER BY Votes DESC");
if ($DB->record_count() > 0) {
$Requests = $DB->to_array();
} else {
$Requests = array();
if ($DB->record_count() > 0) {
$Requests = $DB->to_array();
} else {
$Requests = array();
}
$Cache->cache_value('artists_requests_'.$ArtistID, $Requests);
}
$Cache->cache_value('artists_requests_'.$ArtistID, $Requests);
}
$NumRequests = count($Requests);

View File

@ -38,7 +38,13 @@
if (!$ClassDistribution = $Cache->get_value('class_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query("SELECT p.Name, COUNT(m.ID) AS Users FROM users_main AS m JOIN permissions AS p ON m.PermissionID=p.ID WHERE m.Enabled='1' GROUP BY p.Name ORDER BY Users DESC");
$DB->query("
SELECT p.Name, COUNT(m.ID) AS Users
FROM users_main AS m
JOIN permissions AS p ON m.PermissionID=p.ID
WHERE m.Enabled='1'
GROUP BY p.Name
ORDER BY Users DESC");
$ClassSizes = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
foreach ($ClassSizes as $ClassSize) {
@ -49,13 +55,17 @@
$Pie->color('FF33CC');
$Pie->generate();
$ClassDistribution = $Pie->url();
$Cache->cache_value('class_distribution',$ClassDistribution,3600*24*14);
$Cache->cache_value('class_distribution', $ClassDistribution, 3600 * 24 * 14);
}
if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query("SELECT OperatingSystem, COUNT(UserID) AS Users FROM users_sessions GROUP BY OperatingSystem ORDER BY Users DESC");
$DB->query("
SELECT OperatingSystem, COUNT(UserID) AS Users
FROM users_sessions
GROUP BY OperatingSystem
ORDER BY Users DESC");
$Platforms = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
@ -67,14 +77,18 @@
$Pie->color('8A00B8');
$Pie->generate();
$PlatformDistribution = $Pie->url();
$Cache->cache_value('platform_distribution',$PlatformDistribution,3600 * 24 * 14);
$Cache->cache_value('platform_distribution', $PlatformDistribution, 3600 * 24 * 14);
}
if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query("SELECT Browser, COUNT(UserID) AS Users FROM users_sessions GROUP BY Browser ORDER BY Users DESC");
$DB->query("
SELECT Browser, COUNT(UserID) AS Users
FROM users_sessions
GROUP BY Browser
ORDER BY Users DESC");
$Browsers = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
@ -86,15 +100,25 @@
$Pie->color('008AB8');
$Pie->generate();
$BrowserDistribution = $Pie->url();
$Cache->cache_value('browser_distribution',$BrowserDistribution,3600 * 24 * 14);
$Cache->cache_value('browser_distribution', $BrowserDistribution, 3600 * 24 * 14);
}
//Timeline generation
if (!list($Labels,$InFlow,$OutFlow,$Max) = $Cache->get_value('users_timeline')) {
$DB->query("SELECT DATE_FORMAT(JoinDate,'%b \\'%y') AS Month, COUNT(UserID) FROM users_info GROUP BY Month ORDER BY JoinDate DESC LIMIT 1, 12");
$DB->query("
SELECT DATE_FORMAT(JoinDate,'%b \\'%y') AS Month, COUNT(UserID)
FROM users_info
GROUP BY Month
ORDER BY JoinDate DESC
LIMIT 1, 12");
$TimelineIn = array_reverse($DB->to_array());
$DB->query("SELECT DATE_FORMAT(BanDate,'%b \\'%y') AS Month, COUNT(UserID) FROM users_info GROUP BY Month ORDER BY BanDate DESC LIMIT 1, 12");
$DB->query("
SELECT DATE_FORMAT(BanDate,'%b \\'%y') AS Month, COUNT(UserID)
FROM users_info
GROUP BY Month
ORDER BY BanDate DESC
LIMIT 1, 12");
$TimelineOut = array_reverse($DB->to_array());
foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month;

View File

@ -608,7 +608,7 @@ function filelist($Str) {
</table>
<?
$Requests = get_group_requests($GroupID);
if (count($Requests) > 0) {
if (empty($LoggedUser['DisableRequests']) && count($Requests) > 0) {
$i = 0;
?>
<div class="box">

View File

@ -188,6 +188,8 @@
$DB->query("UPDATE users_main SET IP='127.0.0.1' WHERE ID='$UserID'");
$DB->query("UPDATE xbt_snatched SET IP = '' WHERE uid='$UserID'");
$DB->query("UPDATE users_history_passwords SET ChangerIP = '' WHERE UserID = ".$UserID);
$DB->query("UPDATE users_history_passkeys SET ChangerIP = '' WHERE UserID = ".$UserID);
$EditSummary[] = 'IP history cleared';
}

View File

@ -664,7 +664,7 @@ function check_paranoia_here($Setting) {
}
// Requests
if (check_paranoia_here('requestsvoted_list')) {
if (empty($LoggedUser['DisableRequests']) && check_paranoia_here('requestsvoted_list')) {
$DB->query("SELECT
r.ID,
r.CategoryID,

View File

@ -143,12 +143,12 @@ function UnBan(ip, id, elemID) {
</div>
<div class="linkbox">
<? if ($UsersOnly) { ?>
<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View all IP addresses</a>
<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" class="brackets">View all IP addresses</a>
<? } else { ?>
<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View IP addresses with users</a>
<a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>&amp;usersonly=1" class="brackets">View IP addresses with users</a>
<? } ?>
<br />
<?=$Pages?>
<br />
<?=$Pages?>
</div>
<table>
<tr class="colhead">
@ -163,11 +163,13 @@ function UnBan(ip, id, elemID) {
</td></tr>
</table>
<table>
<table id="iphistory">
<tr class="colhead">
<td>IP address</td>
<td>Started</td>
<td>Started <a href="#" onclick="$('#iphistory td:nth-child(2), #iphistory td:nth-child(4)').hide(); $('#iphistory td:nth-child(3), #iphistory td:nth-child(5)').show(); return false;" class="brackets">Toggle</a></td>
<td class="hidden">Started <a href="#" onclick="$('#iphistory td:nth-child(2), #iphistory td:nth-child(4)').show(); $('#iphistory td:nth-child(3), #iphistory td:nth-child(5)').hide(); return false;" class="brackets">Toggle</a></td>
<td>Ended</td>
<td class="hidden">Ended</td>
<td>Elapsed</td>
</tr>
<?
@ -198,54 +200,55 @@ function UnBan(ip, id, elemID) {
<td>
<?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)<?
if ($CanManageIPBans) {
if (!isset($IPs[$IP])) {
$sql = "SELECT ID, FromIP, ToIP FROM ip_bans WHERE '".Tools::ip_to_unsigned($IP)."' BETWEEN FromIP AND ToIP LIMIT 1";
if (!isset($IPs[$IP])) {
$sql = "SELECT ID, FromIP, ToIP FROM ip_bans WHERE '".Tools::ip_to_unsigned($IP)."' BETWEEN FromIP AND ToIP LIMIT 1";
$DB->query($sql);
if ($DB->record_count() > 0) {
$IPs[$IP] = true;
?>
<strong>[Banned]
<? }
else {
$IPs[$IP] = false; ?>
$IPs[$IP] = true;
?>
<strong>[Banned]</strong>
<?
} else {
$IPs[$IP] = false;
?>
<a id="<?=$counter?>" href="#" onclick="Ban('<?=$IP?>', '<?=$ID?>', '<?=$counter?>'); this.onclick=null;return false;" class="brackets">Ban</a>
<? }
<?
}
$counter++;
}
}
?>
<br />
<?=Tools::get_host_by_ajax($IP)?>
<?=($HasDupe ?
'<a href="#" onclick="ShowIPs('.$Index.'); return false;">('.count($UserIDs).')</a>'
: '(0)')?></td>
<br />
<?=Tools::get_host_by_ajax($IP)?>
<?=($HasDupe ? '<a href="#" onclick="ShowIPs('.$Index.'); return false;">('.count($UserIDs).')</a>' : '(0)')?>
</td>
<td><?=time_diff($StartTime)?></td>
<td class="hidden"><?=$StartTime?></td>
<td><?=time_diff($EndTime)?></td>
<td class="hidden"><?=$EndTime?></td>
<td><?//time_diff(strtotime($StartTime), strtotime($EndTime)); ?></td>
</tr>
<?
if ($HasDupe) {
$HideMe = (count($UserIDs) > 10);
foreach ($UserIDs as $Key => $Val) {
if (!$UserEndTimes[$Key]) {
$UserEndTimes[$Key] = sqltime();
}
if (!$UserEndTimes[$Key]) {
$UserEndTimes[$Key] = sqltime();
}
?>
<tr class="rowb<?=($HideMe ? ' hidden' : '')?>" name="<?=$Index?>">
<td>&nbsp;&nbsp;&#187;&nbsp;<?=Users::format_username($Val, true, true, true)?></td>
<td><?=time_diff($UserStartTimes[$Key])?></td>
<td class="hidden"><?=$UserStartTimes[$Key]?></td>
<td><?=time_diff($UserEndTimes[$Key])?></td>
<td class="hidden"><?=$UserEndTimes[$Key]?></td>
<td><?//time_diff(strtotime($UserStartTimes[$Key]), strtotime($UserEndTimes[$Key])); ?></td>
</tr>
<?
}
}
?>
<?
}
?>
</table>
@ -253,5 +256,5 @@ function UnBan(ip, id, elemID) {
<?=$Pages?>
</div>
</div>
<? View::show_footer(); ?>
<?
View::show_footer();