Empty commit

This commit is contained in:
Git 2013-10-19 08:01:09 +00:00
parent c2c3a83ea0
commit a8f3922ffb
13 changed files with 207 additions and 154 deletions

View File

@ -16,11 +16,11 @@ function time_ago($TimeStamp) {
return time() - $TimeStamp; return time() - $TimeStamp;
} }
/*
* Returns a <span> by default but can optionally return the raw time
* difference in text (e.g. "16 hours and 28 minutes", "1 day, 18 hours").
*/
function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) { function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
/*
Returns a <span> by default but can optionally return the raw time
difference in text (e.g. "16 hours and 28 minutes", "1 day, 18 hours").
*/
if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
if ($TimeStamp == '0000-00-00 00:00:00') { if ($TimeStamp == '0000-00-00 00:00:00') {
return 'Never'; return 'Never';

View File

@ -630,19 +630,19 @@ public static function show_avatar($Avatar, $UserID, $Username, $Setting, $Size
if (!empty($AvatarMouseOverText)) { if (!empty($AvatarMouseOverText)) {
$AvatarMouseOverText = "title=\"$AvatarMouseOverText\" alt=\"$AvatarMouseOverText\""; $AvatarMouseOverText = "title=\"$AvatarMouseOverText\" alt=\"$AvatarMouseOverText\"";
} else { } else {
$AvatarMouseOverText = "alt=\"\""; $AvatarMouseOverText = "alt=\"$Username's avatar\"";
} }
if ($EnabledRewards['HasSecondAvatar'] && !empty($Rewards['SecondAvatar'])) { if ($EnabledRewards['HasSecondAvatar'] && !empty($Rewards['SecondAvatar'])) {
$SecondAvatar = 'data-gazelle-second-avatar="' . ImageTools::process($Rewards['SecondAvatar']) . '"'; $SecondAvatar = ' data-gazelle-second-avatar="' . ImageTools::process($Rewards['SecondAvatar']) . '"';
} }
// case 1 is avatars disabled // case 1 is avatars disabled
switch ($Setting) { switch ($Setting) {
case 0: case 0:
if (!empty($Avatar)) { if (!empty($Avatar)) {
$ToReturn = ($ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" $Style $AvatarMouseOverText $SecondAvatar $Class />" : $Avatar); $ToReturn = ($ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" $Style $AvatarMouseOverText$SecondAvatar $Class />" : $Avatar);
} else { } else {
$URL = STATIC_SERVER.'common/avatars/default.png'; $URL = STATIC_SERVER.'common/avatars/default.png';
$ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" $Style $AvatarMouseOverText $SecondAvatar />" : $URL); $ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" $Style $AvatarMouseOverText$SecondAvatar />" : $URL);
} }
break; break;
case 2: case 2:
@ -683,14 +683,14 @@ public static function show_avatar($Avatar, $UserID, $Username, $Setting, $Size
$URL = 'https://robohash.org/'.md5($Username)."?set=set$Type&amp;size={$Size}x$Size"; $URL = 'https://robohash.org/'.md5($Username)."?set=set$Type&amp;size={$Size}x$Size";
} }
if ($ShowAvatar == true && !empty($Avatar)) { if ($ShowAvatar == true && !empty($Avatar)) {
$ToReturn = ($ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" $Style $AvatarMouseOverText $SecondAvatar $Class/>" : $Avatar); $ToReturn = ($ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" $Style $AvatarMouseOverText$SecondAvatar $Class/>" : $Avatar);
} else { } else {
$ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" $Style $AvatarMouseOverText $SecondAvatar $Class/>" : $URL); $ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" $Style $AvatarMouseOverText$SecondAvatar $Class/>" : $URL);
} }
break; break;
default: default:
$URL = STATIC_SERVER.'common/avatars/default.png'; $URL = STATIC_SERVER.'common/avatars/default.png';
$ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" $Style $AvatarMouseOverText $SecondAvatar $Class/>" : $URL); $ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" $Style $AvatarMouseOverText$SecondAvatar $Class/>" : $URL);
} }
return $ToReturn; return $ToReturn;
} }

View File

@ -31,7 +31,7 @@
<strong>Time:</strong> <span><?=number_format(((microtime(true) - $ScriptStartTime) * 1000), 5)?> ms</span> <strong>Time:</strong> <span><?=number_format(((microtime(true) - $ScriptStartTime) * 1000), 5)?> ms</span>
<strong>Used:</strong> <span><?=Format::get_size(memory_get_usage(true))?></span> <strong>Used:</strong> <span><?=Format::get_size(memory_get_usage(true))?></span>
<strong>Load:</strong> <span><?=number_format($Load[0], 2).' '.number_format($Load[1], 2).' '.number_format($Load[2], 2)?></span> <strong>Load:</strong> <span><?=number_format($Load[0], 2).' '.number_format($Load[1], 2).' '.number_format($Load[2], 2)?></span>
<strong>Date:</strong> <span><?=date('M d Y, H:i')?></span> <strong>Date:</strong> <span id="site_date"><?=date('M d Y')?></span>, <span id="site_time"><?=date('H:i')?></span>
</p> </p>
</div> </div>

View File

