diff --git a/sections/collages/take_delete.php b/sections/collages/take_delete.php
index 345ab93f..5d8f895f 100644
--- a/sections/collages/take_delete.php
+++ b/sections/collages/take_delete.php
@@ -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');
diff --git a/sections/reportsv2/ajax_new_report.php b/sections/reportsv2/ajax_new_report.php
index 04095a36..9d7d054d 100644
--- a/sections/reportsv2/ajax_new_report.php
+++ b/sections/reportsv2/ajax_new_report.php
@@ -162,22 +162,24 @@
uploaded by =$UploaderName?> =time_diff($Time)?>
=$FillerName?> used this torrent to fill this request =time_diff($FilledTime)?>
@@ -244,44 +247,45 @@
$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 = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : "")." ".($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %) " : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
+ $ExtraLinkName = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %) " : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
- $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : "")." ".($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %) " : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
+ $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '')." ".($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %) " : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
} else {
- $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : "")." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : "")." ".($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %) " : "")." (".number_format($ExtraSize/(1024*1024), 2)." MB)";
+ $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]".($ExtraRemastered ? " <$ExtraRemasterTitle - $ExtraRemasterYear>" : '').' '.($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %) " : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)';
}
-
?>
=($First ? '' : ' ')?>
=$ExtraLinkName?>
@@ -366,7 +369,7 @@
Warning
- for($i = 0; $i < 9; $i++) {
+ for ($i = 0; $i < 9; $i++) {
?>
=$i?>
diff --git a/sections/tools/data/database_specifics.php b/sections/tools/data/database_specifics.php
index d20de4ab..9a0a8898 100644
--- a/sections/tools/data/database_specifics.php
+++ b/sections/tools/data/database_specifics.php
@@ -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 @@
- Name
- Engine
- Rows
- Row Size
- Data Size
- Index Size
- Total Size
+ Name
+ Engine
+ Rows
+ Row Size
+ Data Size
+ Index Size
+ Total Size
Tools
diff --git a/sections/tools/data/economic_stats.php b/sections/tools/data/economic_stats.php
index 846f2afc..8974320e 100644
--- a/sections/tools/data/economic_stats.php
+++ b/sections/tools/data/economic_stats.php
@@ -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 @@
Total upload: =Format::get_size($TotalUpload)?>
Total download: =Format::get_size($TotalDownload)?>
- Total buffer: =Format::get_size($TotalUpload-$TotalDownload)?>
+ Total buffer: =Format::get_size($TotalUpload - $TotalDownload)?>
- Mean ratio: =Format::get_ratio_html($TotalUpload,$TotalDownload)?>
- Mean upload: =Format::get_size($TotalUpload/$NumUsers)?>
- Mean download: =Format::get_size($TotalDownload/$NumUsers)?>
- Mean buffer: =Format::get_size(($TotalUpload-$TotalDownload)/$NumUsers)?>
+ Mean ratio: =Format::get_ratio_html($TotalUpload, $TotalDownload)?>
+ Mean upload: =Format::get_size($TotalUpload / $NumUsers)?>
+ Mean download: =Format::get_size($TotalDownload / $NumUsers)?>
+ Mean buffer: =Format::get_size(($TotalUpload - $TotalDownload) / $NumUsers)?>
Total request bounty: =Format::get_size($TotalBounty)?>
Available request bounty: =Format::get_size($AvailableBounty)?>
@@ -99,18 +106,18 @@
Seeder/leecher ratio: =Format::get_ratio_html($TotalSeeders,$TotalLeechers)?>
Seeder/snatch ratio: =Format::get_ratio_html($TotalSeeders,$TotalOverallSnatches)?>
- Mean seeders per torrent: =number_format($TotalSeeders/$TotalTorrents, 2)?>
- Mean leechers per torrent: =number_format($TotalLeechers/$TotalTorrents, 2)?>
- Mean snatches per torrent: =number_format($TotalSnatches/$TotalTorrents, 2)?>
+ Mean seeders per torrent: =number_format($TotalSeeders / $TotalTorrents, 2)?>
+ Mean leechers per torrent: =number_format($TotalLeechers / $TotalTorrents, 2)?>
+ Mean snatches per torrent: =number_format($TotalSnatches / $TotalTorrents, 2)?>
- Mean seeding per user: =number_format($TotalSeeders/$NumUsers, 2)?>
- Mean leeching per user: =number_format($TotalLeechers/$NumUsers, 2)?>
- Mean snatches per user: =number_format($TotalOverallSnatches/$NumUsers, 2)?>
+ Mean seeding per user: =number_format($TotalSeeders / $NumUsers, 2)?>
+ Mean leeching per user: =number_format($TotalLeechers / $NumUsers, 2)?>
+ Mean snatches per user: =number_format($TotalOverallSnatches / $NumUsers, 2)?>
Total users in at least 1 swarm: =number_format($TotalPeerUsers)?>
- Mean seeding per user in at least 1 swarm: =number_format($TotalSeeders/$TotalPeerUsers, 2)?>
- Mean leeching per user in at least 1 swarm: =number_format($TotalLeechers/$TotalPeerUsers, 2)?>
- Mean snatches per user in at least 1 swarm: =number_format($TotalSnatches/$TotalPeerUsers, 2)?>
+ Mean seeding per user in at least 1 swarm: =number_format($TotalSeeders / $TotalPeerUsers, 2)?>
+ Mean leeching per user in at least 1 swarm: =number_format($TotalLeechers / $TotalPeerUsers, 2)?>
+ Mean snatches per user in at least 1 swarm: =number_format($TotalSnatches / $TotalPeerUsers, 2)?>
diff --git a/sections/tools/data/invite_pool.php b/sections/tools/data/invite_pool.php
index 82d6c7dd..8fadeb5d 100644
--- a/sections/tools/data/invite_pool.php
+++ b/sections/tools/data/invite_pool.php
@@ -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 @@
IP
InviteCode
Expires
- if(check_perms('users_edit_invites')){ ?>
+ if (check_perms('users_edit_invites')) { ?>
Controls
} ?>
diff --git a/sections/tools/data/opcode_stats.php b/sections/tools/data/opcode_stats.php
index 605c46aa..b3f2e531 100644
--- a/sections/tools/data/opcode_stats.php
+++ b/sections/tools/data/opcode_stats.php
@@ -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 @@
Enable:
- />
+ />
Cache
if (function_exists('eaccelerator_optimizer')) { ?>
- />
+ />
Optimize
} ?>
@@ -97,9 +99,9 @@
Total Storage:
=Format::get_size($Opcode['memorySize'])?>
Used Storage:
- =Format::get_size($Opcode['memoryAllocated'])?> (=number_format(($Opcode['memoryAllocated']/$Opcode['memorySize'])*100, 3);?>%)
+ =Format::get_size($Opcode['memoryAllocated'])?> (=number_format(($Opcode['memoryAllocated'] / $Opcode['memorySize']) * 100, 3);?>%)
Free Storage:
- =Format::get_size($Opcode['memoryAvailable'])?> (=number_format(($Opcode['memoryAvailable']/$Opcode['memorySize'])*100, 3);?>%)
+ =Format::get_size($Opcode['memoryAvailable'])?> (=number_format(($Opcode['memoryAvailable'] / $Opcode['memorySize']) * 100, 3);?>%)
Cached Scripts:
@@ -123,7 +125,7 @@
Hits
-if(count($CachedScripts) == 0) { // Uh-oh, try again.
+if (count($CachedScripts) == 0) { // Uh-oh, try again.
echo 'No scripts cached. ';
}
$Row = 'a'; // For the pretty colours
@@ -142,4 +144,4 @@
?>
- View::show_footer(); ?>
\ No newline at end of file
+ View::show_footer(); ?>
diff --git a/sections/tools/data/registration_log.php b/sections/tools/data/registration_log.php
index 256a1458..ec1aa62c 100644
--- a/sections/tools/data/registration_log.php
+++ b/sections/tools/data/registration_log.php
@@ -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 @@
?>
- $Pages=Format::get_pages($Page,$Results,USERS_PER_PAGE,11) ;
+ $Pages = Format::get_pages($Page,$Results,USERS_PER_PAGE,11) ;
echo $Pages;
?>
@@ -94,7 +103,7 @@
Registered
- 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';
?>
@@ -120,15 +129,20 @@
=Tools::get_host_by_ajax($IP)?>
=Tools::get_host_by_ajax($InviterIP)?>
- =time_diff($Joined)?> =time_diff($InviterJoined)?>
+
+ =time_diff($Joined)?>
+ =time_diff($InviterJoined)?>
+
} ?>
echo $Pages; ?>
- } else { ?>
+
+} else { ?>
There have been no new registrations in the past 72 hours.
- }
+
+}
View::show_footer();
?>
diff --git a/sections/tools/data/service_stats.php b/sections/tools/data/service_stats.php
index 720278ab..7df07b84 100644
--- a/sections/tools/data/service_stats.php
+++ b/sections/tools/data/service_stats.php
@@ -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 @@
Threads (Active)
Cache:
- =number_format($MemStats['threads'])?> (100.000%)
+ =number_format($MemStats['threads'])?> (100.000%)
- 0.7) { echo ' class="invalid" '; } ?>>Database:
- =number_format($DBStats['Threads_created']['Value'])?> (=number_format(($DBStats['Threads_connected']['Value']/$DBStats['Threads_created']['Value'])*100,3)?>%)
+ 0.7) { echo ' class="invalid" '; } ?>>Database:
+ =number_format($DBStats['Threads_created']['Value'])?> (=number_format(($DBStats['Threads_connected']['Value'] / $DBStats['Threads_created']['Value']) * 100,3)?>%)
Connections
@@ -49,8 +51,8 @@
=number_format($MemStats['total_items'])?>
- 0.85) { echo ' class="invalid" title="Evictions begin when storage exceeds 85%" '; } ?>>Cache Storage:
- =Format::get_size($MemStats['bytes'])?> (=number_format(($MemStats['bytes']/$MemStats['limit_maxbytes'])*100, 3);?>%)
+ 0.85) { echo ' class="invalid" title="Evictions begin when storage exceeds 85%" '; } ?>>Cache Storage:
+ =Format::get_size($MemStats['bytes'])?> (=number_format(($MemStats['bytes'] / $MemStats['limit_maxbytes']) * 100, 3);?>%)
Utilities
@@ -88,66 +90,66 @@
Database:
- =number_format($DBStats['Com_insert']['Value']+$DBStats['Com_update']['Value'])?>
+ =number_format($DBStats['Com_insert']['Value'] + $DBStats['Com_update']['Value'])?>
Get/Select (Success)
- >Cache:
- =number_format($MemStats['get_hits'])?> (=number_format(($MemStats['get_hits']/$MemStats['cmd_get'])*100, 3);?>%)
+ >Cache:
+ =number_format($MemStats['get_hits'])?> (=number_format(($MemStats['get_hits'] / $MemStats['cmd_get']) * 100, 3);?>%)
Database:
- =number_format($DBStats['Com_select']['Value'])?> (100.000%)
+ =number_format($DBStats['Com_select']['Value'])?> (100.000%)
Set/Insert (Success)
Cache:
- =number_format($MemStats['cmd_set'])?> (100.000%)
+ =number_format($MemStats['cmd_set'])?> (100.000%)
Database:
- =number_format($DBStats['Com_insert']['Value'])?> (100.000%)
+ =number_format($DBStats['Com_insert']['Value'])?> (100.000%)
Increment/Decrement (Success)
- >Cache Increment:
- =number_format($MemStats['incr_hits'])?> (=number_format(($MemStats['incr_hits']/($MemStats['incr_hits']+$MemStats['incr_misses']))*100, 3);?>%)
+ >Cache Increment:
+ =number_format($MemStats['incr_hits'])?> (=number_format(($MemStats['incr_hits'] / ($MemStats['incr_hits'] + $MemStats['incr_misses'])) * 100, 3);?>%)
- >Cache Decrement:
- =number_format($MemStats['decr_hits'])?> (=number_format(($MemStats['decr_hits']/($MemStats['decr_hits']+$MemStats['decr_misses']))*100, 3);?>%)
+ >Cache Decrement:
+ =number_format($MemStats['decr_hits'])?> (=number_format(($MemStats['decr_hits'] / ($MemStats['decr_hits'] + $MemStats['decr_misses'])) * 100, 3);?>%)
CAS/Update (Success)
- 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:
- =number_format($MemStats['cas_hits'])?> ( if ($MemStats['cas_hits'] > 0) { echo number_format(($MemStats['cas_hits']/($MemStats['cas_hits']+$MemStats['cas_misses']))*100, 3); } else { echo '0.000'; }?>%)
+ 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:
+ =number_format($MemStats['cas_hits'])?> ( if ($MemStats['cas_hits'] > 0) { echo number_format(($MemStats['cas_hits'] / ($MemStats['cas_hits'] + $MemStats['cas_misses'])) * 100, 3); } else { echo '0.000'; }?>%)
Database:
- =number_format($DBStats['Com_update']['Value'])?> (100.000%)
+ =number_format($DBStats['Com_update']['Value'])?> (100.000%)
Deletes (Success)
- >Cache:
- =number_format($MemStats['delete_hits'])?> (=number_format(($MemStats['delete_hits']/($MemStats['delete_hits']+$MemStats['delete_misses']))*100, 3);?>%)
+ >Cache:
+ =number_format($MemStats['delete_hits'])?> (=number_format(($MemStats['delete_hits'] / ($MemStats['delete_hits'] + $MemStats['delete_misses'])) * 100, 3);?>%)
Database:
- =number_format($DBStats['Com_delete']['Value'])?> (100.000%)
+ =number_format($DBStats['Com_delete']['Value'])?> (100.000%)
Special
- $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:
+ $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:
=number_format($MemStats['cmd_flush'])?>
- 0) { echo ' class="invalid" '; } ?>>Cache Evicted:
+ 0) { echo ' class="invalid" '; } ?>>Cache Evicted:
=number_format($MemStats['evictions'])?>
- $DBStats['Questions']['Value']/7500) { echo ' class="invalid" title="1/7500 queries is allowed to be slow to minimize performance impact." '; } ?>>Database Slow:
+ $DBStats['Questions']['Value'] / 7500) { echo ' class="invalid" title="1/7500 queries is allowed to be slow to minimize performance impact." '; } ?>>Database Slow:
=number_format($DBStats['Slow_queries']['Value'])?>
@@ -178,100 +180,100 @@
Total Reads
- >Cache:
- =number_format($MemStats['cmd_get']/$MemStats['uptime'],5)?>/s
+ >Cache:
+ =number_format($MemStats['cmd_get'] / $MemStats['uptime'],5)?>/s
Database:
- =number_format($DBStats['Com_select']['Value']/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format($DBStats['Com_select']['Value'] / $DBStats['Uptime']['Value'],5)?>/s
Total Writes
- >Cache:
- =number_format($MemStats['cmd_set']/$MemStats['uptime'],5)?>/s
+ >Cache:
+ =number_format($MemStats['cmd_set'] / $MemStats['uptime'],5)?>/s
Database:
- =number_format(($DBStats['Com_insert']['Value']+$DBStats['Com_update']['Value'])/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format(($DBStats['Com_insert']['Value'] + $DBStats['Com_update']['Value']) / $DBStats['Uptime']['Value'],5)?>/s
Get/Select
Cache:
- =number_format($MemStats['get_hits']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['get_hits'] / $MemStats['uptime'],5)?>/s
Database:
- =number_format($DBStats['Com_select']['Value']/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format($DBStats['Com_select']['Value'] / $DBStats['Uptime']['Value'],5)?>/s
Set/Insert
Cache:
- =number_format($MemStats['cmd_set']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['cmd_set'] / $MemStats['uptime'],5)?>/s
Database:
- =number_format($DBStats['Com_insert']['Value']/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format($DBStats['Com_insert']['Value'] / $DBStats['Uptime']['Value'],5)?>/s
Increment/Decrement
Cache Increment:
- =number_format($MemStats['incr_hits']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['incr_hits'] / $MemStats['uptime'],5)?>/s
Cache Decrement:
- =number_format($MemStats['decr_hits']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['decr_hits'] / $MemStats['uptime'],5)?>/s
CAS/Updates
Cache:
- =number_format($MemStats['cas_hits']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['cas_hits'] / $MemStats['uptime'],5)?>/s
Database:
- =number_format($DBStats['Com_update']['Value']/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format($DBStats['Com_update']['Value'] / $DBStats['Uptime']['Value'],5)?>/s
Deletes
Cache:
- =number_format($MemStats['delete_hits']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['delete_hits'] / $MemStats['uptime'],5)?>/s
Database:
- =number_format($DBStats['Com_delete']['Value']/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format($DBStats['Com_delete']['Value'] / $DBStats['Uptime']['Value'],5)?>/s
Special
Cache Flushes:
- =number_format($MemStats['cmd_flush']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['cmd_flush'] / $MemStats['uptime'],5)?>/s
Cache Evicted:
- =number_format($MemStats['evictions']/$MemStats['uptime'],5)?>/s
+ =number_format($MemStats['evictions'] / $MemStats['uptime'],5)?>/s
Database Slow:
- =number_format($DBStats['Slow_queries']['Value']/$DBStats['Uptime']['Value'],5)?>/s
+ =number_format($DBStats['Slow_queries']['Value'] / $DBStats['Uptime']['Value'],5)?>/s
Data Read
Cache:
- =Format::get_size($MemStats['bytes_read']/$MemStats['uptime'])?>/s
+ =Format::get_size($MemStats['bytes_read'] / $MemStats['uptime'])?>/s
Database:
- =Format::get_size($DBStats['Bytes_received']['Value']/$DBStats['Uptime']['Value'])?>/s
+ =Format::get_size($DBStats['Bytes_received']['Value'] / $DBStats['Uptime']['Value'])?>/s
Data Write
Cache:
- =Format::get_size($MemStats['bytes_written']/$MemStats['uptime'])?>/s
+ =Format::get_size($MemStats['bytes_written'] / $MemStats['uptime'])?>/s
Database:
- =Format::get_size($DBStats['Bytes_sent']['Value']/$DBStats['Uptime']['Value'])?>/s
+ =Format::get_size($DBStats['Bytes_sent']['Value'] / $DBStats['Uptime']['Value'])?>/s
diff --git a/sections/tools/data/torrent_stats.php b/sections/tools/data/torrent_stats.php
index 8aa5063c..c9d72363 100644
--- a/sections/tools/data/torrent_stats.php
+++ b/sections/tools/data/torrent_stats.php
@@ -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 @@
Total size: =Format::get_size($TotalSize)?>
Total files: =number_format($TotalFiles)?>
- Mean torrents per user: =number_format($TorrentCount/$NumUsers)?>
- Mean torrent size: =Format::get_size($TotalSize/$TorrentCount)?>
- Mean files per torrent: =number_format($TotalFiles/$TorrentCount)?>
- Mean filesize: =Format::get_size($TotalSize/$TotalFiles)?>
+ Mean torrents per user: =number_format($TorrentCount / $NumUsers)?>
+ Mean torrent size: =Format::get_size($TotalSize / $TorrentCount)?>
+ Mean files per torrent: =number_format($TotalFiles / $TorrentCount)?>
+ Mean filesize: =Format::get_size($TotalSize / $TotalFiles)?>
@@ -52,17 +54,17 @@
Size this week: =Format::get_size($WeekSize)?>
Files this week: =number_format($WeekFiles)?>
- Torrents per day this week: =number_format($WeekNum/7)?>
- Size per day this week: =Format::get_size($WeekSize/7)?>
- Files per day this week: =number_format($WeekFiles/7)?>
+ Torrents per day this week: =number_format($WeekNum / 7)?>
+ Size per day this week: =Format::get_size($WeekSize / 7)?>
+ Files per day this week: =number_format($WeekFiles / 7)?>
Torrents this month: =number_format($MonthNum)?>
Size this month: =Format::get_size($MonthSize)?>
Files this month: =number_format($MonthFiles)?>
- Torrents per day this month: =number_format($MonthNum/30)?>
- Size per day this month: =Format::get_size($MonthSize/30)?>
- Files per day this month: =number_format($MonthFiles/30)?>
+ Torrents per day this month: =number_format($MonthNum / 30)?>
+ Size per day this month: =Format::get_size($MonthSize / 30)?>
+ Files per day this month: =number_format($MonthFiles / 30)?>
diff --git a/sections/tools/data/user_flow.php b/sections/tools/data/user_flow.php
index 57daf3e7..20179523 100644
--- a/sections/tools/data/user_flow.php
+++ b/sections/tools/data/user_flow.php
@@ -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);
?>
- if(!isset($_GET['page'])) { ?>
+ if (!isset($_GET['page'])) { ?>
} ?>
-$Pages=Format::get_pages($Page,$Results,DAYS_PER_PAGE,11) ;
+$Pages = Format::get_pages($Page,$Results,DAYS_PER_PAGE,11) ;
echo $Pages;
?>
@@ -124,7 +127,7 @@
Net Growth
- 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;
?>
diff --git a/sections/tools/managers/bans.php b/sections/tools/managers/bans.php
index 31ac5e2f..8a19df4c 100644
--- a/sections/tools/managers/bans.php
+++ b/sections/tools/managers/bans.php
@@ -130,7 +130,7 @@
$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);
diff --git a/sections/tools/managers/eb_alter.php b/sections/tools/managers/eb_alter.php
index a399b2ed..5284cba0 100644
--- a/sections/tools/managers/eb_alter.php
+++ b/sections/tools/managers/eb_alter.php
@@ -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()."')");
}
}
diff --git a/sections/tools/managers/official_tags.php b/sections/tools/managers/official_tags.php
index 5c320207..8acbdad7 100644
--- a/sections/tools/managers/official_tags.php
+++ b/sections/tools/managers/official_tags.php
@@ -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 @@
-
+
-$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()) {
?>
Name
Level
- User Count
+ User count
Actions
- while(list($ID,$Name,$Level,$Secondary,$UserCount)=$DB->next_record()) { ?>
+ while (list($ID,$Name,$Level,$Secondary,$UserCount)=$DB->next_record()) { ?>
=display_str($Name); ?>
- =($Secondary?'Secondary':$Level) ?>
+ =($Secondary ? 'Secondary' : $Level) ?>
=number_format($UserCount); ?>
Edit
@@ -44,9 +50,11 @@ function confirmDelete(id) {
} ?>
- } else { ?>
+
+} else { ?>
There are no permission classes.
- } ?>
+
+} ?>
View::show_footer();
diff --git a/sections/tools/managers/recommend_add.php b/sections/tools/managers/recommend_add.php
index de8f69be..a164fb47 100644
--- a/sections/tools/managers/recommend_add.php
+++ b/sections/tools/managers/recommend_add.php
@@ -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);
}
diff --git a/sections/tools/managers/recommend_list.php b/sections/tools/managers/recommend_list.php
index d334717b..ce1723d8 100644
--- a/sections/tools/managers/recommend_list.php
+++ b/sections/tools/managers/recommend_list.php
@@ -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 @@
Recommendations
- if(!in_array($LoggedUser['ID'], $DB->collect('UserID'))){ ?>
+ if (!in_array($LoggedUser['ID'], $DB->collect('UserID'))) { ?>
- View::show_footer(); ?>
\ No newline at end of file
+ View::show_footer(); ?>
diff --git a/sections/tools/misc/clear_cache.php b/sections/tools/misc/clear_cache.php
index 6df01ac3..d2949ac0 100644
--- a/sections/tools/misc/clear_cache.php
+++ b/sections/tools/misc/clear_cache.php
@@ -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 '
Keys '.display_str($_GET['key']).' cleared!
';
@@ -35,7 +35,7 @@
- if(!empty($_GET['key']) && $_GET['type'] == "view") { ?>
+ if (!empty($_GET['key']) && $_GET['type'] == 'view') { ?>
var_dump($Cache->get_value($_GET['key'])); ?>
@@ -44,4 +44,4 @@
} ?>
- View::show_footer(); ?>
\ No newline at end of file
+ View::show_footer(); ?>
diff --git a/sections/tools/misc/create_user.php b/sections/tools/misc/create_user.php
index 2fb4fb2b..6b4844fd 100644
--- a/sections/tools/misc/create_user.php
+++ b/sections/tools/misc/create_user.php
@@ -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 @@
+
+ Username
+
+
+
+ Email
+
+
+
+ Password
+
+
+
+
+
+
}
diff --git a/sections/tools/misc/dupe_ip.php b/sections/tools/misc/dupe_ip.php
index 7a177e80..9ad31144 100644
--- a/sections/tools/misc/dupe_ip.php
+++ b/sections/tools/misc/dupe_ip.php
@@ -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()) {
?>
@@ -43,12 +56,14 @@
Registered
- 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';
?>
=Users::format_username($UserID, true, true, true, true)?>
- =Tools::get_host_by_ajax($IP)." ($IP)"?> H S
+
+ =Tools::get_host_by_ajax($IP)." ($IP)"?> H S
+
=display_str($Uses)?>
=time_diff($Joined)?>
diff --git a/sections/tools/services/get_cc.php b/sections/tools/services/get_cc.php
index 8519eafd..6b454055 100644
--- a/sections/tools/services/get_cc.php
+++ b/sections/tools/services/get_cc.php
@@ -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']));
diff --git a/sections/tools/services/get_host.php b/sections/tools/services/get_host.php
index 52ba7ee1..2006d766 100644
--- a/sections/tools/services/get_host.php
+++ b/sections/tools/services/get_host.php
@@ -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;
}
-
diff --git a/sections/user/user.php b/sections/user/user.php
index fd7fc9f2..413dbee8 100644
--- a/sections/user/user.php
+++ b/sections/user/user.php
@@ -209,7 +209,7 @@ function check_paranoia_here($Setting) {