Empty commit

This commit is contained in:
Git 2013-03-25 08:00:21 +00:00
parent 24d951c055
commit 0ccae72a56
10 changed files with 105 additions and 97 deletions

66
classes/class_forums.php Normal file
View File

@ -0,0 +1,66 @@
<?
class Forums {
/**
* @param string $Body
* @param int $PostID
* @param string $Page
* @param int $PageID
*/
public static function quote_notify($Body, $PostID, $Page, $PageID) {
/*
* Explanation of the parameters PageID and Page:
* Page contains where this quote comes from and can be forums, artist,
* collages, requests or torrents. The PageID contains the additional
* value that is necessary for the users_notify_quoted table.
* The PageIDs for the different Page are:
* forums: TopicID
* artist: ArtistID
* collages: CollageID
* requests: RequestID
* torrents: GroupID
*/
global $LoggedUser, $Cache, $DB;
$Matches = array();
preg_match_all('/\[quote(?:=(.*)(?:\|.*)?)?]|\[\/quote]/iU', $Body, $Matches, PREG_SET_ORDER);
if (count($Matches)) {
$Usernames = array();
$Level = 0;
foreach ($Matches as $M) {
if ($M[0] != '[/quote]') {
if ($Level == 0 && isset($M[1]) && strlen($M[1]) > 0 && preg_match('/^[a-z0-9_?]{1,20}$/iD', $M[1])) {
$Usernames[] = preg_replace('/(^[.,]*)|([.,]*$)/', '', $M[1]); // wut?
}
++$Level;
} else {
--$Level;
}
}
}
//remove any dupes in the array (the fast way)
$Usernames = array_flip(array_flip($Usernames));
$DB->query("SELECT m.ID, p.PushService
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN users_push_notifications AS p ON p.UserID = m.ID
WHERE m.Username IN ('" . implode("', '", $Usernames) . "')
AND i.NotifyOnQuote = '1' AND i.UserID != $LoggedUser[ID]");
$Results = $DB->to_array();
foreach ($Results as $Result) {
$UserID = db_string($Result['ID']);
$PushService = $Result['PushService'];
$QuoterID = db_string($LoggedUser['ID']);
$Page = db_string($Page);
$PageID = db_string($PageID);
$PostID = db_string($PostID);
$DB->query("INSERT IGNORE INTO users_notify_quoted (UserID, QuoterID, Page, PageID, PostID, Date)
VALUES ('$UserID', '$QuoterID', '$Page', '$PageID', '$PostID', '" . sqltime() . "')");
$Cache->delete_value('notify_quoted_' . $UserID);
}
}
}

View File

@ -99,6 +99,9 @@
case 'Format':
$FileName = 'class_format';
break;
case 'Forums':
$FileName = 'class_forums';
break;
case 'ImageTools':
$FileName = 'class_image_tools';
break;

View File

@ -1,13 +1,14 @@
<?php
$DB->query("SELECT
f.FriendID, u.Username
FROM friends AS f
RIGHT JOIN users_enable_recommendations AS r
ON r.ID = f.FriendID AND r.Enable = 1
RIGHT JOIN users_main AS u
ON u.ID = f.FriendID
WHERE f.UserID = '$LoggedUser[ID]'
ORDER BY u.Username ASC");
f.FriendID, u.Username
FROM friends AS f
RIGHT JOIN users_enable_recommendations AS r
ON r.ID = f.FriendID
AND r.Enable = 1
RIGHT JOIN users_main AS u
ON u.ID = f.FriendID
WHERE f.UserID = '$LoggedUser[ID]'
ORDER BY u.Username ASC");
echo json_encode($DB->to_array(false, MYSQLI_ASSOC));
die();

View File

@ -38,7 +38,8 @@
t.Seeders,
t.Leechers,
((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
g.ReleaseType
g.ReleaseType,
t.Size
FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID ";
@ -185,7 +186,7 @@ function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail;
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail;
$Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
$TruncArtist = substr($Artist, 0, strlen($Artist)-3);
@ -220,7 +221,8 @@ function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
'snatched' => (int) $Snatched,
'seeders' => (int) $Seeders,
'leechers' => (int) $Leechers,
'data' => (int) $Data
'data' => (int) $Data,
'size' => (int) $Size,
);
}

View File

@ -1,67 +0,0 @@
<?php
$Matches = array();
preg_match_all('/\[quote(.*?)]|\[\/quote]/', $Body, $Matches);
if (array_key_exists(0, $Matches)) {
$Usernames = array();
$Level = 0;
foreach ($Matches[0] as $M) {
if ($M != '[/quote]') {
if ($Level == 0) {
add_username($M);
}
$Level++;
} else {
$Level--;
}
}
}
//remove any dupes in the array
$Usernames = array_unique($Usernames);
$DB->query("SELECT m.ID, p.PushService
FROM users_main AS m
LEFT JOIN users_info AS i ON i.UserID = m.ID
LEFT JOIN users_push_notifications AS p ON p.UserID = m.ID
WHERE m.Username IN " . "('" . implode("', '", $Usernames)
. "')
AND i.NotifyOnQuote = '1' AND i.UserID != $LoggedUser[ID]");
$Results = $DB->to_array();
foreach($Results as $Result) {
$UserID = $Result['ID'];
$PushService = $Result['PushService'];
$QuoterID = db_string($LoggedUser['ID']);
$UserID = db_string($UserID);
$ForumID = db_string($ForumID);
$TopicID = db_string($TopicID);
$PostID = db_string($PostID);
$DB->query("INSERT IGNORE INTO users_notify_quoted (UserID, QuoterID, Page, PageID, PostID, Date)
VALUES ('$UserID', '$QuoterID', 'forums', '$TopicID', '$PostID', '" . sqltime() . "')");
$Cache->delete_value('notify_quoted_' . $UserID);
}
/*
* Validate the username and add it into the $Usernames array
*/
function add_username($Str)
{
global $Usernames;
$Matches = array();
if (preg_match('/\[quote=(.*)]/', $Str, $Matches)) {
$Username = $Matches[1];
$Username = trim($Username);
if (strlen($Username) > 0 && !preg_match('/[^a-zA-Z0-9|]/i', $Username)) {
$Exploded = explode('|', $Username);
$Username = $Exploded[0];
$Username = preg_replace('/(^[.,]*)|([.,]*$)/', '', $Username);
$Usernames[] = $Username;
}
}
}
?>

View File

@ -232,6 +232,6 @@
$Cache->delete_value('subscriptions_user_new_'.$Subscriber);
}
}
include('quote_notify.php');
Forums::quote_notify($Body, $PostID, 'forums', $TopicID);
header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.ceil($ThreadInfo['Posts']/$PerPage));
die();

View File

@ -3,7 +3,7 @@
Tools necessary for economic management
1. Current overall stats (!economy)
2. Statistical traffic trends in a graph
a. All time / 1 year (whichever is smaller)
a. All time / 1 year (whichever is smaller)
b. 1 month
c. 1 week
d. 1 day

View File

@ -67,14 +67,14 @@
?>
<form action="" method="post" acclass="thin box pad">
<input type="hidden" name="action" value="registration_log"/>
Joined After: <input type="date" name="after_date"/>
Joined Before: <input type="date" name="before_date"/>
<input type="submit"/>
<input type="hidden" name="action" value="registration_log" />
Joined after: <input type="date" name="after_date" />
Joined before: <input type="date" name="before_date" />
<input type="submit" />
</form>
<?
if($DB->record_count()) {
if ($DB->record_count()) {
?>
<div class="linkbox">
<?
@ -94,23 +94,23 @@
<td>Registered</td>
</tr>
<?
while(list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses)=$DB->next_record()) {
while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses)=$DB->next_record()) {
$Row = ($IP == $InviterIP) ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
<td><?=Users::format_username($UserID, true, true, true, true)?><br /><?=Users::format_username($InviterID, true, true, true, true)?></td>
<td><?=Format::get_ratio_html($Uploaded,$Downloaded)?><br /><?=Format::get_ratio_html($InviterUploaded,$InviterDownloaded)?></td>
<td>
<span style="float:left;"><?=display_str($Email)?></span>
<span style="float:right;"><a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>" title="Search" class="brackets">S</a></span><br />
<span style="float:left;"><?=display_str($InviterEmail)?></span>
<span style="float:right;"><a href="userhistory.php?action=email&amp;userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($InviterEmail)?>" title="Search" class="brackets">S</a></span><br />
<span style="float: left;"><?=display_str($Email)?></span>
<span style="float: right;"><a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($Email)?>" title="Search" class="brackets">S</a></span><br />
<span style="float: left;"><?=display_str($InviterEmail)?></span>
<span style="float: right;"><a href="userhistory.php?action=email&amp;userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;email_history=on&amp;email=<?=display_str($InviterEmail)?>" title="Search" class="brackets">S</a></span><br />
</td>
<td>
<span style="float:left;"><?=display_str($IP)?></span>
<span style="float:right;"><?=display_str($Uses)?> <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a></span><br />
<span style="float:left;"><?=display_str($InviterIP)?></span>
<span style="float:right;"><?=display_str($InviterUses)?> <a href="userhistory.php?action=ips&amp;userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($InviterIP)?>" title="Search" class="brackets">S</a></span><br />
<span style="float: left;"><?=display_str($IP)?></span>
<span style="float: right;"><?=display_str($Uses)?> <a href="userhistory.php?action=ips&amp;userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a></span><br />
<span style="float: left;"><?=display_str($InviterIP)?></span>
<span style="float: right;"><?=display_str($InviterUses)?> <a href="userhistory.php?action=ips&amp;userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($InviterIP)?>" title="Search" class="brackets">S</a></span><br />
</td>
<td>
<?=$IPCC?> <br />

View File

@ -156,7 +156,8 @@
t.Seeders,
t.Leechers,
((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
g.ReleaseType
g.ReleaseType,
t.Size
FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID ";
@ -376,6 +377,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<td class="center" style="width:15px;"></td>
<td class="cats_col"></td>
<td><strong>Name</strong></td>
<td style="text-align:right"><strong>Size</strong></td>
<td style="text-align:right"><strong>Data</strong></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
@ -416,7 +418,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TagsList,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail;
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail;
$IsBookmarked = has_bookmarked('torrent', $GroupID);
$IsSnatched = Torrents::has_snatched($TorrentID);
@ -490,6 +492,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
</div>
</td>
<td style="text-align:right" class="nobr"><?=Format::get_size($Size)?></td>
<td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td>
<td style="text-align:right"><?=number_format((double) $Snatched)?></td>
<td style="text-align:right"><?=number_format((double) $Seeders)?></td>

View File

@ -433,7 +433,7 @@ tr.torrent .bookmark>a:after {
font-weight: normal;
}
/*
/*
* Fix long filename tables overflowing (Chrome only).
* Fix report information tables overflowing long reports (all browsers).
* Fix long release descriptions overflowing containers (all browsers).