@ -377,9 +377,9 @@
// Inbox // Inbox
if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) { if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
$NotificationsManager->load_inbox(); $NotificationsManager->load_inbox();
$NewMessages = $NotificationsManager->get_notifications()[NotificationsManager::INBOX]; $NewMessages = $NotificationsManager->get_notifications();
if (isset($NewMessages)) { if (isset($NewMessages[NotificationsManager::INBOX])) {
$Alerts[] = NotificationsManagerView::format_traditional($NewMessages); $Alerts[] = NotificationsManagerView::format_traditional($NewMessages[NotificationsManager::INBOX]);
} }
$NotificationsManager->clear_notifications_array(); $NotificationsManager->clear_notifications_array();
} }
@ -393,9 +393,9 @@
// Torrents // Torrents
if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) { if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) {
$NotificationsManager->load_torrent_notifications(); $NotificationsManager->load_torrent_notifications();
$NewTorrents = $NotificationsManager->get_notifications()[NotificationsManager::TORRENTS]; $NewTorrents = $NotificationsManager->get_notifications();
if (isset($NewTorrents)) { if (isset($NewTorrents[NotificationsManager::TORRENTS])) {
$Alerts[] = NotificationsManagerView::format_traditional($NewTorrents); $Alerts[] = NotificationsManagerView::format_traditional($NewTorrents[NotificationsManager::TORRENTS]);
} }
$NotificationsManager->clear_notifications_array(); $NotificationsManager->clear_notifications_array();
} }

View File

