Empty commit

This commit is contained in:
Git 2013-05-02 08:00:23 +00:00
parent 1ad3d86466
commit 1319d254ea
25 changed files with 496 additions and 397 deletions

View File

@ -3,24 +3,24 @@
$CollageID = $_POST['collageid'];
if(!is_number($CollageID) || !$CollageID) {
if (!is_number($CollageID) || !$CollageID) {
error(404);
}
$DB->query("SELECT Name, CategoryID, UserID FROM collages WHERE ID='$CollageID'");
list($Name, $CategoryID, $UserID) = $DB->next_record(MYSQLI_NUM, false);
if(!check_perms('site_collages_delete') && $UserID != $LoggedUser['ID']) {
if (!check_perms('site_collages_delete') && $UserID != $LoggedUser['ID']) {
error(403);
}
$Reason = trim($_POST['reason']);
if(!$Reason) {
error("You must enter a reason!");
if (!$Reason) {
error('You must enter a reason!');
}
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID'");
while(list($GroupID) = $DB->next_record()) {
while (list($GroupID) = $DB->next_record()) {
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
@ -35,7 +35,7 @@
$DB->query("UPDATE collages SET Deleted = '1' WHERE ID='$CollageID'");
}
Misc::write_log("Collage ".$CollageID." (".$Name.") was deleted by ".$LoggedUser['Username'].": ".$Reason);
Misc::write_log("Collage $CollageID ($Name) was deleted by ".$LoggedUser['Username'].': '.$Reason);
$Cache->delete_value('collage_'.$CollageID);
header('Location: collages.php');

View File

@ -162,22 +162,24 @@
uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
<br />
<div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
<? $DB->query("SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.GroupID=$GroupID");
<? $DB->query("
SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.GroupID=$GroupID");
$GroupOthers = ($DB->record_count() - 1);
if ($GroupOthers > 0) { ?>
<div style="text-align: right;">
<a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers other reports" : "is 1 other report")?> for torrents in this group</a>
</div>
<? $DB->query("SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.UserID=$UploaderID");
<? $DB->query("
SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.UserID=$UploaderID");
$UploaderOthers = ($DB->record_count() - 1);
if ($UploaderOthers > 0) { ?>
@ -186,20 +188,21 @@
</div>
<? }
$DB->query("SELECT DISTINCT req.ID,
req.FillerID,
um.Username,
req.TimeFilled
FROM requests AS req
LEFT JOIN torrents AS t ON t.ID=req.TorrentID
LEFT JOIN reportsv2 AS rep ON rep.TorrentID=t.ID
JOIN users_main AS um ON um.ID=req.FillerID
WHERE rep.Status != 'Resolved'
AND req.TimeFilled > '2010-03-04 02:31:49'
AND req.TorrentID=$TorrentID");
$DB->query("
SELECT DISTINCT req.ID,
req.FillerID,
um.Username,
req.TimeFilled
FROM requests AS req
LEFT JOIN torrents AS t ON t.ID=req.TorrentID
LEFT JOIN reportsv2 AS rep ON rep.TorrentID=t.ID
JOIN users_main AS um ON um.ID=req.FillerID
WHERE rep.Status != 'Resolved'
AND req.TimeFilled > '2010-03-04 02:31:49'
AND req.TorrentID=$TorrentID");
$Requests = ($DB->record_count());
if ($Requests > 0) {
while(list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
?>
<div style="text-align: right;">
<strong class="important_text"><a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a> used this torrent to fill <a href="requests.php?action=view&amp;id=<?=$RequestID?>">this request</a> <?=time_diff($FilledTime)?></strong>
@ -244,44 +247,45 @@
<td colspan="3">
<?
$First = true;
$Extras = explode(" ", $ExtraIDs);
$Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) {
$DB->query("SELECT
tg.Name,
tg.ID,
CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.ArtistID
WHEN 0 THEN '0'
ELSE '0'
END AS ArtistID,
CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.Name
WHEN 0 THEN ''
ELSE 'Various Artists'
END AS ArtistName,
tg.Year,
t.Time,
t.Remastered,
t.RemasterTitle,
t.RemasterYear,
t.Media,
t.Format,
t.Encoding,
t.Size,
t.HasCue,
t.HasLog,
t.LogScore,
t.UserID AS UploaderID,
uploader.Username
FROM torrents AS t
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
WHERE t.ID='$ExtraID'
GROUP BY tg.ID");
$DB->query("
SELECT
tg.Name,
tg.ID,
CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.ArtistID
WHEN 0 THEN '0'
ELSE '0'
END AS ArtistID,
CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.Name
WHEN 0 THEN ''
ELSE 'Various Artists'
END AS ArtistName,
tg.Year,
t.Time,
t.Remastered,
t.RemasterTitle,
t.RemasterYear,
t.Media,
t.Format,
t.Encoding,
t.Size,
t.HasCue,
t.HasLog,
t.LogScore,
t.UserID AS UploaderID,
uploader.Username
FROM torrents AS t
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
WHERE t.ID='$ExtraID'
GROUP BY tg.ID");
list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle,
$ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record());
@ -289,13 +293,12 @@
if ($ExtraGroupName) {
if ($ArtistID == 0 && empty($ArtistName)) {
$ExtraLinkName = "<a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
$ExtraLinkName = "<a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : '').'</a> '.($ExtraHasLog == '1' ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID\">(Log: $ExtraLogScore %)</a>" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$ExtraLinkName = "Various Artists - <a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
$ExtraLinkName = "Various Artists - <a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : '')."</a> ".($ExtraHasLog == '1' ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID\">(Log: $ExtraLogScore %)</a>" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
} else {
$ExtraLinkName = "<a href='artist.php?id=$ExtraArtistID'>$ExtraArtistName</a> - <a href='torrents.php?id=$ExtraGroupID'>$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")."</a> <a href='torrents.php?torrentid=$ExtraID'> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : "")."</a> ".($ExtraHasLog == '1' ? " <a href='torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID'>(Log: $ExtraLogScore %)</a>" : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
$ExtraLinkName = "<a href=\"artist.php?id=$ExtraArtistID\">$ExtraArtistName</a> - <a href=\"torrents.php?id=$ExtraGroupID\">$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')."</a> <a href=\"torrents.php?torrentid=$ExtraID\"> [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " &lt;$ExtraRemasterTitle - $ExtraRemasterYear&gt;" : '').'</a> '.($ExtraHasLog == '1' ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$ExtraID&amp;groupid=$ExtraGroupID\">(Log: $ExtraLogScore %)</a>" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
}
?>
<?=($First ? '' : '<br />')?>
<?=$ExtraLinkName?>
@ -366,7 +369,7 @@
<strong>Warning</strong>
<select name="warning" id="warning<?=$ReportID?>">
<?
for($i = 0; $i < 9; $i++) {
for ($i = 0; $i < 9; $i++) {
?>
<option value="<?=$i?>"><?=$i?></option>
<?

View File

@ -1,5 +1,7 @@
<?
if(!check_perms('site_debug')) { error(403); }
if (!check_perms('site_debug')) {
error(403);
}
//View schemas
if (!empty($_GET['table'])) {
@ -18,7 +20,7 @@
if (!$Tables = $Cache->get_value('database_table_stats')) {
$DB->query('SHOW TABLE STATUS');
$Tables =$DB->to_array();
$Cache->cache_value('database_table_stats',$Tables,3600*4);
$Cache->cache_value('database_table_stats', $Tables, 3600 * 4);
}
require(SERVER_ROOT.'/classes/class_charts.php');
@ -26,7 +28,7 @@
//Begin sorting
$Sort = array();
switch (empty($_GET['order_by'])?'':$_GET['order_by']) {
switch (empty($_GET['order_by']) ? '' : $_GET['order_by']) {
case 'name':
foreach ($Tables as $Key => $Value) {
$Pie->add($Value[0], $Value[6] + $Value[8]);
@ -90,13 +92,13 @@
<br />
<table>
<tr class="colhead">
<td><a href="tools.php?action=database_specifics&amp;order_by=name&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'name' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Name</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=engine&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'engine' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Engine</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=rows&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'rows' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Rows</td>
<td><a href="tools.php?action=database_specifics&amp;order_by=rowsize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'rowsize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Row Size</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=datasize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'datasize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Data Size</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=indexsize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'indexsize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Index Size</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=totalsize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'totalsize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc')?'asc':'desc'?>">Total Size</td>
<td><a href="tools.php?action=database_specifics&amp;order_by=name&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'name' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Name</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=engine&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'engine' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Engine</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=rows&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'rows' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Rows</td>
<td><a href="tools.php?action=database_specifics&amp;order_by=rowsize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'rowsize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Row Size</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=datasize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'datasize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Data Size</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=indexsize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'indexsize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Index Size</a></td>
<td><a href="tools.php?action=database_specifics&amp;order_by=totalsize&amp;order_way=<?=(!empty($_GET['order_by']) && $_GET['order_by'] == 'totalsize' && !empty($_GET['order_way']) && $_GET['order_way'] == 'desc') ? 'asc' : 'desc'?>">Total Size</td>
<td>Tools</td>
</tr>
<?

View File

@ -26,7 +26,9 @@
a. number of users changed by ratio being changed
b. project effects with intelligent mathematical analysis of a 24, 48 or 72 hour freeleech
*/
if(!check_perms('site_view_flow')) { error(403); }
if (!check_perms('site_view_flow')) {
error(403);
}
View::show_header('Economy');
if (!$EconomicStats = $Cache->get_value('new_economic_stats')) {
@ -43,7 +45,7 @@
$DB->query("SELECT COUNT(uid) FROM xbt_snatched");
list($TotalOverallSnatches) = $DB->next_record();
if(($PeerStats = $Cache->get_value('stats_peers')) === false) {
if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
$DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining=0");
list($TotalSeeders) = $DB->next_record();
$DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining>0");
@ -52,7 +54,12 @@
list($TotalLeechers,$TotalSeeders) = $PeerStats;
}
$TotalPeers = $TotalLeechers + $TotalSeeders;
$DB->query("SELECT COUNT(ID) FROM users_main WHERE(SELECT COUNT(uid) FROM xbt_files_users WHERE uid=users_main.ID)>0");
$DB->query("
SELECT COUNT(ID)
FROM users_main
WHERE ( SELECT COUNT(uid)
FROM xbt_files_users
WHERE uid=users_main.ID)>0");
list($TotalPeerUsers) = $DB->next_record();
$Cache->cache_value('new_economic_stats',
array($TotalUpload,$TotalDownload,$NumUsers,$TotalBounty,
@ -75,12 +82,12 @@
<ul class="stats nobullet">
<li><strong>Total upload: </strong><?=Format::get_size($TotalUpload)?></li>
<li><strong>Total download: </strong><?=Format::get_size($TotalDownload)?></li>
<li><strong>Total buffer: </strong><?=Format::get_size($TotalUpload-$TotalDownload)?></li>
<li><strong>Total buffer: </strong><?=Format::get_size($TotalUpload - $TotalDownload)?></li>
<br />
<li><strong>Mean ratio: </strong><?=Format::get_ratio_html($TotalUpload,$TotalDownload)?></li>
<li><strong>Mean upload: </strong><?=Format::get_size($TotalUpload/$NumUsers)?></li>
<li><strong>Mean download: </strong><?=Format::get_size($TotalDownload/$NumUsers)?></li>
<li><strong>Mean buffer: </strong><?=Format::get_size(($TotalUpload-$TotalDownload)/$NumUsers)?></li>
<li><strong>Mean ratio: </strong><?=Format::get_ratio_html($TotalUpload, $TotalDownload)?></li>
<li><strong>Mean upload: </strong><?=Format::get_size($TotalUpload / $NumUsers)?></li>
<li><strong>Mean download: </strong><?=Format::get_size($TotalDownload / $NumUsers)?></li>
<li><strong>Mean buffer: </strong><?=Format::get_size(($TotalUpload - $TotalDownload) / $NumUsers)?></li>
<br />
<li><strong>Total request bounty: </strong><?=Format::get_size($TotalBounty)?></li>
<li><strong>Available request bounty: </strong><?=Format::get_size($AvailableBounty)?></li>
@ -99,18 +106,18 @@
<li><strong>Seeder/leecher ratio: </strong><?=Format::get_ratio_html($TotalSeeders,$TotalLeechers)?></li>
<li><strong>Seeder/snatch ratio: </strong><?=Format::get_ratio_html($TotalSeeders,$TotalOverallSnatches)?></li>
<br />
<li><strong>Mean seeders per torrent: </strong><?=number_format($TotalSeeders/$TotalTorrents, 2)?></li>
<li><strong>Mean leechers per torrent: </strong><?=number_format($TotalLeechers/$TotalTorrents, 2)?></li>
<li><strong>Mean snatches per torrent: </strong><?=number_format($TotalSnatches/$TotalTorrents, 2)?></li>
<li><strong>Mean seeders per torrent: </strong><?=number_format($TotalSeeders / $TotalTorrents, 2)?></li>
<li><strong>Mean leechers per torrent: </strong><?=number_format($TotalLeechers / $TotalTorrents, 2)?></li>
<li><strong>Mean snatches per torrent: </strong><?=number_format($TotalSnatches / $TotalTorrents, 2)?></li>
<br />
<li><strong>Mean seeding per user: </strong><?=number_format($TotalSeeders/$NumUsers, 2)?></li>
<li><strong>Mean leeching per user: </strong><?=number_format($TotalLeechers/$NumUsers, 2)?></li>
<li><strong>Mean snatches per user: </strong><?=number_format($TotalOverallSnatches/$NumUsers, 2)?></li>
<li><strong>Mean seeding per user: </strong><?=number_format($TotalSeeders / $NumUsers, 2)?></li>
<li><strong>Mean leeching per user: </strong><?=number_format($TotalLeechers / $NumUsers, 2)?></li>
<li><strong>Mean snatches per user: </strong><?=number_format($TotalOverallSnatches / $NumUsers, 2)?></li>
<br />
<li><strong>Total users in at least 1 swarm: </strong><?=number_format($TotalPeerUsers)?></li>
<li><strong>Mean seeding per user in at least 1 swarm: </strong><?=number_format($TotalSeeders/$TotalPeerUsers, 2)?></li>
<li><strong>Mean leeching per user in at least 1 swarm: </strong><?=number_format($TotalLeechers/$TotalPeerUsers, 2)?></li>
<li><strong>Mean snatches per user in at least 1 swarm: </strong><?=number_format($TotalSnatches/$TotalPeerUsers, 2)?></li>
<li><strong>Mean seeding per user in at least 1 swarm: </strong><?=number_format($TotalSeeders / $TotalPeerUsers, 2)?></li>
<li><strong>Mean leeching per user in at least 1 swarm: </strong><?=number_format($TotalLeechers / $TotalPeerUsers, 2)?></li>
<li><strong>Mean snatches per user in at least 1 swarm: </strong><?=number_format($TotalSnatches / $TotalPeerUsers, 2)?></li>
</ul>
</div>
</div>

View File

@ -15,18 +15,19 @@
if (!empty($_GET['search'])) {
$Search = db_string($_GET['search']);
} else {
$Search = "";
$Search = '';
}
$sql = "SELECT
SQL_CALC_FOUND_ROWS
um.ID,
um.IP,
i.InviteKey,
i.Expires,
i.Email
$sql = "
SELECT
SQL_CALC_FOUND_ROWS
um.ID,
um.IP,
i.InviteKey,
i.Expires,
i.Email
FROM invites as i
JOIN users_main AS um ON um.ID = i.InviterID ";
JOIN users_main AS um ON um.ID = i.InviterID ";
if ($Search) {
$sql .= "WHERE i.Email LIKE '%$Search%' ";
}
@ -70,7 +71,7 @@
<td>IP</td>
<td>InviteCode</td>
<td>Expires</td>
<? if(check_perms('users_edit_invites')){ ?>
<? if (check_perms('users_edit_invites')) { ?>
<td>Controls</td>
<? } ?>
</tr>

View File

@ -2,14 +2,16 @@
//TODO: Accelerator cache keys, removed scripts (stats here and a class to manage them (we'd probably never use it, but I like completeness))
//INFO: http://bart.eaccelerator.net/doc/phpdoc/
//INFO: http://bakery.cakephp.org/articles/view/eaccelerator-cache-engine - pertains to potential todo for eAccelerator cache class
if(!check_perms('site_debug')) { error(403); }
if (!check_perms('site_debug')) {
error(403);
}
if (!extension_loaded('eAccelerator')) {
error('eAccelerator Extension not loaded.');
}
if (isset($_POST['submit'])) {
if($_POST['cache'] == 1) {
if ($_POST['cache'] == 1) {
authorize();
eaccelerator_caching(true);
@ -17,7 +19,7 @@
eaccelerator_caching(false);
}
if (function_exists('eaccelerator_optimizer')) {
if($_POST['optimize'] == 1) {
if ($_POST['optimize'] == 1) {
authorize();
@ -61,10 +63,10 @@
<tr>
<td><strong>Enable:</strong></td>
<td>
<input type="checkbox" name="cache" value="1" id="cache"<?=($Opcode['cache'])?' checked="checked"':''?> />
<input type="checkbox" name="cache" value="1" id="cache"<?=($Opcode['cache']) ? ' checked="checked"' : '' ?> />
<label for="cache">Cache</label>
<? if (function_exists('eaccelerator_optimizer')) { ?>
<input type="checkbox" name="optimize" value="1" id="optimize"<?=($Opcode['optimizer'])?' checked="checked"':''?> />
<input type="checkbox" name="optimize" value="1" id="optimize"<?=($Opcode['optimizer']) ? ' checked="checked"' : '' ?> />
<label for="optimize">Optimize</label>
<? } ?>
</td>
@ -97,9 +99,9 @@
<td>Total Storage:</td>
<td><?=Format::get_size($Opcode['memorySize'])?></td>
<td>Used Storage:</td>
<td><?=Format::get_size($Opcode['memoryAllocated'])?> (<?=number_format(($Opcode['memoryAllocated']/$Opcode['memorySize'])*100, 3);?>%)</td>
<td><?=Format::get_size($Opcode['memoryAllocated'])?> (<?=number_format(($Opcode['memoryAllocated'] / $Opcode['memorySize']) * 100, 3);?>%)</td>
<td>Free Storage:</td>
<td><?=Format::get_size($Opcode['memoryAvailable'])?> (<?=number_format(($Opcode['memoryAvailable']/$Opcode['memorySize'])*100, 3);?>%)</td>
<td><?=Format::get_size($Opcode['memoryAvailable'])?> (<?=number_format(($Opcode['memoryAvailable'] / $Opcode['memorySize']) * 100, 3);?>%)</td>
</tr>
<tr>
<td>Cached Scripts:</td>
@ -123,7 +125,7 @@
<td>Hits</td>
</tr>
<?
if(count($CachedScripts) == 0) { // Uh-oh, try again.
if (count($CachedScripts) == 0) { // Uh-oh, try again.
echo '<tr><td colspan="5">No scripts cached.</td></tr>';
}
$Row = 'a'; // For the pretty colours
@ -142,4 +144,4 @@
?>
</table>
</div>
<? View::show_footer(); ?>
<? View::show_footer(); ?>

View File

@ -1,5 +1,7 @@
<?
if(!check_perms('users_view_ips') || !check_perms('users_view_email')) { error(403); }
if (!check_perms('users_view_ips') || !check_perms('users_view_email')) {
error(403);
}
View::show_header('Registration log');
define('USERS_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
@ -7,57 +9,64 @@
$AfterDate = $_POST['after_date'];
$BeforeDate = $_POST['before_date'];
$DateSearch = false;
if(!empty($AfterDate) && !empty($BeforeDate)) {
list($Y, $M, $D) = explode("-", $AfterDate);
if(!checkdate($M, $D, $Y)) {
error("Incorrect 'after' date format");
if (!empty($AfterDate) && !empty($BeforeDate)) {
list($Y, $M, $D) = explode('-', $AfterDate);
if (!checkdate($M, $D, $Y)) {
error('Incorrect "after" date format');
}
list($Y, $M, $D) = explode("-", $BeforeDate);
if(!checkdate($M, $D, $Y)) {
error("Incorrect 'before' date format");
list($Y, $M, $D) = explode('-', $BeforeDate);
if (!checkdate($M, $D, $Y)) {
error('Incorrect "before" date format');
}
$AfterDate = db_string($AfterDate);
$BeforeDate = db_string($BeforeDate);
$DateSearch = true;
}
$RS = "SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
m.ipcc,
m.Email,
m.Username,
m.PermissionID,
m.Uploaded,
m.Downloaded,
m.Enabled,
i.Donor,
i.Warned,
i.JoinDate,
(SELECT COUNT(h1.UserID) FROM users_history_ips AS h1 WHERE h1.IP=m.IP) AS Uses,
im.ID,
im.IP,
im.ipcc,
im.Email,
im.Username,
im.PermissionID,
im.Uploaded,
im.Downloaded,
im.Enabled,
ii.Donor,
ii.Warned,
ii.JoinDate,
(SELECT COUNT(h2.UserID) FROM users_history_ips AS h2 WHERE h2.IP=im.IP) AS InviterUses
$RS = "
SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
m.ipcc,
m.Email,
m.Username,
m.PermissionID,
m.Uploaded,
m.Downloaded,
m.Enabled,
i.Donor,
i.Warned,
i.JoinDate,
( SELECT COUNT(h1.UserID)
FROM users_history_ips AS h1
WHERE h1.IP=m.IP
) AS Uses,
im.ID,
im.IP,
im.ipcc,
im.Email,
im.Username,
im.PermissionID,
im.Uploaded,
im.Downloaded,
im.Enabled,
ii.Donor,
ii.Warned,
ii.JoinDate,
( SELECT COUNT(h2.UserID)
FROM users_history_ips AS h2
WHERE h2.IP=im.IP
) AS InviterUses
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID=m.ID
LEFT JOIN users_main AS im ON i.Inviter = im.ID
LEFT JOIN users_info AS ii ON i.Inviter = ii.UserID
LEFT JOIN users_info AS i ON i.UserID=m.ID
LEFT JOIN users_main AS im ON i.Inviter = im.ID
LEFT JOIN users_info AS ii ON i.Inviter = ii.UserID
WHERE";
if($DateSearch) {
if ($DateSearch) {
$RS .= " i.JoinDate BETWEEN '$AfterDate' AND '$BeforeDate' ";
} else {
$RS .= " i.JoinDate > '".time_minus(3600*24*3)."'";
$RS .= " i.JoinDate > '".time_minus(3600 * 24 * 3)."'";
}
$RS .= " ORDER BY i.Joindate DESC LIMIT $Limit";
$QueryID = $DB->query($RS);
@ -78,7 +87,7 @@
?>
<div class="linkbox">
<?
$Pages=Format::get_pages($Page,$Results,USERS_PER_PAGE,11) ;
$Pages = Format::get_pages($Page,$Results,USERS_PER_PAGE,11) ;
echo $Pages;
?>
</div>
@ -94,7 +103,7 @@
<td>Registered</td>
</tr>
<?
while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses)=$DB->next_record()) {
while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses) = $DB->next_record()) {
$Row = ($IP == $InviterIP) ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
@ -120,15 +129,20 @@
<?=Tools::get_host_by_ajax($IP)?><br />
<?=Tools::get_host_by_ajax($InviterIP)?>
</td>
<td><?=time_diff($Joined)?><br /><?=time_diff($InviterJoined)?></td>
<td>
<?=time_diff($Joined)?><br />
<?=time_diff($InviterJoined)?>
</td>
</tr>
<? } ?>
</table>
<div class="linkbox">
<? echo $Pages; ?>
</div>
<? } else { ?>
<?
} else { ?>
<h2 align="center">There have been no new registrations in the past 72 hours.</h2>
<? }
<?
}
View::show_footer();
?>

View File

@ -1,11 +1,13 @@
<?
if(!check_perms('site_debug')) { error(403); }
if(isset($_POST['global_flush'])){
if (!check_perms('site_debug')) {
error(403);
}
if (isset($_POST['global_flush'])) {
authorize();
$Cache->flush();
}
$DB->query('SHOW GLOBAL STATUS');
$DBStats =$DB->to_array('Variable_name');
$DBStats = $DB->to_array('Variable_name');
$MemStats = $Cache->getStats();
View::show_header("Service Stats");
@ -22,11 +24,11 @@
<tr><td colspan="2"><strong>Threads (Active)</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=number_format($MemStats['threads'])?> <span style="float:right;">(100.000%)</span></td>
<td><?=number_format($MemStats['threads'])?> <span style="float: right;">(100.000%)</span></td>
</tr>
<tr>
<td<? if($DBStats['Threads_connected']['Value']/$DBStats['Threads_created']['Value'] > 0.7) { echo ' class="invalid" '; } ?>>Database:</td>
<td><?=number_format($DBStats['Threads_created']['Value'])?> <span style="float:right;">(<?=number_format(($DBStats['Threads_connected']['Value']/$DBStats['Threads_created']['Value'])*100,3)?>%)</span></td>
<td<? if ($DBStats['Threads_connected']['Value'] / $DBStats['Threads_created']['Value'] > 0.7) { echo ' class="invalid" '; } ?>>Database:</td>
<td><?=number_format($DBStats['Threads_created']['Value'])?> <span style="float: right;">(<?=number_format(($DBStats['Threads_connected']['Value'] / $DBStats['Threads_created']['Value']) * 100,3)?>%)</span></td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Connections</strong></td></tr>
@ -49,8 +51,8 @@
<td><?=number_format($MemStats['total_items'])?></span></td>
</tr>
<tr>
<td<? if($MemStats['bytes']/$MemStats['limit_maxbytes'] > 0.85) { echo ' class="invalid" title="Evictions begin when storage exceeds 85%" '; } ?>>Cache Storage:</td>
<td><?=Format::get_size($MemStats['bytes'])?> <span style="float:right;">(<?=number_format(($MemStats['bytes']/$MemStats['limit_maxbytes'])*100, 3);?>%)</span></td>
<td<? if ($MemStats['bytes'] / $MemStats['limit_maxbytes'] > 0.85) { echo ' class="invalid" title="Evictions begin when storage exceeds 85%" '; } ?>>Cache Storage:</td>
<td><?=Format::get_size($MemStats['bytes'])?> <span style="float: right;">(<?=number_format(($MemStats['bytes'] / $MemStats['limit_maxbytes']) * 100, 3);?>%)</span></td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Utilities</strong></td></tr>
@ -88,66 +90,66 @@
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_insert']['Value']+$DBStats['Com_update']['Value'])?></td>
<td><?=number_format($DBStats['Com_insert']['Value'] + $DBStats['Com_update']['Value'])?></td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Get/Select (Success)</strong></td></tr>
<tr>
<td<? if($MemStats['get_hits']/$MemStats['cmd_get'] < 0.7) { echo ' class="invalid" '; } ?>>Cache:</td>
<td><?=number_format($MemStats['get_hits'])?> <span style="float:right;">(<?=number_format(($MemStats['get_hits']/$MemStats['cmd_get'])*100, 3);?>%)</span></td>
<td<? if ($MemStats['get_hits'] / $MemStats['cmd_get'] < 0.7) { echo ' class="invalid" '; } ?>>Cache:</td>
<td><?=number_format($MemStats['get_hits'])?> <span style="float: right;">(<?=number_format(($MemStats['get_hits'] / $MemStats['cmd_get']) * 100, 3);?>%)</span></td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_select']['Value'])?> <span style="float:right;">(100.000%)</span></td>
<td><?=number_format($DBStats['Com_select']['Value'])?> <span style="float: right;">(100.000%)</span></td>
</tr>
<tr><td colspan="2"><strong>Set/Insert (Success)</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=number_format($MemStats['cmd_set'])?> <span style="float:right;">(100.000%)</span></td>
<td><?=number_format($MemStats['cmd_set'])?> <span style="float: right;">(100.000%)</span></td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_insert']['Value'])?> <span style="float:right;">(100.000%)</span></td>
<td><?=number_format($DBStats['Com_insert']['Value'])?> <span style="float: right;">(100.000%)</span></td>
</tr>
<tr><td colspan="2"><strong>Increment/Decrement (Success)</strong></td></tr>
<tr>
<td<? if($MemStats['incr_hits']/($MemStats['incr_hits']+$MemStats['incr_misses']) < 0.7) { echo ' class="invalid" '; } ?>>Cache Increment:</td>
<td><?=number_format($MemStats['incr_hits'])?> <span style="float:right;">(<?=number_format(($MemStats['incr_hits']/($MemStats['incr_hits']+$MemStats['incr_misses']))*100, 3);?>%)</span></td>
<td<? if ($MemStats['incr_hits']/($MemStats['incr_hits'] + $MemStats['incr_misses']) < 0.7) { echo ' class="invalid" '; } ?>>Cache Increment:</td>
<td><?=number_format($MemStats['incr_hits'])?> <span style="float: right;">(<?=number_format(($MemStats['incr_hits'] / ($MemStats['incr_hits'] + $MemStats['incr_misses'])) * 100, 3);?>%)</span></td>
</tr>
<tr>
<td<? if($MemStats['decr_hits']/($MemStats['decr_hits']+$MemStats['decr_misses']) < 0.7) { echo ' class="invalid" '; } ?>>Cache Decrement:</td>
<td><?=number_format($MemStats['decr_hits'])?> <span style="float:right;">(<?=number_format(($MemStats['decr_hits']/($MemStats['decr_hits']+$MemStats['decr_misses']))*100, 3);?>%)</span></td>
<td<? if ($MemStats['decr_hits'] / ($MemStats['decr_hits'] + $MemStats['decr_misses']) < 0.7) { echo ' class="invalid" '; } ?>>Cache Decrement:</td>
<td><?=number_format($MemStats['decr_hits'])?> <span style="float: right;">(<?=number_format(($MemStats['decr_hits'] / ($MemStats['decr_hits'] + $MemStats['decr_misses'])) * 100, 3);?>%)</span></td>
</tr>
<tr><td colspan="2"><strong>CAS/Update (Success)</strong></td></tr>
<tr>
<td<? if($MemStats['cas_hits'] > 0 && $MemStats['cas_hits']/($MemStats['cas_hits']+$MemStats['cas_misses']) < 0.7) { echo ' class="invalid" title="More than 30% of the issued CAS commands were unnecessary wasting time and resources." '; } elseif ($MemStats['cas_hits'] == 0) { echo ' class="notice" title="Disable CAS with the -C parameter and save resources since it is not used." '; } ?>>Cache:</td>
<td><?=number_format($MemStats['cas_hits'])?> <span style="float:right;">(<? if ($MemStats['cas_hits'] > 0) { echo number_format(($MemStats['cas_hits']/($MemStats['cas_hits']+$MemStats['cas_misses']))*100, 3); } else { echo '0.000'; }?>%)</span></td>
<td<? if ($MemStats['cas_hits'] > 0 && $MemStats['cas_hits'] / ($MemStats['cas_hits'] + $MemStats['cas_misses']) < 0.7) { echo ' class="invalid" title="More than 30% of the issued CAS commands were unnecessarily wasting time and resources." '; } elseif ($MemStats['cas_hits'] == 0) { echo ' class="notice" title="Disable CAS with the -C parameter and save resources since it is not used." '; } ?>>Cache:</td>
<td><?=number_format($MemStats['cas_hits'])?> <span style="float: right;">(<? if ($MemStats['cas_hits'] > 0) { echo number_format(($MemStats['cas_hits'] / ($MemStats['cas_hits'] + $MemStats['cas_misses'])) * 100, 3); } else { echo '0.000'; }?>%)</span></td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_update']['Value'])?> <span style="float:right;">(100.000%)</span></td>
<td><?=number_format($DBStats['Com_update']['Value'])?> <span style="float: right;">(100.000%)</span></td>
</tr>
<tr><td colspan="2"><strong>Deletes (Success)</strong></td></tr>
<tr>
<td<? if($MemStats['delete_hits']/($MemStats['delete_hits']+$MemStats['delete_misses']) < 0.7) { echo ' class="invalid" title="More than 30% of the issued delete commands were unnecessary wasting time and resources." '; } ?>>Cache:</td>
<td><?=number_format($MemStats['delete_hits'])?> <span style="float:right;">(<?=number_format(($MemStats['delete_hits']/($MemStats['delete_hits']+$MemStats['delete_misses']))*100, 3);?>%)</span></td>
<td<? if ($MemStats['delete_hits'] / ($MemStats['delete_hits']+$MemStats['delete_misses']) < 0.7) { echo ' class="invalid" title="More than 30% of the issued delete commands were unnecessary wasting time and resources." '; } ?>>Cache:</td>
<td><?=number_format($MemStats['delete_hits'])?> <span style="float: right;">(<?=number_format(($MemStats['delete_hits'] / ($MemStats['delete_hits'] + $MemStats['delete_misses'])) * 100, 3);?>%)</span></td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_delete']['Value'])?> <span style="float:right;">(100.000%)</span></td>
<td><?=number_format($DBStats['Com_delete']['Value'])?> <span style="float: right;">(100.000%)</span></td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Special</strong></td></tr>
<tr>
<td<? if($MemStats['cmd_flush'] > $MemStats['uptime']/7*24*3600) { echo ' class="invalid" title="Flushing the cache on a regular basis defeats the benefits of it, look into using cache transactions, or deletes instead of global flushing where possible." '; } ?>>Cache Flushes:</td>
<td<? if ($MemStats['cmd_flush'] > $MemStats['uptime'] / 7 * 24 * 3600) { echo ' class="invalid" title="Flushing the cache on a regular basis defeats the benefits of it, look into using cache transactions, or deletes instead of global flushing where possible." '; } ?>>Cache Flushes:</td>
<td><?=number_format($MemStats['cmd_flush'])?></td>
</tr>
<tr>
<td<? if($MemStats['evictions'] > 0) { echo ' class="invalid" '; } ?>>Cache Evicted:</td>
<td<? if ($MemStats['evictions'] > 0) { echo ' class="invalid" '; } ?>>Cache Evicted:</td>
<td><?=number_format($MemStats['evictions'])?></td>
</tr>
<tr>
<td<? if($DBStats['Slow_queries']['Value'] > $DBStats['Questions']['Value']/7500) { echo ' class="invalid" title="1/7500 queries is allowed to be slow to minimize performance impact." '; } ?>>Database Slow:</td>
<td<? if ($DBStats['Slow_queries']['Value'] > $DBStats['Questions']['Value'] / 7500) { echo ' class="invalid" title="1/7500 queries is allowed to be slow to minimize performance impact." '; } ?>>Database Slow:</td>
<td><?=number_format($DBStats['Slow_queries']['Value'])?></td>
</tr>
<tr><td colspan="2"></td></tr>
@ -178,100 +180,100 @@
</tr>
<tr><td colspan="2"><strong>Total Reads</strong></td></tr>
<tr>
<td<? if(($MemStats['cmd_get']/$MemStats['uptime'])*5 < $DBStats['Com_select']['Value']/$DBStats['Uptime']['Value']) { echo ' class="invalid" '; } ?>>Cache:</td>
<td><?=number_format($MemStats['cmd_get']/$MemStats['uptime'],5)?>/s</td>
<td<? if (($MemStats['cmd_get'] / $MemStats['uptime']) * 5 < $DBStats['Com_select']['Value'] / $DBStats['Uptime']['Value']) { echo ' class="invalid" '; } ?>>Cache:</td>
<td><?=number_format($MemStats['cmd_get'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_select']['Value']/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format($DBStats['Com_select']['Value'] / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"><strong>Total Writes</strong></td></tr>
<tr>
<td<? if(($MemStats['cmd_set']/$MemStats['uptime'])*5 < ($DBStats['Com_insert']['Value']+$DBStats['Com_update']['Value'])/$DBStats['Uptime']['Value']) { echo ' class="invalid" '; } ?>>Cache:</td>
<td><?=number_format($MemStats['cmd_set']/$MemStats['uptime'],5)?>/s</td>
<td<? if (($MemStats['cmd_set'] / $MemStats['uptime']) * 5 < ($DBStats['Com_insert']['Value'] + $DBStats['Com_update']['Value']) / $DBStats['Uptime']['Value']) { echo ' class="invalid" '; } ?>>Cache:</td>
<td><?=number_format($MemStats['cmd_set'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format(($DBStats['Com_insert']['Value']+$DBStats['Com_update']['Value'])/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format(($DBStats['Com_insert']['Value'] + $DBStats['Com_update']['Value']) / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Get/Select</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=number_format($MemStats['get_hits']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['get_hits'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_select']['Value']/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format($DBStats['Com_select']['Value'] / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"><strong>Set/Insert</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=number_format($MemStats['cmd_set']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['cmd_set'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_insert']['Value']/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format($DBStats['Com_insert']['Value'] / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"><strong>Increment/Decrement</strong></td></tr>
<tr>
<td>Cache Increment:</td>
<td><?=number_format($MemStats['incr_hits']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['incr_hits'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Cache Decrement:</td>
<td><?=number_format($MemStats['decr_hits']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['decr_hits'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr><td colspan="2"><strong>CAS/Updates</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=number_format($MemStats['cas_hits']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['cas_hits'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_update']['Value']/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format($DBStats['Com_update']['Value'] / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"><strong>Deletes</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=number_format($MemStats['delete_hits']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['delete_hits'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=number_format($DBStats['Com_delete']['Value']/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format($DBStats['Com_delete']['Value'] / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Special</strong></td></tr>
<tr>
<td>Cache Flushes:</td>
<td><?=number_format($MemStats['cmd_flush']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['cmd_flush'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Cache Evicted:</td>
<td><?=number_format($MemStats['evictions']/$MemStats['uptime'],5)?>/s</td>
<td><?=number_format($MemStats['evictions'] / $MemStats['uptime'],5)?>/s</td>
</tr>
<tr>
<td>Database Slow:</td>
<td><?=number_format($DBStats['Slow_queries']['Value']/$DBStats['Uptime']['Value'],5)?>/s</td>
<td><?=number_format($DBStats['Slow_queries']['Value'] / $DBStats['Uptime']['Value'],5)?>/s</td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"><strong>Data Read</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=Format::get_size($MemStats['bytes_read']/$MemStats['uptime'])?>/s</td>
<td><?=Format::get_size($MemStats['bytes_read'] / $MemStats['uptime'])?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=Format::get_size($DBStats['Bytes_received']['Value']/$DBStats['Uptime']['Value'])?>/s</td>
<td><?=Format::get_size($DBStats['Bytes_received']['Value'] / $DBStats['Uptime']['Value'])?>/s</td>
</tr>
<tr><td colspan="2"><strong>Data Write</strong></td></tr>
<tr>
<td>Cache:</td>
<td><?=Format::get_size($MemStats['bytes_written']/$MemStats['uptime'])?>/s</td>
<td><?=Format::get_size($MemStats['bytes_written'] / $MemStats['uptime'])?>/s</td>
</tr>
<tr>
<td>Database:</td>
<td><?=Format::get_size($DBStats['Bytes_sent']['Value']/$DBStats['Uptime']['Value'])?>/s</td>
<td><?=Format::get_size($DBStats['Bytes_sent']['Value'] / $DBStats['Uptime']['Value'])?>/s</td>
</tr>
</table>
</div>

View File

@ -1,5 +1,7 @@
<?
if(!check_perms('site_view_flow')) { error(403); }
if (!check_perms('site_view_flow')) {
error(403);
}
View::show_header('Torrents');
if (!$TorrentStats = $Cache->get_value('new_torrent_stats')) {
@ -32,10 +34,10 @@
<li><strong>Total size: </strong><?=Format::get_size($TotalSize)?></li>
<li><strong>Total files: </strong><?=number_format($TotalFiles)?></li>
<br />
<li><strong>Mean torrents per user: </strong><?=number_format($TorrentCount/$NumUsers)?></li>
<li><strong>Mean torrent size: </strong><?=Format::get_size($TotalSize/$TorrentCount)?></li>
<li><strong>Mean files per torrent: </strong><?=number_format($TotalFiles/$TorrentCount)?></li>
<li><strong>Mean filesize: </strong><?=Format::get_size($TotalSize/$TotalFiles)?></li>
<li><strong>Mean torrents per user: </strong><?=number_format($TorrentCount / $NumUsers)?></li>
<li><strong>Mean torrent size: </strong><?=Format::get_size($TotalSize / $TorrentCount)?></li>
<li><strong>Mean files per torrent: </strong><?=number_format($TotalFiles / $TorrentCount)?></li>
<li><strong>Mean filesize: </strong><?=Format::get_size($TotalSize / $TotalFiles)?></li>
</ul>
</div>
</div>
@ -52,17 +54,17 @@
<li><strong>Size this week: </strong><?=Format::get_size($WeekSize)?></li>
<li><strong>Files this week: </strong><?=number_format($WeekFiles)?></li>
<br />
<li><strong>Torrents per day this week: </strong><?=number_format($WeekNum/7)?></li>
<li><strong>Size per day this week: </strong><?=Format::get_size($WeekSize/7)?></li>
<li><strong>Files per day this week: </strong><?=number_format($WeekFiles/7)?></li>
<li><strong>Torrents per day this week: </strong><?=number_format($WeekNum / 7)?></li>
<li><strong>Size per day this week: </strong><?=Format::get_size($WeekSize / 7)?></li>
<li><strong>Files per day this week: </strong><?=number_format($WeekFiles / 7)?></li>
<br />
<li><strong>Torrents this month: </strong><?=number_format($MonthNum)?></li>
<li><strong>Size this month: </strong><?=Format::get_size($MonthSize)?></li>
<li><strong>Files this month: </strong><?=number_format($MonthFiles)?></li>
<br />
<li><strong>Torrents per day this month: </strong><?=number_format($MonthNum/30)?></li>
<li><strong>Size per day this month: </strong><?=Format::get_size($MonthSize/30)?></li>
<li><strong>Files per day this month: </strong><?=number_format($MonthFiles/30)?></li>
<li><strong>Torrents per day this month: </strong><?=number_format($MonthNum / 30)?></li>
<li><strong>Size per day this month: </strong><?=Format::get_size($MonthSize / 30)?></li>
<li><strong>Files per day this month: </strong><?=number_format($MonthFiles / 30)?></li>
</ul>
</div>
</div>

View File

@ -1,35 +1,37 @@
<?
if(!check_perms('site_view_flow')) { error(403); }
if (!check_perms('site_view_flow')) {
error(403);
}
//Timeline generation
if(!isset($_GET['page'])) {
if (!isset($_GET['page'])) {
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");
$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");
$TimelineOut = array_reverse($DB->to_array());
foreach($TimelineIn as $Month) {
foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month;
if ($Amount > $Max) {
$Max = $Amount;
}
}
foreach($TimelineOut as $Month) {
foreach ($TimelineOut as $Month) {
list($Label,$Amount) = $Month;
if ($Amount > $Max) {
$Max = $Amount;
}
}
foreach($TimelineIn as $Month) {
foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month;
$Labels[] = $Label;
$InFlow[] = number_format(($Amount/$Max)*100,4);
$InFlow[] = number_format(($Amount / $Max) * 100, 4);
}
foreach($TimelineOut as $Month) {
foreach ($TimelineOut as $Month) {
list($Label,$Amount) = $Month;
$OutFlow[] = number_format(($Amount/$Max)*100,4);
$OutFlow[] = number_format(($Amount / $Max) * 100, 4);
}
$Cache->cache_value('users_timeline',array($Labels,$InFlow,$OutFlow,$Max),mktime(0,0,0,date('n')+1,2));
$Cache->cache_value('users_timeline',array($Labels,$InFlow,$OutFlow,$Max),mktime(0,0,0,date('n') + 1,2));
}
}
//End timeline generation
@ -38,7 +40,8 @@
define('DAYS_PER_PAGE', 100);
list($Page,$Limit) = Format::page_limit(DAYS_PER_PAGE);
$RS = $DB->query("SELECT
$RS = $DB->query("
SELECT
SQL_CALC_FOUND_ROWS
j.Date,
DATE_FORMAT(j.Date,'%Y-%m') AS Month,
@ -102,14 +105,14 @@
$DB->set_query_id($RS);
?>
<div class="thin">
<? if(!isset($_GET['page'])) { ?>
<? if (!isset($_GET['page'])) { ?>
<div class="box pad">
<img src="http://chart.apis.google.com/chart?cht=lc&amp;chs=820x160&amp;chco=000D99,99000D&amp;chg=0,-1,1,1&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|<?=implode('|',$Labels)?>&amp;chxr=0,0,<?=$Max?>&amp;chd=t:<?=implode(',',$InFlow)?>|<?=implode(',',$OutFlow)?>&amp;chls=2,4,0&amp;chdl=New+Registrations|Disabled+Users&amp;chf=bg,s,FFFFFF00" alt="User Flow vs. Time" />
</div>
<? } ?>
<div class="linkbox">
<?
$Pages=Format::get_pages($Page,$Results,DAYS_PER_PAGE,11) ;
$Pages = Format::get_pages($Page,$Results,DAYS_PER_PAGE,11) ;
echo $Pages;
?>
</div>
@ -124,7 +127,7 @@
<td>Net Growth</td>
</tr>
<?
while(list($Date, $Month, $Joined, $Manual, $Ratio, $Inactivity)=$DB->next_record()) {
while (list($Date, $Month, $Joined, $Manual, $Ratio, $Inactivity) = $DB->next_record()) {
$TotalOut = $Ratio + $Inactivity + $Manual;
$TotalGrowth = $Joined - $TotalOut;
?>

View File

@ -130,7 +130,7 @@
</tr>
<?
$Row = 'a';
while(list($ID, $Start, $End, $Reason) = $DB->next_record()) {
while (list($ID, $Start, $End, $Reason) = $DB->next_record()) {
$Row = ($Row === 'a' ? 'b' : 'a');
$Start=long2ip($Start);
$End=long2ip($End);

View File

@ -1,32 +1,43 @@
<?
if(!check_perms('users_view_email')) { error(403); }
if (!check_perms('users_view_email')) {
error(403);
}
authorize();
if($_POST['submit'] == 'Delete'){ //Delete
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
if ($_POST['submit'] == 'Delete') { //Delete
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query('DELETE FROM email_blacklist WHERE ID='.$_POST['id']);
} else { //Edit & Create, Shared Validation
$Val->SetFields('email', '1','string','The email must be set', array('minlength'=>1));
$Val->SetFields('comment', '0','string','The description has a max length of 255 characters', array('maxlength'=>255));
$Err=$Val->ValidateForm($_POST); // Validate the form
if($Err){ error($Err); }
$Err = $Val->ValidateForm($_POST); // Validate the form
if ($Err) {
error($Err);
}
$P=array();
$P=db_array($_POST); // Sanitize the form
$P = array();
$P = db_array($_POST); // Sanitize the form
if($_POST['submit'] == 'Edit'){ //Edit
if(!is_number($_POST['id']) || $_POST['id'] == ''){ error(0); }
$DB->query("UPDATE email_blacklist SET
Email='$P[email]',
Comment='$P[comment]',
UserID='$LoggedUser[ID]',
Time='".sqltime()."'
if ($_POST['submit'] == 'Edit') { //Edit
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
$DB->query("
UPDATE email_blacklist
SET
Email='$P[email]',
Comment='$P[comment]',
UserID='$LoggedUser[ID]',
Time='".sqltime()."'
WHERE ID='$P[id]'");
} else { //Create
$DB->query("INSERT INTO email_blacklist
(Email, Comment, UserID, Time) VALUES
('$P[email]','$P[comment]','$LoggedUser[ID]','".sqltime()."')");
$DB->query("
INSERT INTO email_blacklist (Email, Comment, UserID, Time)
VALUES
('$P[email]','$P[comment]','$LoggedUser[ID]','".sqltime()."')");
}
}

View File

@ -1,5 +1,7 @@
<?
if (!check_perms('users_mod')) { error(403); }
if (!check_perms('users_mod')) {
error(403);
}
if (isset($_POST['doit'])) {
authorize();
@ -7,7 +9,9 @@
if (isset($_POST['oldtags'])) {
$OldTagIDs = $_POST['oldtags'];
foreach ($OldTagIDs AS $OldTagID) {
if (!is_number($OldTagID)) { error(403); }
if (!is_number($OldTagID)) {
error(403);
}
}
$OldTagIDs = implode(', ', $OldTagIDs);
@ -20,7 +24,7 @@
$DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'");
list($TagID) = $DB->next_record();
if($TagID) {
if ($TagID) {
$DB->query("UPDATE tags SET TagType = 'genre' WHERE ID = $TagID");
} else { // Tag doesn't exist yet - create tag
$DB->query("INSERT INTO tags (Name, UserID, TagType, Uses) VALUES ('".$TagName."', ".$LoggedUser['ID'].", 'genre', 0)");
@ -36,7 +40,7 @@
<div class="header">
<h2>Official Tags Manager</h2>
</div>
<div style="text-align: center">
<div style="text-align: center;">
<div style="display: inline-block;">
<form class="manage_form" name="tags" method="post" action="">
<input type="hidden" name="action" value="official_tags" />
@ -44,17 +48,17 @@
<input type="hidden" name="doit" value="1" />
<table class="tags_table layout">
<tr class="colhead_dark">
<td style="font-weight: bold" style="text-align: center">Remove</td>
<td style="font-weight: bold">Tag</td>
<td style="font-weight: bold">Uses</td>
<td style="font-weight: bold; text-align: center;">Remove</td>
<td style="font-weight: bold;">Tag</td>
<td style="font-weight: bold;">Uses</td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td style="font-weight: bold" style="text-align: center">Remove</td>
<td style="font-weight: bold">Tag</td>
<td style="font-weight: bold">Uses</td>
<td style="font-weight: bold; text-align: center;">Remove</td>
<td style="font-weight: bold;">Tag</td>
<td style="font-weight: bold;">Uses</td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td style="font-weight: bold" style="text-align: center">Remove</td>
<td style="font-weight: bold">Tag</td>
<td style="font-weight: bold">Uses</td>
<td style="font-weight: bold; text-align: center;">Remove</td>
<td style="font-weight: bold;">Tag</td>
<td style="font-weight: bold;">Uses</td>
</tr>
<?
$i = 0;
@ -63,38 +67,42 @@
$Tags = $DB->to_array();
for ($i = 0; $i < $TagCount / 3; $i++) {
list($TagID1, $TagName1, $TagUses1) = $Tags[$i];
list($TagID2, $TagName2, $TagUses2) = $Tags[ceil($TagCount/3) + $i];
list($TagID3, $TagName3, $TagUses3) = $Tags[2*ceil($TagCount/3) + $i];
list($TagID2, $TagName2, $TagUses2) = $Tags[ceil($TagCount / 3) + $i];
list($TagID3, $TagName3, $TagUses3) = $Tags[2 * ceil($TagCount / 3) + $i];
?>
<tr class="<?=(($i % 2)?'rowa':'rowb')?>">
<td style="text-align: center"><input type="checkbox" name="oldtags[]" value="<?=$TagID1?>" /></td>
<tr class="<?=(($i % 2) ? 'rowa' : 'rowb')?>">
<td style="text-align: center;"><input type="checkbox" name="oldtags[]" value="<?=$TagID1?>" /></td>
<td><?=$TagName1?></td>
<td style="text-align: center"><?=number_format($TagUses1)?></td>
<td style="text-align: center;"><?=number_format($TagUses1)?></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td style="text-align: center">
<td style="text-align: center;">
<? if ($TagID2) { ?>
<input type="checkbox" name="oldtags[]" value="<?=$TagID2?>" />
<? } ?>
</td>
<td><?=$TagName2?></td>
<td style="text-align: center"><?=number_format($TagUses2)?></td>
<td style="text-align: center;"><?=number_format($TagUses2)?></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td style="text-align: center">
<td style="text-align: center;">
<? if ($TagID3) { ?>
<input type="checkbox" name="oldtags[]" value="<?=$TagID3?>" />
<? } ?>
</td>
<td><?=$TagName3?></td>
<td style="text-align: center"><?=number_format($TagUses3)?></td>
<td style="text-align: center;"><?=number_format($TagUses3)?></td>
</tr>
<?
}
?>
<tr class="<?=(($i % 2)?'rowa':'rowb')?>">
<td colspan="11"><label for="newtag">New official tag: </label><input type="text" name="newtag" /></td>
<tr class="<?=(($i % 2) ? 'rowa' : 'rowb')?>">
<td colspan="11">
<label for="newtag">New official tag: </label><input type="text" name="newtag" />
</td>
</tr>
<tr style="border-top: thin solid">
<td colspan="11" style="text-align: center"><input type="submit" value="Submit changes" /></td>
<tr style="border-top: thin solid;">
<td colspan="11" style="text-align: center;">
<input type="submit" value="Submit changes" />
</td>
</tr>
</table>

View File

@ -18,24 +18,30 @@ function confirmDelete(id) {
</div>
</div>
<?
$DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,COUNT(u.ID)+COUNT(DISTINCT l.UserID)
$DB->query("SELECT
p.ID,
p.Name,
p.Level,
p.Secondary,
COUNT(u.ID)+COUNT(DISTINCT l.UserID)
FROM permissions AS p
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
LEFT JOIN users_levels AS l ON l.PermissionID=p.ID
GROUP BY p.ID ORDER BY p.Secondary ASC, p.Level ASC");
if($DB->record_count()) {
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
LEFT JOIN users_levels AS l ON l.PermissionID=p.ID
GROUP BY p.ID
ORDER BY p.Secondary ASC, p.Level ASC");
if ($DB->record_count()) {
?>
<table width="100%">
<tr class="colhead">
<td>Name</td>
<td>Level</td>
<td>User Count</td>
<td>User count</td>
<td class="center">Actions</td>
</tr>
<? while(list($ID,$Name,$Level,$Secondary,$UserCount)=$DB->next_record()) { ?>
<? while (list($ID,$Name,$Level,$Secondary,$UserCount)=$DB->next_record()) { ?>
<tr>
<td><?=display_str($Name); ?></td>
<td><?=($Secondary?'Secondary':$Level) ?></td>
<td><?=($Secondary ? 'Secondary' : $Level) ?></td>
<td><?=number_format($UserCount); ?></td>
<td class="center">
<a href="tools.php?action=permissions&amp;id=<?=$ID ?>" class="brackets">Edit</a>
@ -44,9 +50,11 @@ function confirmDelete(id) {
</tr>
<? } ?>
</table>
<? } else { ?>
<?
} else { ?>
<h2 align="center">There are no permission classes.</h2>
<? } ?>
<?
} ?>
</div>
<?
View::show_footer();

View File

@ -3,7 +3,7 @@
//--------------- Add a recommendation -----------------------------------------//
authorize();
if(!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')){
if (!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')) {
error(403);
}
@ -15,7 +15,7 @@
'1','regex','The URL must be a link to a torrent on the site.',array('regex'=>$URLRegex));
$Err = $Val->ValidateForm($_POST); // Validate the form
if($Err){ // if something didn't validate
if ($Err) { // if something didn't validate
error($Err);
header('Location: '.$_SERVER['HTTP_REFERER']);
exit;
@ -24,9 +24,9 @@
// Get torrent ID
$URLRegex = '/torrents\.php\?id=([0-9]+)$/i';
preg_match($URLRegex, $URL, $Matches);
$GroupID=$Matches[1];
$GroupID = $Matches[1];
if(empty($GroupID) || !is_number($GroupID)) {
if (empty($GroupID) || !is_number($GroupID)) {
error(404);
}

View File

@ -1,18 +1,19 @@
<?
if(!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')){
if (!check_perms('site_recommend_own') && !check_perms('site_manage_recommendations')) {
error(403);
}
View::show_header('Recommendations');
$DB->query("SELECT
tr.GroupID,
tr.UserID,
tg.Name,
tg.ArtistID,
ag.Name
$DB->query("
SELECT
tr.GroupID,
tr.UserID,
tg.Name,
tg.ArtistID,
ag.Name
FROM torrents_recommended AS tr
JOIN torrents_group AS tg ON tg.ID=tr.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
JOIN torrents_group AS tg ON tg.ID=tr.GroupID
LEFT JOIN artists_group AS ag ON ag.ArtistID=tg.ArtistID
ORDER BY tr.Time DESC
LIMIT 10
");
@ -20,7 +21,7 @@
<div class="thin">
<div class="box" id="recommended">
<div class="head colhead_dark"><strong>Recommendations</strong></div>
<? if(!in_array($LoggedUser['ID'], $DB->collect('UserID'))){ ?>
<? if (!in_array($LoggedUser['ID'], $DB->collect('UserID'))) { ?>
<form class="add_form" name="recommendations" action="tools.php" method="post" class="pad">
<input type="hidden" name="action" value="recommend_add" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
@ -40,15 +41,15 @@
<? } ?>
<ul class="nobullet">
<?
while(list($GroupID, $UserID, $GroupName, $ArtistID, $ArtistName)=$DB->next_record()) {
while (list($GroupID, $UserID, $GroupName, $ArtistID, $ArtistName) = $DB->next_record()) {
?>
<li>
<strong><?=Users::format_username($UserID, false, false, false)?></strong>
<? if($ArtistID){ ?>
<? if ($ArtistID) { ?>
- <a href="artist.php?id=<?=$ArtistID?>"><?=$ArtistName?></a>
<? } ?>
- <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a>
<? if(check_perms('site_manage_recommendations') || $UserID == $LoggedUser['ID']){ ?>
<? if (check_perms('site_manage_recommendations') || $UserID == $LoggedUser['ID']) { ?>
<a href="tools.php?action=recommend_alter&amp;groupid=<?=$GroupID?>" class="brackets">Delete</a>
<? } ?>
</li>

View File

@ -1,13 +1,13 @@
<?
authorize();
if(!check_perms('admin_whitelist')) {
if (!check_perms('admin_whitelist')) {
error(403);
}
if($_POST['submit'] == 'Delete'){
if(!is_number($_POST['id']) || $_POST['id'] == ''){
error("1");
if ($_POST['submit'] == 'Delete') {
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error('1');
}
$DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = ".$_POST['id']);
@ -16,7 +16,7 @@
Tracker::update_tracker('remove_whitelist', array('peer_id' => $PeerID));
} else { //Edit & Create, Shared Validation
if(empty($_POST['client']) || empty($_POST['peer_id'])) {
if (empty($_POST['client']) || empty($_POST['peer_id'])) {
print_r($_POST);
die();
}
@ -24,23 +24,25 @@
$Client = db_string($_POST['client']);
$PeerID = db_string($_POST['peer_id']);
if($_POST['submit'] == 'Edit'){ //Edit
if(empty($_POST['id']) || !is_number($_POST['id'])) {
error("3");
if ($_POST['submit'] == 'Edit'){ //Edit
if (empty($_POST['id']) || !is_number($_POST['id'])) {
error('3');
} else {
$DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = ".$_POST['id']);
list($OldPeerID) = $DB->next_record();
$DB->query("UPDATE xbt_client_whitelist SET
vstring='".$Client."',
peer_id='".$PeerID."'
$DB->query("
UPDATE xbt_client_whitelist
SET
vstring='".$Client."',
peer_id='".$PeerID."'
WHERE ID=".$_POST['id']);
Tracker::update_tracker('edit_whitelist', array('old_peer_id' => $OldPeerID, 'new_peer_id' => $PeerID));
}
} else { //Create
$DB->query("INSERT INTO xbt_client_whitelist
(vstring, peer_id)
VALUES
('".$Client."','".$PeerID."')");
$DB->query("
INSERT INTO xbt_client_whitelist (vstring, peer_id)
VALUES
('$Client','$PeerID')");
Tracker::update_tracker('add_whitelist', array('peer_id' => $PeerID));
}
}

View File

@ -1,5 +1,7 @@
<?
if(!check_perms('admin_whitelist')) { error(403); }
if (!check_perms('admin_whitelist')) {
error(403);
}
View::show_header('Whitelist Management');
$DB->query('SELECT id, vstring, peer_id FROM xbt_client_whitelist ORDER BY peer_id ASC');
@ -16,7 +18,7 @@
</table>
<?
$Row = 'b';
while(list($ID, $Client, $Peer_ID) = $DB->next_record()){
while (list($ID, $Client, $Peer_ID) = $DB->next_record()) {
$Row = ($Row === 'a' ? 'b' : 'a');
?>
<form class="manage_form" name="clients" action="" method="post">
@ -44,7 +46,7 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table>
<tr class="colhead">
<td colspan="4">Add Client</td>
<td colspan="4">Add client</td>
</tr>
<tr class="rowa">
@ -60,4 +62,4 @@
</tr>
</table>
</form>
<? View::show_footer(); ?>
<? View::show_footer(); ?>

View File

@ -1,14 +1,14 @@
<?
if(!check_perms('users_mod') || !check_perms('admin_clear_cache')) {
if (!check_perms('users_mod') || !check_perms('admin_clear_cache')) {
error(403);
}
View::show_header('Clear a cache key');
//Make sure the form was sent
if(!empty($_GET['key']) && $_GET['type'] == "clear") {
if(preg_match('/(.*?)(\d+)\.\.(\d+)$/', $_GET['key'], $Matches) && is_number($Matches[2]) && is_number($Matches[3])) {
for($i=$Matches[2]; $i<=$Matches[3]; $i++) {
if (!empty($_GET['key']) && $_GET['type'] == 'clear') {
if (preg_match('/(.*?)(\d+)\.\.(\d+)$/', $_GET['key'], $Matches) && is_number($Matches[2]) && is_number($Matches[3])) {
for ($i = $Matches[2]; $i <= $Matches[3]; $i++) {
$Cache->delete_value($Matches[1].$i);
}
echo '<div class="save_message">Keys '.display_str($_GET['key']).' cleared!</div>';
@ -35,7 +35,7 @@
<input type="submit" value="key" class="submit" />
</td>
</tr>
<? if(!empty($_GET['key']) && $_GET['type'] == "view") { ?>
<? if (!empty($_GET['key']) && $_GET['type'] == 'view') { ?>
<tr>
<td colspan="2">
<pre><? var_dump($Cache->get_value($_GET['key'])); ?></pre>
@ -44,4 +44,4 @@
<? } ?>
</table>
</form>
<? View::show_footer(); ?>
<? View::show_footer(); ?>

View File

@ -1,6 +1,8 @@
<?
//TODO: rewrite this, make it cleaner, make it work right, add it common stuff
if(!check_perms('admin_create_users')) { error(403); }
if (!check_perms('admin_create_users')) {
error(403);
}
//Show our beautiful header
View::show_header('Create a User');
@ -82,22 +84,22 @@
<input type="hidden" name="action" value="create_user" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">
<tr valign="top">
<td align="right">Username&nbsp;</td>
<td align="left"><input type="text" name="Username" id="username" class="inputtext" /></td>
</tr>
<tr valign="top">
<td align="right">Email&nbsp;</td>
<td align="left"><input type="text" name="Email" id="email" class="inputtext" /></td>
</tr>
<tr valign="top">
<td align="right">Password&nbsp;</td>
<td align="left"><input type="password" name="Password" id="password" class="inputtext" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="submit" value="Create User" class="submit" /></td>
</tr>
</table>
<tr valign="top">
<td align="right">Username&nbsp;</td>
<td align="left"><input type="text" name="Username" id="username" class="inputtext" /></td>
</tr>
<tr valign="top">
<td align="right">Email&nbsp;</td>
<td align="left"><input type="text" name="Email" id="email" class="inputtext" /></td>
</tr>
<tr valign="top">
<td align="right">Password&nbsp;</td>
<td align="left"><input type="password" name="Password" id="password" class="inputtext" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="submit" value="Create User" class="submit" /></td>
</tr>
</table>
</form>
<?
}

View File

@ -1,33 +1,46 @@
<?
if(!check_perms('users_view_ips')) { error(403); }
if (!check_perms('users_view_ips')) {
error(403);
}
View::show_header('Dupe IPs');
define('USERS_PER_PAGE', 50);
define('IP_OVERLAPS', 5);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
$RS = $DB->query("SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
m.Username,
m.PermissionID,
m.Enabled,
i.Donor,
i.Warned,
i.JoinDate,
(SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) AS Uses
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID=m.ID
WHERE (SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) >= ".IP_OVERLAPS."
AND m.Enabled = '1'
AND m.IP != '127.0.0.1'
ORDER BY Uses DESC LIMIT $Limit");
$RS = $DB->query("
SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
m.Username,
m.PermissionID,
m.Enabled,
i.Donor,
i.Warned,
i.JoinDate,
( SELECT
COUNT(DISTINCT h.UserID)
FROM users_history_ips AS h
WHERE h.IP=m.IP
) AS Uses
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID=m.ID
WHERE
( SELECT
COUNT(DISTINCT h.UserID)
FROM users_history_ips AS h
WHERE h.IP=m.IP
) >= ".IP_OVERLAPS."
AND m.Enabled = '1'
AND m.IP != '127.0.0.1'
ORDER BY Uses DESC
LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
if($DB->record_count()) {
if ($DB->record_count()) {
?>
<div class="linkbox">
<?
@ -43,12 +56,14 @@
<td>Registered</td>
</tr>
<?
while(list($UserID, $IP, $Username, $PermissionID, $Enabled, $Donor, $Warned, $Joined, $Uses)=$DB->next_record()) {
while (list($UserID, $IP, $Username, $PermissionID, $Enabled, $Donor, $Warned, $Joined, $Uses) = $DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
<td><?=Users::format_username($UserID, true, true, true, true)?></td>
<td><span style="float:left;"><?=Tools::get_host_by_ajax($IP)." ($IP)"?></span><span style="float:right;"><a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a></span></td>
<td>
<span style="float: left;"><?=Tools::get_host_by_ajax($IP)." ($IP)"?></span><span style="float: right;"><a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a></span>
</td>
<td><?=display_str($Uses)?></td>
<td><?=time_diff($Joined)?></td>
</tr>

View File

@ -1,16 +1,18 @@
<?
if(isset($_SERVER['http_if_modified_since'])) {
header("Status: 304 Not Modified");
if (isset($_SERVER['http_if_modified_since'])) {
header('Status: 304 Not Modified');
die();
}
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time()+3600*24*120)); //120 days
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C',time()));
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C', time() + 3600 * 24 * 120)); //120 days
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C', time()));
if(!check_perms('users_view_ips') && !check_perms('tc_advanced_user_search')) { die('Access denied.'); }
if (!check_perms('users_view_ips') && !check_perms('tc_advanced_user_search')) {
die('Access denied.');
}
if (empty($_GET['ip'])) {
die("Invalid IP");
die('Invalid IP address.');
}
die(Tools::geoip($_GET['ip']));

View File

@ -1,16 +1,18 @@
<?
if(isset($_SERVER['http_if_modified_since'])) {
header("Status: 304 Not Modified");
if (isset($_SERVER['http_if_modified_since'])) {
header('Status: 304 Not Modified');
die();
}
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time()+3600*24*120)); //120 days
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C',time()));
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C', time() + 3600 * 24 * 120)); //120 days
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C', time()));
if(!check_perms('users_view_ips')) { die('Access denied.'); }
if (!check_perms('users_view_ips')) {
die('Access denied.');
}
$Octets = explode(".", $_GET['ip']);
if(
$Octets = explode('.', $_GET['ip']);
if (
empty($_GET['ip']) ||
!preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $_GET['ip']) ||
$Octets[0] < 0 ||
@ -21,19 +23,29 @@
$Octets[2] > 255 ||
$Octets[3] < 0 ||
$Octets[3] > 255 ||
/*
* Per RFC 1918, the following CIDR blocks should never be found on the public Internet.
* 10.0.0.0/8
* 172.16.0.0/12
* 192.168.0.0/16
*
* Per RFC 3330, the block 127.0.0.0/8 should never appear on any network.
*
*/
$Octets[0] == 127 ||
$Octets[0] == 10 ||
($Octets[0] == 172 && ((16 <= $Octets[1]) && ($Octets[1] <= 31))) ||
($Octets[0] == 192 && $Octets[1] == 168)
) {
die('Invalid IP.');
die('Invalid IPv4 address.');
}
$Host = Tools::lookup_ip($_GET['ip']);
if ($Host === '') {
trigger_error("Tools::get_host_by_ajax() command failed with no output, ensure that the host command exists on your system and accepts the argument -W");
trigger_error('Tools::get_host_by_ajax() command failed with no output, ensure that the host command exists on your system and accepts the argument -W');
} elseif ($Host === false) {
print 'Could not retrieve host.';
} else {
print $Host;
}

View File

@ -209,7 +209,7 @@ function check_paranoia_here($Setting) {
<div class="sidebar">
<?
if ($Avatar && Users::has_avatars_enabled()) {
// TODO: use Users::show_avatar; why display_str in line 301??
// TODO: use Users::show_avatar; why is display_str() used a few lines below (where avatar is displayed)?
if (check_perms('site_proxy_images') && !empty($Avatar)) {
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($Avatar);
}

View File

@ -110,20 +110,20 @@
if ($Current['StartTime'] == '0000-00-00 00:00:00') { $Current['StartTime'] = $Joined; }
} else {
foreach ($History as $Key => $Val) {
if ($History[$Key+1]['Time'] == '0000-00-00 00:00:00' && $Val['Time'] != '0000-00-00 00:00:00') {
if ($History[$Key + 1]['Time'] == '0000-00-00 00:00:00' && $Val['Time'] != '0000-00-00 00:00:00') {
// Invited email
$Invite['Email'] = $Val['Email'];
$Invite['EndTime'] = $Joined;
$Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
$Invite['IP'] = $Val['IP'];
} elseif ($History[$Key-1]['Email'] != $Val['Email'] && $Val['Time'] != '0000-00-00 00:00:00') {
} elseif ($History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time'] != '0000-00-00 00:00:00') {
// Old email
$i=1;
while($Val['Email'] == $History[$Key+$i]['Email']) {
$i = 1;
while ($Val['Email'] == $History[$Key + $i]['Email']) {
$i++;
}
$Old[$Key]['StartTime'] = (isset($History[$Key+$i]) && $History[$Key+$i]['Time'] != '0000-00-00 00:00:00') ? $History[$Key+$i]['Time'] : $Joined;
$Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time'] != '0000-00-00 00:00:00') ? $History[$Key + $i]['Time'] : $Joined;
$Old[$Key]['EndTime'] = $Val['Time'];
$Old[$Key]['IP'] = $Val['IP'];
$Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
@ -131,7 +131,7 @@
} else {
// Shouldn't have to be here but I'll leave it anyway
$Other[$Key]['StartTime'] = (isset($History[$Key+$i])) ? $History[$Key+$i]['Time'] : $Joined;
$Other[$Key]['StartTime'] = (isset($History[$Key + $i])) ? $History[$Key + $i]['Time'] : $Joined;
$Other[$Key]['EndTime'] = $Val['Time'];
$Other[$Key]['IP'] = $Val['IP'];
$Other[$Key]['ElapsedTime'] = date(time() + strtotime($Other[$Key]['EndTime']) - strtotime($Other[$Key]['StartTime']));
@ -151,14 +151,14 @@
// Clean up arrays
if ($Old) {
$Old = array_reverse(array_reverse($Old));
$LastOld = count($Old)-1;
$LastOld = count($Old) - 1;
if ($Old[$LastOld]['StartTime'] != $Invite['EndTime']) {
// Make sure the timeline is intact (invite email was used as email for the account in the beginning)
$Old[$LastOld+1]['Email'] = $Invite['Email'];
$Old[$LastOld+1]['StartTime'] = $Invite['EndTime'];
$Old[$LastOld+1]['EndTime'] = $Old[$LastOld]['StartTime'];
$Old[$LastOld+1]['ElapsedTime'] = date(time()+strtotime($Old[$LastOld+1]['EndTime'] )-strtotime($Old[$LastOld+1]['StartTime']));
$Old[$LastOld+1]['IP'] = $Invite['IP'];
$Old[$LastOld + 1]['Email'] = $Invite['Email'];
$Old[$LastOld + 1]['StartTime'] = $Invite['EndTime'];
$Old[$LastOld + 1]['EndTime'] = $Old[$LastOld]['StartTime'];
$Old[$LastOld + 1]['ElapsedTime'] = date(time() + strtotime($Old[$LastOld + 1]['EndTime'] ) - strtotime($Old[$LastOld + 1]['StartTime']));
$Old[$LastOld + 1]['IP'] = $Invite['IP'];
}
}