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

@ -16,7 +16,7 @@
$Reason = trim($_POST['reason']);
if (!$Reason) {
error("You must enter a reason!");
error('You must enter a reason!');
}
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID'");
@ -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,7 +162,8 @@
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
<? $DB->query("
SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
@ -173,7 +174,8 @@
<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
<? $DB->query("
SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
@ -186,7 +188,8 @@
</div>
<? }
$DB->query("SELECT DISTINCT req.ID,
$DB->query("
SELECT DISTINCT req.ID,
req.FillerID,
um.Username,
req.TimeFilled
@ -244,11 +247,12 @@
<td colspan="3">
<?
$First = true;
$Extras = explode(" ", $ExtraIDs);
$Extras = explode(' ', $ExtraIDs);
foreach ($Extras as $ExtraID) {
$DB->query("SELECT
$DB->query("
SELECT
tg.Name,
tg.ID,
CASE COUNT(ta.GroupID)
@ -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?>

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'])) {

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')) {
@ -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,

View File

@ -15,10 +15,11 @@
if (!empty($_GET['search'])) {
$Search = db_string($_GET['search']);
} else {
$Search = "";
$Search = '';
}
$sql = "SELECT
$sql = "
SELECT
SQL_CALC_FOUND_ROWS
um.ID,
um.IP,

View File

@ -2,7 +2,9 @@
//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.');

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);
@ -8,20 +10,21 @@
$BeforeDate = $_POST['before_date'];
$DateSearch = false;
if (!empty($AfterDate) && !empty($BeforeDate)) {
list($Y, $M, $D) = explode("-", $AfterDate);
list($Y, $M, $D) = explode('-', $AfterDate);
if (!checkdate($M, $D, $Y)) {
error("Incorrect 'after' date format");
error('Incorrect "after" date format');
}
list($Y, $M, $D) = explode("-", $BeforeDate);
list($Y, $M, $D) = explode('-', $BeforeDate);
if (!checkdate($M, $D, $Y)) {
error("Incorrect 'before' date format");
error('Incorrect "before" date format');
}
$AfterDate = db_string($AfterDate);
$BeforeDate = db_string($BeforeDate);
$DateSearch = true;
}
$RS = "SELECT
$RS = "
SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
@ -35,7 +38,10 @@
i.Donor,
i.Warned,
i.JoinDate,
(SELECT COUNT(h1.UserID) FROM users_history_ips AS h1 WHERE h1.IP=m.IP) AS Uses,
( SELECT COUNT(h1.UserID)
FROM users_history_ips AS h1
WHERE h1.IP=m.IP
) AS Uses,
im.ID,
im.IP,
im.ipcc,
@ -48,7 +54,10 @@
ii.Donor,
ii.Warned,
ii.JoinDate,
(SELECT COUNT(h2.UserID) FROM users_history_ips AS h2 WHERE h2.IP=im.IP) AS InviterUses
( 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
@ -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,5 +1,7 @@
<?
if(!check_perms('site_debug')) { error(403); }
if (!check_perms('site_debug')) {
error(403);
}
if (isset($_POST['global_flush'])) {
authorize();
$Cache->flush();
@ -120,7 +122,7 @@
</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<? 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>

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')) {

View File

@ -1,5 +1,7 @@
<?
if(!check_perms('site_view_flow')) { error(403); }
if (!check_perms('site_view_flow')) {
error(403);
}
//Timeline generation
if (!isset($_GET['page'])) {
@ -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,

View File

@ -1,31 +1,42 @@
<?
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 (!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); }
if ($Err) {
error($Err);
}
$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
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
$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);
@ -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;
@ -67,34 +71,38 @@
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>
<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>
<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,18 +18,24 @@ 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");
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()) { ?>
@ -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

@ -4,7 +4,8 @@
}
View::show_header('Recommendations');
$DB->query("SELECT
$DB->query("
SELECT
tr.GroupID,
tr.UserID,
tg.Name,

View File

@ -7,7 +7,7 @@
if ($_POST['submit'] == 'Delete') {
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error("1");
error('1');
}
$DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = ".$_POST['id']);
@ -26,21 +26,23 @@
if ($_POST['submit'] == 'Edit'){ //Edit
if (empty($_POST['id']) || !is_number($_POST['id'])) {
error("3");
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
$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)
$DB->query("
INSERT INTO xbt_client_whitelist (vstring, peer_id)
VALUES
('".$Client."','".$PeerID."')");
('$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');
@ -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">

View File

@ -6,7 +6,7 @@
View::show_header('Clear a cache key');
//Make sure the form was sent
if(!empty($_GET['key']) && $_GET['type'] == "clear") {
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);
@ -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>

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');

View File

@ -1,12 +1,15 @@
<?
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
$RS = $DB->query("
SELECT
SQL_CALC_FOUND_ROWS
m.ID,
m.IP,
@ -16,13 +19,23 @@
i.Donor,
i.Warned,
i.JoinDate,
(SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) AS Uses
( 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."
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");
ORDER BY Uses DESC
LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
@ -48,7 +61,9 @@
?>
<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");
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()));
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,15 +1,17 @@
<?
if (isset($_SERVER['http_if_modified_since'])) {
header("Status: 304 Not Modified");
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()));
if(!check_perms('users_view_ips')) { die('Access denied.'); }
if (!check_perms('users_view_ips')) {
die('Access denied.');
}
$Octets = explode(".", $_GET['ip']);
$Octets = explode('.', $_GET['ip']);
if (
empty($_GET['ip']) ||
!preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $_GET['ip']) ||
@ -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);
}