@ -94,11 +94,11 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<? if (Users::has_avatars_enabled()) { ?> <? if (Users::has_avatars_enabled()) { ?>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<?=Users::show_avatar(G::$LoggedUser['Avatar'], G::$LoggedUser['ID'], G::$LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?> <?=Users::show_avatar(G::$LoggedUser['Avatar'], G::$LoggedUser['ID'], G::$LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
</td> </td>
<? } ?> <? } ?>
<td class="body" valign="top"> <td class="body" valign="top">
<div id="contentpreview" style="text-align: left;"> <div id="contentpreview" style="text-align: left;">
<div id="preview_<?=$ReplyText->getID()?>"></div> <div id="preview_<?=$ReplyText->getID()?>"></div>
@ -106,7 +106,7 @@
</td> </td>
</tr> </tr>
</table> </table>
<form class="send_form center" name="reply" id="quickpostform" action="<?=$Action?>" method="post"<? if (!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled=true;" <? } ?>> <form class="send_form center" name="reply" id="quickpostform" action="<?=$Action?>" method="post"<? if (!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled = true;"<? } ?>>
<input type="hidden" name="action" value="<?=$InputAction?>" /> <input type="hidden" name="action" value="<?=$InputAction?>" />
<input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
<input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" /> <input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" />
@ -118,7 +118,8 @@
</div> </div>
<div class="preview_submit"> <div class="preview_submit">
<? <?
if (isset($SubscribeBox) && !isset($ForumID) && Subscriptions::has_subscribed_comments($Document, $InputID) === false) { ?> if (isset($SubscribeBox) && !isset($ForumID) && Subscriptions::has_subscribed_comments($Document, $InputID) === false) {
?>
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" /> <input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" />
<label for="subscribebox">Subscribe</label> <label for="subscribebox">Subscribe</label>
<? <?
@ -126,7 +127,8 @@
// Forum thread logic // Forum thread logic
// This might use some more abstraction // This might use some more abstraction
if (isset($ForumID)) { if (isset($ForumID)) {
if (!Subscriptions::has_subscribed($InputID)) { ?> if (!Subscriptions::has_subscribed($InputID)) {
?>
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" /> <input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> tabindex="2" />
<label for="subscribebox">Subscribe</label> <label for="subscribebox">Subscribe</label>
<? <?
@ -138,10 +140,15 @@
?> ?>
<input id="mergebox" type="checkbox" name="merge" tabindex="2" /> <input id="mergebox" type="checkbox" name="merge" tabindex="2" />
<label for="mergebox">Merge</label> <label for="mergebox">Merge</label>
<? } <?
if (!G::$LoggedUser['DisableAutoSave']) { ?> }
<script type="application/javascript">var storedTempTextarea = new StoreText('quickpost', 'quickpostform', <?=$InputID?>);</script> if (!G::$LoggedUser['DisableAutoSave']) {
<? } ?>
<script type="application/javascript">
var storedTempTextarea = new StoreText('quickpost', 'quickpostform', <?=$InputID?>);
</script>
<?
}
} }
?> ?>
<input type="button" value="Preview" class="hidden button_preview_<?=$ReplyText->getID()?>" title="Preview text" tabindex="1" /> <input type="button" value="Preview" class="hidden button_preview_<?=$ReplyText->getID()?>" title="Preview text" tabindex="1" />

View File

@ -770,14 +770,6 @@ CREATE TABLE `requests_votes` (
KEY `Bounty` (`Bounty`) KEY `Bounty` (`Bounty`)
) ENGINE=InnoDB CHARSET utf8; ) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `sacrifice` (
`UserID` int(10) NOT NULL,
`Time` datetime NOT NULL,
`Sacrifice1` text NOT NULL,
`Sacrifice2` text NOT NULL,
`IsValid` tinyint(4) NOT NULL
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `schedule` ( CREATE TABLE `schedule` (
`NextHour` int(2) NOT NULL DEFAULT '0', `NextHour` int(2) NOT NULL DEFAULT '0',
`NextDay` int(2) NOT NULL DEFAULT '0', `NextDay` int(2) NOT NULL DEFAULT '0',

View File

@ -37,7 +37,7 @@
<a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a> <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a>
</h2> </h2>
<div class="linkbox"> <div class="linkbox">
<a href="#" id="subscribelink_collages<?=$CollageID?>" class="brackets" onclick="SubscribeComments('collages',<?=$CollageID?>);return false;"><?=Subscriptions::has_subscribed_comments('collages', $CollageID) !== false ? 'Unsubscribe' : 'Subscribe'?></a> <a href="#" id="subscribelink_collages<?=$CollageID?>" class="brackets" onclick="SubscribeComments('collages', <?=$CollageID?>); return false;"><?=Subscriptions::has_subscribed_comments('collages', $CollageID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
<? <?
$Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9); $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9);
if ($Pages) { if ($Pages) {
@ -49,7 +49,7 @@
<? <?
//---------- Begin printing //---------- Begin printing
CommentsView::render_comments($Thread, $LastRead, "collages.php?action=comments&collageid=$CollageID"); CommentsView::render_comments($Thread, $LastRead, "collages.php?action=comments&amp;collageid=$CollageID");
if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) { if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) { if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
View::parse('generic/reply/quickreply.php', array( View::parse('generic/reply/quickreply.php', array(

View File

@ -18,13 +18,17 @@
) AS Responses ) AS Responses
FROM user_questions AS uq FROM user_questions AS uq
WHERE uq.ID NOT IN WHERE uq.ID NOT IN
( (
SELECT siq.QuestionID FROM staff_ignored_questions AS siq WHERE siq.UserID = '$LoggedUser[ID]' SELECT siq.QuestionID
) FROM staff_ignored_questions AS siq
AND uq.ID NOT IN WHERE siq.UserID = '$LoggedUser[ID]'
( )
SELECT sq.QuestionID FROM staff_answers AS sq WHERE sq.UserID = '$LoggedUser[ID]' AND uq.ID NOT IN
) (
SELECT sq.QuestionID
FROM staff_answers AS sq
WHERE sq.UserID = '$LoggedUser[ID]'
)
ORDER BY uq.Date DESC"); ORDER BY uq.Date DESC");
$Questions = $DB->to_array(); $Questions = $DB->to_array();

View File

@ -236,10 +236,10 @@
?> ?>
<tr> <tr>
<td> <td>
<a href="user.php?id=<?=$User['UserID']?>"><?=($Boldify ? '<strong>' : '')?><?=display_str($User['Username'])?><?=($Boldify ? '</strong>' : '')?></a> <a href="user.php?id=<?=$User['UserID']?>"><?=($Boldify ? '<strong>' : '') . display_str($User['Username']) . ($Boldify ? '</strong>' : '')?></a>
</td> </td>
<td class="number_column"> <td class="number_column">
<?=($Boldify ? '<strong>' : '')?><?=Format::get_size($User['Bounty'])?><?=($Boldify ? '</strong>' : '')?> <?=($Boldify ? '<strong>' : '') . Format::get_size($User['Bounty']) . ($Boldify ? "</strong>\n" : "\n")?>
</td> </td>
</tr> </tr>
<? } <? }
@ -274,51 +274,38 @@
if (!empty($Request['RecordLabel'])) { ?> if (!empty($Request['RecordLabel'])) { ?>
<tr> <tr>
<td class="label">Record label</td> <td class="label">Record label</td>
<td> <td><?=$Request['RecordLabel']?></td>
<?=$Request['RecordLabel']?>
</td>
</tr> </tr>
<? } <? }
if (!empty($Request['CatalogueNumber'])) { ?> if (!empty($Request['CatalogueNumber'])) { ?>
<tr> <tr>
<td class="label">Catalogue number</td> <td class="label">Catalogue number</td>
<td> <td><?=$Request['CatalogueNumber']?></td>
<?=$Request['CatalogueNumber']?>
</td>
</tr> </tr>
<? } ?> <? } ?>
<tr> <tr>
<td class="label">Release type</td> <td class="label">Release type</td>
<td> <td><?=$ReleaseName?></td>
<?=$ReleaseName?>
</td>
</tr> </tr>
<tr> <tr>
<td class="label">Acceptable bitrates</td> <td class="label">Acceptable bitrates</td>
<td> <td><?=$BitrateString?></td>
<?=$BitrateString?>
</td>
</tr> </tr>
<tr> <tr>
<td class="label">Acceptable formats</td> <td class="label">Acceptable formats</td>
<td> <td><?=$FormatString?></td>
<?=$FormatString?>
</td>
</tr> </tr>
<tr> <tr>
<td class="label">Acceptable media</td> <td class="label">Acceptable media</td>
<td> <td><?=$MediaString?></td>
<?=$MediaString?>
</td>
</tr> </tr>
<? if (!empty($Request['LogCue'])) { ?> <? if (!empty($Request['LogCue'])) { ?>
<tr> <tr>
<td class="label">Required CD FLAC only extras</td> <td class="label">Required CD FLAC only extras</td>
<td> <td><?=$Request['LogCue']?></td>
<?=$Request['LogCue']?>
</td>
</tr> </tr>
<? } <?
}
} }
$Worldcat = ''; $Worldcat = '';
$OCLC = str_replace(' ', '', $Request['OCLC']); $OCLC = str_replace(' ', '', $Request['OCLC']);
@ -332,14 +319,14 @@
} }
} }
} }
if (!empty($Worldcat)) { ?> if (!empty($Worldcat)) {
?>
<tr> <tr>
<td class="label">WorldCat (OCLC) ID</td> <td class="label">WorldCat (OCLC) ID</td>
<td> <td><?=$Worldcat?></td>
<?=$Worldcat?>
</td>
</tr> </tr>
<? } <?
}
if ($Request['GroupID']) { if ($Request['GroupID']) {
?> ?>
<tr> <tr>
@ -360,12 +347,12 @@
<? if ($Request['LastVote'] > $Request['TimeAdded']) { ?> <? if ($Request['LastVote'] > $Request['TimeAdded']) { ?>
<tr> <tr>
<td class="label">Last voted</td> <td class="label">Last voted</td>
<td> <td><?=time_diff($Request['LastVote'])?></td>
<?=time_diff($Request['LastVote'])?>
</td>
</tr> </tr>
<? } <?
if ($CanVote) { ?> }
if ($CanVote) {
?>
<tr id="voting"> <tr id="voting">
<td class="label tooltip" title="These units are in base 2, not base 10. For example, there are 1,024 MB in 1 GB.">Custom vote (MB)</td> <td class="label tooltip" title="These units are in base 2, not base 10. For example, there are 1,024 MB in 1 GB.">Custom vote (MB)</td>
<td> <td>
@ -432,11 +419,11 @@
<br /> <br />
<strong>Should be the permalink (PL) to the torrent (e.g. https://<?=SSL_SITE_URL?>/torrents.php?torrentid=xxxx).</strong> <strong>Should be the permalink (PL) to the torrent (e.g. https://<?=SSL_SITE_URL?>/torrents.php?torrentid=xxxx).</strong>
</div> </div>
<? if (check_perms('site_moderate_requests')) { ?> <? if (check_perms('site_moderate_requests')) { ?>
<div class="field_div"> <div class="field_div">
For user: <input type="text" size="25" name="user"<?=(!empty($FillerUsername) ? " value=\"$FillerUsername\"" : '')?> /> For user: <input type="text" size="25" name="user"<?=(!empty($FillerUsername) ? " value=\"$FillerUsername\"" : '')?> />
</div> </div>
<? } ?> <? } ?>
<div class="submit_div"> <div class="submit_div">
<input type="submit" value="Fill request" /> <input type="submit" value="Fill request" />
</div> </div>
@ -448,7 +435,9 @@
<td colspan="2" class="center"><strong>Description</strong></td> <td colspan="2" class="center"><strong>Description</strong></td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><?=$Text->full_format($Request['Description']);?></td> <td colspan="2">
<?= $Text->full_format($Request['Description']);?>
</td>
</tr> </tr>
</table> </table>
<? <?
@ -465,20 +454,20 @@
<? <?
//---------- Begin printing //---------- Begin printing
CommentsView::render_comments($Thread, $LastRead, "requests.php?action=view&id=$RequestID"); CommentsView::render_comments($Thread, $LastRead, "requests.php?action=view&amp;id=$RequestID");
if ($Pages) { ?> if ($Pages) { ?>
<div class="linkbox pager"><?=$Pages?></div> <div class="linkbox pager"><?=$Pages?></div>
<? <?
} }
View::parse('generic/reply/quickreply.php', array( View::parse('generic/reply/quickreply.php', array(
'InputName' => 'pageid', 'InputName' => 'pageid',
'InputID' => $RequestID, 'InputID' => $RequestID,
'Action' => 'comments.php?page=requests', 'Action' => 'comments.php?page=requests',
'InputAction' => 'take_post', 'InputAction' => 'take_post',
'SubscribeBox' => true 'SubscribeBox' => true
)); ));
?> ?>
</div> </div>
</div> </div>

View File

@ -6,11 +6,14 @@
authorize(); authorize();
if ($_POST['submit'] == 'Reorder') { // Reorder if ($_POST['submit'] == 'Reorder') { // Reorder
foreach ($_POST['item'] as $Position => $Item) { foreach ($_POST['item'] as $Position => $Item) {
$Position = db_string($Position); $Position = db_string($Position);
$Item = db_string($Item); $Item = db_string($Item);
$DB->query('UPDATE `do_not_upload` SET `Sequence` = ' . $Position . ' WHERE `id` = '. $Item); $DB->query('
} UPDATE `do_not_upload`
SET `Sequence` = ' . $Position . '
WHERE `id` = '. $Item);
}
} elseif ($_POST['submit'] == 'Delete') { //Delete } elseif ($_POST['submit'] == 'Delete') { //Delete
if (!is_number($_POST['id']) || $_POST['id'] == '') { if (!is_number($_POST['id']) || $_POST['id'] == '') {
@ -20,7 +23,7 @@
DELETE FROM do_not_upload DELETE FROM do_not_upload
WHERE ID = '.$_POST['id']); WHERE ID = '.$_POST['id']);
} else { //Edit & Create, Shared Validation } else { //Edit & Create, Shared Validation
$Val->SetFields('name', '1', 'string', 'The name must be set, has a maximum length of 100 characters, and has a minimum length of 5 characters.', array('maxlength' => 100, 'minlength' => 5)); $Val->SetFields('name', '1', 'string', 'The name must be set, have a maximum length of 100 characters, and have a minimum length of 5 characters.', array('maxlength' => 100, 'minlength' => 5));
$Val->SetFields('comment', '0', 'string', 'The description has a maximum length of 255 characters.', array('maxlength' => 255)); $Val->SetFields('comment', '0', 'string', 'The description has a maximum length of 255 characters.', array('maxlength' => 255));
$Err = $Val->ValidateForm($_POST); // Validate the form $Err = $Val->ValidateForm($_POST); // Validate the form
if ($Err) { if ($Err) {

View File

@ -558,25 +558,41 @@ function filelist($Str) {
$Reports = $Cache->get_value("reports_torrent_$TorrentID"); $Reports = $Cache->get_value("reports_torrent_$TorrentID");
if ($Reports === false) { if ($Reports === false) {
$DB->query(" $DB->query("
SELECT r.ID, SELECT
r.ID,
r.ReporterID, r.ReporterID,
r.Type, r.Type,
r.UserComment, r.UserComment,
r.ReportedTime r.ReportedTime
FROM reportsv2 AS r FROM reportsv2 AS r
WHERE TorrentID = $TorrentID WHERE TorrentID = $TorrentID
AND Type != 'edited'
AND Status != 'Resolved'"); AND Status != 'Resolved'");
$Reports = $DB->to_array(); $Reports = $DB->to_array();
$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0); $Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
} }
if (count($Reports) > 0) {
// used to see if we have any non-"edited log" reports to display
$NumNonEditedLogReports = 0;
foreach ($Reports as $Report) {
if ($Report['Type'] != 'edited') {
$NumNonEditedLogReports += 1;
}
}
/* for regular users, don't display the torrent reports table if there
* are 0 non-"edited log" reports.
* always let staff (e.g. permission "admin_reports") view "edited
* log" reports.
*/
if ($NumNonEditedLogReports > 0 || (check_perms('admin_reports') && $Reports)) {
$Reported = true; $Reported = true;
include(SERVER_ROOT.'/sections/reportsv2/array.php'); include(SERVER_ROOT.'/sections/reportsv2/array.php');
$NumReports = check_perms('admin_reports') ? count($Reports) : $NumNonEditedLogReports;
$ReportInfo = ' $ReportInfo = '
<table class="reportinfo_table"> <table class="reportinfo_table">
<tr class="colhead_dark" style="font-weight: bold;"> <tr class="colhead_dark" style="font-weight: bold;">
<td>This torrent has '.count($Reports).' active '.(count($Reports) > 1 ? 'reports' : 'report').":</td> <td>This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":</td>
</tr>"; </tr>";
foreach ($Reports as $Report) { foreach ($Reports as $Report) {
@ -585,18 +601,27 @@ function filelist($Str) {
$Reporter = Users::user_info($ReporterID); $Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username']; $ReporterName = $Reporter['Username'];
if ($ReportType == 'edited' && !check_perms('admin_reports')) {
// Edited Log report and the viewing user does not have adequate permission
continue;
}
if (array_key_exists($ReportType, $Types[$GroupCategoryID])) { if (array_key_exists($ReportType, $Types[$GroupCategoryID])) {
$ReportType = $Types[$GroupCategoryID][$ReportType]; $ReportType = $Types[$GroupCategoryID][$ReportType];
} elseif (array_key_exists($ReportType,$Types['master'])) { } elseif (array_key_exists($ReportType, $Types['master'])) {
$ReportType = $Types['master'][$ReportType]; $ReportType = $Types['master'][$ReportType];
} else { } else {
//There was a type but it wasn't an option! //There was a type but it wasn't an option!
$ReportType = $Types['master']['other']; $ReportType = $Types['master']['other'];
} }
$ReportInfo .= "\n\t<tr>\n\t\t<td>".(check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":'; $ReportInfo .= "
$ReportInfo .= "\n<blockquote>".$Text->full_format($ReportReason)."</blockquote>\n\t\t</td>\n\t</tr>"; <tr>
<td>".(check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":
<blockquote>'.$Text->full_format($ReportReason).'</blockquote>
</td>
</tr>';
} }
$ReportInfo .= "\n</table>"; $ReportInfo .= "\n\t\t</table>";
} }
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear))); $CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
@ -604,12 +629,15 @@ function filelist($Str) {
$RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid='.$TorrentID.'" class="brackets">Regenerate</a>' : ''; $RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid='.$TorrentID.'" class="brackets">Regenerate</a>' : '';
$FileTable = ' $FileTable = '
<table class="filelist_table"> <table class="filelist_table">
<tr class="colhead_dark"><td> <tr class="colhead_dark">
<div class="filelist_title" style="float: left;">File Names' . $RegenLink . '</div> <td>
<div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div> <div class="filelist_title" style="float: left;">File Names' . $RegenLink . '</div>
</td><td> <div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div>
<strong>Size</strong> </td>
</td></tr>'; <td>
<strong>Size</strong>
</td>
</tr>';
if (substr($FileList, -3) == '}}}') { // Old style if (substr($FileList, -3) == '}}}') { // Old style
$FileListSplit = explode('|||', $FileList); $FileListSplit = explode('|||', $FileList);
foreach ($FileListSplit as $File) { foreach ($FileListSplit as $File) {

View File

@ -82,7 +82,7 @@
<? <?
} }
if (($Override = check_paranoia_here('collagecontribs+'))) { ?> if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
<li id="comm_collstart"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?> <li id="comm_collcontrib"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?>
<? if ($Override = check_paranoia_here('collagecontribs')) { ?> <? if ($Override = check_paranoia_here('collagecontribs')) { ?>
<a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>" title="View">View</a> <a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>" title="View">View</a>
<? } ?> <? } ?>

View File

@ -26,10 +26,12 @@
$AvatarMouseOverText = ''; $AvatarMouseOverText = '';
$SecondAvatar = ''; $SecondAvatar = '';
if ($EnabledRewards['HasAvatarMouseOverText'] && !empty($Rewards['AvatarMouseOverText'])) { if ($EnabledRewards['HasAvatarMouseOverText'] && !empty($Rewards['AvatarMouseOverText'])) {
$AvatarMouseOverText = "title=\"$Rewards[AvatarMouseOverText]\" alt=\"$Rewards[AvatarMouseOverText]\""; $AvatarMouseOverText = " title=\"$Rewards[AvatarMouseOverText]\" alt=\"$Rewards[AvatarMouseOverText]\"";
} else {
$AvatarMouseOverText = " alt=\"\"";
} }
if ($EnabledRewards['HasSecondAvatar'] && !empty($Rewards['SecondAvatar'])) { if ($EnabledRewards['HasSecondAvatar'] && !empty($Rewards['SecondAvatar'])) {
$SecondAvatar = 'data-gazelle-second-avatar="' . ImageTools::process($Rewards['SecondAvatar']) . '"'; $SecondAvatar = ' data-gazelle-second-avatar="' . ImageTools::process($Rewards['SecondAvatar']) . '"';
} }
@ -187,7 +189,8 @@ function check_paranoia_here($Setting) {
<h2><?=Users::format_username($UserID, true, true, true, false, true)?></h2> <h2><?=Users::format_username($UserID, true, true, true, false, true)?></h2>
<div class="linkbox"> <div class="linkbox">
<? <?
if (!$OwnProfile) { ?> if (!$OwnProfile) {
?>
<a href="inbox.php?action=compose&amp;to=<?=$UserID?>" class="brackets">Send message</a> <a href="inbox.php?action=compose&amp;to=<?=$UserID?>" class="brackets">Send message</a>
<? <?
$DB->query(" $DB->query("
@ -195,7 +198,8 @@ function check_paranoia_here($Setting) {
FROM friends FROM friends
WHERE UserID = '$LoggedUser[ID]' WHERE UserID = '$LoggedUser[ID]'
AND FriendID = '$UserID'"); AND FriendID = '$UserID'");
if (!$DB->has_results()) { ?> if (!$DB->has_results()) {
?>
<a href="friends.php?action=add&amp;friendid=<?=$UserID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Add to friends</a> <a href="friends.php?action=add&amp;friendid=<?=$UserID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Add to friends</a>
<? } ?> <? } ?>
<a href="reports.php?action=report&amp;type=user&amp;id=<?=$UserID?>" class="brackets">Report user</a> <a href="reports.php?action=report&amp;type=user&amp;id=<?=$UserID?>" class="brackets">Report user</a>
@ -211,65 +215,88 @@ function check_paranoia_here($Setting) {
if (check_perms('users_view_invites', $Class)) { if (check_perms('users_view_invites', $Class)) {
?> ?>
<a href="user.php?action=invite&amp;userid=<?=$UserID?>" class="brackets">Invites</a> <a href="user.php?action=invite&amp;userid=<?=$UserID?>" class="brackets">Invites</a>
<? } <?
}
if (check_perms('admin_manage_permissions', $Class)) { if (check_perms('admin_manage_permissions', $Class)) {
?> ?>
<a href="user.php?action=permissions&amp;userid=<?=$UserID?>" class="brackets">Permissions</a> <a href="user.php?action=permissions&amp;userid=<?=$UserID?>" class="brackets">Permissions</a>
<? } <?
}
if (check_perms('users_logout', $Class) && check_perms('users_view_ips', $Class)) { if (check_perms('users_logout', $Class) && check_perms('users_view_ips', $Class)) {
?> ?>
<a href="user.php?action=sessions&amp;userid=<?=$UserID?>" class="brackets">Sessions</a> <a href="user.php?action=sessions&amp;userid=<?=$UserID?>" class="brackets">Sessions</a>
<? } <?
}
if (check_perms('admin_reports')) { if (check_perms('admin_reports')) {
?> ?>
<a href="reportsv2.php?view=reporter&amp;id=<?=$UserID?>" class="brackets">Reports</a> <a href="reportsv2.php?view=reporter&amp;id=<?=$UserID?>" class="brackets">Reports</a>
<? } <?
}
if (check_perms('users_mod')) { if (check_perms('users_mod')) {
?> ?>
<a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>" class="brackets">FL tokens</a> <a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>" class="brackets">FL tokens</a>
<? } <?
}
if (check_perms('admin_clear_cache') && check_perms('users_override_paranoia')) { if (check_perms('admin_clear_cache') && check_perms('users_override_paranoia')) {
?> ?>
<a href="user.php?action=clearcache&amp;id=<?=$UserID?>" class="brackets">Clear cache</a> <a href="user.php?action=clearcache&amp;id=<?=$UserID?>" class="brackets">Clear cache</a>
<? } ?> <?
}
?>
</div> </div>
<div class="sidebar"> <div class="sidebar">
<? <?
if ($Avatar && Users::has_avatars_enabled()) { if ($Avatar && Users::has_avatars_enabled()) {
// TODO: use Users::show_avatar; why is display_str() used a few lines below (where avatar is displayed)? // TODO: use Users::show_avatar; why is display_str() used a few lines below (where avatar is displayed)?
if (check_perms('site_proxy_images') && !empty($Avatar)) { if (check_perms('site_proxy_images') && !empty($Avatar)) {
$Avatar = 'http'.($SSL ? 's' : '').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($Avatar); $Avatar = 'http'.($SSL ? 's' : '').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($Avatar);
} }
?> ?>
<div class="box box_image box_image_avatar"> <div class="box box_image box_image_avatar">
<div class="head colhead_dark">Avatar</div> <div class="head colhead_dark">Avatar</div>
<div align="center"><img class="avatar double_avatar" src="<?=display_str($Avatar)?>" width="150" style="max-height: 400px;" <?=$AvatarMouseOverText?> <?=$SecondAvatar?> /></div> <div align="center">
<img class="avatar double_avatar" src="<?=display_str($Avatar)?>" width="150" style="max-height: 400px;"<?=$AvatarMouseOverText?><?=$SecondAvatar?> />
</div>
</div> </div>
<? } ?> <?
}
?>
<div class="box box_info box_userinfo_stats"> <div class="box box_info box_userinfo_stats">
<div class="head colhead_dark">Statistics</div> <div class="head colhead_dark">Statistics</div>
<ul class="stats nobullet"> <ul class="stats nobullet">
<li>Joined: <?=$JoinedDate?></li> <li>Joined: <?=$JoinedDate?></li>
<? if (($Override = check_paranoia_here('lastseen'))) { ?> <? if (($Override = check_paranoia_here('lastseen'))) { ?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Last seen: <?=$LastAccess?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Last seen: <?=$LastAccess?></li>
<? } <?
if (($Override = check_paranoia_here('uploaded'))) { ?> }
if (($Override = check_paranoia_here('uploaded'))) {
?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded)?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Uploaded, 5)?>">Uploaded: <?=Format::get_size($Uploaded)?></li>
<? } <?
if (($Override = check_paranoia_here('downloaded'))) { ?> }
if (($Override = check_paranoia_here('downloaded'))) {
?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded)?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?> title="<?=Format::get_size($Downloaded, 5)?>">Downloaded: <?=Format::get_size($Downloaded)?></li>
<? } <?
if (($Override = check_paranoia_here('ratio'))) { ?> }
if (($Override = check_paranoia_here('ratio'))) {
?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Ratio: <?=Format::get_ratio_html($Uploaded, $Downloaded)?></li>
<? } <?
if (($Override = check_paranoia_here('requiredratio')) && isset($RequiredRatio)) { ?> }
if (($Override = check_paranoia_here('requiredratio')) && isset($RequiredRatio)) {
?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Required Ratio: <?=number_format((double)$RequiredRatio, 2)?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Required Ratio: <?=number_format((double)$RequiredRatio, 2)?></li>
<? } <?
if ($OwnProfile || ($Override = check_paranoia_here(false)) || check_perms('users_mod')) { ?> }
if ($OwnProfile || ($Override = check_paranoia_here(false)) || check_perms('users_mod')) {
?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
<? } <?
if (($OwnProfile || check_perms('users_mod')) && $Warned != '0000-00-00 00:00:00') { ?> }
if (($OwnProfile || check_perms('users_mod')) && $Warned != '0000-00-00 00:00:00') {
?>
<li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Warning expires in: <?=time_diff((date('Y-m-d H:i', strtotime($Warned))))?></li> <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Warning expires in: <?=time_diff((date('Y-m-d H:i', strtotime($Warned))))?></li>
<? } ?> <? } ?>
</ul> </ul>
@ -1046,14 +1073,14 @@ function check_paranoia_here($Setting) {
if (check_perms('users_edit_ratio', $Class) || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID'])) { if (check_perms('users_edit_ratio', $Class) || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID'])) {
?> ?>
<tr> <tr>
<td class="label tooltip" title="Upload amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">Uploaded:</span></td> <td class="label tooltip" title="Upload amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">Uploaded:</td>
<td> <td>
<input type="hidden" name="OldUploaded" value="<?=$Uploaded?>" /> <input type="hidden" name="OldUploaded" value="<?=$Uploaded?>" />
<input type="text" size="20" name="Uploaded" value="<?=$Uploaded?>" /> <input type="text" size="20" name="Uploaded" value="<?=$Uploaded?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label tooltip" title="Download amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">Downloaded:</span></td> <td class="label tooltip" title="Download amount in bytes. Also accepts e.g. +20GB or -35.6364MB on the end.">Downloaded:</td>
<td> <td>
<input type="hidden" name="OldDownloaded" value="<?=$Downloaded?>" /> <input type="hidden" name="OldDownloaded" value="<?=$Downloaded?>" />
<input type="text" size="20" name="Downloaded" value="<?=$Downloaded?>" /> <input type="text" size="20" name="Downloaded" value="<?=$Downloaded?>" />
@ -1077,7 +1104,7 @@ function check_paranoia_here($Setting) {
if (check_perms('users_edit_invites')) { if (check_perms('users_edit_invites')) {
?> ?>
<tr> <tr>
<td class="label tooltip" title="Number of invites">Invites:</span></td> <td class="label tooltip" title="Number of invites">Invites:</td>
<td><input type="text" size="5" name="Invites" value="<?=$Invites?>" /></td> <td><input type="text" size="5" name="Invites" value="<?=$Invites?>" /></td>
</tr> </tr>
<? <?
@ -1086,7 +1113,7 @@ function check_paranoia_here($Setting) {
if (check_perms('admin_manage_fls') || (check_perms('users_mod') && $OwnProfile)) { if (check_perms('admin_manage_fls') || (check_perms('users_mod') && $OwnProfile)) {
?> ?>
<tr> <tr>
<td class="label tooltip" title="This is the message shown in the right-hand column on /staff.php">FLS/Staff remark:</span></td> <td class="label tooltip" title="This is the message shown in the right-hand column on /staff.php">FLS/Staff remark:</td>
<td><input type="text" class="wide_input_text" name="SupportFor" value="<?=display_str($SupportFor)?>" /></td> <td><input type="text" class="wide_input_text" name="SupportFor" value="<?=display_str($SupportFor)?>" /></td>
</tr> </tr>
<? <?
@ -1122,7 +1149,8 @@ function check_paranoia_here($Setting) {
</select> </select>
</td> </td>
</tr> </tr>
<? } <?
}
if (check_perms('users_edit_password')) { if (check_perms('users_edit_password')) {
?> ?>
@ -1189,7 +1217,7 @@ function check_paranoia_here($Setting) {
</tr> </tr>
<? } ?> <? } ?>
<tr> <tr>
<td class="label tooltip" title="This message *will* be sent to the user in the warning PM!">Warning reason:</span></td> <td class="label tooltip" title="This message *will* be sent to the user in the warning PM!">Warning reason:</td>
<td> <td>
<input type="text" class="wide_input_text" name="WarnReason" /> <input type="text" class="wide_input_text" name="WarnReason" />
</td> </td>
@ -1248,8 +1276,8 @@ function check_paranoia_here($Setting) {
</td> </td>
</tr> </tr>
<? } ?>
<? <?
}
} }
if (check_perms('users_disable_any')) { if (check_perms('users_disable_any')) {
@ -1276,13 +1304,13 @@ function check_paranoia_here($Setting) {
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Restricted forums:</span></td> <td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Restricted forums:</td>
<td> <td>
<input type="text" class="wide_input_text" name="RestrictedForums" value="<?=display_str($RestrictedForums)?>" /> <input type="text" class="wide_input_text" name="RestrictedForums" value="<?=display_str($RestrictedForums)?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Extra forums:</span></td> <td class="label tooltip" title="Enter a comma-delimited list of forum IDs.">Extra forums:</td>
<td> <td>
<input type="text" class="wide_input_text" name="PermittedForums" value="<?=display_str($PermittedForums)?>" /> <input type="text" class="wide_input_text" name="PermittedForums" value="<?=display_str($PermittedForums)?>" />
</td> </td>
@ -1306,8 +1334,9 @@ function check_paranoia_here($Setting) {
<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);
} }
?> ?>
@ -1318,9 +1347,9 @@ function check_paranoia_here($Setting) {
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label tooltip" title="This message will be entered into staff notes only.">Reason:</span></td> <td class="label tooltip" title="This message will be entered into staff notes only.">Reason:</td>
<td> <td>
<textarea rows="1" class="wide_input_text" name="Reason" id="Reason" onkeyup="resize('Reason');"></textarea> <textarea rows="1" cols="35" class="wide_input_text" name="Reason" id="Reason" onkeyup="resize('Reason');"></textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -1337,7 +1366,8 @@ function check_paranoia_here($Setting) {
</tr> </tr>
</table> </table>
</form> </form>
<? } <?
}
?> ?>
</div> </div>
</div> </div>