Empty commit

This commit is contained in:
Git 2013-10-01 23:08:42 +00:00
parent 9c736fd946
commit a14a9f0b59
40 changed files with 392 additions and 641 deletions

View File

@ -180,7 +180,7 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
case 2: case 2:
$link = Artists::display_artist($DJs[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($DJs[1], $MakeLink, $Escape); $link = Artists::display_artist($DJs[0], $MakeLink, $Escape).$ampersand.Artists::display_artist($DJs[1], $MakeLink, $Escape);
break; break;
default : default:
$link = 'Various DJs'; $link = 'Various DJs';
} }
return $link.($IncludeHyphen?' - ':''); return $link.($IncludeHyphen?' - ':'');

View File

@ -31,8 +31,9 @@ public static function get_thread_info($ThreadID, $Return = true, $SelectiveCach
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
WHERE t.ID = '$ThreadID' WHERE t.ID = '$ThreadID'
GROUP BY fp.TopicID"); GROUP BY fp.TopicID");
if (G::$DB->record_count() == 0) { if (!G::$DB->has_results()) {
error(404); G::$DB->set_query_id($QueryID);
return null;
} }
$ThreadInfo = G::$DB->next_record(MYSQLI_ASSOC, false); $ThreadInfo = G::$DB->next_record(MYSQLI_ASSOC, false);
if ($ThreadInfo['StickyPostID']) { if ($ThreadInfo['StickyPostID']) {
@ -108,7 +109,7 @@ public static function get_forum_info($ForumID) {
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
WHERE forums.ID='$ForumID' WHERE forums.ID='$ForumID'
GROUP BY ForumID"); GROUP BY ForumID");
if (G::$DB->record_count() == 0) { if (!G::$DB->has_results()) {
return false; return false;
} }
// Makes an array, with $Forum['Name'], etc. // Makes an array, with $Forum['Name'], etc.

View File

@ -1,5 +1,8 @@
CHANGELOG CHANGELOG
2013-10-01 by alderaan
In the staff toolbox, reorganized tools into more useful categories
2013-09-30 by alderaan 2013-09-30 by alderaan
Refactored backend code for staff toolbox Refactored backend code for staff toolbox

View File

@ -80,7 +80,7 @@
$ForumName = display_str($Forums[$ForumID]['Name']); $ForumName = display_str($Forums[$ForumID]['Name']);
$JsonSpecificRules = array(); $JsonSpecificRules = array();
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) { foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
$Thread = get_thread_info($ThreadIDs); $Thread = Forums::get_thread_info($ThreadIDs);
$JsonSpecificRules[] = array( $JsonSpecificRules[] = array(
'threadId' => (int) $ThreadIDs, 'threadId' => (int) $ThreadIDs,
'thread' => display_str($Thread['Title']) 'thread' => display_str($Thread['Title'])

View File

@ -6,62 +6,11 @@
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die(); die();
} else { } else {
include(SERVER_ROOT.'/sections/forums/functions.php');
// Replace the old hard-coded forum categories // Replace the old hard-coded forum categories
unset($ForumCats); $ForumCats = Forums::get_forum_categories();
$ForumCats = $Cache->get_value('forums_categories');
if ($ForumCats === false) {
$DB->query("
SELECT ID, Name
FROM forums_categories");
$ForumCats = array();
while (list($ID, $Name) = $DB->next_record()) {
$ForumCats[$ID] = $Name;
}
$Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache.
}
//This variable contains all our lovely forum data //This variable contains all our lovely forum data
if (!$Forums = $Cache->get_value('forums_list')) { $Forums = Forums::get_forums();
$DB->query("
SELECT
f.ID,
f.CategoryID,
f.Name,
f.Description,
f.MinClassRead,
f.MinClassWrite,
f.MinClassCreate,
f.NumTopics,
f.NumPosts,
f.LastPostID,
f.LastPostAuthorID,
f.LastPostTopicID,
f.LastPostTime,
COUNT(sr.ThreadID) AS SpecificRules,
t.Title,
t.IsLocked,
t.IsSticky
FROM forums AS f
JOIN forums_categories AS fc ON fc.ID = f.CategoryID
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
GROUP BY f.ID
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort");
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
foreach ($Forums as $ForumID => $Forum) {
if (count($Forum['SpecificRules'])) {
$DB->query("
SELECT ThreadID
FROM forums_specific_rules
WHERE ForumID = $ForumID");
$ThreadIDs = $DB->collect('ThreadID');
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
}
}
unset($ForumID, $Forum);
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
}
if (empty($_GET['type']) || $_GET['type'] == 'main') { if (empty($_GET['type']) || $_GET['type'] == 'main') {
include(SERVER_ROOT.'/sections/ajax/forum/main.php'); include(SERVER_ROOT.'/sections/ajax/forum/main.php');
@ -79,33 +28,3 @@
} }
} }
} }
// Function to get basic information on a forum
// Uses class CACHE
function get_forum_info($ForumID) {
global $DB, $Cache;
$Forum = $Cache->get_value("ForumInfo_$ForumID");
if (!$Forum) {
$DB->query("
SELECT
Name,
MinClassRead,
MinClassWrite,
MinClassCreate,
COUNT(forums_topics.ID) AS Topics
FROM forums
LEFT JOIN forums_topics ON forums_topics.ForumID = forums.ID
WHERE forums.ID = '$ForumID'
GROUP BY ForumID");
if (!$DB->has_results()) {
return false;
}
// Makes an array, with $Forum['Name'], etc.
$Forum = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value("ForumInfo_$ForumID", $Forum, 86400); // Cache for a day
}
return $Forum;
}
?>

View File

@ -51,14 +51,14 @@
//---------- Get some data to start processing //---------- Get some data to start processing
// Thread information, constant across all pages // Thread information, constant across all pages
$ThreadInfo = get_thread_info($ThreadID, true, true, true); $ThreadInfo = Forums::get_thread_info($ThreadID, true, true);
if ($ThreadInfo == NULL) { if ($ThreadInfo === null) {
json_die('failure', 'no such thread exists'); json_die('failure', 'no such thread exists');
} }
$ForumID = $ThreadInfo['ForumID']; $ForumID = $ThreadInfo['ForumID'];
// Make sure they're allowed to look at the page // Make sure they're allowed to look at the page
if (!check_forumperm($ForumID)) { if (!Forums::check_forumperm($ForumID)) {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die(); die();
} }

View File

@ -1,7 +1,5 @@
<? <?
include(SERVER_ROOT . "/sections/forums/functions.php");
$PostID = (int)$_POST['postid']; $PostID = (int)$_POST['postid'];
if (empty($PostID)) { if (empty($PostID)) {
@ -19,8 +17,7 @@
} }
list($ForumID, $Body) = $DB->next_record(); list($ForumID, $Body) = $DB->next_record();
$Forums = get_forums(); if (!Forums::check_forumperm($ForumID)) {
if (!check_forumperm($ForumID)) {
json_die("error", "assholes"); json_die("error", "assholes");
} }

View File

@ -12,16 +12,16 @@
include(SERVER_ROOT.'/sections/ajax/top10/torrents.php'); include(SERVER_ROOT.'/sections/ajax/top10/torrents.php');
} else { } else {
switch ($_GET['type']) { switch ($_GET['type']) {
case 'users' : case 'users':
include(SERVER_ROOT.'/sections/ajax/top10/users.php'); include(SERVER_ROOT.'/sections/ajax/top10/users.php');
break; break;
case 'tags' : case 'tags':
include(SERVER_ROOT.'/sections/ajax/top10/tags.php'); include(SERVER_ROOT.'/sections/ajax/top10/tags.php');
break; break;
case 'history' : case 'history':
include(SERVER_ROOT.'/sections/ajax/top10/history.php'); include(SERVER_ROOT.'/sections/ajax/top10/history.php');
break; break;
default : default:
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
break; break;
} }

View File

@ -9,7 +9,7 @@
if (check_perms('admin_manage_blog')) { if (check_perms('admin_manage_blog')) {
if (!empty($_REQUEST['action'])) { if (!empty($_REQUEST['action'])) {
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'deadthread' : case 'deadthread':
if (is_number($_GET['id'])) { if (is_number($_GET['id'])) {
$DB->query(" $DB->query("
UPDATE blog UPDATE blog

View File

@ -40,7 +40,7 @@
} else { } else {
//Not an edit, have to get from the original //Not an edit, have to get from the original
switch ($Type) { switch ($Type) {
case 'forums' : case 'forums':
//Get from normal forum stuffs //Get from normal forum stuffs
$DB->query(" $DB->query("
SELECT Body SELECT Body
@ -48,10 +48,10 @@
WHERE ID = $PostID"); WHERE ID = $PostID");
list($Body) = $DB->next_record(); list($Body) = $DB->next_record();
break; break;
case 'collages' : case 'collages':
case 'requests' : case 'requests':
case 'artist' : case 'artist':
case 'torrents' : case 'torrents':
$DB->query(" $DB->query("
SELECT Body SELECT Body
FROM comments FROM comments

View File

@ -136,6 +136,9 @@
<strong>Forum Specific Rules</strong> <strong>Forum Specific Rules</strong>
<? foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) { <? foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
$Thread = Forums::get_thread_info($ThreadIDs); $Thread = Forums::get_thread_info($ThreadIDs);
if ($Thread === null) {
error(404);
}
?> ?>
<br /> <br />
<a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadIDs?>" class="brackets"><?=display_str($Thread['Title'])?></a> <a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadIDs?>" class="brackets"><?=display_str($Thread['Title'])?></a>

View File

@ -1,141 +0,0 @@
<?
function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false, $ApiCall = false) {
global $DB, $Cache;
if ((!$ThreadInfo = $Cache->get_value('thread_'.$ThreadID.'_info')) || !isset($ThreadInfo['OP'])) {
$DB->query("
SELECT
t.Title,
t.ForumID,
t.IsLocked,
t.IsSticky,
COUNT(fp.id) AS Posts,
t.LastPostAuthorID,
ISNULL(p.TopicID) AS NoPoll,
t.StickyPostID,
t.AuthorID as OP,
t.Ranking
FROM forums_topics AS t
JOIN forums_posts AS fp ON fp.TopicID = t.ID
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
WHERE t.ID = '$ThreadID'
GROUP BY fp.TopicID");
if (!$DB->has_results()) {
if (!$ApiCall) {
error(404);
} else {
return NULL;
}
}
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC, false);
if ($ThreadInfo['StickyPostID']) {
$ThreadInfo['Posts']--;
$DB->query("
SELECT
p.ID,
p.AuthorID,
p.AddedTime,
p.Body,
p.EditedUserID,
p.EditedTime,
ed.Username
FROM forums_posts as p
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
WHERE p.TopicID = '$ThreadID'
AND p.ID = '".$ThreadInfo['StickyPostID']."'");
list($ThreadInfo['StickyPost']) = $DB->to_array(false, MYSQLI_ASSOC);
}
if (!$SelectiveCache || !$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$Cache->cache_value('thread_'.$ThreadID.'_info', $ThreadInfo, 0);
}
}
if ($Return) {
return $ThreadInfo;
}
}
function check_forumperm($ForumID, $Perm = 'Read') {
global $LoggedUser, $Forums;
if ($LoggedUser['CustomForums'][$ForumID] == 1) {
return true;
}
if ($Forums[$ForumID]['MinClass'.$Perm] > $LoggedUser['Class'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) {
return false;
}
if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0) {
return false;
}
return true;
}
// Function to get basic information on a forum
// Uses class CACHE
function get_forum_info($ForumID) {
global $DB, $Cache;
$Forum = $Cache->get_value('ForumInfo_'.$ForumID);
if (!$Forum) {
$DB->query("
SELECT
Name,
MinClassRead,
MinClassWrite,
MinClassCreate,
COUNT(forums_topics.ID) AS Topics
FROM forums
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
WHERE forums.ID='$ForumID'
GROUP BY ForumID");
if (!$DB->has_results()) {
return false;
}
// Makes an array, with $Forum['Name'], etc.
$Forum = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
}
return $Forum;
}
function get_forums() {
global $DB, $Cache;
if (!$Forums = $Cache->get_value('forums_list')) {
$DB->query('
SELECT
f.ID,
f.CategoryID,
f.Name,
f.Description,
f.MinClassRead,
f.MinClassWrite,
f.MinClassCreate,
f.NumTopics,
f.NumPosts,
f.LastPostID,
f.LastPostAuthorID,
f.LastPostTopicID,
f.LastPostTime,
COUNT(sr.ThreadID) AS SpecificRules,
t.Title,
t.IsLocked,
t.IsSticky
FROM forums AS f
JOIN forums_categories AS fc ON fc.ID = f.CategoryID
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
LEFT JOIN forums_specific_rules AS sr ON sr.ForumID = f.ID
GROUP BY f.ID
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort');
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
foreach ($Forums as $ForumID => $Forum) {
if (count($Forum['SpecificRules'])) {
$DB->query("
SELECT ThreadID
FROM forums_specific_rules
WHERE ForumID = $ForumID");
$ThreadIDs = $DB->collect('ThreadID');
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
}
}
unset($ForumID, $Forum);
$Cache->cache_value('forums_list', $Forums, 0); //Inf cache.
}
return $Forums;
}

View File

@ -48,6 +48,9 @@
$TopicID = $_POST['thread']; $TopicID = $_POST['thread'];
$ThreadInfo = Forums::get_thread_info($TopicID); $ThreadInfo = Forums::get_thread_info($TopicID);
if ($ThreadInfo === null) {
error(404);
}
$ForumID = $ThreadInfo['ForumID']; $ForumID = $ThreadInfo['ForumID'];
$SQLTime = sqltime(); $SQLTime = sqltime();

View File

@ -88,6 +88,9 @@
$Cache->commit_transaction(3600 * 24 * 5); $Cache->commit_transaction(3600 * 24 * 5);
} }
$ThreadInfo = Forums::get_thread_info($TopicID); $ThreadInfo = Forums::get_thread_info($TopicID);
if ($ThreadInfo === null) {
error(404);
}
if ($ThreadInfo['StickyPostID'] == $PostID) { if ($ThreadInfo['StickyPostID'] == $PostID) {
$ThreadInfo['StickyPost']['Body'] = $Body; $ThreadInfo['StickyPost']['Body'] = $Body;
$ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID']; $ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID'];

View File

@ -104,6 +104,9 @@
$Cache->commit_transaction(3600 * 24 * 5); $Cache->commit_transaction(3600 * 24 * 5);
} }
$ThreadInfo = Forums::get_thread_info($TopicID); $ThreadInfo = Forums::get_thread_info($TopicID);
if ($ThreadInfo === null) {
error(404);
}
if ($ThreadInfo['StickyPostID'] == $PostID) { if ($ThreadInfo['StickyPostID'] == $PostID) {
$ThreadInfo['StickyPost']['Body'] = $Body; $ThreadInfo['StickyPost']['Body'] = $Body;
$ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID']; $ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID'];

View File

@ -49,6 +49,9 @@
// Thread information, constant across all pages // Thread information, constant across all pages
$ThreadInfo = Forums::get_thread_info($ThreadID, true, true); $ThreadInfo = Forums::get_thread_info($ThreadID, true, true);
if ($ThreadInfo === null) {
error(404);
}
$ForumID = $ThreadInfo['ForumID']; $ForumID = $ThreadInfo['ForumID'];
$IsDonorForum = $ForumID == DONOR_FORUM ? true : false; $IsDonorForum = $ForumID == DONOR_FORUM ? true : false;

View File

@ -24,7 +24,7 @@
case 'Contact': case 'Contact':
header('Location: inbox.php?action=compose&to='.$_POST['friendid']); header('Location: inbox.php?action=compose&to='.$_POST['friendid']);
break; break;
default : default:
error(404); error(404);
} }
} else { } else {

View File

@ -303,8 +303,6 @@ function log_attempt($UserID) {
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
} }
$DB->query(" $DB->query("
INSERT INTO users_sessions INSERT INTO users_sessions
(UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA) (UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA)

View File

@ -26,10 +26,10 @@
} else { } else {
$View = $_GET['view']; $View = $_GET['view'];
switch ($_GET['view']) { switch ($_GET['view']) {
case 'old' : case 'old':
$Where = "Status = 'Resolved'"; $Where = "Status = 'Resolved'";
break; break;
default : default:
error(404); error(404);
break; break;
} }

View File

@ -80,6 +80,7 @@
$UserIDs[] = $UserID; $UserIDs[] = $UserID;
} }
NotificationsManager::notify_users($UserIDs, NotificationsManager::REQUESTALERTS, Format::get_size($Amount) . " of bounty has been added to a request you've voted on!", "requests.php?action=view&id=" . $RequestID); NotificationsManager::notify_users($UserIDs, NotificationsManager::REQUESTALERTS, Format::get_size($Amount) . " of bounty has been added to a request you've voted on!", "requests.php?action=view&id=" . $RequestID);
} elseif ($LoggedUser['BytesUploaded'] < $Amount) { } elseif ($LoggedUser['BytesUploaded'] < $Amount) {
echo 'bankrupt'; echo 'bankrupt';
} }

View File

@ -101,27 +101,27 @@
bracket. The maximum and minimum required ratios are also referred to as the <strong>0% seeded</strong> and <strong>100% seeded</strong> required ratios, respectively. bracket. The maximum and minimum required ratios are also referred to as the <strong>0% seeded</strong> and <strong>100% seeded</strong> required ratios, respectively.
</li> </li>
<li><strong>2: Determine the actual required ratio.</strong> Your actual required ratio will be a number that falls between the maximum and minimum required ratio values determined in the <li><strong>2: Determine the actual required ratio.</strong> Your actual required ratio will be a number that falls between the maximum and minimum required ratio values determined in the
previous step. To determine your actual required ratio, the system first uses the maximum required ratio (0% seeded) and multiplies it by the value [1 &minus; (seeding / snatched)]. Formatted previous step. To determine your actual required ratio, the system first uses the maximum required ratio (0% seeded) and multiplies it by the value [1 &minus; (<var>seeding</var> / <var>snatched</var>)]. Formatted
differently, the calculation performed by the system looks like this: differently, the calculation performed by the system looks like this:
<br />
<br />
<div style="text-align: center;">
<img style="vertical-align: middle;" src="static/blank.gif"
onload="if (this.src.substr(this.src.length - 9, this.src.length) == 'blank.gif') { this.src = 'https://chart.googleapis.com/chart?cht=tx&amp;chf=bg,s,FFFFFF00&amp;chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&amp;chco=' + hexify(getComputedStyle(this.parentNode, null).color); }" />
</div>
<br />
<br />
<ul>
<li>In this formula, <var>snatched</var> is the number of non-deleted unique snatches you have made. If you snatch a torrent twice, it only counts once. If a snatched torrent is
deleted from the site, it is not counted at all.
</li>
<li>In this formula, <var>seeding</var> is the average number of torrents you&#39;ve seeded over a 72 hour period within the last week. If you&#39;ve seeded a torrent for less than
72 hours within the last week, it will not raise your seeding total. Please note that while it is possible to seed more torrents than you have snatched, the system effectively caps the
value at 100% of your snatched amount.
</li>
</ul>
</li> </li>
</ul> <li><strong>3: Round, if necessary.</strong> The value determined in the previous step is rounded up to your minimum required ratio (100% seeded) if necessary. This step is required because
<br />
<br />
<div style="text-align: center;"><img style="vertical-align: middle;" src="static/blank.gif"
onload="if (this.src.substr(this.src.length - 9, this.src.length) == 'blank.gif') { this.src = 'https://chart.googleapis.com/chart?cht=tx&amp;chf=bg,s,FFFFFF00&amp;chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&amp;chco=' + hexify(getComputedStyle(this.parentNode, null).color); }" />
</div>
<br />
<br />
<ul>
<li>In this formula, <strong>snatched</strong> is the number of non-deleted unique snatches you have made. If you snatch a torrent twice, it only counts once. If a snatched torrent is
deleted from the site, it is not counted at all.
</li>
<li>In this formula, <strong>seeding</strong> is the average number of torrents you&#39;ve seeded over a 72 hour period within the last week. If you&#39;ve seeded a torrent for less than
72 hours within the last week, it will not raise your seeding total. Please note that while it is possible to seed more torrents than you have snatched, the system effectively caps the
value at 100% of your snatched amount.
</li>
<li><strong>3: Round if necessary.</strong> The value determined in the previous step is rounded up to your minimum required ratio (100% seeded) if necessary. This step is required because
most amount downloaded brackets have a minimum required ratio (100% seeded) greater than zero, and the value returned by the above calculation is zero when seeding equals snatched. most amount downloaded brackets have a minimum required ratio (100% seeded) greater than zero, and the value returned by the above calculation is zero when seeding equals snatched.
</li> </li>
</ul> </ul>
@ -147,7 +147,7 @@
<li>In this example, Rippy has downloaded 25 GB. Rippy falls into the 20&ndash;30 GB amount downloaded bracket in the table above. Rippy&#39;s maximum required ratio (0% seeded) is 0.30, and his minimum required ratio (100% seeded) is 0.05. <li>In this example, Rippy has downloaded 25 GB. Rippy falls into the 20&ndash;30 GB amount downloaded bracket in the table above. Rippy&#39;s maximum required ratio (0% seeded) is 0.30, and his minimum required ratio (100% seeded) is 0.05.
</li> </li>
<li>In this example, Rippy has snatched 90 torrents, and is currently seeding 45 torrents.</li> <li>In this example, Rippy has snatched 90 torrents, and is currently seeding 45 torrents.</li>
<li>To calculate Rippy&#39;s actual required ratio, we take his maximum required ratio (0% seeded), which is 0.30, and multiply it by [1 &minus; (seeding / snatched)] (which is 0.50). Written out: <li>To calculate Rippy&#39;s actual required ratio, we take his maximum required ratio (0% seeded), which is 0.30, and multiply it by [1 &minus; (<var>seeding</var> / <var>snatched</var>)] (which is 0.50). Written out:
<samp>0.3 * [1 &minus; (45 / 90)] = 0.15</samp> <samp>0.3 * [1 &minus; (45 / 90)] = 0.15</samp>
</li> </li>
<li>The resulting required ratio is 0.15, which falls between the maximum required ratio of 0.30 and the minimum required ratio of 0.05 for his amount downloaded bracket.</li> <li>The resulting required ratio is 0.15, which falls between the maximum required ratio of 0.30 and the minimum required ratio of 0.05 for his amount downloaded bracket.</li>

View File

@ -17,13 +17,13 @@
if (!empty($_GET['to'])) { if (!empty($_GET['to'])) {
$Level = 0; $Level = 0;
switch ($_GET['to']) { switch ($_GET['to']) {
case 'forum' : case 'forum':
$Level = 650; $Level = 650;
break; break;
case 'staff' : case 'staff':
$Level = 700; $Level = 700;
break; break;
default : default:
error(404); error(404);
break; break;
} }

View File

@ -1,7 +1,5 @@
<? <?
include(SERVER_ROOT.'/sections/staffpm/functions.php');
View::show_header('Staff PMs', 'staffpm'); View::show_header('Staff PMs', 'staffpm');
// Get messages // Get messages

View File

@ -2,8 +2,8 @@
if (!check_perms('admin_donor_log')) { if (!check_perms('admin_donor_log')) {
error(403); error(403);
} }
$Title = "Bitcoin Donation Balance";
View::show_header('Bitcoin donation balance'); View::show_header($Title);
$Balance = DonationsBitcoin::get_balance() . ' BTC'; $Balance = DonationsBitcoin::get_balance() . ' BTC';
$BitcoinAddresses = DonationsBitcoin::get_received(); $BitcoinAddresses = DonationsBitcoin::get_received();
@ -16,6 +16,9 @@
WHERE BitcoinAddress != '' WHERE BitcoinAddress != ''
ORDER BY m.Username ASC"); ORDER BY m.Username ASC");
?> ?>
<div class="header">
<h2><?=$Title?></h2>
</div>
<div class="thin"> <div class="thin">
<div class="header"> <div class="header">
<h3><?=$Balance?></h3> <h3><?=$Balance?></h3>
@ -23,7 +26,7 @@
<table> <table>
<tr class="colhead"> <tr class="colhead">
<th>Username</th> <th>Username</th>
<th>Receiving Bitcoin address</th> <th>Receiving Bitcoin Address</th>
<th>Amount</th> <th>Amount</th>
</tr> </tr>
<? <?

View File

@ -2,7 +2,8 @@
if (!check_perms('users_mod')) { if (!check_perms('users_mod')) {
error(403); error(403);
} }
View::show_header('Unprocessed Bitcoin donations'); $Title = "Unprocessed Bitcoin Donations";
View::show_header($Title);
// Find all donors // Find all donors
$AllDonations = DonationsBitcoin::get_received(); $AllDonations = DonationsBitcoin::get_received();
@ -13,12 +14,12 @@
GROUP BY BitcoinAddress"); GROUP BY BitcoinAddress");
$OldDonations = G::$DB->to_pair(0, 1, false); $OldDonations = G::$DB->to_pair(0, 1, false);
?> ?>
<div id="thin"> <div class="thin">
<div class="header"> <div class="header">
<h2>Unprocessed Bitcoin donations</h2> <h2><?=$Title?></h2>
</div> </div>
<div class="box2"> <div class="box2">
<div class="pad">Do not process these donations manually! The bitcoin parser <em>will</em> get them sooner or later (poke a developer if something seems broken).</div> <div class="pad"><strong>Do not process these donations manually!</strong> The Bitcoin parser <em>will</em> get them sooner or later (poke a developer if something seems broken).</div>
</div> </div>
<? <?
$NewDonations = array(); $NewDonations = array();
@ -39,12 +40,12 @@
?> ?>
<table class="border" width="100%"> <table class="border" width="100%">
<tr class="colhead"> <tr class="colhead">
<td>Bitcoin address</td> <td>Bitcoin Address</td>
<td>User</td> <td>User</td>
<td>Unprocessed amount (<?=$TotalUnproc ?: '0'?>)</td> <td>Unprocessed Amount (Total: <?=$TotalUnproc ?: '0'?>)</td>
<td>Total amount</td> <td>Total Amount</td>
<td>Donor rank</td> <td>Donor Rank</td>
<td>Special rank</td> <td>Special Rank</td>
</tr> </tr>
<? <?
if (!empty($NewDonations)) { if (!empty($NewDonations)) {

View File

@ -1,147 +0,0 @@
<?
//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 (!extension_loaded('eAccelerator')) {
error('eAccelerator Extension not loaded.');
}
if (isset($_POST['submit'])) {
if ($_POST['cache'] == 1) {
authorize();
eaccelerator_caching(true);
} else {
eaccelerator_caching(false);
}
if (function_exists('eaccelerator_optimizer')) {
if ($_POST['optimize'] == 1) {
authorize();
eaccelerator_optimizer(true);
} else {
eaccelerator_optimizer(false);
}
}
if (isset($_POST['clear'])) {
authorize();
eaccelerator_clear();
}
if (isset($_POST['clean'])) {
authorize();
eaccelerator_clean();
}
if (isset($_POST['purge'])) {
authorize();
eaccelerator_purge();
}
}
$Opcode = eaccelerator_info();
$CachedScripts = eaccelerator_cached_scripts();
//$RemovedScripts = eaccelerator_removed_scripts();
View::show_header("Opcode Stats");
?>
<div class="thin">
<div>
<form class="manage_form" name="opcode_stats" action="" method="post">
<div>
<input type="hidden" name="action" value="opcode_stats" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
</div>
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
<tr>
<td><strong>Enable:</strong></td>
<td>
<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"' : '' ?> />
<label for="optimize">Optimize</label>
<? } ?>
</td>
</tr>
<tr>
<td><strong>Controls:</strong></td>
<td>
<input type="checkbox" name="clear" value="clear" id="clear" />
<label for="clear">Clear</label>
<input type="checkbox" name="clean" value="clean" id="clean" />
<label for="clean">Clean</label>
<input type="checkbox" name="purge" value="purge" id="purge" />
<label for="purge">Purge</label>
</td>
</tr>
<tr>
<td colspan="2" class="center">
<input type="submit" name="submit" value="Update" />
</td>
</tr>
</table>
</form>
</div>
<br /><br />
<table>
<tr class="colhead">
<td colspan="6">Status</td>
</tr>
<tr>
<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>Free Storage:</td>
<td><?=Format::get_size($Opcode['memoryAvailable'])?> (<?=number_format(($Opcode['memoryAvailable'] / $Opcode['memorySize']) * 100, 3);?>%)</td>
</tr>
<tr>
<td>Cached Scripts:</td>
<td><?=number_format($Opcode['cachedScripts'])?></td>
<td>Removed Scripts:</td>
<td><?=number_format($Opcode['removedScripts'])?></td>
<td>Cached Keys:</td>
<? if (function_exists('eaccelerator_get')) { ?>
<td><?=number_format($Opcode['cachedKeys'])?></td>
<? } else { ?>
<td>N/A</td>
<? } ?>
</tr>
</table>
<br /><br />
<table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
<tr class="colhead">
<td>File Path</td>
<td>Age</td>
<td>Size</td>
<td>Hits</td>
</tr>
<?
if (count($CachedScripts) === 0) { // Uh-oh, try again.
echo '<tr><td colspan="5">No scripts cached.</td></tr>';
}
$Row = 'a'; // For the pretty colours
foreach ($CachedScripts as $Script) {
list($FilePath, $Modified, $Size, $Reloads, $Uses, $Hits) = array_values($Script);
$Row = $Row === 'a' ? 'b' : 'a';
?>
<tr class="row<?=$Row?>">
<td><?=$FilePath?></td>
<td><?=time_diff($Modified)?></td>
<td><?=Format::get_size($Size)?></td>
<td><?=number_format($Hits)?></td>
</tr>
<?
}
?>
</table>
</div>
<? View::show_footer(); ?>

View File

@ -36,11 +36,15 @@
AND BanReason = '2'"); AND BanReason = '2'");
list($TotalDisabled) = $DB->next_record(); list($TotalDisabled) = $DB->next_record();
$DB->set_query_id($RS); $DB->set_query_id($RS);
?>
<div class="header">
<h2>Upscale Pool</h2>
</div>
<?
if ($DB->has_results()) { if ($DB->has_results()) {
?> ?>
<div class="box pad"> <div class="box pad thin">
<p>There are currently <?=number_format($Results)?> users queued by the system and <?=number_format($TotalDisabled)?> already disabled.</p> <p>There are currently <?=number_format($Results)?> enabled users on Ratio Watch and <?=number_format($TotalDisabled)?> already disabled.</p>
</div> </div>
<div class="linkbox"> <div class="linkbox">
<? <?
@ -51,14 +55,14 @@
<table width="100%"> <table width="100%">
<tr class="colhead"> <tr class="colhead">
<td>User</td> <td>User</td>
<td>Up</td> <td class="number_column">Uploaded</td>
<td>Down</td> <td class="number_column">Downloaded</td>
<td>Ratio</td> <td class="number_column">Ratio</td>
<td>Required Ratio</td> <td class="number_column">Required Ratio</td>
<td>Deficit</td> <td class="number_column tooltip" title="How much the user needs to upload to meet his or her required ratio">Deficit</td>
<td>Gamble</td> <td class="number_column tooltip" title="How much the user has downloaded on Ratio Watch">Gamble</td>
<td>Registered</td> <td>Registration Date</td>
<td>Remaining</td> <td class="tooltip" title="If the time shown here ends in &quot;ago&quot;, then this is how long the user has been on ratio watch and/or below his or her required ratio. If the time shown here does not end in &quot;ago&quot;, then this is the time until the two week Ratio Watch period expires.">Ratio Watch Ended/Ends</td>
<td>Lifespan</td> <td>Lifespan</td>
</tr> </tr>
<? <?
@ -68,12 +72,12 @@
?> ?>
<tr class="row<?=$Row?>"> <tr class="row<?=$Row?>">
<td><?=Users::format_username($UserID, true, true, true, true)?></td> <td><?=Users::format_username($UserID, true, true, true, true)?></td>
<td><?=Format::get_size($Uploaded)?></td> <td class="number_column"><?=Format::get_size($Uploaded)?></td>
<td><?=Format::get_size($Downloaded)?></td> <td class="number_column"><?=Format::get_size($Downloaded)?></td>
<td><?=Format::get_ratio_html($Uploaded, $Downloaded)?></td> <td class="number_column"><?=Format::get_ratio_html($Uploaded, $Downloaded)?></td>
<td><?=number_format($RequiredRatio, 2)?></td> <td class="number_column"><?=number_format($RequiredRatio, 2)?></td>
<td><? if (($Downloaded * $RequiredRatio) > $Uploaded) { echo Format::get_size(($Downloaded * $RequiredRatio) - $Uploaded);} ?></td> <td class="number_column"><? if (($Downloaded * $RequiredRatio) > $Uploaded) { echo Format::get_size(($Downloaded * $RequiredRatio) - $Uploaded);} ?></td>
<td><?=Format::get_size($Downloaded - $RatioWatchDownload)?></td> <td class="number_column"><?=Format::get_size($Downloaded - $RatioWatchDownload)?></td>
<td><?=time_diff($Joined, 2)?></td> <td><?=time_diff($Joined, 2)?></td>
<td><?=time_diff($RatioWatchEnds)?></td> <td><?=time_diff($RatioWatchEnds)?></td>
<td><?//time_diff(strtotime($Joined), strtotime($RatioWatchEnds))?></td> <td><?//time_diff(strtotime($Joined), strtotime($RatioWatchEnds))?></td>

View File

@ -10,11 +10,6 @@
*****************************************************************/ *****************************************************************/
if (isset($argv[1])) { if (isset($argv[1])) {
if ($argv[1] == 'cli_sandbox') {
include('misc/cli_sandbox.php');
die();
}
$_REQUEST['action'] = $argv[1]; $_REQUEST['action'] = $argv[1];
} else { } else {
if (empty($_REQUEST['action']) || ($_REQUEST['action'] != 'public_sandbox' && $_REQUEST['action'] != 'ocelot')) { if (empty($_REQUEST['action']) || ($_REQUEST['action'] != 'public_sandbox' && $_REQUEST['action'] != 'ocelot')) {
@ -45,7 +40,7 @@
} }
} }
include(SERVER_ROOT."/classes/validate.class.php"); include(SERVER_ROOT.'/classes/validate.class.php');
$Val = new VALIDATE; $Val = new VALIDATE;
include(SERVER_ROOT.'/classes/feed.class.php'); include(SERVER_ROOT.'/classes/feed.class.php');
@ -60,71 +55,71 @@
break; break;
//Services //Services
case 'get_host': case 'get_host':
include('services/get_host.php'); include(SERVER_ROOT.'/sections/tools/services/get_host.php');
break; break;
case 'get_cc': case 'get_cc':
include('services/get_cc.php'); include(SERVER_ROOT.'/sections/tools/services/get_cc.php');
break; break;
//Managers //Managers
case 'forum': case 'forum':
include('managers/forum_list.php'); include(SERVER_ROOT.'/sections/tools/managers/forum_list.php');
break; break;
case 'forum_alter': case 'forum_alter':
include('managers/forum_alter.php'); include(SERVER_ROOT.'/sections/tools/managers/forum_alter.php');
break; break;
case 'whitelist': case 'whitelist':
include('managers/whitelist_list.php'); include(SERVER_ROOT.'/sections/tools/managers/whitelist_list.php');
break; break;
case 'whitelist_alter': case 'whitelist_alter':
include('managers/whitelist_alter.php'); include(SERVER_ROOT.'/sections/tools/managers/whitelist_alter.php');
break; break;
case 'login_watch': case 'login_watch':
include('managers/login_watch.php'); include(SERVER_ROOT.'/sections/tools/managers/login_watch.php');
break; break;
case 'recommend': case 'recommend':
include('managers/recommend_list.php'); include(SERVER_ROOT.'/sections/tools/managers/recommend_list.php');
break; break;
case 'recommend_add': case 'recommend_add':
include('managers/recommend_add.php'); include(SERVER_ROOT.'/sections/tools/managers/recommend_add.php');
break; break;
case 'recommend_alter': case 'recommend_alter':
include('managers/recommend_alter.php'); include(SERVER_ROOT.'/sections/tools/managers/recommend_alter.php');
break; break;
case 'recommend_restore': case 'recommend_restore':
include('managers/recommend_restore.php'); include(SERVER_ROOT.'/sections/tools/managers/recommend_restore.php');
break; break;
case 'email_blacklist': case 'email_blacklist':
include('managers/email_blacklist.php'); include(SERVER_ROOT.'/sections/tools/managers/email_blacklist.php');
break; break;
case 'email_blacklist_alter': case 'email_blacklist_alter':
include('managers/email_blacklist_alter.php'); include(SERVER_ROOT.'/sections/tools/managers/email_blacklist_alter.php');
break; break;
case 'email_blacklist_search': case 'email_blacklist_search':
include('managers/email_blacklist_search.php'); include(SERVER_ROOT.'/sections/tools/managers/email_blacklist_search.php');
break; break;
case 'dnu': case 'dnu':
include('managers/dnu_list.php'); include(SERVER_ROOT.'/sections/tools/managers/dnu_list.php');
break; break;
case 'dnu_alter': case 'dnu_alter':
include('managers/dnu_alter.php'); include(SERVER_ROOT.'/sections/tools/managers/dnu_alter.php');
break; break;
case 'editnews': case 'editnews':
case 'news': case 'news':
include('managers/news.php'); include(SERVER_ROOT.'/sections/tools/managers/news.php');
break; break;
case 'takeeditnews': case 'takeeditnews':
@ -183,29 +178,29 @@
break; break;
case 'tokens': case 'tokens':
include('managers/tokens.php'); include(SERVER_ROOT.'/sections/tools/managers/tokens.php');
break; break;
case 'ocelot': case 'ocelot':
include('managers/ocelot.php'); include(SERVER_ROOT.'/sections/tools/managers/ocelot.php');
break; break;
case 'official_tags': case 'official_tags':
include('managers/official_tags.php'); include(SERVER_ROOT.'/sections/tools/managers/official_tags.php');
break; break;
case 'tag_aliases': case 'tag_aliases':
include('managers/tag_aliases.php'); include(SERVER_ROOT.'/sections/tools/managers/tag_aliases.php');
break; break;
case 'label_aliases': case 'label_aliases':
include('managers/label_aliases.php'); include(SERVER_ROOT.'/sections/tools/managers/label_aliases.php');
break; break;
case 'change_log': case 'change_log':
include('managers/change_log.php'); include(SERVER_ROOT.'/sections/tools/managers/change_log.php');
break; break;
case 'global_notification': case 'global_notification':
include('managers/global_notification.php'); include(SERVER_ROOT.'/sections/tools/managers/global_notification.php');
break; break;
case 'take_global_notification': case 'take_global_notification':
include('managers/take_global_notification.php'); include(SERVER_ROOT.'/sections/tools/managers/take_global_notification.php');
break; break;
case 'permissions': case 'permissions':
if (!check_perms('admin_manage_permissions')) { if (!check_perms('admin_manage_permissions')) {
@ -299,7 +294,7 @@
} }
} }
include('managers/permissions_alter.php'); include(SERVER_ROOT.'/sections/tools/managers/permissions_alter.php');
} else { } else {
if (!empty($_REQUEST['removeid'])) { if (!empty($_REQUEST['removeid'])) {
@ -333,176 +328,172 @@
$Cache->delete_value('classes'); $Cache->delete_value('classes');
} }
include('managers/permissions_list.php'); include(SERVER_ROOT.'/sections/tools/managers/permissions_list.php');
} }
break; break;
case 'ip_ban': case 'ip_ban':
//TODO: Clean up DB table ip_bans. //TODO: Clean up DB table ip_bans.
include("managers/bans.php"); include(SERVER_ROOT.'/sections/tools/managers/bans.php');
break; break;
case 'quick_ban': case 'quick_ban':
include("misc/quick_ban.php"); include(SERVER_ROOT.'/sections/tools/misc/quick_ban.php');
break; break;
//Data //Data
case 'registration_log': case 'registration_log':
include('data/registration_log.php'); include(SERVER_ROOT.'/sections/tools/data/registration_log.php');
break; break;
case 'donation_log': case 'donation_log':
include('data/donation_log.php'); include(SERVER_ROOT.'/sections/tools/data/donation_log.php');
break; break;
case 'bitcoin_unproc': case 'bitcoin_unproc':
include('data/bitcoin_unproc.php'); include(SERVER_ROOT.'/sections/tools/data/bitcoin_unproc.php');
break; break;
case 'bitcoin_balance': case 'bitcoin_balance':
include('data/bitcoin_balance.php'); include(SERVER_ROOT.'/sections/tools/data/bitcoin_balance.php');
break; break;
case 'donor_rewards': case 'donor_rewards':
include('data/donor_rewards.php'); include(SERVER_ROOT.'/sections/tools/data/donor_rewards.php');
break; break;
case 'upscale_pool': case 'upscale_pool':
include('data/upscale_pool.php'); include(SERVER_ROOT.'/sections/tools/data/upscale_pool.php');
break; break;
case 'invite_pool': case 'invite_pool':
include('data/invite_pool.php'); include(SERVER_ROOT.'/sections/tools/data/invite_pool.php');
break; break;
case 'torrent_stats': case 'torrent_stats':
include('data/torrent_stats.php'); include(SERVER_ROOT.'/sections/tools/data/torrent_stats.php');
break; break;
case 'user_flow': case 'user_flow':
include('data/user_flow.php'); include(SERVER_ROOT.'/sections/tools/data/user_flow.php');
break; break;
case 'economic_stats': case 'economic_stats':
include('data/economic_stats.php'); include(SERVER_ROOT.'/sections/tools/data/economic_stats.php');
break;
case 'opcode_stats':
include('data/opcode_stats.php');
break; break;
case 'service_stats': case 'service_stats':
include('data/service_stats.php'); include(SERVER_ROOT.'/sections/tools/data/service_stats.php');
break; break;
case 'database_specifics': case 'database_specifics':
include('data/database_specifics.php'); include(SERVER_ROOT.'/sections/tools/data/database_specifics.php');
break; break;
case 'special_users': case 'special_users':
include('data/special_users.php'); include(SERVER_ROOT.'/sections/tools/data/special_users.php');
break; break;
case 'browser_support': case 'browser_support':
include('data/browser_support.php'); include(SERVER_ROOT.'/sections/tools/data/browser_support.php');
break; break;
//END Data //END Data
//Misc //Misc
case 'update_geoip': case 'update_geoip':
include('misc/update_geoip.php'); include(SERVER_ROOT.'/sections/tools/misc/update_geoip.php');
break; break;
case 'dupe_ips': case 'dupe_ips':
include('misc/dupe_ip.php'); include(SERVER_ROOT.'/sections/tools/misc/dupe_ip.php');
break; break;
case 'clear_cache': case 'clear_cache':
include('misc/clear_cache.php'); include(SERVER_ROOT.'/sections/tools/misc/clear_cache.php');
break; break;
case 'create_user': case 'create_user':
include('misc/create_user.php'); include(SERVER_ROOT.'/sections/tools/misc/create_user.php');
break; break;
case 'manipulate_tree': case 'manipulate_tree':
include('misc/manipulate_tree.php'); include(SERVER_ROOT.'/sections/tools/misc/manipulate_tree.php');
break; break;
case 'recommendations': case 'recommendations':
include('misc/recommendations.php'); include(SERVER_ROOT.'/sections/tools/misc/recommendations.php');
break; break;
case 'analysis': case 'analysis':
include('misc/analysis.php'); include(SERVER_ROOT.'/sections/tools/misc/analysis.php');
break; break;
case 'process_info': case 'process_info':
include('misc/process_info.php'); include(SERVER_ROOT.'/sections/tools/misc/process_info.php');
break; break;
case 'rerender_gallery': case 'rerender_gallery':
include('misc/rerender_gallery.php'); include(SERVER_ROOT.'/sections/tools/misc/rerender_gallery.php');
break; break;
case 'sandbox1': case 'sandbox1':
include('misc/sandbox1.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox1.php');
break; break;
case 'sandbox2': case 'sandbox2':
include('misc/sandbox2.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox2.php');
break; break;
case 'sandbox3': case 'sandbox3':
include('misc/sandbox3.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox3.php');
break; break;
case 'sandbox4': case 'sandbox4':
include('misc/sandbox4.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox4.php');
break; break;
case 'sandbox5': case 'sandbox5':
include('misc/sandbox5.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox5.php');
break; break;
case 'sandbox6': case 'sandbox6':
include('misc/sandbox6.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox6.php');
break; break;
case 'sandbox7': case 'sandbox7':
include('misc/sandbox7.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox7.php');
break; break;
case 'sandbox8': case 'sandbox8':
include('misc/sandbox8.php'); include(SERVER_ROOT.'/sections/tools/misc/sandbox8.php');
break; break;
case 'public_sandbox': case 'public_sandbox':
include('misc/public_sandbox.php'); include(SERVER_ROOT.'/sections/tools/misc/public_sandbox.php');
break; break;
case 'mod_sandbox': case 'mod_sandbox':
if (check_perms('users_mod')) { if (check_perms('users_mod')) {
include('misc/mod_sandbox.php'); include(SERVER_ROOT.'/sections/tools/misc/mod_sandbox.php');
} else { } else {
error(403); error(403);
} }
break; break;
case 'bbcode_sandbox': case 'bbcode_sandbox':
include('misc/bbcode_sandbox.php'); include(SERVER_ROOT.'/sections/tools/misc/bbcode_sandbox.php');
break; break;
case 'calendar': case 'calendar':
include('managers/calendar.php'); include(SERVER_ROOT.'/sections/tools/managers/calendar.php');
break; break;
case 'get_calendar_event': case 'get_calendar_event':
include('managers/ajax_get_calendar_event.php'); include(SERVER_ROOT.'/sections/tools/managers/ajax_get_calendar_event.php');
break; break;
case 'take_calendar_event': case 'take_calendar_event':
include('managers/ajax_take_calendar_event.php'); include(SERVER_ROOT.'/sections/tools/managers/ajax_take_calendar_event.php');
break; break;
case 'mass_pm': case 'mass_pm':
include('managers/mass_pm.php'); include(SERVER_ROOT.'/sections/tools/managers/mass_pm.php');
break; break;
case 'take_mass_pm': case 'take_mass_pm':
include('managers/take_mass_pm.php'); include(SERVER_ROOT.'/sections/tools/managers/take_mass_pm.php');
break; break;
default: default:
include(SERVER_ROOT.'/sections/tools/tools.php'); include(SERVER_ROOT.'/sections/tools/tools.php');

View File

@ -1,10 +1,23 @@
<? <?
/***********************************************
* This file displays the list of available tools in the staff toolbox.
*
* Because there are various subcontainers and various permissions, it
* is possible to have empty subcontainers. The $ToolsHTML variable is
* used to display only non-empty subcontainers.
*
***********************************************
*/
if (!check_perms('users_mod')) { if (!check_perms('users_mod')) {
error(403); error(403);
} }
/** /**
* Used for rendering a single table row in the staff toolbox * Used for rendering a single table row in the staff toolbox. The
* $ToolsHTML variable is incrementally expanded with each function call
* in a given subcontainer and gets reset at the beginning of each new
* subcontainer.
* *
* @param string $Title - the displayed name of the tool * @param string $Title - the displayed name of the tool
* @param string $URL - the relative URL of the tool * @param string $URL - the relative URL of the tool
@ -13,10 +26,10 @@
* *
*/ */
function create_row($Title, $URL, $HasPermission = false, $Tooltip = false) { function create_row($Title, $URL, $HasPermission = false, $Tooltip = false) {
$TooltipHTML = $Tooltip !== false ? " class=\"tooltip\" title=\"$Tooltip\"" : "";
if ($HasPermission) { if ($HasPermission) {
echo "\t\t\t\t<tr><td><a href=\"$URL\"$TooltipHTML>$Title</a></td></tr>\n"; global $ToolsHTML;
$TooltipHTML = $Tooltip !== false ? " class=\"tooltip\" title=\"$Tooltip\"" : "";
$ToolsHTML .= "\t\t\t\t<tr><td><a href=\"$URL\"$TooltipHTML>$Title</a></td></tr>\n";
} }
} }
@ -25,137 +38,200 @@ function create_row($Title, $URL, $HasPermission = false, $Tooltip = false) {
<div class="permissions"> <div class="permissions">
<div class="permission_container"> <div class="permission_container">
<!-- begin left column --> <!-- begin left column -->
<div class="permission_container"> <?
// begin Announcements category
$ToolsHTML = "";
create_row("Calendar", "tools.php?action=calendar", Calendar::can_view());
create_row("Change log", "tools.php?action=change_log", check_perms("users_mod"));
create_row("Global notification", "tools.php?action=global_notification", check_perms("users_mod"));
create_row("Mass PM", "tools.php?action=mass_pm", check_perms("users_mod"));
create_row("News post", "tools.php?action=news", check_perms("admin_manage_news"));
create_row("Vanity House additions", "tools.php?action=recommend", check_perms("site_recommend_own") || check_perms("site_manage_recommendations"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Announcements</td></tr> <tr class="colhead"><td>Announcements</td></tr>
<? <?= $ToolsHTML ?>
create_row("Calendar", "tools.php?action=calendar", Calendar::can_view());
create_row("Change log", "tools.php?action=change_log", check_perms("users_mod"));
create_row("Global notification", "tools.php?action=global_notification", check_perms("users_mod"));
create_row("News post", "tools.php?action=news", check_perms("admin_manage_news"));
create_row("Vanity House additions", "tools.php?action=recommend", check_perms("site_recommend_own") || check_perms("site_manage_recommendations"));
?>
</table> </table>
</div> </div>
<div class="permission_container"> <?
}
// begin Community category
$ToolsHTML = "";
create_row("Forum manager", "tools.php?action=forum", check_perms("admin_manage_forums"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Community</td></tr> <tr class="colhead"><td>Community</td></tr>
<? <?= $ToolsHTML ?>
create_row("Forum manager", "tools.php?action=forum", check_perms("admin_manage_forums"));
create_row("Permissions manager", "tools.php?action=permissions", check_perms("admin_manage_permissions"));
create_row("Special users", "tools.php?action=special_users", check_perms("admin_manage_permissions"));
?>
</table> </table>
</div> </div>
<div class="permission_container"> <?
}
// begin Finances category
$ToolsHTML = "";
create_row("Bitcoin donations (balance)", "tools.php?action=bitcoin_balance", check_perms("admin_donor_log"));
create_row("Bitcoin donations (unprocessed)", "tools.php?action=bitcoin_unproc", check_perms("admin_donor_log"));
create_row("Donation log", "tools.php?action=donation_log", check_perms("admin_donor_log"));
create_row("Donor rewards", "tools.php?action=donor_rewards", check_perms("users_mod"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Finances</td></tr> <tr class="colhead"><td>Finances</td></tr>
<? <?= $ToolsHTML ?>
create_row("Bitcoin donations (balance)", "tools.php?action=bitcoin_balance", check_perms("admin_donor_log"));
create_row("Bitcoin donations (unprocessed)", "tools.php?action=bitcoin_unproc", check_perms("admin_donor_log"));
create_row("Donation log", "tools.php?action=donation_log", check_perms("admin_donor_log"));
create_row("Donor rewards", "tools.php?action=donor_rewards", check_perms("users_mod"));
?>
</table> </table>
</div> </div>
<div class="permission_container"> <?
}
// begin Administration category
$ToolsHTML = "";
create_row("Client whitelist", "tools.php?action=whitelist", check_perms("admin_whitelist"));
create_row("Create user", "tools.php?action=create_user", check_perms("admin_create_users"));
create_row("Permissions manager", "tools.php?action=permissions", check_perms("admin_manage_permissions"));
create_row("Special users", "tools.php?action=special_users", check_perms("admin_manage_permissions"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Administration</td></tr> <tr class="colhead"><td>Administration</td></tr>
<? <?= $ToolsHTML ?>
create_row("Client whitelist", "tools.php?action=whitelist", check_perms("admin_whitelist"));
create_row("Create user", "tools.php?action=create_user", check_perms("admin_create_users"));
create_row("Global notification", "tools.php?action=global_notification", check_perms("users_mod"));
create_row("Mass PM", "tools.php?action=mass_pm", check_perms("users_mod"));
?>
</table> </table>
</div> </div>
<? } ?>
<!-- end left column --> <!-- end left column -->
</div> </div>
<div class="permission_container"> <div class="permission_container">
<!-- begin middle column --> <!-- begin middle column -->
<div class="permission_container">
<table class="layout">
<? <?
// begin Queue category
$ToolsHTML = "";
create_row("Login watch", "tools.php?action=login_watch", check_perms("admin_login_watch"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout">
<tr class="colhead"><td>Queue</td></tr> <tr class="colhead"><td>Queue</td></tr>
?> <?= $ToolsHTML ?>
<? create_row("Login watch", "tools.php?action=login_watch", check_perms("admin_login_watch"));
?>
</table> </table>
</div> </div>
<div class="permission_container">
<table class="layout">
<? <?
}
// begin Managers category
$ToolsHTML = "";
create_row("Email blacklist", "tools.php?action=email_blacklist", check_perms("users_view_email"));
create_row("IP address bans", "tools.php?action=ip_ban", check_perms("admin_manage_ipbans"));
create_row("Duplicate IP addresses", "tools.php?action=dupe_ips", check_perms("users_view_ips"));
create_row("Manipulate invite tree", "tools.php?action=manipulate_tree", check_perms("users_mod"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout">
<tr class="colhead"><td>Managers</td></tr> <tr class="colhead"><td>Managers</td></tr>
?> <?= $ToolsHTML ?>
<? create_row("Email blacklist", "tools.php?action=email_blacklist", check_perms("users_view_email"));
create_row("IP address bans", "tools.php?action=ip_ban", check_perms("admin_manage_ipbans"));
create_row("Duplicate IP addresses", "tools.php?action=dupe_ips", check_perms("users_view_ips"));
create_row("Manipulate invite tree", "tools.php?action=manipulate_tree", check_perms("users_mod"));
?>
</table> </table>
</div> </div>
<?
}
// begin Developer Sandboxes category
$ToolsHTML = "";
create_row("Sandbox (1)", "tools.php?action=sandbox1", check_perms("site_debug"));
create_row("Sandbox (2)", "tools.php?action=sandbox2", check_perms("site_debug"));
create_row("Sandbox (3)", "tools.php?action=sandbox3", check_perms("site_debug"));
create_row("Sandbox (4)", "tools.php?action=sandbox4", check_perms("site_debug"));
create_row("Sandbox (5)", "tools.php?action=sandbox5", check_perms("site_debug"));
create_row("Sandbox (6)", "tools.php?action=sandbox6", check_perms("site_debug"));
create_row("Sandbox (7)", "tools.php?action=sandbox7", check_perms("site_debug"));
create_row("Sandbox (8)", "tools.php?action=sandbox8", check_perms("site_debug"));
create_row("BBCode sandbox", "tools.php?action=bbcode_sandbox", check_perms("users_mod"));
create_row("Public sandbox", "tools.php?action=public_sandbox", check_perms("users_mod"), "Do not click this!");
create_row("Mod-level sandbox", "tools.php?action=mod_sandbox", check_perms("users_mod"), "Do not click this!");
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout">
<tr class="colhead"><td>Developer Sandboxes</td></tr>
<?= $ToolsHTML ?>
</table>
</div>
<? } ?>
<!-- end middle column --> <!-- end middle column -->
</div> </div>
<div class="permission_container"> <div class="permission_container">
<!-- begin right column --> <!-- begin right column -->
<div class="permission_container"> <?
// begin Site Information category
$ToolsHTML = "";
create_row("Economic stats", "tools.php?action=economic_stats", check_perms("site_view_flow"));
create_row("Invite pool", "tools.php?action=invite_pool", check_perms("users_view_invites"));
create_row("Registration log", "tools.php?action=registration_log", check_perms("users_view_ips") && check_perms("users_view_email"));
create_row("Torrent stats", "tools.php?action=torrent_stats", check_perms("site_view_flow"));
create_row("Upscale pool", "tools.php?action=upscale_pool", check_perms("site_view_flow"));
create_row("User flow", "tools.php?action=user_flow", check_perms("site_view_flow"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Site Information</td></tr> <tr class="colhead"><td>Site Information</td></tr>
<? <?= $ToolsHTML ?>
create_row("Economic stats", "tools.php?action=economic_stats", check_perms("site_view_flow"));
create_row("Invite pool", "tools.php?action=invite_pool", check_perms("users_view_invites"));
create_row("Registration log", "tools.php?action=registration_log", check_perms("users_view_ips") && check_perms("users_view_email"));
create_row("Torrent stats", "tools.php?action=torrent_stats", check_perms("site_view_flow"));
// create_row("Upscale pool", "tools.php?action=upscale_pool", check_perms("site_view_flow"));
create_row("User flow", "tools.php?action=user_flow", check_perms("site_view_flow"));
?>
</table> </table>
</div> </div>
<div class="permission_container"> <?
}
// begin Torrents category
$ToolsHTML = "";
create_row("\"Do Not Upload\" list", "tools.php?action=dnu", check_perms("admin_dnu"));
create_row("Manage freeleech tokens", "tools.php?action=tokens", check_perms("users_mod"));
create_row("Label aliases", "tools.php?action=label_aliases", check_perms("users_mod"));
create_row("Tag aliases", "tools.php?action=tag_aliases", check_perms("users_mod"));
create_row("Batch tag editor", "tools.php?action=edit_tags", check_perms("users_mod"));
create_row("Official tags manager", "tools.php?action=official_tags", check_perms("users_mod"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Torrents</td></tr> <tr class="colhead"><td>Torrents</td></tr>
<? <?= $ToolsHTML ?>
create_row("\"Do Not Upload\" list", "tools.php?action=dnu", check_perms("admin_dnu"));
create_row("Manage freeleech tokens", "tools.php?action=tokens", check_perms("users_mod"));
create_row("Label aliases", "tools.php?action=label_aliases", check_perms("users_mod"));
create_row("Tag aliases", "tools.php?action=tag_aliases", check_perms("users_mod"));
create_row("Batch tag editor", "tools.php?action=edit_tags", check_perms("users_mod"));
create_row("Official tags manager", "tools.php?action=official_tags", check_perms("users_mod"));
?>
</table> </table>
</div> </div>
<div class="permission_container"> <?
}
// begin Development category
$ToolsHTML = "";
create_row("Clear/view a cache key", "tools.php?action=clear_cache", check_perms("users_mod"));
create_row("PHP processes", "tools.php?action=process_info", check_perms("site_debug"));
create_row("Rerender stylesheet gallery images", "tools.php?action=rerender_gallery", check_perms("site_debug") || check_perms("users_mod"));
create_row("Schedule", "schedule.php?auth=$LoggedUser[AuthKey]", check_perms("site_debug"));
create_row("Service stats", "tools.php?action=service_stats", check_perms("site_debug"));
create_row("Update GeoIP", "tools.php?action=update_geoip", check_perms("admin_update_geoip"));
if ($ToolsHTML) {
?>
<div class="permission_subcontainer">
<table class="layout"> <table class="layout">
<tr class="colhead"><td>Development</td></tr> <tr class="colhead"><td>Development</td></tr>
<? <?= $ToolsHTML ?>
create_row("Clear/view a cache key", "tools.php?action=clear_cache", check_perms("users_mod"));
create_row("Opcode stats", "tools.php?action=opcode_stats", check_perms("site_debug"));
create_row("PHP processes", "tools.php?action=process_info", check_perms("site_debug"));
create_row("Rerender stylesheet gallery images", "tools.php?action=rerender_gallery", check_perms("admin_clear_cache") || check_perms("users_mod"));
create_row("Schedule", "schedule.php?auth=$LoggedUser[AuthKey]", check_perms("site_debug"));
create_row("Service stats", "tools.php?action=service_stats", check_perms("site_debug"));
create_row("Update GeoIP", "tools.php?action=update_geoip", check_perms("admin_update_geoip"));
?>
</table>
</div>
<div class="permission_container">
<table class="layout">
<tr class="colhead"><td>Developer Sandboxes</td></tr>
<?
create_row("Sandbox (1)", "tools.php?action=sandbox1", check_perms("site_debug"));
create_row("Sandbox (2)", "tools.php?action=sandbox2", check_perms("site_debug"));
create_row("Sandbox (3)", "tools.php?action=sandbox3", check_perms("site_debug"));
create_row("Sandbox (4)", "tools.php?action=sandbox4", check_perms("site_debug"));
create_row("Sandbox (5)", "tools.php?action=sandbox5", check_perms("site_debug"));
create_row("Sandbox (6)", "tools.php?action=sandbox6", check_perms("site_debug"));
create_row("Sandbox (7)", "tools.php?action=sandbox7", check_perms("site_debug"));
create_row("Sandbox (8)", "tools.php?action=sandbox8", check_perms("site_debug"));
create_row("BBCode sandbox", "tools.php?action=bbcode_sandbox", check_perms("users_mod"));
create_row("Public sandbox", "tools.php?action=public_sandbox", check_perms("users_mod"), "Do not click this!");
create_row("Mod-level sandbox", "tools.php?action=mod_sandbox", check_perms("users_mod"), "Do not click this!");
?>
</table> </table>
</div> </div>
<? } ?>
<!-- end right column --> <!-- end right column -->
</div> </div>
</div> </div>

View File

@ -17,25 +17,25 @@
include(SERVER_ROOT.'/sections/top10/torrents.php'); include(SERVER_ROOT.'/sections/top10/torrents.php');
} else { } else {
switch ($_GET['type']) { switch ($_GET['type']) {
case 'users' : case 'users':
include(SERVER_ROOT.'/sections/top10/users.php'); include(SERVER_ROOT.'/sections/top10/users.php');
break; break;
case 'tags' : case 'tags':
include(SERVER_ROOT.'/sections/top10/tags.php'); include(SERVER_ROOT.'/sections/top10/tags.php');
break; break;
case 'history' : case 'history':
include(SERVER_ROOT.'/sections/top10/history.php'); include(SERVER_ROOT.'/sections/top10/history.php');
break; break;
case 'votes' : case 'votes':
include(SERVER_ROOT.'/sections/top10/votes.php'); include(SERVER_ROOT.'/sections/top10/votes.php');
break; break;
case 'donors' : case 'donors':
include(SERVER_ROOT.'/sections/top10/donors.php'); include(SERVER_ROOT.'/sections/top10/donors.php');
break; break;
case 'artists': case 'artists':
include(SERVER_ROOT.'/sections/top10/artists.php'); include(SERVER_ROOT.'/sections/top10/artists.php');
break; break;
default : default:
error(404); error(404);
break; break;
} }

View File

@ -308,8 +308,6 @@
$EditSummary[] = 'EAC v0.95 logs rescored to '.$Logs095; $EditSummary[] = 'EAC v0.95 logs rescored to '.$Logs095;
} }
// Start building SQL query and edit summary // Start building SQL query and edit summary
if ($Classes[$Class]['Level'] != $Cur['Class'] if ($Classes[$Class]['Level'] != $Cur['Class']
&& ( && (

View File

@ -440,10 +440,7 @@ function check_paranoia_here($Setting) {
?> ?>
<li>Passwords: <?=number_format($PasswordChanges)?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li> <li>Passwords: <?=number_format($PasswordChanges)?> <a href="userhistory.php?action=passwords&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li> <li>Stats: N/A <a href="userhistory.php?action=stats&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
<? <? } ?>
}
?>
</ul> </ul>
</div> </div>
<? } ?> <? } ?>
@ -1308,12 +1305,11 @@ function check_paranoia_here($Setting) {
<td class="label">Log out:</td> <td class="label">Log out:</td>
<td><input type="checkbox" name="LogOut" id="LogOut" /></td> <td><input type="checkbox" name="LogOut" id="LogOut" /></td>
</tr> </tr>
</table> </table>
<? } ?> <? } ?>
<? if (check_perms("users_mod")) { <? if (check_perms("users_mod")) {
DonationsView::render_mod_donations($UserID); DonationsView::render_mod_donations($UserID);
} }
?> ?>
<table class="layout" id="submit_box"> <table class="layout" id="submit_box">
<tr class="colhead"> <tr class="colhead">

View File

@ -64,7 +64,6 @@
case 'catchup_collages': case 'catchup_collages':
require('catchup_collages.php'); require('catchup_collages.php');
break; break;
case 'token_history': case 'token_history':
require('token_history.php'); require('token_history.php');
break; break;

View File

@ -55,7 +55,7 @@ a img {
border-bottom: 1px solid #4f4f4f; border-bottom: 1px solid #4f4f4f;
} }
#site_debug { #wrapper>#site_debug {
padding: 20px 0 20px 0; padding: 20px 0 20px 0;
color: #a5a5a5; color: #a5a5a5;
text-align: left; text-align: left;
@ -733,6 +733,17 @@ td.body {width:100%;}
strong.quoteheader{color: #878787;} strong.quoteheader{color: #878787;}
/* Toolbox */
.permission_container {
float: left;
margin-left: 20px;
width: 286px;
}
.permission_container:first-child {
margin-left: 0;
}
/* TORRENTS */ /* TORRENTS */
#torrents input[value="Edit torrent"] { #torrents input[value="Edit torrent"] {

View File

@ -601,4 +601,8 @@ tr.torrent .bookmark>a:after {
margin-bottom: 5px; margin-bottom: 5px;
list-style-type: decimal; list-style-type: decimal;
font-size: 150%; font-size: 150%;
}
.permission_subcontainer {
margin-bottom: 10px;
} }

View File

@ -571,3 +571,12 @@ tr.torrent .bookmark > a:after { content: ""; }
.autocomplete-selected { .autocomplete-selected {
background: #666; background: #666;
} }
.permission_container {
float: left;
margin-left: 20px;
width: 313px;
}
.permission_container:first-child {
margin-left: 0;
}

View File

@ -1195,7 +1195,7 @@ div.permission_container:nth-child(2) {
padding: 0px 2%; padding: 0px 2%;
} }
div.permission_container>table { div.permission_container table.layout {
width: 100%; width: 100%;
} }

View File

@ -1281,7 +1281,12 @@ tr.torrent .bookmark > a:after {
/* Toolbox */ /* Toolbox */
.permission_container { .permission_container {
float: left; float: left;
width: 33.3%; margin-left: 20px;
width: 286px;
}
.permission_container:first-child {
margin-left: 0;
} }
/* TORRENTS */ /* TORRENTS */

View File

@ -815,3 +815,13 @@ div[class~=tooltipster-base] {
.user_options .label { .user_options .label {
width: 150px; width: 150px;
} }
.permission_container {
float: left;
margin-left: 20px;
width: 303px;
}
.permission_container:first-child {
margin-left: 0;
}