summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit <git@what.cd>2013-03-25 08:00:21 +0000
committerGit <git@what.cd>2013-03-25 08:00:21 +0000
commit0ccae72a562fd9ba681c6380c3f179941b8eda88 (patch)
tree200c2c97f694fc6b625526d393afc31e6be28ce8
parent24d951c0558129338a22dbcd234eca85443a4189 (diff)
downloadGazelle-0ccae72a562fd9ba681c6380c3f179941b8eda88.zip
Gazelle-0ccae72a562fd9ba681c6380c3f179941b8eda88.tar.gz
Gazelle-0ccae72a562fd9ba681c6380c3f179941b8eda88.tar.bz2
Empty commit
-rw-r--r--classes/class_forums.php66
-rw-r--r--classes/script_start.php3
-rw-r--r--sections/ajax/get_friends.php17
-rw-r--r--sections/ajax/top10/torrents.php8
-rw-r--r--sections/forums/quote_notify.php67
-rw-r--r--sections/forums/take_reply.php2
-rw-r--r--sections/tools/data/economic_stats.php2
-rw-r--r--sections/tools/data/registration_log.php28
-rw-r--r--sections/top10/torrents.php7
-rw-r--r--static/styles/global.css2
10 files changed, 105 insertions, 97 deletions
diff --git a/classes/class_forums.php b/classes/class_forums.php
new file mode 100644
index 0000000..506e1fc
--- /dev/null
+++ b/classes/class_forums.php
@@ -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);
+
+ }
+ }
+} \ No newline at end of file
diff --git a/classes/script_start.php b/classes/script_start.php
index 9b40136..1149177 100644
--- a/classes/script_start.php
+++ b/classes/script_start.php
@@ -99,6 +99,9 @@ spl_autoload_register(function ($ClassName) {
case 'Format':
$FileName = 'class_format';
break;
+ case 'Forums':
+ $FileName = 'class_forums';
+ break;
case 'ImageTools':
$FileName = 'class_image_tools';
break;
diff --git a/sections/ajax/get_friends.php b/sections/ajax/get_friends.php
index 0b9d740..94f4ab1 100644
--- a/sections/ajax/get_friends.php
+++ b/sections/ajax/get_friends.php
@@ -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();
diff --git a/sections/ajax/top10/torrents.php b/sections/ajax/top10/torrents.php
index ec5b793..4812f59 100644
--- a/sections/ajax/top10/torrents.php
+++ b/sections/ajax/top10/torrents.php
@@ -38,7 +38,8 @@ $BaseQuery = "SELECT
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,
);
}
diff --git a/sections/forums/quote_notify.php b/sections/forums/quote_notify.php
deleted file mode 100644
index 2071cba..0000000
--- a/sections/forums/quote_notify.php
+++ /dev/null
@@ -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;
- }
- }
-}
-
-?>
diff --git a/sections/forums/take_reply.php b/sections/forums/take_reply.php
index 6df2beb..bd56da7 100644
--- a/sections/forums/take_reply.php
+++ b/sections/forums/take_reply.php
@@ -232,6 +232,6 @@ if($DB->record_count() > 0) {
$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();
diff --git a/sections/tools/data/economic_stats.php b/sections/tools/data/economic_stats.php
index 6ac091c..846f2af 100644
--- a/sections/tools/data/economic_stats.php
+++ b/sections/tools/data/economic_stats.php
@@ -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
diff --git a/sections/tools/data/registration_log.php b/sections/tools/data/registration_log.php
index 7f0432b..256a145 100644
--- a/sections/tools/data/registration_log.php
+++ b/sections/tools/data/registration_log.php
@@ -67,14 +67,14 @@ $DB->set_query_id($QueryID);
?>
<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 @@ if($DB->record_count()) {
<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 />
diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php
index 97fc7ec..6d91080 100644
--- a/sections/top10/torrents.php
+++ b/sections/top10/torrents.php
@@ -156,7 +156,8 @@ $BaseQuery = "SELECT
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>
diff --git a/static/styles/global.css b/static/styles/global.css
index 8062634..2afee65 100644
--- a/static/styles/global.css
+++ b/static/styles/global.css
@@ -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).