mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-05 22:10:11 +00:00
Empty commit
This commit is contained in:
parent
f86bb1f066
commit
888e8708d4
0
CONTRIBUTING.md
Normal file
0
CONTRIBUTING.md
Normal file
@ -588,7 +588,7 @@ function show() {
|
||||
<? } ?>
|
||||
<input type="text" id="tags" name="tags" size="40" value="<?=display_str($Torrent['TagList']) ?>"<? Users::has_autocomplete_enabled('other'); ?><?=$this->Disabled?> />
|
||||
<br />
|
||||
<? Rules::display_site_tag_rules(true) // indent the opening PHP tag with 3 tabs for proper HTML generation ?>
|
||||
<? Rules::display_site_tag_rules(true); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -269,11 +269,11 @@ public static function update_site_options($UserID, $NewOptions) {
|
||||
|
||||
/**
|
||||
* Generates a check list of release types, ordered by the user or default
|
||||
* @global array $SiteOptions
|
||||
* @param array $SiteOptions
|
||||
* @param boolean $Default Returns the default list if true
|
||||
*/
|
||||
public static function release_order ($Default = false) {
|
||||
global $SiteOptions, $ReleaseTypes;
|
||||
public static function release_order(&$SiteOptions, $Default = false) {
|
||||
global $ReleaseTypes;
|
||||
|
||||
$RT = $ReleaseTypes + array(
|
||||
1024 => 'Guest Appearance',
|
||||
@ -286,6 +286,12 @@ public static function release_order ($Default = false) {
|
||||
$Defaults = !empty($SiteOptions['HideTypes']);
|
||||
} else {
|
||||
$Sort =& $SiteOptions['SortHide'];
|
||||
$MissingTypes = array_diff_key($ReleaseTypes, $Sort);
|
||||
if (!empty($MissingTypes)) {
|
||||
foreach (array_keys($MissingTypes) as $Missing) {
|
||||
$Sort[$Missing] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($Sort as $Key => $Val) {
|
||||
@ -312,9 +318,9 @@ public static function release_order ($Default = false) {
|
||||
* Returns the default order for the sort list in a JS-friendly string
|
||||
* @return string
|
||||
*/
|
||||
public static function release_order_default_js () {
|
||||
public static function release_order_default_js(&$SiteOptions) {
|
||||
ob_start();
|
||||
self::release_order(true);
|
||||
self::release_order($SiteOptions, true);
|
||||
$HTML = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return json_encode($HTML);
|
||||
@ -627,7 +633,7 @@ public static function has_avatars_enabled() {
|
||||
* 0 - Enabled everywhere (default), 1 - Disabled, 2 - Searches only
|
||||
*
|
||||
* @param string $Type the type of the input.
|
||||
* @param boolean $Output echo out html
|
||||
* @param boolean $Output echo out HTML
|
||||
* @return boolean
|
||||
*/
|
||||
public static function has_autocomplete_enabled($Type, $Output = true) {
|
||||
@ -635,8 +641,7 @@ public static function has_autocomplete_enabled($Type, $Output = true) {
|
||||
$Enabled = false;
|
||||
if (empty($LoggedUser['AutoComplete'])) {
|
||||
$Enabled = true;
|
||||
}
|
||||
elseif ($LoggedUser['AutoComplete'] !== 1) {
|
||||
} elseif ($LoggedUser['AutoComplete'] !== 1) {
|
||||
switch ($Type) {
|
||||
case 'search':
|
||||
if ($LoggedUser['AutoComplete'] == 2) {
|
||||
|
@ -1,5 +1,11 @@
|
||||
CHANGELOG
|
||||
|
||||
2013-07-04 by Ajax
|
||||
added collages to api
|
||||
|
||||
2013-07-03 by Ajax
|
||||
Option to enable/disable autocomplete in user profile settings.
|
||||
|
||||
2013-07-01 by alderaan
|
||||
Serve Google Charts API images over HTTPS
|
||||
|
||||
|
@ -5,6 +5,34 @@ NOTE: The standards defined in this document will likely differ from
|
||||
what is actually seen in the Gazelle code. This document is the first
|
||||
step in properly enforcing coding standards throughout the project.
|
||||
|
||||
# Table of Contents
|
||||
|
||||
1. FILE FORMATTING
|
||||
2. CODE STYLING
|
||||
1. Code styling for PHP and JavaScript
|
||||
2. Code styling for CSS
|
||||
3. Code styling for SQL
|
||||
3. NAMING CONVENTIONS
|
||||
1. Function names
|
||||
2. Variable names
|
||||
3. Class names
|
||||
4. SQL names
|
||||
5. Miscellaneous names
|
||||
4. COMMENTS
|
||||
5. USER INTERFACE
|
||||
6. EXAMPLES
|
||||
1. PHP examples
|
||||
2. CSS examples
|
||||
3. SQL examples
|
||||
|
||||
|
||||
This document contains the coding standards for Gazelle.
|
||||
This document is a work-in-progress and is subject to change.
|
||||
|
||||
NOTE: The standards defined in this document will likely differ from
|
||||
what is actually seen in the Gazelle code. This document is the first
|
||||
step in properly enforcing coding standards throughout the project.
|
||||
|
||||
|
||||
== TABLE OF CONTENTS ==
|
||||
|
||||
@ -27,7 +55,7 @@ step in properly enforcing coding standards throughout the project.
|
||||
6.3 SQL examples
|
||||
|
||||
|
||||
1. FILE FORMATTING
|
||||
# FILE FORMATTING
|
||||
|
||||
Tabs shall always be used for indentation.
|
||||
|
||||
@ -41,22 +69,22 @@ File names for PHP, CSS, and JavaScript files shall be all lowercase and
|
||||
use underscores instead of spaces.
|
||||
|
||||
|
||||
2. CODE STYLING
|
||||
# CODE STYLING
|
||||
|
||||
2.1 Code styling for PHP and JavaScript
|
||||
## Code styling for PHP and JavaScript
|
||||
|
||||
All statement blocks, including functions, shall have the opening brace
|
||||
at the end of the same line with a space before the brace. The astute
|
||||
reader will note that this is K&R style with the exception of functions.
|
||||
|
||||
There shall be a space between a control structure statement (e.g. if,
|
||||
elseif, for) and the following parenthesis.
|
||||
There shall be a space between a control structure statement (e.g. `if`,
|
||||
`elseif`, `for`) and the following parenthesis.
|
||||
|
||||
There shall be a space around conditional operators.
|
||||
|
||||
When using ternary operators, spaces shall be used around the operators.
|
||||
|
||||
For conditional blocks, "elseif" is to be used instead of "else if".
|
||||
For conditional blocks, `elseif` is to be used instead of `else if`.
|
||||
|
||||
In loops and conditional blocks, there shall be braces even if there is
|
||||
only one statement.
|
||||
@ -64,7 +92,7 @@ only one statement.
|
||||
In loops and conditional blocks, the statement(s) shall be placed on the
|
||||
following lines.
|
||||
|
||||
When opening a PHP statement, "<?" shall be used instead of "<?php".
|
||||
When opening a PHP statement, `<?` shall be used instead of `<?php`.
|
||||
|
||||
Switch cases in index files shall not contain substantial code. The use
|
||||
of include statements is acceptable.
|
||||
@ -72,11 +100,11 @@ of include statements is acceptable.
|
||||
When building strings in PHP, single quotes shall be used when not
|
||||
printing a variable.
|
||||
|
||||
When declaring JavaScript variables, "var" shall always be used.
|
||||
When declaring JavaScript variables, `var` shall always be used.
|
||||
|
||||
2.2 Code styling for CSS
|
||||
## Code styling for CSS
|
||||
|
||||
"property: value;" pairs shall be separated by a space, and the value
|
||||
`property: value;` pairs shall be separated by a space, and the value
|
||||
shall be followed by a semi-colon.
|
||||
|
||||
Multiple, related CSS selectors with the same declarations shall appear
|
||||
@ -85,7 +113,7 @@ on multiple lines to improve readability.
|
||||
The opening brace shall be on the same line as the last related
|
||||
selector with a space between the selector and the brace.
|
||||
|
||||
2.3 Code styling for SQL
|
||||
## Code styling for SQL
|
||||
|
||||
Long SQL queries shall be separated on multiple lines.
|
||||
|
||||
@ -96,94 +124,95 @@ part of a JOIN or other complex statement.
|
||||
|
||||
Use indents as appropriate to aid readability.
|
||||
|
||||
The SQL keywords JOIN, RIGHT JOIN, LEFT JOIN must be indented once from
|
||||
the SELECT statement.
|
||||
The SQL keywords `JOIN`, `RIGHT JOIN`, `LEFT JOIN` must be indented once from
|
||||
the `SELECT` statement.
|
||||
|
||||
The SQL keyword AND must be indented once from the WHILE (and similar)
|
||||
The SQL keyword `AND` must be indented once from the `WHILE` (and similar)
|
||||
statements.
|
||||
|
||||
The "not equal to" operator "!=" must be used instead of the alternative
|
||||
operator "<>".
|
||||
The "not equal to" operator `!=` must be used instead of the alternative
|
||||
operator `<>`.
|
||||
|
||||
|
||||
3. NAMING CONVENTIONS
|
||||
# NAMING CONVENTIONS
|
||||
|
||||
Function, variable, and class names shall always be descriptive.
|
||||
|
||||
3.1 Function names
|
||||
## Function names
|
||||
|
||||
PHP function names shall be written in lowercase_with_underscores.
|
||||
PHP function names shall be written in `lowercase_with_underscores`.
|
||||
|
||||
JavaScript function names shall be written in camelCase with a leading
|
||||
JavaScript function names shall be written in `camelCase` with a leading
|
||||
lowercase letter.
|
||||
|
||||
3.2 Variable names
|
||||
## Variable names
|
||||
|
||||
PHP variable names shall be written in CamelCase with a leading
|
||||
PHP variable names shall be written in `CamelCase` with a leading
|
||||
uppercase letter.
|
||||
|
||||
JavaScript global-scope variables shall be written in camelCase with a
|
||||
JavaScript global-scope variables shall be written in `camelCase` with a
|
||||
leading lowercase letter.
|
||||
|
||||
JavaScript local-scope variables shall be written in
|
||||
lowercase_with_underscores.
|
||||
`lowercase_with_underscores`.
|
||||
|
||||
3.3 Class names
|
||||
## Class names
|
||||
|
||||
PHP class names shall be written in CamelCase with a leading uppercase
|
||||
PHP class names shall be written in `CamelCase` with a leading uppercase
|
||||
letter.
|
||||
|
||||
PHP class constants shall be written in CamelCase with a leading
|
||||
PHP class constants shall be written in `CamelCase` with a leading
|
||||
uppercase letter.
|
||||
|
||||
3.4 SQL names
|
||||
## SQL names
|
||||
|
||||
All SQL keywords shall be written in all UPPERCASE.
|
||||
|
||||
All SQL table names shall be written in lowercase_with_underscores.
|
||||
All SQL table names shall be written in `lowercase_with_underscores`.
|
||||
|
||||
All SQL column names shall be written in CamelCase with a leading
|
||||
All SQL column names shall be written in `CamelCase` with a leading
|
||||
uppercase letter.
|
||||
|
||||
All automatically-incremented ID columns shall be named "ID", while the
|
||||
other columns for ID numbers shall have names like RequestID, TorrentID,
|
||||
All automatically-incremented ID columns shall be named `ID`, while the
|
||||
other columns for Identification numbers shall have names like `RequestID`, `TorrentID`,
|
||||
etc.
|
||||
|
||||
3.5 Miscellaneous names
|
||||
## Miscellaneous names
|
||||
|
||||
PHP global constants shall be written in ALL_CAPS.
|
||||
PHP global constants shall be written in `ALL_CAPS`.
|
||||
|
||||
PHP constants true, false, and null shall be written in all lowercase.
|
||||
PHP constants `true`, `false`, and `null` shall be written in all lowercase.
|
||||
|
||||
|
||||
4. COMMENTS
|
||||
# COMMENTS
|
||||
|
||||
Use C89-style "/* ... */" comments for multi-line comments.
|
||||
Use C89-style `/* ... */` comments for multi-line comments.
|
||||
|
||||
Use C99-style "// ..." comments for single-line comments.
|
||||
Use C99-style `// ...` comments for single-line comments.
|
||||
|
||||
|
||||
5. USER INTERFACE
|
||||
# USER INTERFACE
|
||||
|
||||
All button labels shall use sentence case.
|
||||
|
||||
All table headings shall use sentence case.
|
||||
|
||||
All text-based buttons shall use the "brackets" CSS class.
|
||||
All text-based buttons shall use the `brackets` CSS class.
|
||||
|
||||
Use common sense for design-related code. Microsoft's UI design guidelines
|
||||
explain when certain form input controls should be used over others to
|
||||
provide a familiar and intuitive interface. Refer to the following links
|
||||
for the most likely issues to encounter in web design:
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa511452.aspx
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa511453.aspx
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa511488.aspx
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa511494.aspx
|
||||
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa511452.aspx
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa511453.aspx
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa511488.aspx
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa511494.aspx
|
||||
|
||||
|
||||
6. EXAMPLES
|
||||
# EXAMPLES
|
||||
|
||||
6.1 PHP examples
|
||||
## PHP examples
|
||||
|
||||
if ($Foo >= 0) {
|
||||
$SomeString = "this is a string $DiffString with more text";
|
||||
@ -212,7 +241,7 @@ if ($Foo == true) {
|
||||
// This is a good, single-line comment.
|
||||
|
||||
|
||||
6.2 CSS examples
|
||||
## CSS examples
|
||||
|
||||
<a href="foobar.php" style="font-weight: bold;">link text</a>
|
||||
|
||||
@ -230,7 +259,7 @@ if ($Foo == true) {
|
||||
}
|
||||
|
||||
|
||||
6.3 SQL examples
|
||||
# SQL examples
|
||||
|
||||
SELECT
|
||||
r.ID, e.EditionID, r.Title, r.Year, r.CatalogueNumber,
|
||||
@ -259,6 +288,3 @@ LIMIT 25
|
||||
|
||||
|
||||
SELECT RequestID AS ID, UserID FROM bookmarks_requests
|
||||
|
||||
|
||||
EOF
|
||||
|
184
image.php
184
image.php
@ -1,10 +1,5 @@
|
||||
<?
|
||||
/*-- Image Start Class ---------------------------------*/
|
||||
/*------------------------------------------------------*/
|
||||
/* Simplified version of script_start, used for the */
|
||||
/* sitewide image proxy. */
|
||||
/*------------------------------------------------------*/
|
||||
/********************************************************/
|
||||
// Functions and headers needed by the image proxy
|
||||
error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);
|
||||
|
||||
if (isset($_SERVER['http_if_modified_since'])) {
|
||||
@ -15,35 +10,11 @@
|
||||
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C', time() + 3600 * 24 * 120)); // 120 days
|
||||
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C', time()));
|
||||
|
||||
require('classes/config.php'); // The config contains all site wide configuration information as well as memcached rules
|
||||
|
||||
if (!extension_loaded('gd')) {
|
||||
error('nogd');
|
||||
}
|
||||
|
||||
require(SERVER_ROOT.'/classes/cache.class.php'); // Require the caching class
|
||||
require(SERVER_ROOT.'/classes/encrypt.class.php'); // Require the encryption class
|
||||
require(SERVER_ROOT.'/classes/regex.php');
|
||||
|
||||
$Cache = NEW CACHE($MemcachedServers); // Load the caching class
|
||||
$Enc = NEW CRYPT; // Load the encryption class
|
||||
|
||||
if (isset($_COOKIE['session'])) {
|
||||
$LoginCookie = $Enc->decrypt($_COOKIE['session']);
|
||||
}
|
||||
if (isset($LoginCookie)) {
|
||||
list($SessionID, $UserID) = explode('|~|', $Enc->decrypt($LoginCookie));
|
||||
$UserID = (int)$UserID;
|
||||
$UserInfo = $Cache->get_value("user_info_$UserID");
|
||||
$Permissions = $Cache->get_value('perm_'.$UserInfo['PermissionID']);
|
||||
}
|
||||
|
||||
function check_perms($PermissionName) {
|
||||
global $Permissions;
|
||||
return (isset($Permissions['Permissions'][$PermissionName])) ? true : false;
|
||||
}
|
||||
|
||||
function error($Type) {
|
||||
function img_error($Type) {
|
||||
header('Content-type: image/gif');
|
||||
die(file_get_contents(SERVER_ROOT.'/sections/image/'.$Type.'.gif'));
|
||||
}
|
||||
@ -62,16 +33,6 @@ function invisible($Image) {
|
||||
|
||||
}
|
||||
|
||||
function is_number($Str) {
|
||||
$Return = true;
|
||||
if ($Str < 0) {
|
||||
$Return = false;
|
||||
}
|
||||
// We're converting input to a int, then string and comparing to original
|
||||
$Return = ($Str == strval(intval($Str)) ? true : false);
|
||||
return $Return;
|
||||
}
|
||||
|
||||
function verysmall($Image) {
|
||||
return ((imagesx($Image) * imagesy($Image)) < 25) ? true : false;
|
||||
}
|
||||
@ -136,144 +97,5 @@ function image_height($Type, $Data) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function send_pm($ToID, $FromID, $Subject, $Body, $ConvID = '') {
|
||||
global $DB, $Cache;
|
||||
if ($ToID == 0) {
|
||||
// Don't allow users to send messages to the system
|
||||
return;
|
||||
}
|
||||
if ($ConvID == '') {
|
||||
$DB->query("
|
||||
INSERT INTO pm_conversations (Subject)
|
||||
VALUES ('$Subject')");
|
||||
$ConvID = $DB->inserted_id();
|
||||
$DB->query("
|
||||
INSERT INTO pm_conversations_users
|
||||
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead)
|
||||
VALUES
|
||||
('$ToID', '$ConvID', '1', '0', '".sqltime()."', '".sqltime()."', '1')");
|
||||
if ($FromID != 0) {
|
||||
$DB->query("
|
||||
INSERT INTO pm_conversations_users
|
||||
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead)
|
||||
VALUES
|
||||
('$FromID', '$ConvID', '0', '1', '".sqltime()."', '".sqltime()."', '0')");
|
||||
}
|
||||
} else {
|
||||
$DB->query("
|
||||
UPDATE pm_conversations_users
|
||||
SET
|
||||
InInbox = '1',
|
||||
UnRead = '1',
|
||||
ReceivedDate = '".sqltime()."'
|
||||
WHERE UserID = '$ToID'
|
||||
AND ConvID = '$ConvID'");
|
||||
|
||||
$DB->query("
|
||||
UPDATE pm_conversations_users
|
||||
SET
|
||||
InSentbox = '1',
|
||||
SentDate = '".sqltime()."'
|
||||
WHERE UserID = '$FromID'
|
||||
AND ConvID = '$ConvID'");
|
||||
}
|
||||
$DB->query("
|
||||
INSERT INTO pm_messages
|
||||
(SenderID, ConvID, SentDate, Body)
|
||||
VALUES
|
||||
('$FromID', '$ConvID', '".sqltime()."', '$Body')");
|
||||
|
||||
// Clear the caches of the inbox and sentbox
|
||||
/*$DB->query("
|
||||
SELECT UnRead
|
||||
FROM pm_conversations_users
|
||||
WHERE ConvID = '$ConvID'
|
||||
AND UserID = '$ToID'");
|
||||
*/
|
||||
$DB->query("
|
||||
SELECT COUNT(ConvID)
|
||||
FROM pm_conversations_users
|
||||
WHERE UnRead = '1'
|
||||
AND UserID = '$ToID'
|
||||
AND InInbox = '1'");
|
||||
list($UnRead) = $DB->next_record(MYSQLI_BOTH, FALSE);
|
||||
$Cache->cache_value("inbox_new_$ToID", $UnRead);
|
||||
|
||||
//if ($UnRead == 0) {
|
||||
// $Cache->increment("inbox_new_$ToID");
|
||||
//}
|
||||
return $ConvID;
|
||||
}
|
||||
|
||||
function send_irc($Raw) {
|
||||
$IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
|
||||
fwrite($IRCSocket, $Raw);
|
||||
fclose($IRCSocket);
|
||||
}
|
||||
|
||||
function display_str($Str) {
|
||||
if ($Str === NULL || $Str === false || is_array($Str)) {
|
||||
return '';
|
||||
}
|
||||
if ($Str != '' && !is_number($Str)) {
|
||||
$Str = make_utf8($Str);
|
||||
$Str = mb_convert_encoding($Str, 'HTML-ENTITIES', 'UTF-8');
|
||||
$Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/m", '&', $Str);
|
||||
|
||||
$Replace = array(
|
||||
"'",'"',"<",">",
|
||||
'€','‚','ƒ','„','…','†','‡','ˆ',
|
||||
'‰','Š','‹','Œ','Ž','‘','’','“',
|
||||
'”','•','–','—','˜','™','š','›',
|
||||
'œ','ž','Ÿ'
|
||||
);
|
||||
|
||||
$With = array(
|
||||
''','"','<','>',
|
||||
'€','‚','ƒ','„','…','†','‡','ˆ',
|
||||
'‰','Š','‹','Œ','Ž','‘','’','“',
|
||||
'”','•','–','—','˜','™','š','›',
|
||||
'œ','ž','Ÿ'
|
||||
);
|
||||
|
||||
$Str = str_replace($Replace, $With, $Str);
|
||||
}
|
||||
return $Str;
|
||||
}
|
||||
|
||||
function make_utf8($Str) {
|
||||
if ($Str != '') {
|
||||
if (is_utf8($Str)) {
|
||||
$Encoding = 'UTF-8';
|
||||
}
|
||||
if (empty($Encoding)) {
|
||||
$Encoding = mb_detect_encoding($Str, 'UTF-8, ISO-8859-1');
|
||||
}
|
||||
if (empty($Encoding)) {
|
||||
$Encoding = 'ISO-8859-1';
|
||||
}
|
||||
if ($Encoding == 'UTF-8') {
|
||||
return $Str;
|
||||
} else {
|
||||
return @mb_convert_encoding($Str, 'UTF-8', $Encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function is_utf8($Str) {
|
||||
return preg_match('%^(?:
|
||||
[\x09\x0A\x0D\x20-\x7E] // ASCII
|
||||
| [\xC2-\xDF][\x80-\xBF] // non-overlong 2-byte
|
||||
| \xE0[\xA0-\xBF][\x80-\xBF] // excluding overlongs
|
||||
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} // straight 3-byte
|
||||
| \xED[\x80-\x9F][\x80-\xBF] // excluding surrogates
|
||||
| \xF0[\x90-\xBF][\x80-\xBF]{2} // planes 1-3
|
||||
| [\xF1-\xF3][\x80-\xBF]{3} // planes 4-15
|
||||
| \xF4[\x80-\x8F][\x80-\xBF]{2} // plane 16
|
||||
)*$%xs', $Str
|
||||
);
|
||||
}
|
||||
|
||||
require(SERVER_ROOT.'/sections/image/index.php');
|
||||
require('classes/script_start.php'); // script_start contains all we need and includes sections/image/index.php
|
||||
?>
|
||||
|
59
sections/ajax/collage.php
Normal file
59
sections/ajax/collage.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?
|
||||
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
|
||||
if (empty($_GET['id'])) {
|
||||
json_die("failure", "bad parameters");
|
||||
}
|
||||
|
||||
$CollageID = $_GET['id'];
|
||||
if ($CollageID && !is_number($CollageID)) {
|
||||
json_die("failure");
|
||||
}
|
||||
|
||||
$CacheKey = "collage_$CollageID";
|
||||
$Data = $Cache->get_value($CacheKey);
|
||||
if ($Data) {
|
||||
list($K, list($Name, $Description, , , , $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)) = each($Data);
|
||||
} else {
|
||||
$sql = "
|
||||
SELECT
|
||||
Name,
|
||||
Description,
|
||||
UserID,
|
||||
Deleted,
|
||||
CategoryID,
|
||||
Locked,
|
||||
MaxGroups,
|
||||
MaxGroupsPerUser,
|
||||
Subscribers
|
||||
FROM collages
|
||||
WHERE ID='$CollageID'";
|
||||
$DB->query($sql);
|
||||
|
||||
if ($DB->record_count() == 0) {
|
||||
json_die("failure");
|
||||
}
|
||||
|
||||
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
|
||||
}
|
||||
|
||||
|
||||
$Cache->cache_value($CacheKey, array(array($Name, $Description, array(), array(), array(), $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser)), 3600);
|
||||
|
||||
json_die("success", array(
|
||||
'id' => (int) $CollageID,
|
||||
'name' => $Name,
|
||||
'description' => $Text->full_format($Description),
|
||||
'creatorID' => (int) $CreatorID,
|
||||
'deleted' => (bool) $Deleted,
|
||||
'collageCategoryID' => (int) $CollageCategoryID,
|
||||
'locked' => (bool) $Locked,
|
||||
'categoryID' => (int) $CategoryID,
|
||||
'maxGroups' => (int) $MaxGroups,
|
||||
'maxGroupsPerUser' => (int) $MaxGroupsPerUser,
|
||||
'hasBookmarked' => Bookmarks::has_bookmarked('collage', $CollageID),
|
||||
'cached' => (bool) $Cached,
|
||||
));
|
||||
|
||||
?>
|
@ -13,7 +13,7 @@
|
||||
/* AJAX_LIMIT = array(x,y) = 'x' requests every 'y' seconds.
|
||||
e.g. array(5,10) = 5 requests every 10 seconds */
|
||||
$AJAX_LIMIT = array(5,10);
|
||||
$LimitedPages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup','news_ajax','user_recents');
|
||||
$LimitedPages = array('tcomments','user','forum','top10','browse','usersearch','requests','artist','inbox','subscriptions','bookmarks','announcements','notifications','request','better','similar_artists','userhistory','votefavorite','wiki','torrentgroup','news_ajax','user_recents', 'collage');
|
||||
|
||||
// These users aren't rate limited.
|
||||
// This array should contain user IDs.
|
||||
@ -158,6 +158,9 @@
|
||||
case 'user_recents':
|
||||
require(SERVER_ROOT . '/sections/ajax/user_recents.php');
|
||||
break;
|
||||
case 'collage':
|
||||
require(SERVER_ROOT . '/sections/ajax/collage.php');
|
||||
break;
|
||||
default:
|
||||
// If they're screwing around with the query string
|
||||
json_die("failure");
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
|
||||
$Text = new TEXT(true);
|
||||
|
||||
if (!empty($_POST['AdminComment'])) {
|
||||
echo $Text->full_format($_POST['AdminComment']);
|
||||
} else {
|
||||
|
@ -23,15 +23,19 @@
|
||||
$AppID = $_GET['aid'];
|
||||
$UserID = $_GET['uid'];
|
||||
|
||||
$App = $Cache->get_value('api_apps_'.$AppID);
|
||||
$App = $Cache->get_value("api_apps_$AppID");
|
||||
if (!is_array($App)) {
|
||||
if (!isset($DB)) {
|
||||
require(SERVER_ROOT.'/classes/mysql.class.php');
|
||||
$DB = new DB_MYSQL;
|
||||
}
|
||||
$DB->query("SELECT Token, Name FROM api_applications WHERE ID='$AppID' LIMIT 1");
|
||||
$DB->query("
|
||||
SELECT Token, Name
|
||||
FROM api_applications
|
||||
WHERE ID = '$AppID'
|
||||
LIMIT 1");
|
||||
$App = $DB->to_array(false, MYSQLI_ASSOC);
|
||||
$Cache->cache_value('api_apps_'.$AppID, $App, 0);
|
||||
$Cache->cache_value("api_apps_$AppID", $App, 0);
|
||||
}
|
||||
$App = $App[0];
|
||||
|
||||
@ -41,7 +45,7 @@
|
||||
error('invalid');
|
||||
}
|
||||
} else {
|
||||
$User = $Cache->get_value('api_users_'.$UserID);
|
||||
$User = $Cache->get_value("api_users_$UserID");
|
||||
if (!is_array($User)) {
|
||||
if (!isset($DB)) {
|
||||
require(SERVER_ROOT.'/classes/mysql.class.php');
|
||||
@ -53,7 +57,7 @@
|
||||
WHERE UserID = '$UserID'
|
||||
LIMIT 1"); //int, no db_string
|
||||
$User = $DB->to_array('AppID', MYSQLI_ASSOC);
|
||||
$Cache->cache_value('api_users_'.$UserID, $User, 0);
|
||||
$Cache->cache_value("api_users_$UserID", $User, 0);
|
||||
}
|
||||
$User = $User[$AppID];
|
||||
|
||||
|
@ -180,7 +180,7 @@
|
||||
<tr id="tagfilter">
|
||||
<td class="label">Tags (comma-separated):</td>
|
||||
<td>
|
||||
<input type="text" id="tags" name="tags" size="70" value="<?=(!empty($_GET['tags']) ? display_str($_GET['tags']) : '')?> <? Users::has_autocomplete_enabled('other'); ?>" />
|
||||
<input type="text" id="tags" name="tags" size="70" value="<?=(!empty($_GET['tags']) ? display_str($_GET['tags']) : '')?>"<? Users::has_autocomplete_enabled('other'); ?> />
|
||||
<input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>
|
||||
<input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
|
||||
</td>
|
||||
|
@ -18,7 +18,10 @@ function btc_balance() {
|
||||
function btc_address($UserID, $GenAddress = false) {
|
||||
global $DB;
|
||||
$UserID = (int)$UserID;
|
||||
$DB->query("SELECT BitcoinAddress FROM users_info WHERE UserID = '$UserID'");
|
||||
$DB->query("
|
||||
SELECT BitcoinAddress
|
||||
FROM users_info
|
||||
WHERE UserID = '$UserID'");
|
||||
list($Addr) = $DB->next_record();
|
||||
|
||||
if (!empty($Addr)) {
|
||||
|
@ -4,7 +4,10 @@
|
||||
|
||||
//Include the header
|
||||
if (!$UserCount = $Cache->get_value('stats_user_count')) {
|
||||
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'");
|
||||
list($UserCount) = $DB->next_record();
|
||||
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
||||
}
|
||||
|
@ -8,7 +8,10 @@
|
||||
}
|
||||
|
||||
if (!$UserCount = $Cache->get_value('stats_user_count')) {
|
||||
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'");
|
||||
list($UserCount) = $DB->next_record();
|
||||
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
||||
}
|
||||
|
@ -25,9 +25,12 @@
|
||||
if (!$Enabled = $Cache->get_value('enabled_'.$User)) {
|
||||
require(SERVER_ROOT.'/classes/mysql.class.php');
|
||||
$DB=NEW DB_MYSQL; //Load the database wrapper
|
||||
$DB->query("SELECT Enabled FROM users_main WHERE ID='$User'");
|
||||
$DB->query("
|
||||
SELECT Enabled
|
||||
FROM users_main
|
||||
WHERE ID = '$User'");
|
||||
list($Enabled) = $DB->next_record();
|
||||
$Cache->cache_value('enabled_'.$User, $Enabled, 0);
|
||||
$Cache->cache_value("enabled_$User", $Enabled, 0);
|
||||
}
|
||||
|
||||
if (md5($User.RSS_HASH.$_GET['passkey']) != $_GET['auth'] || $Enabled != 1) {
|
||||
@ -48,7 +51,8 @@
|
||||
if (!$News = $Cache->get_value('news')) {
|
||||
require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
|
||||
$DB=NEW DB_MYSQL; //Load the database wrapper
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
ID,
|
||||
Title,
|
||||
Body,
|
||||
@ -65,7 +69,7 @@
|
||||
if (strtotime($NewsTime) >= time()) {
|
||||
continue;
|
||||
}
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), 'index.php#news'.$NewsID, SITE_NAME.' Staff','','',$NewsTime);
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), "index.php#news$NewsID", SITE_NAME.' Staff', '', '', $NewsTime);
|
||||
if (++$Count > 4) {
|
||||
break;
|
||||
}
|
||||
@ -98,7 +102,7 @@
|
||||
if ($ThreadID) {
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), 'forums.php?action=viewthread&threadid='.$ThreadID, SITE_NAME.' Staff', '', '', $BlogTime);
|
||||
} else {
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), 'blog.php#blog'.$BlogID, SITE_NAME.' Staff','','',$BlogTime);
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), "blog.php#blog$BlogID", SITE_NAME.' Staff', '', '', $BlogTime);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -109,13 +113,17 @@
|
||||
require(SERVER_ROOT.'/classes/misc.class.php');
|
||||
|
||||
$DB = NEW DB_MYSQL;
|
||||
$DB->query("SELECT Message, Author, Date(Time) FROM changelog ORDER BY Time DESC LIMIT 20");
|
||||
$DB->query("
|
||||
SELECT Message, Author, Date(Time)
|
||||
FROM changelog
|
||||
ORDER BY Time DESC
|
||||
LIMIT 20");
|
||||
$Changelog = $DB->to_array();
|
||||
$Cache->cache_value('changelog', $Changelog, 86400);
|
||||
}
|
||||
foreach ($Changelog as $Change) {
|
||||
list($Message, $Author, $Date) = $Change;
|
||||
echo $Feed->item($Date . " by " . $Author, $Message, 'tools.php?action=change_log', SITE_NAME.' Staff','','',$Date);
|
||||
echo $Feed->item("$Date by $Author", $Message, 'tools.php?action=change_log', SITE_NAME.' Staff', '', '', $Date);
|
||||
}
|
||||
break;
|
||||
case 'torrents_all':
|
||||
|
@ -4,16 +4,16 @@
|
||||
// Bear this in mind when you try to use script_start functions.
|
||||
|
||||
if (!check_perms('site_proxy_images')) {
|
||||
error('forbidden');
|
||||
img_error('forbidden');
|
||||
}
|
||||
$URL = isset($_GET['i']) ? htmlspecialchars_decode($_GET['i']) : null;
|
||||
|
||||
if (!extension_loaded('openssl') && strtoupper($URL[4]) == 'S') {
|
||||
error('badprotocol');
|
||||
img_error('badprotocol');
|
||||
}
|
||||
|
||||
if (!preg_match('/^'.IMAGE_REGEX.'/is',$URL,$Matches)) {
|
||||
error('invalid');
|
||||
img_error('invalid');
|
||||
}
|
||||
|
||||
if (isset($_GET['c'])) {
|
||||
@ -24,16 +24,16 @@
|
||||
$Cached = false;
|
||||
$Data = @file_get_contents($URL,0,stream_context_create(array('http'=>array('timeout'=>15))));
|
||||
if (!$Data || empty($Data)) {
|
||||
error('timeout');
|
||||
img_error('timeout');
|
||||
}
|
||||
$Type = image_type($Data);
|
||||
if ($Type && function_exists('imagecreatefrom'.$Type)) {
|
||||
$Image = imagecreatefromstring($Data);
|
||||
if (invisible($Image)) {
|
||||
error('invisible');
|
||||
img_error('invisible');
|
||||
}
|
||||
if (verysmall($Image)) {
|
||||
error('small');
|
||||
img_error('small');
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,6 @@
|
||||
if (strlen($Data2) > 256 * 1024 || image_height($Type, $Data2) > 400) {
|
||||
require_once(SERVER_ROOT.'/classes/mysql.class.php');
|
||||
require_once(SERVER_ROOT.'/classes/time.class.php'); //Require the time class
|
||||
|
||||
$DB = new DB_MYSQL;
|
||||
$DBURL = db_string($URL);
|
||||
|
||||
// Reset avatar, add mod note
|
||||
@ -76,7 +74,7 @@
|
||||
|
||||
// Send PM
|
||||
|
||||
send_pm($UserID,0,"Your avatar has been automatically reset","The following avatar rules have been in effect for months now:
|
||||
Misc::send_pm($UserID,0,"Your avatar has been automatically reset","The following avatar rules have been in effect for months now:
|
||||
|
||||
[b]Avatars must not exceed 256 kB or be vertically longer than 400px. [/b]
|
||||
|
||||
@ -90,7 +88,7 @@
|
||||
/*
|
||||
TODO: solve this properly for photoshop output images which prepend shit to the image file. skip it or strip it
|
||||
if (!isset($Type)) {
|
||||
error('timeout');
|
||||
img_error('timeout');
|
||||
}
|
||||
*/
|
||||
if (isset($Type)) {
|
||||
|
@ -84,7 +84,7 @@
|
||||
|
||||
<div class="box pad">
|
||||
<? if ($Count == 0 && empty($_GET['search'])) { ?>
|
||||
<h2>Your <?=(($Section == 'sentbox') ? 'sentbox' : 'inbox')?> is currently empty</h2>
|
||||
<h2>Your <?=(($Section == 'sentbox') ? 'sentbox' : 'inbox')?> is empty.</h2>
|
||||
<? } else { ?>
|
||||
<form class="search_form" name="<?=(($Section == 'sentbox') ? 'sentbox' : 'inbox')?>" action="inbox.php" method="get" id="searchbox">
|
||||
<div>
|
||||
|
@ -165,7 +165,9 @@
|
||||
// If the inviter doesn't have an invite tree
|
||||
// Note: This should never happen unless you've transferred from another database, like What.CD did
|
||||
if ($DB->record_count() == 0) {
|
||||
$DB->query("SELECT MAX(TreeID)+1 FROM invite_tree");
|
||||
$DB->query("
|
||||
SELECT MAX(TreeID) + 1
|
||||
FROM invite_tree");
|
||||
list($TreeID) = $DB->next_record();
|
||||
|
||||
$DB->query("
|
||||
|
@ -11,7 +11,10 @@
|
||||
}
|
||||
|
||||
$ID = (int)$_POST['id'];
|
||||
$DB->query("SELECT ClaimerID FROM reports WHERE ID = '$ID'");
|
||||
$DB->query("
|
||||
SELECT ClaimerID
|
||||
FROM reports
|
||||
WHERE ID = '$ID'");
|
||||
list($ClaimerID) = $DB->next_record();
|
||||
if ($ClaimerID) {
|
||||
print
|
||||
@ -23,7 +26,10 @@
|
||||
die();
|
||||
} else {
|
||||
$UserID = $LoggedUser['ID'];
|
||||
$DB->query("UPDATE reports SET ClaimerID = '$UserID' WHERE ID = '$ID'");
|
||||
$DB->query("
|
||||
UPDATE reports
|
||||
SET ClaimerID = '$UserID'
|
||||
WHERE ID = '$ID'");
|
||||
print
|
||||
json_encode(
|
||||
array(
|
||||
|
@ -7,7 +7,10 @@
|
||||
|
||||
$ReportID = $_POST['reportid'];
|
||||
|
||||
$DB->query('SELECT Type FROM reports WHERE ID = '.$ReportID);
|
||||
$DB->query("
|
||||
SELECT Type
|
||||
FROM reports
|
||||
WHERE ID = $ReportID");
|
||||
list($Type) = $DB->next_record();
|
||||
if (!check_perms('admin_reports')) {
|
||||
if (check_perms('site_moderate_forums')) {
|
||||
@ -28,7 +31,6 @@
|
||||
ResolverID = '".$LoggedUser['ID']."'
|
||||
WHERE ID = '".db_string($ReportID)."'");
|
||||
|
||||
|
||||
$Channels = array();
|
||||
|
||||
if ($Type == 'request_update') {
|
||||
@ -41,12 +43,14 @@
|
||||
$Cache->decrement('num_forum_reports');
|
||||
}
|
||||
|
||||
|
||||
$DB->query("SELECT COUNT(ID) FROM reports WHERE Status = 'New'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM reports
|
||||
WHERE Status = 'New'");
|
||||
list($Remaining) = $DB->next_record();
|
||||
|
||||
foreach ($Channels as $Channel) {
|
||||
send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace("/^(.{2})/", "$1·", $LoggedUser['Username']).' on site ('.(int)$Remaining.' remaining).');
|
||||
send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace('/^(.{2})/', '$1·', $LoggedUser['Username']).' on site ('.(int)$Remaining.' remaining).');
|
||||
}
|
||||
|
||||
$Cache->delete_value('num_other_reports');
|
||||
@ -59,7 +63,7 @@ function ajax_error($Error = 'error') {
|
||||
}
|
||||
|
||||
function ajax_success() {
|
||||
echo json_encode(array("status"=>"success"));
|
||||
echo json_encode(array('status' => 'success'));
|
||||
die();
|
||||
}
|
||||
?>
|
||||
|
@ -16,7 +16,10 @@
|
||||
|
||||
switch ($Short) {
|
||||
case 'user':
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
|
||||
$DB->query("
|
||||
SELECT Username
|
||||
FROM users_main
|
||||
WHERE ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
@ -25,7 +28,10 @@
|
||||
|
||||
case 'request_update':
|
||||
$NoReason = true;
|
||||
$DB->query("SELECT Title, Description, TorrentID, CategoryID, Year FROM requests WHERE ID=".$ID);
|
||||
$DB->query("
|
||||
SELECT Title, Description, TorrentID, CategoryID, Year
|
||||
FROM requests
|
||||
WHERE ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
@ -36,7 +42,10 @@
|
||||
break;
|
||||
|
||||
case 'request':
|
||||
$DB->query("SELECT Title, Description, TorrentID FROM requests WHERE ID=".$ID);
|
||||
$DB->query("
|
||||
SELECT Title, Description, TorrentID
|
||||
FROM requests
|
||||
WHERE ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
@ -44,7 +53,10 @@
|
||||
break;
|
||||
|
||||
case 'collage':
|
||||
$DB->query("SELECT Name, Description FROM collages WHERE ID=".$ID);
|
||||
$DB->query("
|
||||
SELECT Name, Description
|
||||
FROM collages
|
||||
WHERE ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
@ -56,37 +68,46 @@
|
||||
SELECT ft.Title, ft.ForumID, um.Username
|
||||
FROM forums_topics AS ft
|
||||
JOIN users_main AS um ON um.ID = ft.AuthorID
|
||||
WHERE ft.ID=".$ID);
|
||||
WHERE ft.ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
list($Title, $ForumID, $Username) = $DB->next_record();
|
||||
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
|
||||
$DB->query("
|
||||
SELECT MinClassRead
|
||||
FROM forums
|
||||
WHERE ID = $ForumID");
|
||||
list($MinClassRead) = $DB->next_record();
|
||||
if (!empty($LoggedUser['DisableForums']) ||
|
||||
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
|
||||
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
|
||||
if (!empty($LoggedUser['DisableForums'])
|
||||
|| ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0))
|
||||
|| (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
|
||||
error(403);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$DB->query('
|
||||
$DB->query("
|
||||
SELECT fp.Body, fp.TopicID, um.Username
|
||||
FROM forums_posts AS fp
|
||||
JOIN users_main AS um ON um.ID = fp.AuthorID
|
||||
WHERE fp.ID='.$ID);
|
||||
WHERE fp.ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
list($Body, $TopicID, $Username) = $DB->next_record();
|
||||
$DB->query('SELECT ForumID FROM forums_topics WHERE ID = '.$TopicID);
|
||||
$DB->query("
|
||||
SELECT ForumID
|
||||
FROM forums_topics
|
||||
WHERE ID = $TopicID");
|
||||
list($ForumID) = $DB->next_record();
|
||||
$DB->query('SELECT MinClassRead FROM forums WHERE ID = '.$ForumID);
|
||||
$DB->query("
|
||||
SELECT MinClassRead
|
||||
FROM forums
|
||||
WHERE ID = $ForumID");
|
||||
list($MinClassRead) = $DB->next_record();
|
||||
if (!empty($LoggedUser['DisableForums']) ||
|
||||
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
|
||||
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
|
||||
if (!empty($LoggedUser['DisableForums'])
|
||||
|| ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0))
|
||||
|| (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
|
||||
error(403);
|
||||
}
|
||||
break;
|
||||
@ -95,17 +116,17 @@
|
||||
case 'torrents_comment':
|
||||
case 'artist_comment':
|
||||
case 'collages_comment':
|
||||
$Table = $Short.'s';
|
||||
$Table = "{$Short}s";
|
||||
if ($Short == 'collages_comment') {
|
||||
$Column = 'UserID';
|
||||
} else {
|
||||
$Column = 'AuthorID';
|
||||
}
|
||||
$DB->query('
|
||||
SELECT '.$Short.".Body, um.Username
|
||||
$DB->query("
|
||||
SELECT $Short.Body, um.Username
|
||||
FROM $Table AS $Short
|
||||
JOIN users_main AS um ON um.ID = $Short.$Column
|
||||
WHERE $Short.ID=".$ID);
|
||||
WHERE $Short.ID = $ID");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
}
|
||||
@ -123,9 +144,7 @@
|
||||
<div class="box pad">
|
||||
<p>Following these guidelines will help the moderators deal with your report in a timely fashion. </p>
|
||||
<ul>
|
||||
<?
|
||||
foreach ($Type['guidelines'] as $Guideline) {
|
||||
?>
|
||||
<? foreach ($Type['guidelines'] as $Guideline) { ?>
|
||||
<li><?=$Guideline?></li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
@ -179,12 +198,9 @@
|
||||
<td>
|
||||
<select id="releasetype" name="releasetype">
|
||||
<option value="0">---</option>
|
||||
<?
|
||||
foreach ($ReleaseTypes as $Key => $Val) {
|
||||
?> <option value="<?=$Key?>"<?=(!empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : '') : '')?>><?=$Val?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<? foreach ($ReleaseTypes as $Key => $Val) { ?>
|
||||
<option value="<?=$Key?>"<?=(!empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : '') : '')?>><?=$Val?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -18,10 +18,10 @@
|
||||
View::show_header('Reports', 'bbcode,reports');
|
||||
|
||||
if ($_GET['id'] && is_number($_GET['id'])) {
|
||||
$View = "Single report";
|
||||
$Where = "r.ID = " . $_GET['id'];
|
||||
$View = 'Single report';
|
||||
$Where = 'r.ID = ' . $_GET['id'];
|
||||
} else if (empty($_GET['view'])) {
|
||||
$View = "New";
|
||||
$View = 'New';
|
||||
$Where = "Status = 'New'";
|
||||
} else {
|
||||
$View = $_GET['view'];
|
||||
@ -93,7 +93,7 @@
|
||||
<?
|
||||
while (list($ReportID, $SnitchID, $SnitchName, $ThingID, $Short, $ReportedTime, $Reason, $Status, $ClaimerID, $Notes, $ResolverID) = $DB->next_record()) {
|
||||
$Type = $Types[$Short];
|
||||
$Reference = "reports.php?id=" . $ReportID . "#report" . $ReportID;
|
||||
$Reference = "reports.php?id=$ReportID#report$ReportID";
|
||||
?>
|
||||
<div id="report_<?=$ReportID?>">
|
||||
<table cellpadding="5" id="report_<?=$ReportID?>">
|
||||
@ -108,8 +108,11 @@
|
||||
<td class="center" colspan="2">
|
||||
<strong>
|
||||
<? switch ($Short) {
|
||||
case "user" :
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID=" . $ThingID);
|
||||
case 'user':
|
||||
$DB->query("
|
||||
SELECT Username
|
||||
FROM users_main
|
||||
WHERE ID = $ThingID");
|
||||
if ($DB->record_count() < 1) {
|
||||
echo 'No user with the reported ID found';
|
||||
} else {
|
||||
@ -117,9 +120,12 @@
|
||||
echo "<a href=\"user.php?id=$ThingID\">" . display_str($Username) . '</a>';
|
||||
}
|
||||
break;
|
||||
case "request" :
|
||||
case "request_update" :
|
||||
$DB->query("SELECT Title FROM requests WHERE ID=" . $ThingID);
|
||||
case 'request':
|
||||
case 'request_update':
|
||||
$DB->query("
|
||||
SELECT Title
|
||||
FROM requests
|
||||
WHERE ID = $ThingID");
|
||||
if ($DB->record_count() < 1) {
|
||||
echo 'No request with the reported ID found';
|
||||
} else {
|
||||
@ -127,8 +133,11 @@
|
||||
echo "<a href=\"requests.php?action=view&id=$ThingID\">" . display_str($Name) . '</a>';
|
||||
}
|
||||
break;
|
||||
case "collage" :
|
||||
$DB->query("SELECT Name FROM collages WHERE ID=" . $ThingID);
|
||||
case 'collage':
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM collages
|
||||
WHERE ID = $ThingID");
|
||||
if ($DB->record_count() < 1) {
|
||||
echo 'No collage with the reported ID found';
|
||||
} else {
|
||||
@ -136,8 +145,11 @@
|
||||
echo "<a href=\"collages.php?id=$ThingID\">" . display_str($Name) . '</a>';
|
||||
}
|
||||
break;
|
||||
case "thread" :
|
||||
$DB->query("SELECT Title FROM forums_topics WHERE ID=" . $ThingID);
|
||||
case 'thread':
|
||||
$DB->query("
|
||||
SELECT Title
|
||||
FROM forums_topics
|
||||
WHERE ID = $ThingID");
|
||||
if ($DB->record_count() < 1) {
|
||||
echo 'No forum thread with the reported ID found';
|
||||
} else {
|
||||
@ -145,7 +157,7 @@
|
||||
echo "<a href=\"forums.php?action=viewthread&threadid=$ThingID\">" . display_str($Title) . '</a>';
|
||||
}
|
||||
break;
|
||||
case "post" :
|
||||
case 'post':
|
||||
if (isset($LoggedUser['PostsPerPage'])) {
|
||||
$PerPage = $LoggedUser['PostsPerPage'];
|
||||
} else {
|
||||
@ -167,10 +179,10 @@
|
||||
echo 'No forum post with the reported ID found';
|
||||
} else {
|
||||
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
|
||||
echo "<a href=\"forums.php?action=viewthread&threadid=" . $TopicID . "&post=" . $PostNum . "#post" . $PostID . "\">FORUM POST</a>";
|
||||
echo "<a href=\"forums.php?action=viewthread&threadid=$TopicID&post=$PostNum#post$PostID\">FORUM POST</a>";
|
||||
}
|
||||
break;
|
||||
case "requests_comment" :
|
||||
case 'requests_comment':
|
||||
$DB->query("
|
||||
SELECT
|
||||
rc.RequestID,
|
||||
@ -187,10 +199,10 @@
|
||||
} else {
|
||||
list($RequestID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
echo "<a href=\"requests.php?action=view&id=" . $RequestID . "&page=" . $PageNum . "#post" . $ThingID . "\">REQUEST COMMENT</a>";
|
||||
echo "<a href=\"requests.php?action=view&id=$RequestID&page=$PageNum#post$ThingID\">REQUEST COMMENT</a>";
|
||||
}
|
||||
break;
|
||||
case "torrents_comment" :
|
||||
case 'torrents_comment':
|
||||
$DB->query("
|
||||
SELECT
|
||||
tc.GroupID,
|
||||
@ -207,10 +219,10 @@
|
||||
} else {
|
||||
list($GroupID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
echo "<a href=\"torrents.php?id=" . $GroupID . "&page=" . $PageNum . "#post" . $ThingID . "\">TORRENT COMMENT</a>";
|
||||
echo "<a href=\"torrents.php?id=$GroupID&page=$PageNum#post$ThingID\">TORRENT COMMENT</a>";
|
||||
}
|
||||
break;
|
||||
case "artist_comment" :
|
||||
case 'artist_comment':
|
||||
$DB->query("
|
||||
SELECT
|
||||
ac.ArtistID,
|
||||
@ -227,11 +239,11 @@
|
||||
} else {
|
||||
list($ArtistID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
echo "<a href=\"artist.php?id=" . $ArtistID . "&page=" . $PageNum . "#post" . $ThingID . "\">ARTIST COMMENT</a>";
|
||||
echo "<a href=\"artist.php?id=$ArtistID&page=$PageNum#post$ThingID\">ARTIST COMMENT</a>";
|
||||
}
|
||||
break;
|
||||
|
||||
case "collages_comment" :
|
||||
case 'collages_comment':
|
||||
$DB->query("
|
||||
SELECT
|
||||
cc.CollageID,
|
||||
@ -249,7 +261,7 @@
|
||||
list($CollageID, $Body, $PostNum) = $DB->next_record();
|
||||
$PerPage = POSTS_PER_PAGE;
|
||||
$PageNum = ceil($PostNum / $PerPage);
|
||||
echo "<a href=\"collage.php?action=comments&collageid=" . $CollageID . "&page=" . $PageNum . "#post" . $ThingID . "\">COLLAGE COMMENT</a>";
|
||||
echo "<a href=\"collage.php?action=comments&collageid=$CollageID&page=$PageNum#post$ThingID\">COLLAGE COMMENT</a>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -272,7 +284,7 @@
|
||||
|
||||
<a href="#" onclick="toggleNotes(<?=$ReportID?>); return false;" class="brackets">Toggle notes</a>
|
||||
|
||||
<div id="notes_div_<?=$ReportID?>" style="display: <?=empty($Notes) ? "none" : "block"?>;">
|
||||
<div id="notes_div_<?=$ReportID?>" style="display: <?=empty($Notes) ? 'none' : 'block'; ?>;">
|
||||
<textarea cols="50" rows="3" id="notes_<?=$ReportID?>"><?=$Notes?></textarea>
|
||||
<br />
|
||||
<input type="submit" onclick="saveNotes(<?=$ReportID?>)" value="Save" />
|
||||
@ -289,7 +301,8 @@
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<? } else {
|
||||
<?
|
||||
} else {
|
||||
$ResolverInfo = Users::user_info($ResolverID);
|
||||
?>
|
||||
<tr>
|
||||
|
@ -18,7 +18,8 @@
|
||||
<table class="layout">
|
||||
<?
|
||||
if (check_perms('admin_reports')) :
|
||||
$DB->query("SELECT um.Username,
|
||||
$DB->query("
|
||||
SELECT um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reports AS r
|
||||
JOIN users_main AS um ON um.ID = r.ResolverID
|
||||
@ -36,7 +37,8 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach ($Results as $Result) {
|
||||
<?
|
||||
foreach ($Results as $Result) {
|
||||
list($Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -49,7 +51,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<?
|
||||
$DB->query("SELECT um.Username,
|
||||
$DB->query("
|
||||
SELECT um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reports AS r
|
||||
JOIN users_main AS um ON um.ID = r.ResolverID
|
||||
@ -66,7 +69,8 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach ($Results as $Result) {
|
||||
<?
|
||||
foreach ($Results as $Result) {
|
||||
list($Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -79,7 +83,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<?
|
||||
$DB->query("SELECT um.Username,
|
||||
$DB->query("
|
||||
SELECT um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reports AS r
|
||||
JOIN users_main AS um ON um.ID = r.ResolverID
|
||||
@ -96,7 +101,8 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach ($Results as $Result) {
|
||||
<?
|
||||
foreach ($Results as $Result) {
|
||||
list($Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -109,7 +115,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<?
|
||||
$DB->query("SELECT um.Username,
|
||||
$DB->query("
|
||||
SELECT um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reports AS r
|
||||
JOIN users_main AS um ON um.ID = r.ResolverID
|
||||
@ -124,7 +131,8 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach ($Results as $Result) {
|
||||
<?
|
||||
foreach ($Results as $Result) {
|
||||
list($Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -138,14 +146,15 @@
|
||||
<? endif; ?>
|
||||
<tr>
|
||||
<?
|
||||
$DB->query("SELECT u.Username,
|
||||
$DB->query("
|
||||
SELECT u.Username,
|
||||
count(LastPostAuthorID) as Trashed
|
||||
FROM forums_topics as f
|
||||
LEFT JOIN users_main as u on u.id = LastPostAuthorID
|
||||
WHERE ForumID = 12
|
||||
GROUP BY LastPostAuthorID
|
||||
ORDER BY Trashed DESC
|
||||
LIMIT 30;");
|
||||
LIMIT 30");
|
||||
$Results = $DB->to_array();
|
||||
?>
|
||||
<td class="label"><strong>Threads trashed since the beginning of time</strong></td>
|
||||
@ -166,7 +175,8 @@
|
||||
<td><?=$Username?></td>
|
||||
<td><?=number_format($Trashed)?></td>
|
||||
</tr>
|
||||
<? $i++;
|
||||
<?
|
||||
$i++;
|
||||
} ?>
|
||||
</table>
|
||||
</td>
|
||||
|
@ -20,7 +20,11 @@
|
||||
$Err = 'A recipient does not exist.';
|
||||
}
|
||||
}
|
||||
$DB->query("SELECT UserID FROM pm_conversations_users WHERE UserID='$LoggedUser[ID]' AND ConvID='$ConvID'");
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM pm_conversations_users
|
||||
WHERE UserID = '$LoggedUser[ID]'
|
||||
AND ConvID = '$ConvID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
error(403);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
if ($Short == 'request_update') {
|
||||
if (empty($_POST['year']) || !is_number($_POST['year'])) {
|
||||
error('Year must be specified.');
|
||||
header('Location: reports.php?action=report&type=request_update&id='.$ID);
|
||||
header("Location: reports.php?action=report&type=request_update&id=$ID");
|
||||
die();
|
||||
}
|
||||
$Reason = '[b]Year[/b]: '.$_POST['year'].".\n\n";
|
||||
@ -30,16 +30,16 @@
|
||||
switch ($Short) {
|
||||
case 'request':
|
||||
case 'request_update':
|
||||
$Link = 'requests.php?action=view&id='.$ID;
|
||||
$Link = "requests.php?action=view&id=$ID";
|
||||
break;
|
||||
case 'user':
|
||||
$Link = 'user.php?id='.$ID;
|
||||
$Link = "user.php?id=$ID";
|
||||
break;
|
||||
case 'collage':
|
||||
$Link = 'collages.php?id='.$ID;
|
||||
$Link = "collages.php?id=$ID";
|
||||
break;
|
||||
case 'thread':
|
||||
$Link = 'forums.php?action=viewthread&threadid='.$ID;
|
||||
$Link = "forums.php?action=viewthread&threadid=$ID";
|
||||
break;
|
||||
case 'post':
|
||||
$DB->query("
|
||||
@ -52,9 +52,9 @@
|
||||
AND forums_posts.ID <= p.ID
|
||||
) AS PostNum
|
||||
FROM forums_posts AS p
|
||||
WHERE ID=".$ID);
|
||||
WHERE ID = $ID");
|
||||
list($PostID, $TopicID, $PostNum) = $DB->next_record();
|
||||
$Link = 'forums.php?action=viewthread&threadid='.$TopicID.'&post='.$PostNum.'#post'.$PostID;
|
||||
$Link = "forums.php?action=viewthread&threadid=$TopicID&post=$PostNum#post$PostID";
|
||||
break;
|
||||
case 'requests_comment':
|
||||
$DB->query("
|
||||
@ -67,10 +67,10 @@
|
||||
AND requests_comments.RequestID = rc.RequestID
|
||||
) AS CommentNum
|
||||
FROM requests_comments AS rc
|
||||
WHERE ID=".$ID);
|
||||
WHERE ID = $ID");
|
||||
list($RequestID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
$Link = 'requests.php?action=view&id='.$RequestID.'&page='.$PageNum.'#post'.$ID;
|
||||
$Link = "requests.php?action=view&id=$RequestID&page=$PageNum#post$ID";
|
||||
break;
|
||||
case 'torrents_comment':
|
||||
$DB->query("
|
||||
@ -83,10 +83,10 @@
|
||||
AND torrents_comments.GroupID = tc.GroupID
|
||||
) AS CommentNum
|
||||
FROM torrents_comments AS tc
|
||||
WHERE ID=".$ID);
|
||||
WHERE ID = $ID");
|
||||
list($GroupID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
$Link = 'torrents.php?id='.$GroupID.'&page='.$PageNum.'#post'.$ID;
|
||||
$Link = "torrents.php?id=$GroupID&page=$PageNum#post$ID";
|
||||
break;
|
||||
case 'artist_comment':
|
||||
$DB->query("
|
||||
@ -99,10 +99,10 @@
|
||||
AND artist_comments.ArtistID = ac.ArtistID
|
||||
) AS CommentNum
|
||||
FROM artist_comments AS ac
|
||||
WHERE ID=".$ID);
|
||||
WHERE ID = $ID");
|
||||
list($ArtistID, $Body, $PostNum) = $DB->next_record();
|
||||
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
|
||||
$Link = 'artist.php?id='.$ArtistID.'&page='.$PageNum.'#post'.$ID;
|
||||
$Link = "artist.php?id=$ArtistID&page=$PageNum#post$ID";
|
||||
break;
|
||||
case 'collages_comment':
|
||||
$DB->query("
|
||||
@ -115,11 +115,11 @@
|
||||
AND collages_comments.CollageID = cc.CollageID
|
||||
) AS CommentNum
|
||||
FROM collages_comments AS cc
|
||||
WHERE ID=".$ID);
|
||||
WHERE ID = $ID");
|
||||
list($CollageID, $Body, $PostNum) = $DB->next_record();
|
||||
$PerPage = POSTS_PER_PAGE;
|
||||
$PageNum = ceil($PostNum / $PerPage);
|
||||
$Link = 'collage.php?action=comments&collageid='.$CollageID.'&page='.$PageNum.'#post'.$ID;
|
||||
$Link = "collage.php?action=comments&collageid=$CollageID&page=$PageNum#post$ID";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -147,5 +147,5 @@
|
||||
|
||||
$Cache->delete_value('num_other_reports');
|
||||
|
||||
header('Location: '.$Link);
|
||||
header("Location: $Link");
|
||||
?>
|
||||
|
@ -11,7 +11,10 @@
|
||||
|
||||
$ReportID = $_POST['reportid'];
|
||||
|
||||
$DB->query("SELECT Type FROM reports WHERE ID = ".$ReportID);
|
||||
$DB->query("
|
||||
SELECT Type
|
||||
FROM reports
|
||||
WHERE ID = $ReportID");
|
||||
list($Type) = $DB->next_record();
|
||||
if (!check_perms('admin_reports')) {
|
||||
if (check_perms('site_moderate_forums')) {
|
||||
@ -25,13 +28,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("UPDATE reports
|
||||
$DB->query("
|
||||
UPDATE reports
|
||||
SET Status = 'Resolved',
|
||||
ResolvedTime = '".sqltime()."',
|
||||
ResolverID = '".$LoggedUser['ID']."'
|
||||
WHERE ID = '".db_string($ReportID)."'");
|
||||
|
||||
|
||||
$Channels = array();
|
||||
|
||||
if ($Type == 'request_update') {
|
||||
@ -44,12 +47,14 @@
|
||||
$Cache->decrement('num_forum_reports');
|
||||
}
|
||||
|
||||
|
||||
$DB->query("SELECT COUNT(ID) FROM reports WHERE Status = 'New'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM reports
|
||||
WHERE Status = 'New'");
|
||||
list($Remaining) = $DB->next_record();
|
||||
|
||||
foreach ($Channels as $Channel) {
|
||||
send_irc("PRIVMSG ".$Channel." :Report ".$ReportID." resolved by ".preg_replace("/^(.{2})/", "$1·", $LoggedUser['Username'])." on site (".(int)$Remaining." remaining).");
|
||||
send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace('/^(.{2})/', '$1·', $LoggedUser['Username']).' on site ('.(int)$Remaining.' remaining).');
|
||||
}
|
||||
|
||||
$Cache->delete_value('num_other_reports');
|
||||
|
@ -7,9 +7,10 @@
|
||||
|
||||
View::show_header('Bitcoin donation balance');
|
||||
|
||||
$Balance = btc_balance() . " BTC";
|
||||
$Balance = btc_balance() . ' BTC';
|
||||
$Receiveds = btc_received();
|
||||
$DB->query("SELECT i.UserID, i.BitcoinAddress
|
||||
$DB->query("
|
||||
SELECT i.UserID, i.BitcoinAddress
|
||||
FROM users_info AS i
|
||||
JOIN users_main AS m ON m.ID = i.UserID
|
||||
WHERE BitcoinAddress IS NOT NULL
|
||||
|
@ -52,13 +52,21 @@
|
||||
FROM torrents");
|
||||
list($TotalSnatches, $TotalTorrents) = $DB->next_record(); // This is the total number of snatches for torrents that still exist
|
||||
|
||||
$DB->query("SELECT COUNT(uid) FROM xbt_snatched");
|
||||
$DB->query("
|
||||
SELECT COUNT(uid)
|
||||
FROM xbt_snatched");
|
||||
list($TotalOverallSnatches) = $DB->next_record();
|
||||
|
||||
if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
|
||||
$DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining=0");
|
||||
$DB->query("
|
||||
SELECT COUNT(fid)
|
||||
FROM xbt_files_users
|
||||
WHERE remaining = 0");
|
||||
list($TotalSeeders) = $DB->next_record();
|
||||
$DB->query("SELECT COUNT(fid) FROM xbt_files_users WHERE remaining>0");
|
||||
$DB->query("
|
||||
SELECT COUNT(fid)
|
||||
FROM xbt_files_users
|
||||
WHERE remaining > 0");
|
||||
list($TotalLeechers) = $DB->next_record();
|
||||
} else {
|
||||
list($TotalLeechers,$TotalSeeders) = $PeerStats;
|
||||
@ -67,9 +75,11 @@
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM users_main
|
||||
WHERE ( SELECT COUNT(uid)
|
||||
WHERE (
|
||||
SELECT COUNT(uid)
|
||||
FROM xbt_files_users
|
||||
WHERE uid=users_main.ID)>0");
|
||||
WHERE uid = users_main.ID
|
||||
) > 0");
|
||||
list($TotalPeerUsers) = $DB->next_record();
|
||||
$Cache->cache_value('new_economic_stats',
|
||||
array($TotalUpload, $TotalDownload, $NumUsers, $TotalBounty,
|
||||
|
@ -6,7 +6,8 @@
|
||||
?>
|
||||
<div class="thin">
|
||||
<?
|
||||
$DB->query("SELECT m.ID
|
||||
$DB->query("
|
||||
SELECT m.ID
|
||||
FROM users_main AS m
|
||||
WHERE m.CustomPermissions != ''
|
||||
AND m.CustomPermissions != 'a:0:{}'");
|
||||
|
@ -5,9 +5,14 @@
|
||||
View::show_header('Torrents');
|
||||
|
||||
if (!$TorrentStats = $Cache->get_value('new_torrent_stats')) {
|
||||
$DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID), SUM(Size), SUM(FileCount)
|
||||
FROM torrents");
|
||||
list($TorrentCount, $TotalSize, $TotalFiles) = $DB->next_record();
|
||||
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM users_main
|
||||
WHERE Enabled = '1'");
|
||||
list($NumUsers) = $DB->next_record();
|
||||
$DB->query("SELECT COUNT(ID), SUM(Size), SUM(FileCount) FROM torrents WHERE Time > SUBDATE('".sqltime()."', INTERVAL 1 DAY)");
|
||||
list($DayNum, $DaySize, $DayFiles) = $DB->next_record();
|
||||
|
@ -469,6 +469,9 @@
|
||||
error(403);
|
||||
}
|
||||
break;
|
||||
case 'bbcode_sandbox':
|
||||
include('misc/bbcode_sandbox.php');
|
||||
break;
|
||||
|
||||
default:
|
||||
include(SERVER_ROOT.'/sections/tools/tools.php');
|
||||
|
@ -9,7 +9,9 @@
|
||||
if (!is_number($_POST['id']) || $_POST['id'] == '') {
|
||||
error(0);
|
||||
}
|
||||
$DB->query('DELETE FROM forums WHERE ID='.$_POST['id']);
|
||||
$DB->query('
|
||||
DELETE FROM forums
|
||||
WHERE ID = '.$_POST['id']);
|
||||
} else { //Edit & Create, Shared Validation
|
||||
$Val->SetFields('name', '1', 'string', 'The name must be set, and has a max length of 40 characters', array('maxlength' => 40, 'minlength' => 1));
|
||||
$Val->SetFields('description', '0', 'string', 'The description has a max length of 255 characters', array('maxlength' => 255));
|
||||
@ -32,7 +34,10 @@
|
||||
if (!is_number($_POST['id']) || $_POST['id'] == '') {
|
||||
error(0);
|
||||
}
|
||||
$DB->query('SELECT MinClassRead FROM forums WHERE ID=' . $P['id']);
|
||||
$DB->query('
|
||||
SELECT MinClassRead
|
||||
FROM forums
|
||||
WHERE ID = ' . $P['id']);
|
||||
if ($DB->record_count() < 1) {
|
||||
error(404);
|
||||
} else {
|
||||
@ -56,8 +61,10 @@
|
||||
AutoLockWeeks = '$P[autolockweeks]'
|
||||
WHERE ID = '$P[id]'");
|
||||
} else { //Create
|
||||
$DB->query("INSERT INTO forums
|
||||
(Sort, CategoryID, Name, Description, MinClassRead, MinClassWrite, MinClassCreate, AutoLock, AutoLockWeeks) VALUES
|
||||
$DB->query("
|
||||
INSERT INTO forums
|
||||
(Sort, CategoryID, Name, Description, MinClassRead, MinClassWrite, MinClassCreate, AutoLock, AutoLockWeeks)
|
||||
VALUES
|
||||
('$P[sort]', '$P[categoryid]', '$P[name]', '$P[description]', '$P[minclassread]', '$P[minclasswrite]', '$P[minclasscreate]', '$P[autolock]', '$P[autolockweeks]')");
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ function class_list($Selected = 0) {
|
||||
|
||||
$Name = $Class['Name'];
|
||||
$Level = $Class['Level'];
|
||||
$Return.='<option value="'.$Level.'"';
|
||||
$Return .= "<option value=\"$Level\"";
|
||||
if ($Selected == $Level) {
|
||||
$Return .= ' selected="selected"';
|
||||
}
|
||||
$Return.='>'.Format::cut_string($Name, 20, 1).'</option>'."\n";
|
||||
$Return .= '>'.Format::cut_string($Name, 20, 1)."</option>\n";
|
||||
}
|
||||
reset($Classes);
|
||||
return $Return;
|
||||
@ -24,14 +24,19 @@ function class_list($Selected = 0) {
|
||||
}
|
||||
|
||||
View::show_header('Forum Management');
|
||||
$DB->query('SELECT ID, Name FROM forums ORDER BY Sort');
|
||||
$DB->query('
|
||||
SELECT ID, Name
|
||||
FROM forums
|
||||
ORDER BY Sort');
|
||||
$ForumArray = $DB->to_array(); // used for generating the 'parent' drop down list
|
||||
|
||||
// Replace the old hard-coded forum categories
|
||||
unset($ForumCats);
|
||||
$ForumCats = $Cache->get_value('forums_categories');
|
||||
if ($ForumCats === false) {
|
||||
$DB->query('SELECT ID, Name FROM forums_categories');
|
||||
$DB->query('
|
||||
SELECT ID, Name
|
||||
FROM forums_categories');
|
||||
$ForumCats = array();
|
||||
while (list($ID, $Name) = $DB->next_record()) {
|
||||
$ForumCats[$ID] = $Name;
|
||||
@ -67,8 +72,8 @@ function class_list($Selected = 0) {
|
||||
<td>Min class read</td>
|
||||
<td>Min class write</td>
|
||||
<td>Min class create</td>
|
||||
<td>Autolock</td>
|
||||
<td>Autolock weeks</td>
|
||||
<td>Auto-lock</td>
|
||||
<td>Auto-lock weeks</td>
|
||||
<td>Submit</td>
|
||||
</tr>
|
||||
<?
|
||||
|
@ -16,7 +16,10 @@
|
||||
if (is_number($_POST['newsid'])) {
|
||||
authorize();
|
||||
|
||||
$DB->query("UPDATE news SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."' WHERE ID='".db_string($_POST['newsid'])."'");
|
||||
$DB->query("
|
||||
UPDATE news
|
||||
SET Title = '".db_string($_POST['title'])."', Body = '".db_string($_POST['body'])."'
|
||||
WHERE ID = '".db_string($_POST['newsid'])."'");
|
||||
$Cache->delete_value('news');
|
||||
$Cache->delete_value('feed_news');
|
||||
}
|
||||
@ -25,7 +28,10 @@
|
||||
case 'editnews':
|
||||
if (is_number($_GET['id'])) {
|
||||
$NewsID = $_GET['id'];
|
||||
$DB->query("SELECT Title, Body FROM news WHERE ID=$NewsID");
|
||||
$DB->query("
|
||||
SELECT Title, Body
|
||||
FROM news
|
||||
WHERE ID = $NewsID");
|
||||
list($Title, $Body) = $DB->next_record();
|
||||
}
|
||||
}
|
||||
|
@ -15,19 +15,32 @@
|
||||
}
|
||||
$OldTagIDs = implode(', ', $OldTagIDs);
|
||||
|
||||
$DB->query("UPDATE tags SET TagType = 'other' WHERE ID IN ($OldTagIDs)");
|
||||
$DB->query("
|
||||
UPDATE tags
|
||||
SET TagType = 'other'
|
||||
WHERE ID IN ($OldTagIDs)");
|
||||
}
|
||||
|
||||
if ($_POST['newtag']) {
|
||||
$TagName = Misc::sanitize_tag($_POST['newtag']);
|
||||
|
||||
$DB->query("SELECT t.ID FROM tags AS t WHERE t.Name LIKE '".$TagName."'");
|
||||
$DB->query("
|
||||
SELECT t.ID
|
||||
FROM tags AS t
|
||||
WHERE t.Name LIKE '$TagName'");
|
||||
list($TagID) = $DB->next_record();
|
||||
|
||||
if ($TagID) {
|
||||
$DB->query("UPDATE tags SET TagType = 'genre' WHERE ID = $TagID");
|
||||
$DB->query("
|
||||
UPDATE tags
|
||||
SET TagType = 'genre'
|
||||
WHERE ID = $TagID");
|
||||
} else { // Tag doesn't exist yet - create tag
|
||||
$DB->query("INSERT INTO tags (Name, UserID, TagType, Uses) VALUES ('".$TagName."', ".$LoggedUser['ID'].", 'genre', 0)");
|
||||
$DB->query("
|
||||
INSERT INTO tags
|
||||
(Name, UserID, TagType, Uses)
|
||||
VALUES
|
||||
('$TagName', ".$LoggedUser['ID'].", 'genre', 0)");
|
||||
$TagID = $DB->inserted_id();
|
||||
}
|
||||
}
|
||||
@ -62,7 +75,11 @@
|
||||
</tr>
|
||||
<?
|
||||
$i = 0;
|
||||
$DB->query("SELECT ID, Name, Uses FROM tags WHERE TagType='genre' ORDER BY Name ASC");
|
||||
$DB->query("
|
||||
SELECT ID, Name, Uses
|
||||
FROM tags
|
||||
WHERE TagType = 'genre'
|
||||
ORDER BY Name ASC");
|
||||
$TagCount = $DB->record_count();
|
||||
$Tags = $DB->to_array();
|
||||
for ($i = 0; $i < $TagCount / 3; $i++) {
|
||||
|
@ -18,7 +18,8 @@ function confirmDelete(id) {
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
p.ID,
|
||||
p.Name,
|
||||
p.Level,
|
||||
@ -45,7 +46,7 @@ function confirmDelete(id) {
|
||||
<td><?=number_format($UserCount); ?></td>
|
||||
<td class="center">
|
||||
<a href="tools.php?action=permissions&id=<?=$ID ?>" class="brackets">Edit</a>
|
||||
<a href="#" onclick="return confirmDelete(<?=$ID?>)" class="brackets">Remove</a>
|
||||
<a href="#" onclick="return confirmDelete(<?=$ID?>);" class="brackets">Remove</a>
|
||||
</td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
|
@ -12,14 +12,19 @@
|
||||
}
|
||||
|
||||
if (!check_perms('site_manage_recommendations')) {
|
||||
$DB->query("SELECT UserID FROM torrents_recommended WHERE GroupID='$GroupID'");
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM torrents_recommended
|
||||
WHERE GroupID = '$GroupID'");
|
||||
list($UserID) = $DB->next_record();
|
||||
if ($UserID != $LoggedUser['ID']) {
|
||||
error(403);
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM torrents_recommended WHERE GroupID='$GroupID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_recommended
|
||||
WHERE GroupID = '$GroupID'");
|
||||
|
||||
$Cache->delete_value('recommend');
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
|
@ -8,7 +8,9 @@
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query('SELECT GroupID FROM torrents_recommended');
|
||||
$DB->query('
|
||||
SELECT GroupID
|
||||
FROM torrents_recommended');
|
||||
$ToNL = $DB->next_record();
|
||||
Torrents::freeleech_groups($ToNL, 2, 3);
|
||||
?>
|
||||
|
@ -10,9 +10,14 @@
|
||||
error('1');
|
||||
}
|
||||
|
||||
$DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = ".$_POST['id']);
|
||||
$DB->query('
|
||||
SELECT peer_id
|
||||
FROM xbt_client_whitelist
|
||||
WHERE id = '.$_POST['id']);
|
||||
list($PeerID) = $DB->next_record();
|
||||
$DB->query('DELETE FROM xbt_client_whitelist WHERE id='.$_POST['id']);
|
||||
$DB->query('
|
||||
DELETE FROM xbt_client_whitelist
|
||||
WHERE id = '.$_POST['id']);
|
||||
Tracker::update_tracker('remove_whitelist', array('peer_id' => $PeerID));
|
||||
} else { //Edit & Create, Shared Validation
|
||||
|
||||
@ -28,19 +33,23 @@
|
||||
if (empty($_POST['id']) || !is_number($_POST['id'])) {
|
||||
error('3');
|
||||
} else {
|
||||
$DB->query("SELECT peer_id FROM xbt_client_whitelist WHERE id = ".$_POST['id']);
|
||||
$DB->query('
|
||||
SELECT peer_id
|
||||
FROM xbt_client_whitelist
|
||||
WHERE id = '.$_POST['id']);
|
||||
list($OldPeerID) = $DB->next_record();
|
||||
$DB->query("
|
||||
UPDATE xbt_client_whitelist
|
||||
SET
|
||||
vstring='".$Client."',
|
||||
peer_id='".$PeerID."'
|
||||
vstring = '$Client',
|
||||
peer_id = '$PeerID'
|
||||
WHERE ID = ".$_POST['id']);
|
||||
Tracker::update_tracker('edit_whitelist', array('old_peer_id' => $OldPeerID, 'new_peer_id' => $PeerID));
|
||||
}
|
||||
} else { //Create
|
||||
$DB->query("
|
||||
INSERT INTO xbt_client_whitelist (vstring, peer_id)
|
||||
INSERT INTO xbt_client_whitelist
|
||||
(vstring, peer_id)
|
||||
VALUES
|
||||
('$Client', '$PeerID')");
|
||||
Tracker::update_tracker('add_whitelist', array('peer_id' => $PeerID));
|
||||
|
@ -4,7 +4,10 @@
|
||||
}
|
||||
|
||||
View::show_header('Whitelist Management');
|
||||
$DB->query('SELECT id, vstring, peer_id FROM xbt_client_whitelist ORDER BY peer_id ASC');
|
||||
$DB->query('
|
||||
SELECT id, vstring, peer_id
|
||||
FROM xbt_client_whitelist
|
||||
ORDER BY peer_id ASC');
|
||||
?>
|
||||
<div class="header">
|
||||
<h2>Allowed Clients</h2>
|
||||
|
16
sections/tools/misc/bbcode_sandbox.php
Normal file
16
sections/tools/misc/bbcode_sandbox.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?
|
||||
if (!check_perms("users_mod")) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
View::show_header("BBCode Sandbox", 'bbcode_sandbox');
|
||||
?>
|
||||
<div class="thin">
|
||||
<textarea id="sandbox" class="wbbarea" style="width: 98%;" onkeyup="resize('sandbox');" name="body" cols="90" rows="8"></textarea>
|
||||
<br />
|
||||
<br />
|
||||
<div id="preview" class="">
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
@ -51,7 +51,8 @@
|
||||
// validate input
|
||||
$Err = $Val->ValidateForm($_GET);
|
||||
if ($Err) {
|
||||
echo ' <div class="box pad center">
|
||||
echo '
|
||||
<div class="box pad center">
|
||||
<strong>Error:</strong> '.$Err.'
|
||||
</div>';
|
||||
} else {
|
||||
@ -60,8 +61,9 @@
|
||||
|
||||
// trying to merge tag with itself would create big problems
|
||||
if ($Tag == $Replacement) {
|
||||
echo " <div class=\"box pad center\">
|
||||
<strong>Error:</strong> Cannot merge tag $Tag with itself (doh).
|
||||
echo "
|
||||
<div class=\"box pad center\">
|
||||
<strong>Error:</strong> Cannot merge tag $Tag with itself!
|
||||
</div>
|
||||
</div>";
|
||||
View::show_footer();
|
||||
@ -75,7 +77,8 @@
|
||||
WHERE Name = '$Tag'
|
||||
LIMIT 1;");
|
||||
if ($DB->record_count() == 0) {
|
||||
echo " <div class=\"box pad center\">
|
||||
echo "
|
||||
<div class=\"box pad center\">
|
||||
<strong>Error:</strong> No such tag found: $Tag
|
||||
</div>
|
||||
</div>";
|
||||
@ -149,14 +152,17 @@
|
||||
// HARD! merge two tags together and update usage
|
||||
// 5) remove dupe tags from torrents
|
||||
// (torrents that have both "old tag" and "replacement tag" set)
|
||||
$DB->query("SELECT GroupID FROM torrents_tags WHERE TagID=$ReplacementID;");
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents_tags
|
||||
WHERE TagID = $ReplacementID;");
|
||||
if ($DB->record_count() > 0 ) {
|
||||
$Query = "
|
||||
DELETE FROM torrents_tags
|
||||
WHERE TagID = $TagID
|
||||
AND GroupID IN (";
|
||||
while (list($GroupID) = $DB->next_record()) {
|
||||
$Query.= $GroupID.',';
|
||||
$Query .= "$GroupID,";
|
||||
}
|
||||
$Query = substr($Query, 0, -1) . ');';
|
||||
$DB->query($Query);
|
||||
@ -171,14 +177,17 @@
|
||||
$UsageChange = $DB->affected_rows();
|
||||
|
||||
// 7) remove dupe tags from artists
|
||||
$DB->query("SELECT ArtistID FROM artists_tags WHERE TagID=$ReplacementID;");
|
||||
$DB->query("
|
||||
SELECT ArtistID
|
||||
FROM artists_tags
|
||||
WHERE TagID = $ReplacementID;");
|
||||
if ($DB->record_count() > 0 ) {
|
||||
$Query = "
|
||||
DELETE FROM artists_tags
|
||||
WHERE TagID = $TagID
|
||||
AND ArtistID IN (";
|
||||
while (list($ArtistID) = $DB->next_record()) {
|
||||
$Query.= $ArtistID.',';
|
||||
$Query .= "$ArtistID,";
|
||||
}
|
||||
$Query = substr($Query, 0, -1) . ');';
|
||||
$DB->query($Query);
|
||||
@ -193,14 +202,17 @@
|
||||
$UsageChange += $DB->affected_rows();
|
||||
|
||||
// 9) remove dupe tags from requests
|
||||
$DB->query("SELECT RequestID FROM requests_tags WHERE TagID=$ReplacementID;");
|
||||
$DB->query("
|
||||
SELECT RequestID
|
||||
FROM requests_tags
|
||||
WHERE TagID = $ReplacementID;");
|
||||
if ($DB->record_count() > 0) {
|
||||
$Query = "
|
||||
DELETE FROM requests_tags
|
||||
WHERE TagID = $TagID
|
||||
AND RequestID IN (";
|
||||
while (list($RequestID) = $DB->next_record()) {
|
||||
$Query.= $RequestID.',';
|
||||
$Query .= "$RequestID,";
|
||||
}
|
||||
$Query = substr($Query, 0, -1) . ');';
|
||||
$DB->query($Query);
|
||||
@ -230,7 +242,7 @@
|
||||
|
||||
} // if ($Mode == MODE_MERGE)
|
||||
|
||||
echo '<div class="box pad center"><strong>Success!</strong> Affected entries: '.number_format($TotalAffected).'</div>';
|
||||
echo "\n".'<div class="box pad center"><strong>Success!</strong> Affected entries: '.number_format($TotalAffected).'</div>';
|
||||
|
||||
if ($_GET['list']) {
|
||||
?>
|
||||
@ -244,7 +256,7 @@
|
||||
<?
|
||||
if (count($AffectedTorrents)) {
|
||||
foreach ($AffectedTorrents as $Row) {
|
||||
echo "<tr><td>$Row</td></tr>";
|
||||
echo "\n\t\t<tr><td>$Row</td></tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -256,7 +268,7 @@
|
||||
<?
|
||||
if (count($AffectedRequests)) {
|
||||
foreach ($AffectedRequests as $Row) {
|
||||
echo "<tr><td>$Row</td></tr>";
|
||||
echo "\n\t\t<tr><td>$Row</td></tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -89,6 +89,7 @@
|
||||
<? } if (check_perms('admin_clear_cache') || check_perms('users_mod')) { ?>
|
||||
<tr><td><a href="tools.php?action=rerender_gallery">Rerender stylesheet gallery images</a></td></tr>
|
||||
<? } if (check_perms('users_mod')) { ?>
|
||||
<tr><td><a href="tools.php?action=bbcode_sandbox">BBCode Sandbox</a></td></tr>
|
||||
<tr><td><strong><a href="tools.php?action=public_sandbox">Public sandbox</a></strong></td></tr>
|
||||
<? } if (check_perms('users_mod')) { ?>
|
||||
<tr><td><strong><a href="tools.php?action=mod_sandbox">Mod-level sandbox</a></strong></td></tr>
|
||||
|
@ -52,15 +52,20 @@
|
||||
|
||||
if (empty($_GET['datetype']) || $_GET['datetype'] == 'day') {
|
||||
$Type = 'day';
|
||||
$Where = "WHERE th.Date BETWEEN '".$SQLTime."' AND '".$SQLTime."' + INTERVAL 24 HOUR AND Type='Daily'";
|
||||
$Where = "
|
||||
WHERE th.Date BETWEEN '$SQLTime' AND '$SQLTime' + INTERVAL 24 HOUR
|
||||
AND Type = 'Daily'";
|
||||
} else {
|
||||
$Type = 'week';
|
||||
$Where = "WHERE th.Date BETWEEN '".$SQLTime."' - AND '".$SQLTime."' + INTERVAL 7 DAY' AND Type='Weekly'";
|
||||
$Where = "
|
||||
WHERE th.Date BETWEEN '$SQLTime' - AND '$SQLTime' + INTERVAL 7 DAY
|
||||
AND Type = 'Weekly'";
|
||||
}
|
||||
|
||||
$Details = $Cache->get_value('top10_history_'.$SQLTime);
|
||||
$Details = $Cache->get_value("top10_history_$SQLTime");
|
||||
if ($Details === false) {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
tht.Rank,
|
||||
tht.TitleString,
|
||||
tht.TagString,
|
||||
@ -83,12 +88,12 @@
|
||||
LEFT JOIN top10_history_torrents AS tht ON tht.HistoryID = th.ID
|
||||
LEFT JOIN torrents AS t ON t.ID = tht.TorrentID
|
||||
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
|
||||
".$Where."
|
||||
$Where
|
||||
ORDER BY tht.Rank ASC");
|
||||
|
||||
$Details = $DB->to_array();
|
||||
|
||||
$Cache->cache_value('top10_history_'.$SQLTime, $Details, 3600*24);
|
||||
$Cache->cache_value("top10_history_$SQLTime", $Details, 3600 * 24);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -139,11 +144,11 @@
|
||||
}
|
||||
//"FLAC / Lossless / Log (100%) / Cue / CD";
|
||||
if ($HasLog) {
|
||||
$ExtraInfo.= "$AddExtra Log ($LogScore".'%)';
|
||||
$ExtraInfo .= "$AddExtra Log ($LogScore%)";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($HasCue) {
|
||||
$ExtraInfo.= $AddExtra.'Cue';
|
||||
$ExtraInfo .= "{$AddExtra}Cue";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Media) {
|
||||
@ -151,7 +156,7 @@
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Scene) {
|
||||
$ExtraInfo.= $AddExtra.'Scene';
|
||||
$ExtraInfo .= "{$AddExtra}Scene";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Year > 0) {
|
||||
@ -168,7 +173,7 @@
|
||||
$DisplayName .= $ExtraInfo;
|
||||
$TorrentTags = new Tags($TorrentTags);
|
||||
else:
|
||||
$DisplayName = $TitleString.' (Deleted)';
|
||||
$DisplayName = "$TitleString (Deleted)";
|
||||
$TorrentTags = new Tags($TagString);
|
||||
endif;
|
||||
|
||||
|
@ -21,7 +21,10 @@
|
||||
}
|
||||
|
||||
if (strlen($AliasName) > 0) {
|
||||
$DB->query("SELECT AliasID, ArtistID, Redirect, Name FROM artists_alias WHERE Name = '".db_string($AliasName)."'");
|
||||
$DB->query("
|
||||
SELECT AliasID, ArtistID, Redirect, Name
|
||||
FROM artists_alias
|
||||
WHERE Name = '".db_string($AliasName)."'");
|
||||
while (list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||
if (!strcasecmp($AliasName, $FoundAliasName)) {
|
||||
if ($Redirect) {
|
||||
@ -32,26 +35,39 @@
|
||||
}
|
||||
if (!$AliasID) {
|
||||
$AliasName = db_string($AliasName);
|
||||
$DB->query("INSERT INTO artists_group (Name) VALUES ('$AliasName')");
|
||||
$DB->query("
|
||||
INSERT INTO artists_group (Name)
|
||||
VALUES ('$AliasName')");
|
||||
$ArtistID = $DB->inserted_id();
|
||||
$DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$AliasName')");
|
||||
$DB->query("
|
||||
INSERT INTO artists_alias (ArtistID, Name)
|
||||
VALUES ('$ArtistID', '$AliasName')");
|
||||
$AliasID = $DB->inserted_id();
|
||||
}
|
||||
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID=".$GroupID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($GroupName) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
$DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM artists_group
|
||||
WHERE ArtistID = $ArtistID");
|
||||
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
|
||||
$DB->query("INSERT IGNORE INTO torrents_artists
|
||||
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO torrents_artists
|
||||
(GroupID, ArtistID, AliasID, Importance, UserID)
|
||||
VALUES
|
||||
('$GroupID', '$ArtistID', '$AliasID', '$Importance', '$UserID')");
|
||||
|
||||
if ($DB->affected_rows()) {
|
||||
$Changed = true;
|
||||
$DB->query("INSERT INTO torrents_group (ID, NumArtists)
|
||||
$DB->query("
|
||||
INSERT INTO torrents_group (ID, NumArtists)
|
||||
SELECT ta.GroupID, COUNT(ta.ArtistID)
|
||||
FROM torrents_artists AS ta
|
||||
WHERE ta.GroupID = '$GroupID'
|
||||
@ -60,15 +76,15 @@
|
||||
ON DUPLICATE KEY UPDATE
|
||||
NumArtists = VALUES (NumArtists);");
|
||||
|
||||
Misc::write_log("Artist ".$ArtistID." (".$ArtistName.") was added to the group ".$GroupID." (".$GroupName.") as ".$ArtistTypes[$Importance]." by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "added artist ".$ArtistName." as ".$ArtistTypes[$Importance], 0);
|
||||
Misc::write_log("Artist $ArtistID ($ArtistName) was added to the group $GroupID ($GroupName) as ".$ArtistTypes[$Importance].' by user '.$LoggedUser['ID'].' ('.$LoggedUser['Username'].')');
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "added artist $ArtistName as ".$ArtistTypes[$Importance], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($Changed) {
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("groups_artists_$GroupID"); // Delete group artist cache
|
||||
Torrents::update_hash($GroupID);
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,9 @@ function build_search($SearchStr, $Field, $Exact = false, $SQLWhere = '', $FullT
|
||||
$SQLWhere .= ' AND ';
|
||||
}
|
||||
if (substr($SearchVal,0,1) == '-') {
|
||||
$SQLWhere.=$Field." NOT LIKE '%".db_string(substr($SearchVal,1))."%'";
|
||||
$SQLWhere .= "$Field NOT LIKE '%".db_string(substr($SearchVal,1))."%'";
|
||||
} else {
|
||||
$SQLWhere.=$Field." LIKE '%".db_string($SearchVal)."%'";
|
||||
$SQLWhere .= "$Field LIKE '%".db_string($SearchVal)."%'";
|
||||
}
|
||||
}
|
||||
$FilterString .= "($SearchVal)(.+?)";
|
||||
@ -81,20 +81,20 @@ function build_search($SearchStr, $Field, $Exact = false, $SQLWhere = '', $FullT
|
||||
if ($SQLWhere != '') {
|
||||
$SQLWhere .= ' AND ';
|
||||
}
|
||||
$SQLWhere.= $Field." LIKE '".db_string($SearchStr)."'";
|
||||
$SQLWhere .= "$Field LIKE '".db_string($SearchStr)."'";
|
||||
$FilterString .= "(.+?)($SearchStr)(.+?)";
|
||||
}
|
||||
$Search = 1;
|
||||
$FilterString = "/$FilterString/si";
|
||||
if ($SQLWhere != '' && $AddWhere) {
|
||||
$SQLWhere = 'WHERE '.$SQLWhere;
|
||||
$SQLWhere = "WHERE $SQLWhere";
|
||||
}
|
||||
return $SQLWhere;
|
||||
}
|
||||
|
||||
function quotes($Str) {
|
||||
$Str = str_replace(' ', '{{SPACE}}', trim($Str[1]));
|
||||
return ' '.$Str.' ';
|
||||
return " $Str ";
|
||||
}
|
||||
|
||||
// The "order by x" links on columns headers
|
||||
@ -110,7 +110,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
$NewWay = $DefaultWay;
|
||||
}
|
||||
|
||||
return 'torrents.php?order_way='.$NewWay.'&order_by='.$SortKey.'&'.Format::get_url(array('order_way','order_by'));
|
||||
return "torrents.php?order_way=$NewWay&order_by=$SortKey&" . Format::get_url(array('order_way', 'order_by'));
|
||||
}
|
||||
|
||||
// Setting default search options
|
||||
@ -118,23 +118,35 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
$UnsetList[] = '/(&?page\=.+?&?)/i';
|
||||
$UnsetList[] = '/(&?setdefault\=.+?&?)/i';
|
||||
|
||||
$DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
||||
$DB->query("
|
||||
SELECT SiteOptions
|
||||
FROM users_info
|
||||
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, true);
|
||||
$SiteOptions = unserialize($SiteOptions);
|
||||
$SiteOptions['DefaultSearch'] = preg_replace($UnsetList, '', $_SERVER['QUERY_STRING']);
|
||||
$DB->query("UPDATE users_info SET SiteOptions='".db_string(serialize($SiteOptions))."' WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET SiteOptions = '".db_string(serialize($SiteOptions))."'
|
||||
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('DefaultSearch' => preg_replace($UnsetList, '', $_SERVER['QUERY_STRING'])));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
// Clearing default search options
|
||||
} elseif ($_GET['cleardefault']) {
|
||||
$DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
||||
$DB->query("
|
||||
SELECT SiteOptions
|
||||
FROM users_info
|
||||
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, true);
|
||||
$SiteOptions = unserialize($SiteOptions);
|
||||
$SiteOptions['DefaultSearch'] = '';
|
||||
$DB->query("UPDATE users_info SET SiteOptions='".db_string(serialize($SiteOptions))."' WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET SiteOptions = '".db_string(serialize($SiteOptions))."'
|
||||
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('DefaultSearch' => ''));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
@ -181,7 +193,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
if (!check_paranoia('uploads', $Paranoia, $UserClass, $UserID)) {
|
||||
error(403);
|
||||
}
|
||||
$TorrentWhere = "WHERE t.UserID='".$UserID."'";
|
||||
$TorrentWhere = "WHERE t.UserID = '$UserID'";
|
||||
$Title = 'Uploaded Torrents';
|
||||
|
||||
} elseif ($_GET['type'] == 'seeding') {
|
||||
@ -273,7 +285,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
if ($_GET['remastertitle'] != '') {
|
||||
$RemasterTitle = $_GET['remastertitle'];
|
||||
if ($_GET['exactremaster']) {
|
||||
$RemasterTitle = '%'.$RemasterTitle.'%';
|
||||
$RemasterTitle = "%$RemasterTitle%";
|
||||
}
|
||||
$GroupWhere = build_search($RemasterTitle, 'RemasterTitleList', $_GET['exactremaster'], $GroupWhere, 0, $RemasterRegEx);
|
||||
if ($TorrentSpecifics > 0) {
|
||||
@ -328,7 +340,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
}
|
||||
|
||||
if ($_GET['format'] != '' && in_array($_GET['format'], $Formats)) {
|
||||
$GroupWhere = build_search('%'.$_GET['format'].'%','FormatList',f,$GroupWhere);
|
||||
$GroupWhere = build_search('%'.$_GET['format'].'%', 'FormatList', false, $GroupWhere);
|
||||
if ($TorrentSpecifics > 0) {
|
||||
if ($TorrentWhere == '') {
|
||||
$TorrentWhere = 'WHERE ';
|
||||
@ -474,7 +486,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
}
|
||||
$TagSearch .= ')';
|
||||
} else {
|
||||
$TagSearch.=$TagField." LIKE '%".db_string($Tag)."%'";
|
||||
$TagSearch .= "$TagField LIKE '%".db_string($Tag)."%'";
|
||||
}
|
||||
}
|
||||
endforeach;
|
||||
@ -510,7 +522,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
if ($CatFilter != '') {
|
||||
$CatFilter .= ' OR ';
|
||||
}
|
||||
$CatFilter.=$CategoryField."='".db_string(ceil($CatKey))."'";
|
||||
$CatFilter .= "$CategoryField = '".db_string(ceil($CatKey))."'";
|
||||
}
|
||||
|
||||
if ($DisableGrouping) {
|
||||
@ -544,9 +556,17 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
} else {
|
||||
$GroupWhere .= ' AND ';
|
||||
}
|
||||
$GroupWhere.= "(SELECT t.GroupID FROM torrents AS t $TorrentWhere AND t.GroupID=h.GroupID LIMIT 1)";
|
||||
$GroupWhere .= "
|
||||
(
|
||||
SELECT t.GroupID
|
||||
FROM torrents AS t
|
||||
$TorrentWhere
|
||||
AND t.GroupID = h.GroupID
|
||||
LIMIT 1
|
||||
)";
|
||||
}
|
||||
$DB->query("SELECT $SCFR
|
||||
$DB->query("
|
||||
SELECT $SCFR
|
||||
h.GroupID,
|
||||
h.GroupName,
|
||||
h.GroupYear AS s2,
|
||||
@ -584,7 +604,15 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
|
||||
$TorrentList=$DB->to_array();
|
||||
if (EXPLAIN_HACK) {
|
||||
$DB->query("EXPLAIN SELECT NULL FROM (SELECT NULL FROM torrent_hash AS h $TorrentJoin $GroupWhere) AS Count");
|
||||
$DB->query("
|
||||
EXPLAIN
|
||||
SELECT NULL
|
||||
FROM (
|
||||
SELECT NULL
|
||||
FROM torrent_hash AS h
|
||||
$TorrentJoin
|
||||
$GroupWhere
|
||||
) AS Count");
|
||||
list($Null, $Null, $Null, $Null, $Null, $Null, $Null, $Null, $TorrentCount) = $DB->next_record();
|
||||
} else {
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
@ -595,7 +623,8 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
if (!$TimeField) {
|
||||
$TimeField = 't.Time';
|
||||
}
|
||||
$DB->query("SELECT $SCFR
|
||||
$DB->query("
|
||||
SELECT $SCFR
|
||||
g.ID,
|
||||
g.Name,
|
||||
g.Year AS s2,
|
||||
@ -629,7 +658,15 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
|
||||
$TorrentList = $DB->to_array();
|
||||
if (EXPLAIN_HACK) {
|
||||
$DB->query("EXPLAIN SELECT NULL FROM (SELECT NULL FROM torrent_hash AS h $TorrentJoin $GroupWhere) AS Count");
|
||||
$DB->query("
|
||||
EXPLAIN
|
||||
SELECT NULL
|
||||
FROM (
|
||||
SELECT NULL
|
||||
FROM torrent_hash AS h
|
||||
$TorrentJoin
|
||||
$GroupWhere
|
||||
) AS Count");
|
||||
list($Null, $Null, $Null, $Null, $Null, $Null, $Null, $Null, $TorrentCount) = $DB->next_record();
|
||||
} else {
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
@ -639,7 +676,10 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
|
||||
if ($UserID) {
|
||||
// Get the username, so we can display the title as "<user>'s snatched torrents", etc
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='".db_string($UserID)."'");
|
||||
$DB->query("
|
||||
SELECT Username
|
||||
FROM users_main
|
||||
WHERE ID = '".db_string($UserID)."'");
|
||||
list($TitleUser) = $DB->next_record();
|
||||
}
|
||||
} else {
|
||||
@ -798,7 +838,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Order by:</td>
|
||||
<td colspan="<?=($AdvancedSearch) ? '3' : '1' ?>">
|
||||
<td colspan="<?=$AdvancedSearch ? '3' : '1'; ?>">
|
||||
<select name="order_by" style="width: auto;">
|
||||
<option value="s1"<? if ($OrderBy == 's1') { ?> selected="selected"<? } ?>>Name</option>
|
||||
<option value="s2"<? if ($OrderBy == 's2') { ?> selected="selected"<? } ?>>Year</option>
|
||||
@ -849,7 +889,11 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
<?
|
||||
$GenreTags = $Cache->get_value('genre_tags');
|
||||
if (!$GenreTags) {
|
||||
$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name');
|
||||
$DB->query('
|
||||
SELECT Name
|
||||
FROM tags
|
||||
WHERE TagType = \'genre\'
|
||||
ORDER BY Name');
|
||||
$GenreTags = $DB->collect('Name');
|
||||
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
|
||||
}
|
||||
@ -869,7 +913,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
endforeach;
|
||||
if ($x % 7 != 0) { // Padding
|
||||
?>
|
||||
<td colspan="<?=7 - ($x % 7) ?>"> </td>
|
||||
<td colspan="<?= 7 - ($x % 7); ?>"> </td>
|
||||
<?
|
||||
} ?>
|
||||
</tr>
|
||||
@ -930,7 +974,10 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
}
|
||||
$Artists = Artists::get_artists($GroupIDs);
|
||||
foreach ($TorrentList as $Key => $Properties) {
|
||||
list($GroupID,$GroupName,$GroupYear,$GroupCategoryID,$GroupTime,$MaxSize,$TotalSnatched,$TotalSeeders,$TotalLeechers,$TorrentsID,$TagsList,$TorrentsMedia,$TorrentsFormat,$TorrentsEncoding,$TorrentsYear,$TorrentsRemastered,$TorrentsRemasterTitle,$TorrentsScene,$TorrentsLog,$TorrentsCue,$TorrentsLogScores,$TorrentsFileCount,$TorrentsFreeTorrent,$TorrentsSize,$TorrentsLeechers,$TorrentsSeeders,$TorrentsSnatched,$TorrentsTime) = $Properties;
|
||||
list($GroupID, $GroupName, $GroupYear, $GroupCategoryID, $GroupTime, $MaxSize, $TotalSnatched, $TotalSeeders, $TotalLeechers,
|
||||
$TorrentsID, $TagsList, $TorrentsMedia, $TorrentsFormat, $TorrentsEncoding, $TorrentsYear, $TorrentsRemastered,
|
||||
$TorrentsRemasterTitle, $TorrentsScene, $TorrentsLog, $TorrentsCue, $TorrentsLogScores, $TorrentsFileCount, $TorrentsFreeTorrent,
|
||||
$TorrentsSize, $TorrentsLeechers, $TorrentsSeeders, $TorrentsSnatched, $TorrentsTime) = $Properties;
|
||||
$Torrents['id'] = explode('|', $TorrentsID);
|
||||
$Torrents['media'] = explode('|', $TorrentsMedia);
|
||||
$Torrents['format'] = explode('|', $TorrentsFormat);
|
||||
@ -985,7 +1032,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
$DisplayName = Artists::display_artists($Artists[$GroupID]);
|
||||
if ((count($Torrents['id']) > 1 || $GroupCategoryID == 1) && !$DisableGrouping) {
|
||||
// These torrents are in a group
|
||||
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
@ -1090,7 +1137,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
}
|
||||
}
|
||||
if ($Torrents['cue'][$Key] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Cue';
|
||||
$ExtraInfo .= "{$AddExtra}Cue";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrents['media'][$Key]) {
|
||||
@ -1098,14 +1145,14 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrents['scene'][$Key] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Scene';
|
||||
$ExtraInfo .= "{$AddExtra}Scene";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if (trim($Torrents['remastertitle'][$Key])) {
|
||||
$ExtraInfo .= $AddExtra.$Torrents['remastertitle'][$Key];
|
||||
$AddExtra = ' - ';
|
||||
} elseif ($Torrents['remastered'][$Key] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Remastered';
|
||||
$ExtraInfo .= "{$AddExtra}Remastered";
|
||||
$AddExtra = ' - ';
|
||||
}
|
||||
if ($Torrents['year'][$Key] > '0') {
|
||||
@ -1154,14 +1201,14 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrents['log'][0] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Log';
|
||||
$ExtraInfo .= "{$AddExtra}Log";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrents['score'][0]) {
|
||||
$ExtraInfo .= ' ('.$Torrents['score'][0].'%) ';
|
||||
}
|
||||
if ($Torrents['cue'][0] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Cue';
|
||||
$ExtraInfo .= "{$AddExtra}Cue";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrents['media'][0]) {
|
||||
@ -1169,14 +1216,14 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Torrents['scene'][0] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Scene';
|
||||
$ExtraInfo .= "{$AddExtra}Scene";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if (trim($Torrents['remastertitle'][0])) {
|
||||
$ExtraInfo .= $AddExtra.$Torrents['remastertitle'][0];
|
||||
$AddExtra = ' - ';
|
||||
} elseif ($Torrents['remastered'][0] == '1') {
|
||||
$ExtraInfo.=$AddExtra.'Remastered';
|
||||
$ExtraInfo .= "{$AddExtra}Remastered";
|
||||
$AddExtra = ' - ';
|
||||
}
|
||||
if ($Torrents['year'][0] > '0') {
|
||||
@ -1229,7 +1276,8 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
|
||||
?>
|
||||
</table>
|
||||
<? } else {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
tags.Name,
|
||||
((COUNT(tags.Name) - 2) * (SUM(tt.PositiveVotes) - SUM(tt.NegativeVotes))) / (tags.Uses * 0.8) AS Score
|
||||
FROM xbt_snatched AS s
|
||||
|
@ -25,13 +25,18 @@
|
||||
|
||||
|
||||
// The "order by x" links on columns headers
|
||||
function header_link($SortKey,$DefaultWay="desc") {
|
||||
function header_link($SortKey, $DefaultWay = 'desc') {
|
||||
global $OrderBy, $OrderWay;
|
||||
if ($SortKey == $OrderBy) {
|
||||
if ($OrderWay=="desc") { $NewWay="asc"; }
|
||||
else { $NewWay="desc"; }
|
||||
} else { $NewWay=$DefaultWay; }
|
||||
return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('order_way','order_by'));
|
||||
if ($OrderWay == 'desc') {
|
||||
$NewWay = 'asc';
|
||||
} else {
|
||||
$NewWay = 'desc';
|
||||
}
|
||||
} else {
|
||||
$NewWay = $DefaultWay;
|
||||
}
|
||||
return "torrents.php?order_way=$NewWay&order_by=$SortKey&".Format::get_url(array('order_way', 'order_by'));
|
||||
}
|
||||
|
||||
/** Start default parameters and validation **/
|
||||
@ -44,11 +49,14 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
|
||||
// Search by infohash
|
||||
if ($InfoHash = is_valid_torrenthash($InfoHash)) {
|
||||
$InfoHash = db_string(pack("H*", $InfoHash));
|
||||
$DB->query("SELECT ID,GroupID FROM torrents WHERE info_hash='$InfoHash'");
|
||||
$InfoHash = db_string(pack('H*', $InfoHash));
|
||||
$DB->query("
|
||||
SELECT ID, GroupID
|
||||
FROM torrents
|
||||
WHERE info_hash = '$InfoHash'");
|
||||
if ($DB->record_count() > 0) {
|
||||
list($ID, $GroupID) = $DB->next_record();
|
||||
header('Location: torrents.php?id='.$GroupID.'&torrentid='.$ID);
|
||||
header("Location: torrents.php?id=$GroupID&torrentid=$ID");
|
||||
die();
|
||||
}
|
||||
}
|
||||
@ -74,7 +82,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
UPDATE users_info
|
||||
SET SiteOptions = '".db_string(serialize($SiteOptions))."'
|
||||
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('DefaultSearch' => $SiteOptions['DefaultSearch']));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
@ -91,7 +99,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
UPDATE users_info
|
||||
SET SiteOptions = '".db_string(serialize($SiteOptions))."'
|
||||
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('DefaultSearch' => ''));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
@ -124,6 +132,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
'leechers' => array('sumleechers', 'leechers'),
|
||||
'snatched' => array('sumsnatched', 'snatched'),
|
||||
'random' => false);
|
||||
|
||||
$AggregateExp = array(
|
||||
'maxsize' => 'MAX(size) AS maxsize',
|
||||
'sumseeders' => 'SUM(seeders) AS sumseeders',
|
||||
@ -195,7 +204,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
$Filtered = false;
|
||||
$EnableNegation = false; // Sphinx needs at least one positive search condition to support the NOT operator
|
||||
|
||||
// Filelist searches makes use of the proximity operator to ensure that all keywords match the same file
|
||||
// File list searches make use of the proximity operator to ensure that all keywords match the same file
|
||||
if (!empty($_GET['filelist'])) {
|
||||
$SearchString = trim($_GET['filelist']);
|
||||
if ($SearchString != '') {
|
||||
@ -321,10 +330,10 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
//Get tag aliases.
|
||||
$TagAliases = $Cache->get_value('tag_aliases_search');
|
||||
if (!$TagAliases) {
|
||||
$DB->query("
|
||||
$DB->query('
|
||||
SELECT ID, BadTag, AliasTag
|
||||
FROM tag_aliases
|
||||
ORDER BY BadTag");
|
||||
ORDER BY BadTag');
|
||||
$TagAliases = $DB->to_array();
|
||||
//Unify tag aliases to be in_this_format as tags not in.this.format
|
||||
array_walk_recursive($TagAliases, create_function('&$val', '$val = preg_replace("/\./","_", $val);'));
|
||||
@ -361,7 +370,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
//Only keep unique entries after unifying tag standard
|
||||
$Tags['include'] = array_unique($Tags['include']);
|
||||
$Tags['exclude'] = array_unique($Tags['exclude']);
|
||||
$TagListString = implode(", ", array_merge($Tags['include'], $Tags['exclude']));
|
||||
$TagListString = implode(', ', array_merge($Tags['include'], $Tags['exclude']));
|
||||
if (!$EnableNegation && !empty($Tags['exclude'])) {
|
||||
$Tags['include'] = array_merge($Tags['include'], $Tags['exclude']);
|
||||
unset($Tags['exclude']);
|
||||
@ -663,8 +672,8 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
<td colspan="4" class="center ft_edition_expand"><a href="#" class="brackets" onclick="ToggleEditionRows(); return false;">Click here to toggle searching for specific remaster information</a></td>
|
||||
</tr>
|
||||
<?
|
||||
if (Format::form('remastertitle', true) == "" && Format::form('remasteryear', true) == "" &&
|
||||
Format::form('remasterrecordlabel', true) == "" && Format::form('remastercataloguenumber', true) == "") {
|
||||
if (Format::form('remastertitle', true) == '' && Format::form('remasteryear', true) == '' &&
|
||||
Format::form('remasterrecordlabel', true) == '' && Format::form('remastercataloguenumber', true) == '') {
|
||||
$Hidden = ' hidden';
|
||||
} else {
|
||||
$Hidden = '';
|
||||
@ -830,7 +839,11 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
<?
|
||||
$GenreTags = $Cache->get_value('genre_tags');
|
||||
if (!$GenreTags) {
|
||||
$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name');
|
||||
$DB->query('
|
||||
SELECT Name
|
||||
FROM tags
|
||||
WHERE TagType = \'genre\'
|
||||
ORDER BY Name');
|
||||
$GenreTags = $DB->collect('Name');
|
||||
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
|
||||
}
|
||||
@ -883,7 +896,8 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
</form>
|
||||
<?
|
||||
if ($TorrentCount == 0) {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
tags.Name,
|
||||
((COUNT(tags.Name) - 2) * (SUM(tt.PositiveVotes) - SUM(tt.NegativeVotes))) / (tags.Uses * 0.8) AS Score
|
||||
FROM xbt_snatched AS s
|
||||
@ -992,7 +1006,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
|
||||
if ($GroupResults && (count($Torrents) > 1 || isset($GroupedCategories[$CategoryID - 1]))) {
|
||||
// These torrents are in a group
|
||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\" dir=\"ltr\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
}
|
||||
@ -1112,7 +1126,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
// Viewing a type that does not require grouping
|
||||
|
||||
list($TorrentID, $Data) = each($Torrents);
|
||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'&torrentid='.$TorrentID.'#torrent'.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID\" title=\"View Torrent\" dir=\"ltr\">$GroupName</a>";
|
||||
if (isset($GroupedCategories[$CategoryID - 1])) {
|
||||
if ($GroupYear) {
|
||||
$DisplayName .= " [$GroupYear]";
|
||||
|
@ -10,32 +10,45 @@
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM torrents_artists WHERE GroupID='$GroupID' AND ArtistID='$ArtistID' AND Importance='$Importance'");
|
||||
$DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID);
|
||||
$DB->query("
|
||||
DELETE FROM torrents_artists
|
||||
WHERE GroupID = '$GroupID'
|
||||
AND ArtistID = '$ArtistID'
|
||||
AND Importance = '$Importance'");
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM artists_group
|
||||
WHERE ArtistID = $ArtistID");
|
||||
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID=".$GroupID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($GroupName) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
// Get a count of how many groups or requests use this artist ID
|
||||
$DB->query("SELECT ag.ArtistID
|
||||
$DB->query("
|
||||
SELECT ag.ArtistID
|
||||
FROM artists_group as ag
|
||||
LEFT JOIN requests_artists AS ra ON ag.ArtistID = ra.ArtistID
|
||||
WHERE ra.ArtistID IS NOT NULL
|
||||
AND ag.ArtistID = ".$ArtistID);
|
||||
AND ag.ArtistID = $ArtistID");
|
||||
$ReqCount = $DB->record_count();
|
||||
$DB->query("SELECT ag.ArtistID
|
||||
$DB->query("
|
||||
SELECT ag.ArtistID
|
||||
FROM artists_group as ag
|
||||
LEFT JOIN torrents_artists AS ta ON ag.ArtistID = ta.ArtistID
|
||||
WHERE ta.ArtistID IS NOT NULL
|
||||
AND ag.ArtistID = ".$ArtistID);
|
||||
AND ag.ArtistID = $ArtistID");
|
||||
$GroupCount = $DB->record_count();
|
||||
if (($ReqCount + $GroupCount) == 0) {
|
||||
// The only group to use this artist
|
||||
Artists::delete_artist($ArtistID);
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO torrents_group (ID, NumArtists)
|
||||
$DB->query("
|
||||
INSERT INTO torrents_group (ID, NumArtists)
|
||||
SELECT ta.GroupID, COUNT(ta.ArtistID)
|
||||
FROM torrents_artists AS ta
|
||||
WHERE ta.GroupID = '$GroupID'
|
||||
@ -44,13 +57,13 @@
|
||||
ON DUPLICATE KEY UPDATE
|
||||
NumArtists = VALUES (NumArtists);");
|
||||
|
||||
$Cache->delete_value('torrents_details_'.$GroupID); // Delete torrent group cache
|
||||
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
|
||||
Misc::write_log("Artist (".$ArtistTypes[$Importance].") ".$ArtistID." (".$ArtistName.") was removed from the group ".$GroupID." (".$GroupName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "removed artist ".$ArtistName." (".$ArtistTypes[$Importance].")", 0);
|
||||
$Cache->delete_value("torrents_details_$GroupID"); // Delete torrent group cache
|
||||
$Cache->delete_value("groups_artists_$GroupID"); // Delete group artist cache
|
||||
Misc::write_log('Artist ('.$ArtistTypes[$Importance].") $ArtistID ($ArtistName) was removed from the group $GroupID ($GroupName) by user ".$LoggedUser['ID'].' ('.$LoggedUser['Username'].')');
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "removed artist $ArtistName (".$ArtistTypes[$Importance].')', 0);
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
$Cache->delete_value('artist_groups_'.$ArtistID);
|
||||
$Cache->delete_value("artist_groups_$ArtistID");
|
||||
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
?>
|
||||
|
@ -546,7 +546,8 @@ function filelist($Str) {
|
||||
unset($ReportedTimes);
|
||||
$Reports = $Cache->get_value('reports_torrent_'.$TorrentID);
|
||||
if ($Reports === false) {
|
||||
$DB->query("SELECT r.ID,
|
||||
$DB->query("
|
||||
SELECT r.ID,
|
||||
r.ReporterID,
|
||||
r.Type,
|
||||
r.UserComment,
|
||||
@ -556,12 +557,12 @@ function filelist($Str) {
|
||||
AND Type != 'edited'
|
||||
AND Status != 'Resolved'");
|
||||
$Reports = $DB->to_array();
|
||||
$Cache->cache_value('reports_torrent_'.$TorrentID, $Reports, 0);
|
||||
$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
|
||||
}
|
||||
if (count($Reports) > 0) {
|
||||
$Reported = true;
|
||||
include(SERVER_ROOT.'/sections/reportsv2/array.php');
|
||||
$ReportInfo = '<table class="reportinfo_table"><tr class="colhead_dark" style="font-weight: bold;"><td>This torrent has '.count($Reports).' active '.(count($Reports) > 1 ? "reports" : "report").':</td></tr>';
|
||||
$ReportInfo = "\n<table class=\"reportinfo_table\">\n\t<tr class=\"colhead_dark\" style=\"font-weight: bold;\">\n\t\t<td>This torrent has ".count($Reports).' active '.(count($Reports) > 1 ? 'reports' : 'report').":</td>\n\t</tr>";
|
||||
|
||||
foreach ($Reports as $Report) {
|
||||
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report;
|
||||
@ -577,10 +578,10 @@ function filelist($Str) {
|
||||
//There was a type but it wasn't an option!
|
||||
$ReportType = $Types['master']['other'];
|
||||
}
|
||||
$ReportInfo .= "<tr><td>".(check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":';
|
||||
$ReportInfo .= "<blockquote>".$Text->full_format($ReportReason)."</blockquote></td></tr>";
|
||||
$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&id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":';
|
||||
$ReportInfo .= "\n<blockquote>".$Text->full_format($ReportReason)."</blockquote>\n\t\t</td>\n\t</tr>";
|
||||
}
|
||||
$ReportInfo .= "</table>";
|
||||
$ReportInfo .= "\n</table>";
|
||||
}
|
||||
|
||||
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
|
||||
@ -589,7 +590,7 @@ function filelist($Str) {
|
||||
$FileTable = '
|
||||
<table class="filelist_table">
|
||||
<tr class="colhead_dark"><td>
|
||||
<div class="filelist_title" style="float: left;">File Name' . $RegenLink . '</div>
|
||||
<div class="filelist_title" style="float: left;">File name' . $RegenLink . '</div>
|
||||
<div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div>
|
||||
</td><td>
|
||||
<strong>Size</strong>
|
||||
@ -733,7 +734,7 @@ function filelist($Str) {
|
||||
<div id="reported_<?=$TorrentID?>" class="hidden"><?=$ReportInfo?></div>
|
||||
<? }
|
||||
if (!empty($Description)) {
|
||||
echo '<blockquote>'.$Text->full_format($Description).'</blockquote>';}
|
||||
echo "\n<blockquote>".$Text->full_format($Description).'</blockquote>';}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -8,9 +8,8 @@
|
||||
} else {
|
||||
$UserInfo = $Cache->get_value('user_'.$_REQUEST['torrent_pass']);
|
||||
if (!is_array($UserInfo)) {
|
||||
$DB->query("SELECT
|
||||
ID,
|
||||
DownloadAlt
|
||||
$DB->query("
|
||||
SELECT ID, DownloadAlt
|
||||
FROM users_main AS m
|
||||
INNER JOIN users_info AS i ON i.UserID = m.ID
|
||||
WHERE m.torrent_pass = '".db_string($_REQUEST['torrent_pass'])."'
|
||||
@ -35,20 +34,26 @@
|
||||
error(0);
|
||||
}
|
||||
|
||||
/* uTorrent remote redownloads .torrent files every fifteen minutes
|
||||
to prevent this retardation from blowing bandwidth etc., let's block it
|
||||
if he's downloaded the .torrent file twice before */
|
||||
/* uTorrent Remote redownloads .torrent files every fifteen minutes.
|
||||
To prevent this retardation from blowing bandwidth etc., let's block it
|
||||
if he has downloaded the .torrent file twice before */
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'BTWebClient') !== false) {
|
||||
$DB->query("SELECT 1 FROM users_downloads WHERE UserID=$UserID AND TorrentID=$TorrentID LIMIT 3");
|
||||
$DB->query("
|
||||
SELECT 1
|
||||
FROM users_downloads
|
||||
WHERE UserID = $UserID
|
||||
AND TorrentID = $TorrentID
|
||||
LIMIT 3");
|
||||
if ($DB->record_count() > 2) {
|
||||
error('You have already downloaded this .torrent three times. If you need to download it again, please do so from your browser, not through uTorrent remote.');
|
||||
error('You have already downloaded this torrent file three times. If you need to download it again, please do so from your browser, not through μTorrent Remote.');
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$Info = $Cache->get_value('torrent_download_'.$TorrentID);
|
||||
if (!is_array($Info) || !array_key_exists('PlainArtists', $Info) || empty($Info[10])) {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.Media,
|
||||
t.Format,
|
||||
t.Encoding,
|
||||
@ -70,7 +75,7 @@
|
||||
$Artists = Artists::get_artist($Info[0][4], false);
|
||||
$Info['Artists'] = Artists::display_artists($Artists, false, true);
|
||||
$Info['PlainArtists'] = Artists::display_artists($Artists, false, true, false);
|
||||
$Cache->cache_value('torrent_download_'.$TorrentID, $Info, 0);
|
||||
$Cache->cache_value("torrent_download_$TorrentID", $Info, 0);
|
||||
}
|
||||
if (!is_array($Info[0])) {
|
||||
error(404);
|
||||
@ -99,40 +104,52 @@
|
||||
|
||||
if (!Torrents::has_token($TorrentID)) {
|
||||
if ($FLTokens <= 0) {
|
||||
error("You do not have any freeleech tokens left. Please use the regular DL link.");
|
||||
error('You do not have any freeleech tokens left. Please use the regular DL link.');
|
||||
}
|
||||
if ($Size >= 1073741824) {
|
||||
error("This torrent is too large. Please use the regular DL link.");
|
||||
error('This torrent is too large. Please use the regular DL link.');
|
||||
}
|
||||
|
||||
// Let the tracker know about this
|
||||
if (!Tracker::update_tracker('add_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID))) {
|
||||
error("Sorry! An error occurred while trying to register your token. Most often, this is due to the tracker being down or under heavy load. Please try again later.");
|
||||
error('Sorry! An error occurred while trying to register your token. Most often, this is due to the tracker being down or under heavy load. Please try again later.');
|
||||
}
|
||||
|
||||
if (!Torrents::has_token($TorrentID)) {
|
||||
$DB->query("INSERT INTO users_freeleeches (UserID, TorrentID, Time) VALUES ($UserID, $TorrentID, NOW())
|
||||
ON DUPLICATE KEY UPDATE Time=VALUES(Time), Expired=FALSE, Uses=Uses+1");
|
||||
$DB->query("UPDATE users_main SET FLTokens = FLTokens - 1 WHERE ID=$UserID");
|
||||
$DB->query("
|
||||
INSERT INTO users_freeleeches (UserID, TorrentID, Time)
|
||||
VALUES ($UserID, $TorrentID, NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Time = VALUES(Time),
|
||||
Expired = FALSE,
|
||||
Uses = Uses + 1");
|
||||
$DB->query("
|
||||
UPDATE users_main
|
||||
SET FLTokens = FLTokens - 1
|
||||
WHERE ID = $UserID");
|
||||
|
||||
// Fix for downloadthemall messing with the cached token count
|
||||
$UInfo = Users::user_heavy_info($UserID);
|
||||
$FLTokens = $UInfo['FLTokens'];
|
||||
|
||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
||||
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||
$Cache->update_row(false, array('FLTokens' => ($FLTokens - 1)));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$Cache->delete_value('users_tokens_'.$UserID);
|
||||
$Cache->delete_value("users_tokens_$UserID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Stupid Recent Snatches On User Page
|
||||
if ($CategoryID == '1' && $Image != '') {
|
||||
$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
|
||||
$RecentSnatches = $Cache->get_value("recent_snatches_$UserID");
|
||||
if (!empty($RecentSnatches)) {
|
||||
$Snatch = array('ID'=>$GroupID,'Name'=>$Name,'Artist'=>$Artists,'WikiImage'=>$Image);
|
||||
$Snatch = array(
|
||||
'ID' => $GroupID,
|
||||
'Name' => $Name,
|
||||
'Artist' => $Artists,
|
||||
'WikiImage' => $Image);
|
||||
if (!in_array($Snatch, $RecentSnatches)) {
|
||||
if (count($RecentSnatches) == 5) {
|
||||
array_pop($RecentSnatches);
|
||||
@ -141,7 +158,7 @@
|
||||
} elseif (!is_array($RecentSnatches)) {
|
||||
$RecentSnatches = array($Snatch);
|
||||
}
|
||||
$Cache->cache_value('recent_snatches_'.$UserID, $RecentSnatches, 0);
|
||||
$Cache->cache_value("recent_snatches_$UserID", $RecentSnatches, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +166,10 @@
|
||||
INSERT IGNORE INTO users_downloads (UserID, TorrentID, Time)
|
||||
VALUES ('$UserID', '$TorrentID', '".sqltime()."')");
|
||||
|
||||
$DB->query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT File
|
||||
FROM torrents_files
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
|
||||
list($Contents) = $DB->next_record(MYSQLI_NUM, false);
|
||||
$FileName = TorrentsDL::construct_file_name($Info['PlainArtists'], $Name, $Year, $Media, $Format, $Encoding, false, $DownloadAlt);
|
||||
|
@ -23,15 +23,21 @@
|
||||
|
||||
//Everything is legit, let's just confim they're not retarded
|
||||
if (empty($_POST['confirm'])) {
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$OldGroupID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $OldGroupID");
|
||||
if ($DB->record_count() < 1) {
|
||||
//Trying to move to an empty group? I think not!
|
||||
set_message("That group doesn't exist!");
|
||||
set_message('That group does not exist!');
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
die();
|
||||
}
|
||||
list($Name) = $DB->next_record();
|
||||
$DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID = ".$GroupID);
|
||||
$DB->query("
|
||||
SELECT CategoryID, Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($CategoryID, $NewName) = $DB->next_record();
|
||||
if ($Categories[$CategoryID - 1] != 'Music') {
|
||||
error('Target must be a music group.');
|
||||
@ -54,9 +60,13 @@
|
||||
<input type="hidden" name="oldgroupid" value="<?=$OldGroupID?>" />
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
|
||||
<h3>You are attempting to move the torrent with ID <?=$TorrentID?> from the group:</h3>
|
||||
<ul><li><?= Artists::display_artists($Artists[$OldGroupID], true, false)?> - <a href="torrents.php?id=<?=$OldGroupID?>"><?=$Name?></a></li></ul>
|
||||
<ul>
|
||||
<li><?= Artists::display_artists($Artists[$OldGroupID], true, false)?> - <a href="torrents.php?id=<?=$OldGroupID?>"><?=$Name?></a></li>
|
||||
</ul>
|
||||
<h3>Into the group:</h3>
|
||||
<ul><li><?= Artists::display_artists($Artists[$GroupID], true, false)?> - <a href="torrents.php?id=<?=$GroupID?>"><?=$NewName?></a></li></ul>
|
||||
<ul>
|
||||
<li><?= Artists::display_artists($Artists[$GroupID], true, false)?> - <a href="torrents.php?id=<?=$GroupID?>"><?=$NewName?></a></li>
|
||||
</ul>
|
||||
<input type="submit" value="Confirm" />
|
||||
</form>
|
||||
</div>
|
||||
@ -71,12 +81,18 @@
|
||||
WHERE ID = $TorrentID");
|
||||
|
||||
// Delete old torrent group if it's empty now
|
||||
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$OldGroupID'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM torrents
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
list($TorrentsInGroup) = $DB->next_record();
|
||||
if ($TorrentsInGroup == 0) {
|
||||
$DB->query("UPDATE torrents_comments SET GroupID='$GroupID' WHERE GroupID='$OldGroupID'");
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0');
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID);
|
||||
$DB->query("
|
||||
UPDATE torrents_comments
|
||||
SET GroupID = '$GroupID'
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
$Cache->delete_value("torrent_comments_{$GroupID}_catalogue_0");
|
||||
$Cache->delete_value("torrent_comments_$GroupID");
|
||||
Torrents::delete_group($OldGroupID);
|
||||
} else {
|
||||
Torrents::update_hash($OldGroupID);
|
||||
@ -84,11 +100,14 @@
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']); // TODO: this is probably broken
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "merged group ".$OldGroupID, 0);
|
||||
$DB->query("UPDATE group_log SET GroupID = ".$GroupID." WHERE GroupID = ".$OldGroupID);
|
||||
Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "merged group $OldGroupID", 0);
|
||||
$DB->query("
|
||||
UPDATE group_log
|
||||
SET GroupID = $GroupID
|
||||
WHERE GroupID = $OldGroupID");
|
||||
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
}
|
||||
|
@ -17,16 +17,16 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
|
||||
if ($RevisionID || !is_array($TorrentCache) || isset($OutdatedCache)) {
|
||||
// Fetch the group details
|
||||
|
||||
$SQL = "SELECT ";
|
||||
$SQL = 'SELECT ';
|
||||
|
||||
if (!$RevisionID) {
|
||||
$SQL .= "
|
||||
$SQL .= '
|
||||
g.WikiBody,
|
||||
g.WikiImage, ";
|
||||
g.WikiImage, ';
|
||||
} else {
|
||||
$SQL .= "
|
||||
$SQL .= '
|
||||
w.Body,
|
||||
w.Image, ";
|
||||
w.Image, ';
|
||||
}
|
||||
|
||||
$SQL .= "
|
||||
@ -50,7 +50,8 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
|
||||
|
||||
if ($RevisionID) {
|
||||
$SQL .= "
|
||||
LEFT JOIN wiki_torrents AS w ON w.PageID='".db_string($GroupID)."' AND w.RevisionID='".db_string($RevisionID)."' ";
|
||||
LEFT JOIN wiki_torrents AS w ON w.PageID = '".db_string($GroupID)."'
|
||||
AND w.RevisionID = '".db_string($RevisionID)."' ";
|
||||
}
|
||||
|
||||
$SQL .= "
|
||||
@ -122,7 +123,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
|
||||
|
||||
$TorrentList = $DB->to_array('ID', MYSQLI_ASSOC);
|
||||
if (count($TorrentList) == 0 && $ApiCall == false) {
|
||||
header("Location: log.php?search=".(empty($_GET['torrentid']) ? "Group+$GroupID" : "Torrent+$_GET[torrentid]"));
|
||||
header('Location: log.php?search='.(empty($_GET['torrentid']) ? "Group+$GroupID" : "Torrent+$_GET[torrentid]"));
|
||||
die();
|
||||
} else if (count($TorrentList) == 0 && $ApiCall == true) {
|
||||
return NULL;
|
||||
@ -134,7 +135,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
|
||||
}
|
||||
// Store it all in cache
|
||||
if (!$RevisionID) {
|
||||
$Cache->cache_value('torrents_details_'.$GroupID, array($TorrentDetails, $TorrentList), $CacheTime);
|
||||
$Cache->cache_value("torrents_details_$GroupID", array($TorrentDetails, $TorrentList), $CacheTime);
|
||||
}
|
||||
} else { // If we're reading from cache
|
||||
$TorrentDetails = $TorrentCache[0];
|
||||
@ -188,7 +189,10 @@ function is_valid_torrenthash($Str) {
|
||||
|
||||
function torrenthash_to_torrentid($Str) {
|
||||
global $Cache, $DB;
|
||||
$DB->query("SELECT t.ID FROM torrents AS t WHERE HEX(t.info_hash)='".db_string($Str)."'");
|
||||
$DB->query("
|
||||
SELECT t.ID
|
||||
FROM torrents AS t
|
||||
WHERE HEX(t.info_hash) = '".db_string($Str)."'");
|
||||
$TorrentID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
|
||||
if ($TorrentID) {
|
||||
return $TorrentID;
|
||||
@ -198,7 +202,10 @@ function torrenthash_to_torrentid($Str) {
|
||||
|
||||
function torrenthash_to_groupid($Str) {
|
||||
global $Cache, $DB;
|
||||
$DB->query("SELECT t.GroupID FROM torrents AS t WHERE HEX(t.info_hash)='".db_string($Str)."'");
|
||||
$DB->query("
|
||||
SELECT t.GroupID
|
||||
FROM torrents AS t
|
||||
WHERE HEX(t.info_hash) = '".db_string($Str)."'");
|
||||
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
|
||||
if ($GroupID) {
|
||||
return $GroupID;
|
||||
@ -208,7 +215,10 @@ function torrenthash_to_groupid($Str) {
|
||||
|
||||
function torrentid_to_groupid($TorrentID) {
|
||||
global $Cache, $DB;
|
||||
$DB->query("SELECT t.GroupID FROM torrents AS t WHERE t.ID='".db_string($TorrentID)."'");
|
||||
$DB->query("
|
||||
SELECT t.GroupID
|
||||
FROM torrents AS t
|
||||
WHERE t.ID = '".db_string($TorrentID)."'");
|
||||
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
|
||||
if ($GroupID) {
|
||||
return $GroupID;
|
||||
@ -219,7 +229,14 @@ function torrentid_to_groupid($TorrentID) {
|
||||
//After adjusting / deleting logs, recalculate the score for the torrent.
|
||||
function set_torrent_logscore($TorrentID) {
|
||||
global $DB;
|
||||
$DB->query("UPDATE torrents SET LogScore = (SELECT FLOOR(AVG(Score)) FROM torrents_logs_new WHERE TorrentID = ".$TorrentID.") WHERE ID = ".$TorrentID);
|
||||
$DB->query("
|
||||
UPDATE torrents
|
||||
SET LogScore = (
|
||||
SELECT FLOOR(AVG(Score))
|
||||
FROM torrents_logs_new
|
||||
WHERE TorrentID = $TorrentID
|
||||
)
|
||||
WHERE ID = $TorrentID");
|
||||
}
|
||||
|
||||
function get_group_requests($GroupID) {
|
||||
@ -228,11 +245,15 @@ function get_group_requests($GroupID) {
|
||||
}
|
||||
global $DB, $Cache;
|
||||
|
||||
$Requests = $Cache->get_value('requests_group_'.$GroupID);
|
||||
$Requests = $Cache->get_value("requests_group_$GroupID");
|
||||
if ($Requests === false) {
|
||||
$DB->query("SELECT ID FROM requests WHERE GroupID = $GroupID AND TimeFilled = '0000-00-00 00:00:00'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM requests
|
||||
WHERE GroupID = $GroupID
|
||||
AND TimeFilled = '0000-00-00 00:00:00'");
|
||||
$Requests = $DB->collect('ID');
|
||||
$Cache->cache_value('requests_group_'.$GroupID, $Requests, 0);
|
||||
$Cache->cache_value("requests_group_$GroupID", $Requests, 0);
|
||||
}
|
||||
$Requests = Requests::get_requests($Requests);
|
||||
return $Requests['matches'];
|
||||
@ -241,7 +262,7 @@ function get_group_requests($GroupID) {
|
||||
//Used to get reports info on a unison cache in both browsing pages and torrent pages.
|
||||
function get_reports($TorrentID) {
|
||||
global $Cache, $DB;
|
||||
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
|
||||
$Reports = $Cache->get_value("reports_torrent_$TorrentID");
|
||||
if ($Reports === false) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
@ -255,7 +276,7 @@ function get_reports($TorrentID) {
|
||||
AND Type != 'edited'
|
||||
AND Status != 'Resolved'");
|
||||
$Reports = $DB->to_array();
|
||||
$Cache->cache_value('reports_torrent_' . $TorrentID, $Reports, 0);
|
||||
$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
|
||||
}
|
||||
return $Reports;
|
||||
}
|
||||
@ -264,7 +285,7 @@ function get_reports($TorrentID) {
|
||||
function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Text, $Username, $ReportedTimes) {
|
||||
|
||||
function filelist($Str) {
|
||||
return '</td><td>' . Format::get_size($Str[1]) . '</td></tr>';
|
||||
return "</td>\n<td>" . Format::get_size($Str[1]) . "</td>\n</tr>";
|
||||
}
|
||||
|
||||
$LastRemasterYear = '-';
|
||||
@ -295,7 +316,7 @@ function filelist($Str) {
|
||||
|
||||
$Reported = false;
|
||||
unset($ReportedTimes);
|
||||
$Reports = $Cache->get_value('reports_torrent_' . $TorrentID);
|
||||
$Reports = $Cache->get_value("reports_torrent_$TorrentID");
|
||||
if ($Reports === false) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
@ -309,12 +330,12 @@ function filelist($Str) {
|
||||
AND Type != 'edited'
|
||||
AND Status != 'Resolved'");
|
||||
$Reports = $DB->to_array();
|
||||
$Cache->cache_value('reports_torrent_' . $TorrentID, $Reports, 0);
|
||||
$Cache->cache_value("reports_torrent_$TorrentID", $Reports, 0);
|
||||
}
|
||||
if (count($Reports) > 0) {
|
||||
$Reported = true;
|
||||
include(SERVER_ROOT . '/sections/reportsv2/array.php');
|
||||
$ReportInfo = '<table><tr class="colhead_dark" style="font-weight: bold;"><td>This torrent has ' . count($Reports) . ' active ' . (count($Reports) > 1 ? 'reports' : 'report') . ':</td></tr>';
|
||||
$ReportInfo = "\n<table>\n\t<tr class=\"colhead_dark\" style=\"font-weight: bold;\">\n\t\t<td>This torrent has " . count($Reports) . ' active ' . (count($Reports) > 1 ? 'reports' : 'report') . ":</td>\n\t</tr>";
|
||||
|
||||
foreach ($Reports as $Report) {
|
||||
list($ReportID, $ReporterID, $ReportType, $ReportReason, $ReportedTime) = $Report;
|
||||
@ -330,10 +351,10 @@ function filelist($Str) {
|
||||
//There was a type but it wasn't an option!
|
||||
$ReportType = $Types['master']['other'];
|
||||
}
|
||||
$ReportInfo .= '<tr><td>' . (check_perms('admin_reports') ? "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":';
|
||||
$ReportInfo .= '<blockquote>' . $Text->full_format($ReportReason) . '</blockquote></td></tr>';
|
||||
$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&id=$ReportID\">reported it</a> " : 'Someone reported it ') . time_diff($ReportedTime, 2, true, true) . ' for the reason "' . $ReportType['title'] . '":';
|
||||
$ReportInfo .= "\n\t\t\t<blockquote>" . $Text->full_format($ReportReason) . "</blockquote>\n\t\t</td>\n\t</tr>";
|
||||
}
|
||||
$ReportInfo .= '</table>';
|
||||
$ReportInfo .= "\n</table>";
|
||||
}
|
||||
|
||||
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
|
||||
@ -385,18 +406,18 @@ function filelist($Str) {
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($HasLog) {
|
||||
$ExtraInfo.=$AddExtra . 'Log';
|
||||
$ExtraInfo .= "{$AddExtra}Log";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($HasLog && $LogInDB) {
|
||||
$ExtraInfo .= ' (' . (int) $LogScore . '%)';
|
||||
}
|
||||
if ($HasCue) {
|
||||
$ExtraInfo.=$AddExtra . 'Cue';
|
||||
$ExtraInfo .= "{$AddExtra}Cue";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if ($Scene) {
|
||||
$ExtraInfo.=$AddExtra . 'Scene';
|
||||
$ExtraInfo .= "{$AddExtra}Scene";
|
||||
$AddExtra = ' / ';
|
||||
}
|
||||
if (!$ExtraInfo) {
|
||||
@ -459,7 +480,7 @@ function filelist($Str) {
|
||||
$EditionID++;
|
||||
?>
|
||||
<tr class="releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition group_torrent">
|
||||
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=($GroupID)?>, <?=($EditionID)?>, this, event)" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
|
||||
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=($GroupID)?>, <?=($EditionID)?>, this, event);" title="Collapse this edition. Hold "Ctrl" while clicking to collapse all editions in this torrent group.">−</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
@ -530,7 +551,7 @@ function filelist($Str) {
|
||||
<div id="reported_<?=($TorrentID)?>" class="hidden"><?=($ReportInfo)?></div>
|
||||
<? }
|
||||
if (!empty($Description)) {
|
||||
echo '<blockquote>' . $Text->full_format($Description) . '</blockquote>';
|
||||
echo "\n\t\t\t\t\t\t<blockquote>" . $Text->full_format($Description) . '</blockquote>';
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -8,7 +8,7 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
if ($i == $CurrentPage) {
|
||||
$PageLinks[] = $i;
|
||||
} else {
|
||||
$PageLinks[] = '<a href="#" onclick="'.$Action.'('.$TorrentID.', '.$i.')">'.$i.'</a>';
|
||||
$PageLinks[] = "<a href=\"#\" onclick=\"$Action($TorrentID, $i)\">$i</a>";
|
||||
}
|
||||
}
|
||||
return implode(' | ', $PageLinks);
|
||||
@ -196,17 +196,20 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
CEIL((
|
||||
SELECT COUNT(ID) + 1
|
||||
FROM torrents_comments AS tc
|
||||
WHERE tc.GroupID='".db_string($GroupID)."')/".TORRENT_COMMENTS_PER_PAGE."
|
||||
) AS Pages");
|
||||
WHERE tc.GroupID = '".db_string($GroupID)."'
|
||||
) / ".TORRENT_COMMENTS_PER_PAGE.'
|
||||
) AS Pages');
|
||||
list($Pages) = $DB->next_record();
|
||||
|
||||
$DB->query("
|
||||
INSERT INTO torrents_comments (GroupID,AuthorID,AddedTime,Body)
|
||||
VALUES ('".db_string($GroupID)."', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
|
||||
INSERT INTO torrents_comments
|
||||
(GroupID, AuthorID, AddedTime, Body)
|
||||
VALUES
|
||||
('".db_string($GroupID)."', '".db_string($LoggedUser['ID'])."', '".sqltime()."', '".db_string($_POST['body'])."')");
|
||||
$PostID = $DB->inserted_id();
|
||||
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('torrent_comments_'.$GroupID.'_catalogue_'.$CatalogueID);
|
||||
$Cache->begin_transaction("torrent_comments_{$GroupID}_catalogue_$CatalogueID");
|
||||
$Post = array(
|
||||
'ID' => $PostID,
|
||||
'AuthorID' => $LoggedUser['ID'],
|
||||
@ -218,9 +221,9 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
);
|
||||
$Cache->insert('', $Post);
|
||||
$Cache->commit_transaction(0);
|
||||
$Cache->increment('torrent_comments_'.$GroupID);
|
||||
$Cache->increment("torrent_comments_$GroupID");
|
||||
|
||||
header('Location: torrents.php?id='.$GroupID.'&page='.$Pages);
|
||||
header("Location: torrents.php?id=$GroupID&page=$Pages");
|
||||
break;
|
||||
|
||||
case 'get_post':
|
||||
@ -228,7 +231,10 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||
error(0);
|
||||
}
|
||||
$DB->query("SELECT Body FROM torrents_comments WHERE ID='".db_string($_GET['post'])."'");
|
||||
$DB->query("
|
||||
SELECT Body
|
||||
FROM torrents_comments
|
||||
WHERE ID = '".db_string($_GET['post'])."'");
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
|
||||
echo trim($Body);
|
||||
@ -282,7 +288,7 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
|
||||
// Update the cache
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('torrent_comments_'.$GroupID.'_catalogue_'.$CatalogueID);
|
||||
$Cache->begin_transaction("torrent_comments_{$GroupID}_catalogue_$CatalogueID");
|
||||
|
||||
$Cache->update_row($_POST['key'], array(
|
||||
'ID' => $_POST['post'],
|
||||
@ -295,8 +301,11 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('torrents', ".db_string($_POST['post']).", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')");
|
||||
$DB->query("
|
||||
INSERT INTO comments_edits
|
||||
(Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES
|
||||
('torrents', ".db_string($_POST['post']).", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')");
|
||||
|
||||
// This gets sent to the browser, which echoes it in place of the old body
|
||||
echo $Text->full_format($_POST['body']);
|
||||
@ -317,30 +326,36 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
}
|
||||
|
||||
// Get topicid, forumid, number of pages
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
GroupID,
|
||||
CEIL(COUNT(tc.ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
|
||||
CEIL(SUM(IF(tc.ID <= ".$_GET['postid'].", 1, 0)) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page
|
||||
FROM torrents_comments AS tc
|
||||
WHERE tc.GroupID=(SELECT GroupID FROM torrents_comments WHERE ID=".$_GET['postid'].")
|
||||
GROUP BY tc.GroupID");
|
||||
WHERE tc.GroupID =
|
||||
(SELECT GroupID
|
||||
FROM torrents_comments
|
||||
WHERE ID = ".$_GET['postid'].')
|
||||
GROUP BY tc.GroupID');
|
||||
list($GroupID, $Pages, $Page) = $DB->next_record();
|
||||
|
||||
// $Pages = number of pages in the thread
|
||||
// $Page = which page the post is on
|
||||
// These are set for cache clearing.
|
||||
|
||||
$DB->query("DELETE FROM torrents_comments WHERE ID='".db_string($_GET['postid'])."'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_comments
|
||||
WHERE ID = '".db_string($_GET['postid'])."'");
|
||||
|
||||
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
|
||||
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_'.$i);
|
||||
$Cache->delete_value("torrent_comments_{$GroupID}_catalogue_$i");
|
||||
}
|
||||
|
||||
// Delete thread info cache (eg. number of pages)
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID);
|
||||
// Delete thread info cache (e.g. number of pages)
|
||||
$Cache->delete_value("torrent_comments_$GroupID");
|
||||
|
||||
break;
|
||||
case 'regen_filelist':
|
||||
@ -354,7 +369,10 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
break;
|
||||
case 'fix_group':
|
||||
if ((check_perms('users_mod') || check_perms('torrents_fix_ghosts')) && authorize() && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
|
||||
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID = ".$_GET['groupid']);
|
||||
$DB->query('
|
||||
SELECT COUNT(ID)
|
||||
FROM torrents
|
||||
WHERE GroupID = '.$_GET['groupid']);
|
||||
list($Count) = $DB->next_record();
|
||||
if ($Count == 0) {
|
||||
Torrents::delete_group($_GET['groupid']);
|
||||
@ -390,10 +408,13 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
if (!empty($_GET['id'])) {
|
||||
include(SERVER_ROOT.'/sections/torrents/details.php');
|
||||
} elseif (isset($_GET['torrentid']) && is_number($_GET['torrentid'])) {
|
||||
$DB->query("SELECT GroupID FROM torrents WHERE ID=".$_GET['torrentid']);
|
||||
$DB->query('
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = '.$_GET['torrentid']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
if ($GroupID) {
|
||||
header("Location: torrents.php?id=".$GroupID."&torrentid=".$_GET['torrentid']);
|
||||
header("Location: torrents.php?id=$GroupID&torrentid=".$_GET['torrentid']);
|
||||
}
|
||||
} else {
|
||||
include(SERVER_ROOT.'/sections/torrents/browse2.php');
|
||||
@ -406,26 +427,31 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
|
||||
if (!empty($_GET['id'])) {
|
||||
include(SERVER_ROOT.'/sections/torrents/details.php');
|
||||
} elseif (isset($_GET['torrentid']) && is_number($_GET['torrentid'])) {
|
||||
$DB->query("SELECT GroupID FROM torrents WHERE ID=".$_GET['torrentid']);
|
||||
$DB->query("
|
||||
SELECT GroupID
|
||||
FROM torrents
|
||||
WHERE ID = ".$_GET['torrentid']);
|
||||
list($GroupID) = $DB->next_record();
|
||||
if ($GroupID) {
|
||||
header("Location: torrents.php?id=".$GroupID."&torrentid=".$_GET['torrentid']."#torrent".$_GET['torrentid']);
|
||||
header("Location: torrents.php?id=$GroupID&torrentid=".$_GET['torrentid'].'#torrent'.$_GET['torrentid']);
|
||||
} else {
|
||||
header("Location: log.php?search=Torrent+$_GET[torrentid]");
|
||||
}
|
||||
} elseif (!empty($_GET['type'])) {
|
||||
include(SERVER_ROOT.'/sections/torrents/user.php');
|
||||
} elseif (!empty($_GET['groupname']) && !empty($_GET['forward'])) {
|
||||
$DB->query("SELECT ID FROM torrents_group WHERE Name LIKE '".db_string($_GET['groupname'])."'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents_group
|
||||
WHERE Name LIKE '".db_string($_GET['groupname'])."'");
|
||||
list($GroupID) = $DB->next_record();
|
||||
if ($GroupID) {
|
||||
header("Location: torrents.php?id=".$GroupID);
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
} else {
|
||||
include(SERVER_ROOT.'/sections/torrents/browse2.php');
|
||||
}
|
||||
} else {
|
||||
include(SERVER_ROOT.'/sections/torrents/browse2.php');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -16,7 +16,10 @@
|
||||
if ($NewGroupID == $GroupID) {
|
||||
error('Old group ID is the same as new group ID!');
|
||||
}
|
||||
$DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID='$NewGroupID'");
|
||||
$DB->query("
|
||||
SELECT CategoryID, Name
|
||||
FROM torrents_group
|
||||
WHERE ID = '$NewGroupID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
error('Target group does not exist.');
|
||||
}
|
||||
@ -25,7 +28,10 @@
|
||||
error('Only music groups can be merged.');
|
||||
}
|
||||
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID = ".$GroupID);
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($Name) = $DB->next_record();
|
||||
|
||||
// Everything is legit, let's just confim they're not retarded
|
||||
@ -46,9 +52,13 @@
|
||||
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
|
||||
<input type="hidden" name="targetgroupid" value="<?=$NewGroupID?>" />
|
||||
<h3>You are attempting to merge the group:</h3>
|
||||
<ul><li><?= Artists::display_artists($Artists[$GroupID], true, false)?> - <a href="torrents.php?id=<?=$GroupID?>"><?=$Name?></a></li></ul>
|
||||
<ul>
|
||||
<li><?= Artists::display_artists($Artists[$GroupID], true, false)?> - <a href="torrents.php?id=<?=$GroupID?>"><?=$Name?></a></li>
|
||||
</ul>
|
||||
<h3>Into the group:</h3>
|
||||
<ul><li><?= Artists::display_artists($Artists[$NewGroupID], true, false)?> - <a href="torrents.php?id=<?=$NewGroupID?>"><?=$NewName?></a></li></ul>
|
||||
<ul>
|
||||
<li><?= Artists::display_artists($Artists[$NewGroupID], true, false)?> - <a href="torrents.php?id=<?=$NewGroupID?>"><?=$NewName?></a></li>
|
||||
</ul>
|
||||
<input type="submit" value="Confirm" />
|
||||
</form>
|
||||
</div>
|
||||
@ -60,78 +70,122 @@
|
||||
|
||||
// Votes ninjutsu. This is so annoyingly complicated.
|
||||
// 1. Get a list of everybody who voted on the old group and clear their cache keys
|
||||
$DB->query("SELECT UserID FROM users_votes WHERE GroupID='$GroupID'");
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM users_votes
|
||||
WHERE GroupID = '$GroupID'");
|
||||
while (list($UserID) = $DB->next_record()) {
|
||||
$Cache->delete_value('voted_albums_'.$UserID);
|
||||
$Cache->delete_value("voted_albums_$UserID");
|
||||
}
|
||||
// 2. Update the existing votes where possible, clear out the duplicates left by key
|
||||
// conflicts, and update the torrents_votes table
|
||||
$DB->query("UPDATE IGNORE users_votes SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
|
||||
$DB->query("DELETE FROM users_votes WHERE GroupID='$GroupID'");
|
||||
$DB->query("INSERT INTO torrents_votes (GroupID, Ups, Total, Score)
|
||||
$DB->query("
|
||||
UPDATE IGNORE users_votes
|
||||
SET GroupID = '$NewGroupID'
|
||||
WHERE GroupID = '$GroupID'");
|
||||
$DB->query("
|
||||
DELETE FROM users_votes
|
||||
WHERE GroupID = '$GroupID'");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_votes (GroupID, Ups, Total, Score)
|
||||
SELECT $NewGroupID, UpVotes, TotalVotes, VoteScore
|
||||
FROM (SELECT IFNULL(SUM(IF(Type='Up',1,0)),0) As UpVotes,
|
||||
FROM (
|
||||
SELECT
|
||||
IFNULL(SUM(IF(Type = 'Up', 1, 0)), 0) As UpVotes,
|
||||
COUNT(1) AS TotalVotes,
|
||||
binomial_ci(IFNULL(SUM(IF(Type = 'Up', 1, 0)), 0), COUNT(1)) AS VoteScore
|
||||
FROM users_votes
|
||||
WHERE GroupID = $NewGroupID
|
||||
GROUP BY GroupID) AS a
|
||||
GROUP BY GroupID
|
||||
) AS a
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Ups = a.UpVotes,
|
||||
Total = a.TotalVotes,
|
||||
Score = a.VoteScore;");
|
||||
// 3. Clear the votes_pairs keys!
|
||||
$DB->query("SELECT v2.GroupID
|
||||
$DB->query("
|
||||
SELECT v2.GroupID
|
||||
FROM users_votes AS v1
|
||||
INNER JOIN users_votes AS v2 USING (UserID)
|
||||
WHERE (v1.Type = 'Up' OR v2.Type = 'Up')
|
||||
AND (v1.GroupID IN($GroupID, $NewGroupID))
|
||||
AND (v2.GroupID NOT IN($GroupID, $NewGroupID));");
|
||||
while (list($CacheGroupID) = $DB->next_record()) {
|
||||
$Cache->delete_value('vote_pairs_'.$CacheGroupID);
|
||||
$Cache->delete_value("vote_pairs_$CacheGroupID");
|
||||
}
|
||||
// 4. Clear the new groups vote keys
|
||||
$Cache->delete_value('votes_'.$NewGroupID);
|
||||
$Cache->delete_value("votes_$NewGroupID");
|
||||
|
||||
$DB->query("UPDATE torrents SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
|
||||
$DB->query("UPDATE wiki_torrents SET PageID='$NewGroupID' WHERE PageID='$GroupID'");
|
||||
$DB->query("UPDATE torrents_comments SET GroupID='$NewGroupID' WHERE GroupID='$GroupID'");
|
||||
$DB->query("
|
||||
UPDATE torrents
|
||||
SET GroupID = '$NewGroupID'
|
||||
WHERE GroupID = '$GroupID'");
|
||||
$DB->query("
|
||||
UPDATE wiki_torrents
|
||||
SET PageID = '$NewGroupID'
|
||||
WHERE PageID = '$GroupID'");
|
||||
$DB->query("
|
||||
UPDATE torrents_comments
|
||||
SET GroupID = '$NewGroupID'
|
||||
WHERE GroupID = '$GroupID'");
|
||||
|
||||
Torrents::delete_group($GroupID);
|
||||
|
||||
Torrents::write_group_log($NewGroupID, 0, $LoggedUser['ID'], "Merged Group ".$GroupID." (".$Name.") to ".$NewGroupID." (".$NewName.")", 0);
|
||||
$DB->query("UPDATE group_log SET GroupID = ".$NewGroupID." WHERE GroupID = ".$GroupID);
|
||||
Torrents::write_group_log($NewGroupID, 0, $LoggedUser['ID'], "Merged Group $GroupID ($Name) to $NewGroupID ($NewName)", 0);
|
||||
$DB->query("
|
||||
UPDATE group_log
|
||||
SET GroupID = $NewGroupID
|
||||
WHERE GroupID = $GroupID");
|
||||
|
||||
$GroupID = $NewGroupID;
|
||||
|
||||
//Collages
|
||||
$DB->query("SELECT CollageID FROM collages_torrents WHERE GroupID='$OldGroupID'"); //Select all collages that contain edited group
|
||||
$DB->query("
|
||||
SELECT CollageID
|
||||
FROM collages_torrents
|
||||
WHERE GroupID = '$OldGroupID'"); // Select all collages that contain edited group
|
||||
while (list($CollageID) = $DB->next_record()) {
|
||||
$DB->query("UPDATE IGNORE collages_torrents SET GroupID='$NewGroupID' WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'"); //Change collage groupid to new ID
|
||||
$DB->query("DELETE FROM collages_torrents WHERE GroupID='$OldGroupID' AND CollageID='$CollageID'");
|
||||
$Cache->delete_value('collage_'.$CollageID);
|
||||
$DB->query("
|
||||
UPDATE IGNORE collages_torrents
|
||||
SET GroupID = '$NewGroupID'
|
||||
WHERE GroupID = '$OldGroupID'
|
||||
AND CollageID = '$CollageID'"); // Change collage group ID to new ID
|
||||
$DB->query("
|
||||
DELETE FROM collages_torrents
|
||||
WHERE GroupID = '$OldGroupID'
|
||||
AND CollageID = '$CollageID'");
|
||||
$Cache->delete_value("collage_$CollageID");
|
||||
}
|
||||
$Cache->delete_value('torrent_collages_'.$NewGroupID);
|
||||
$Cache->delete_value('torrent_collages_personal_'.$NewGroupID);
|
||||
$Cache->delete_value("torrent_collages_$NewGroupID");
|
||||
$Cache->delete_value("torrent_collages_personal_$NewGroupID");
|
||||
|
||||
// Requests
|
||||
$DB->query("SELECT ID FROM requests WHERE GroupID='$OldGroupID'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM requests
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
$Requests = $DB->collect('ID');
|
||||
$DB->query("UPDATE requests SET GroupID = 'NewGroupID' WHERE GroupID = '$OldGroupID'");
|
||||
$DB->query("
|
||||
UPDATE requests
|
||||
SET GroupID = 'NewGroupID'
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
foreach ($Requests as $RequestID) {
|
||||
$Cache->delete_value('request_'.$RequestID);
|
||||
$Cache->delete_value("request_$RequestID");
|
||||
}
|
||||
|
||||
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
while (list($TorrentID) = $DB->next_record()) {
|
||||
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
}
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID.'_catalogue_0');
|
||||
$Cache->delete_value('torrent_comments_'.$GroupID);
|
||||
$Cache->delete_value('groups_artists_'.$GroupID);
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("torrent_comments_{$GroupID}_catalogue_0");
|
||||
$Cache->delete_value("torrent_comments_$GroupID");
|
||||
$Cache->delete_value("groups_artists_$GroupID");
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
header('Location: torrents.php?id='.$GroupID);
|
||||
header("Location: torrents.php?id=" . $GroupID);
|
||||
}
|
||||
?>
|
||||
|
@ -10,7 +10,10 @@
|
||||
|
||||
//Usual perm checks
|
||||
if (!check_perms('torrents_edit')) {
|
||||
$DB->query("SELECT UserID FROM torrents WHERE GroupID = ".$GroupID);
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM torrents
|
||||
WHERE GroupID = $GroupID");
|
||||
if (!in_array($LoggedUser['ID'], $DB->collect('UserID'))) {
|
||||
error(403);
|
||||
}
|
||||
@ -41,28 +44,37 @@
|
||||
$CatalogueNumber = db_string($_POST['catalogue_number']);
|
||||
|
||||
// Get some info for the group log
|
||||
$DB->query("SELECT Year FROM torrents_group WHERE ID = $GroupID");
|
||||
$DB->query("
|
||||
SELECT Year
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($OldYear) = $DB->next_record();
|
||||
|
||||
|
||||
|
||||
$DB->query("UPDATE torrents_group SET
|
||||
$DB->query("
|
||||
UPDATE torrents_group
|
||||
SET
|
||||
Year = '$Year',
|
||||
RecordLabel = '".$RecordLabel."',
|
||||
CatalogueNumber = '".$CatalogueNumber."'
|
||||
WHERE ID = ".$GroupID);
|
||||
WHERE ID = $GroupID");
|
||||
|
||||
if ($OldYear != $Year) {
|
||||
$DB->query("INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
$DB->query("
|
||||
INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
VALUES ('$GroupID', ".$LoggedUser['ID'].", '".sqltime()."', '".db_string("Year changed from $OldYear to $Year")."')");
|
||||
}
|
||||
|
||||
$DB->query("SELECT ID FROM torrents WHERE GroupID='$GroupID'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents
|
||||
WHERE GroupID = '$GroupID'");
|
||||
while (list($TorrentID) = $DB->next_record()) {
|
||||
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
}
|
||||
Torrents::update_hash($GroupID);
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
|
||||
header("Location: torrents.php?id=".$GroupID);
|
||||
header("Location: torrents.php?id=$GroupID");
|
||||
?>
|
||||
|
@ -12,14 +12,22 @@
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT Image, Summary FROM cover_art WHERE ID = '$ID'");
|
||||
$DB->query("
|
||||
SELECT Image, Summary
|
||||
FROM cover_art
|
||||
WHERE ID = '$ID'");
|
||||
list($Image, $Summary) = $DB->next_record();
|
||||
|
||||
$DB->query("DELETE FROM cover_art WHERE ID = '$ID'");
|
||||
$DB->query("
|
||||
DELETE FROM cover_art
|
||||
WHERE ID = '$ID'");
|
||||
|
||||
$DB->query("INSERT INTO group_log (GroupID, UserID, Time, Info)
|
||||
VALUES ('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Additional Cover "'.$Summary . ' - ' . $Image .'" removed from group')."')");
|
||||
$DB->query("
|
||||
INSERT INTO group_log
|
||||
(GroupID, UserID, Time, Info)
|
||||
VALUES
|
||||
('$GroupID', ".$LoggedUser['ID'].", '".sqltime()."', '".db_string("Additional Cover \"$Summary - $Image\" removed from group")."')");
|
||||
|
||||
$Cache->delete_value('torrents_cover_art_' . $GroupID);
|
||||
$Cache->delete_value("torrents_cover_art_$GroupID");
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
?>
|
||||
|
@ -24,20 +24,22 @@
|
||||
$Subject = 'You have received a warning';
|
||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
$WarnTime = time_plus($Time);
|
||||
$AdminComment = date('Y-m-d') . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
$AdminComment = date('Y-m-d') . " - Warned until $WarnTime by " . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
} else {
|
||||
$Subject = 'You have received a verbal warning';
|
||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
||||
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||
}
|
||||
$DB->query("INSERT INTO users_warnings_forums (UserID, Comment)
|
||||
$DB->query("
|
||||
INSERT INTO users_warnings_forums (UserID, Comment)
|
||||
VALUES('$UserID', '" . db_string($AdminComment) . "')
|
||||
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
|
||||
Tools::update_user_notes($UserID, $AdminComment);
|
||||
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
|
||||
|
||||
// Mainly
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
tc.Body,
|
||||
tc.AuthorID,
|
||||
tc.GroupID,
|
||||
@ -46,13 +48,16 @@
|
||||
WHERE tc.ID = '$PostID'");
|
||||
list($OldBody, $AuthorID, $GroupID, $AddedTime) = $DB->next_record();
|
||||
|
||||
$DB->query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
||||
$DB->query("
|
||||
SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
||||
FROM torrents_comments
|
||||
WHERE GroupID = $GroupID AND ID <= $PostID");
|
||||
WHERE GroupID = $GroupID
|
||||
AND ID <= $PostID");
|
||||
list($Page) = $DB->next_record();
|
||||
|
||||
// Perform the update
|
||||
$DB->query("UPDATE torrents_comments
|
||||
$DB->query("
|
||||
UPDATE torrents_comments
|
||||
SET Body = '" . db_string($Body) . "',
|
||||
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
||||
EditedTime = '" . sqltime() . "'
|
||||
@ -60,15 +65,15 @@
|
||||
|
||||
// Update the cache
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$Cache->begin_transaction('torrent_comments_' . $GroupID . '_catalogue_' . $CatalogueID);
|
||||
$Cache->begin_transaction("torrent_comments_{$GroupID}_catalogue_$CatalogueID");
|
||||
|
||||
$Cache->update_row($_POST['key'], array('ID' => $_POST['postid'], 'AuthorID' => $AuthorID, 'AddedTime' => $AddedTime, 'Body' => $Body,
|
||||
'EditedUserID' => db_string($LoggedUser['ID']), 'EditedTime' => sqltime(), 'Username' => $LoggedUser['Username']));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
$DB->query("
|
||||
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
||||
VALUES ('torrents', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
|
||||
|
||||
header("Location: torrents.php?id=$GroupID&postid=$PostID#post$PostID");
|
||||
?>
|
||||
;
|
||||
|
@ -6,11 +6,12 @@
|
||||
error(404);
|
||||
}
|
||||
|
||||
if ($Cache->get_value('torrent_'.$TorrentID.'_lock')) {
|
||||
if ($Cache->get_value("torrent_{$TorrentID}_lock")) {
|
||||
error('Torrent cannot be deleted because the upload process is not completed yet. Please try again later.');
|
||||
}
|
||||
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.UserID,
|
||||
t.GroupID,
|
||||
t.Size,
|
||||
@ -31,22 +32,22 @@
|
||||
}
|
||||
|
||||
if ($ArtistName) {
|
||||
$Name = $ArtistName.' - '.$Name;
|
||||
$Name = "$ArtistName - $Name";
|
||||
}
|
||||
|
||||
if (isset($_SESSION['logged_user']['multi_delete'])) {
|
||||
if ($_SESSION['logged_user']['multi_delete'] >= 3 && !check_perms('torrents_delete_fast')) {
|
||||
error('You have recently deleted 3 torrents, please contact a staff member if you need to delete more.');
|
||||
error('You have recently deleted 3 torrents. Please contact a staff member if you need to delete more.');
|
||||
}
|
||||
$_SESSION['logged_user']['multi_delete']++;
|
||||
} else {
|
||||
$_SESSION['logged_user']['multi_delete'] = 1;
|
||||
}
|
||||
|
||||
$InfoHash = unpack("H*", $InfoHash);
|
||||
$InfoHash = unpack('H*', $InfoHash);
|
||||
Torrents::delete_torrent($TorrentID, $GroupID);
|
||||
Misc::write_log('Torrent '.$TorrentID.' ('.$Name.') ('.number_format($Size / (1024 * 1024), 2).' MB) ('.strtoupper($InfoHash[1]).') was deleted by '.$LoggedUser['Username'].': ' .$_POST['reason'].' '.$_POST['extra']);
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], "deleted torrent (".number_format($Size / (1024 * 1024), 2)." MB, ".strtoupper($InfoHash[1]).") for reason: ".$_POST['reason']." ".$_POST['extra'], 0);
|
||||
Misc::write_log("Torrent $TorrentID ($Name) (".number_format($Size / (1024 * 1024), 2).' MB) ('.strtoupper($InfoHash[1]).') was deleted by '.$LoggedUser['Username'].': ' .$_POST['reason'].' '.$_POST['extra']);
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], 'deleted torrent ('.number_format($Size / (1024 * 1024), 2).' MB, '.strtoupper($InfoHash[1]).') for reason: '.$_POST['reason'].' '.$_POST['extra'], 0);
|
||||
|
||||
View::show_header('Torrent deleted');
|
||||
?>
|
||||
|
@ -80,7 +80,10 @@
|
||||
//******************************************************************************//
|
||||
//--------------- Validate data in edit form -----------------------------------//
|
||||
|
||||
$DB->query('SELECT UserID, Remastered, RemasterYear, FreeTorrent FROM torrents WHERE ID='.$TorrentID);
|
||||
$DB->query("
|
||||
SELECT UserID, Remastered, RemasterYear, FreeTorrent
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
if ($DB->record_count() == 0) {
|
||||
error(404);
|
||||
}
|
||||
@ -254,12 +257,15 @@
|
||||
//--------------- Start database stuff -----------------------------------------//
|
||||
|
||||
$DBTorVals = array();
|
||||
$DB->query("SELECT Media, Format, Encoding, RemasterYear, Remastered, RemasterTItle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, Description FROM torrents WHERE ID = ".$TorrentID);
|
||||
$DB->query("
|
||||
SELECT Media, Format, Encoding, RemasterYear, Remastered, RemasterTItle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, Description
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
$DBTorVals = $DB->to_array(false, MYSQLI_ASSOC);
|
||||
$DBTorVals = $DBTorVals[0];
|
||||
$LogDetails = "";
|
||||
$LogDetails = '';
|
||||
foreach ($DBTorVals as $Key => $Value) {
|
||||
$Value = "'".$Value."'";
|
||||
$Value = "'$Value'";
|
||||
if ($Value != $T[$Key]) {
|
||||
if (!isset($T[$Key])) {
|
||||
continue;
|
||||
@ -267,17 +273,18 @@
|
||||
if ((empty($Value) && empty($T[$Key])) || ($Value == "'0'" && $T[$Key] == "''")) {
|
||||
continue;
|
||||
}
|
||||
if ($LogDetails == "") {
|
||||
$LogDetails = $Key.": ".$Value." -> ".$T[$Key];
|
||||
if ($LogDetails == '') {
|
||||
$LogDetails = "$Key: $Value -> ".$T[$Key];
|
||||
} else {
|
||||
$LogDetails = $LogDetails.", ".$Key.": ".$Value." -> ".$T[$Key];
|
||||
$LogDetails = "$LogDetails, $Key: $Value -> ".$T[$Key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update info for the torrent
|
||||
$SQL = "
|
||||
UPDATE torrents SET
|
||||
UPDATE torrents
|
||||
SET
|
||||
Media = $T[Media],
|
||||
Format = $T[Format],
|
||||
Encoding = $T[Encoding],
|
||||
@ -298,135 +305,213 @@
|
||||
if ($T[Format] != "'FLAC'") {
|
||||
$SQL .= "
|
||||
HasLog = '0',
|
||||
HasCue='0',
|
||||
";
|
||||
HasCue = '0',";
|
||||
} else {
|
||||
$SQL .= "
|
||||
HasLog = $T[HasLog],
|
||||
HasCue=$T[HasCue],
|
||||
";
|
||||
HasCue = $T[HasCue],";
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM torrents_bad_tags WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_bad_tags
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($btID) = $DB->next_record();
|
||||
|
||||
if (!$btID && $Properties['BadTags']) {
|
||||
$DB->query("INSERT INTO torrents_bad_tags VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_bad_tags
|
||||
VALUES ($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
}
|
||||
if ($btID && !$Properties['BadTags']) {
|
||||
$DB->query("DELETE FROM torrents_bad_tags WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_tags
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM torrents_bad_folders WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_bad_folders
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($bfID) = $DB->next_record();
|
||||
|
||||
if (!$bfID && $Properties['BadFolders']) {
|
||||
$DB->query("INSERT INTO torrents_bad_folders VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_bad_folders
|
||||
VALUES ($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
}
|
||||
if ($bfID && !$Properties['BadFolders']) {
|
||||
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_folders
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM torrents_bad_files WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_bad_files
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($bfiID) = $DB->next_record();
|
||||
|
||||
if (!$bfiID && $Properties['BadFiles']) {
|
||||
$DB->query("INSERT INTO torrents_bad_files VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_bad_files
|
||||
VALUES ($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
}
|
||||
if ($bfiID && !$Properties['BadFiles']) {
|
||||
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_bad_files
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM library_contest WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM library_contest
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($lbID) = $DB->next_record();
|
||||
if (!$lbID && $Properties['LibraryUpload'] && $Properties['LibraryPoints'] > 0) {
|
||||
$DB->query("SELECT UserID FROM torrents WHERE ID = ".$TorrentID);
|
||||
$DB->query("
|
||||
SELECT UserID
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
list($UploaderID) = $DB->next_record();
|
||||
$DB->query("INSERT INTO library_contest VALUES ($UploaderID, $TorrentID, $Properties[LibraryPoints])");
|
||||
$DB->query("
|
||||
INSERT INTO library_contest
|
||||
VALUES ($UploaderID, $TorrentID, $Properties[LibraryPoints])");
|
||||
}
|
||||
if ($lbID && !$Properties['LibraryUpload']) {
|
||||
$DB->query("DELETE FROM library_contest WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM library_contest
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_cassette_approved
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($caID) = $DB->next_record();
|
||||
|
||||
if (!$caID && $Properties['CassetteApproved']) {
|
||||
$DB->query("INSERT INTO torrents_cassette_approved VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_cassette_approved
|
||||
VALUES ($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
}
|
||||
if ($caID && !$Properties['CassetteApproved']) {
|
||||
$DB->query("DELETE FROM torrents_cassette_approved WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_cassette_approved
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_lossymaster_approved
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($lmaID) = $DB->next_record();
|
||||
|
||||
if (!$lmaID && $Properties['LossymasterApproved']) {
|
||||
$DB->query("INSERT INTO torrents_lossymaster_approved VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_lossymaster_approved
|
||||
VALUES ($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
}
|
||||
if ($lmaID && !$Properties['LossymasterApproved']) {
|
||||
$DB->query("DELETE FROM torrents_lossymaster_approved WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_lossymaster_approved
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
|
||||
$DB->query("SELECT TorrentID FROM torrents_lossyweb_approved WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_lossyweb_approved
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
list($lwID) = $DB->next_record();
|
||||
if (!$lwID && $Properties['LossywebApproved']) {
|
||||
$DB->query("INSERT INTO torrents_lossyweb_approved VALUES($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
$DB->query("
|
||||
INSERT INTO torrents_lossyweb_approved
|
||||
VALUES ($TorrentID, $LoggedUser[ID], '".sqltime()."')");
|
||||
}
|
||||
if ($lwID && !$Properties['LossywebApproved']) {
|
||||
$DB->query("DELETE FROM torrents_lossyweb_approved WHERE TorrentID='$TorrentID'");
|
||||
$DB->query("
|
||||
DELETE FROM torrents_lossyweb_approved
|
||||
WHERE TorrentID = '$TorrentID'");
|
||||
}
|
||||
}
|
||||
|
||||
$SQL .= "
|
||||
flags = '2'
|
||||
WHERE ID=$TorrentID
|
||||
";
|
||||
WHERE ID = $TorrentID";
|
||||
$DB->query($SQL);
|
||||
|
||||
if (check_perms('torrents_freeleech') && $Properties['FreeLeech'] != $CurFreeLeech) {
|
||||
Torrents::freeleech_torrents($TorrentID, $Properties['FreeLeech'], $Properties['FreeLeechType']);
|
||||
}
|
||||
|
||||
$DB->query("SELECT GroupID, Time FROM torrents WHERE ID='$TorrentID'");
|
||||
$DB->query("
|
||||
SELECT GroupID, Time
|
||||
FROM torrents
|
||||
WHERE ID = '$TorrentID'");
|
||||
list($GroupID, $Time) = $DB->next_record();
|
||||
|
||||
// Competition
|
||||
if (strtotime($Time) > 1241352173) {
|
||||
if ($_POST['log_score'] == '100') {
|
||||
$DB->query("INSERT IGNORE into users_points (GroupID, UserID, Points) VALUES ('$GroupID', '$UserID', '1')");
|
||||
$DB->query("
|
||||
INSERT IGNORE into users_points (GroupID, UserID, Points)
|
||||
VALUES ('$GroupID', '$UserID', '1')");
|
||||
}
|
||||
}
|
||||
// End competiton
|
||||
|
||||
$DB->query("SELECT LogScore FROM torrents WHERE ID = ".$TorrentID);
|
||||
$DB->query("
|
||||
SELECT LogScore
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
list($LogScore) = $DB->next_record();
|
||||
if ($Properties['Trumpable'] == 1 && $LogScore == 100) {
|
||||
$DB->query("UPDATE torrents SET LogScore = 99 WHERE ID = ".$TorrentID);
|
||||
$DB->query("
|
||||
UPDATE torrents
|
||||
SET LogScore = 99
|
||||
WHERE ID = $TorrentID");
|
||||
$Results = array();
|
||||
$Results[] = "The original uploader has chosen to allow this log to be deducted one point for using EAC v0.95., -1 point [1]";
|
||||
$Results[] = 'The original uploader has chosen to allow this log to be deducted one point for using EAC v0.95., -1 point [1]';
|
||||
$Details = db_string(serialize($Results));
|
||||
$DB->query("UPDATE torrents_logs_new SET Score = 99, Details = '".$Details."' WHERE TorrentID = ".$TorrentID);
|
||||
$DB->query("
|
||||
UPDATE torrents_logs_new
|
||||
SET Score = 99, Details = '$Details'
|
||||
WHERE TorrentID = $TorrentID");
|
||||
}
|
||||
|
||||
$DB->query("SELECT Enabled FROM users_main WHERE ID =".$UserID);
|
||||
$DB->query("
|
||||
SELECT Enabled
|
||||
FROM users_main
|
||||
WHERE ID = $UserID");
|
||||
list($Enabled) = $DB->next_record();
|
||||
if ($Properties['Trumpable'] == 0 && $LogScore == 99 && $Enabled == 1 && strtotime($Time) < 1284422400) {
|
||||
$DB->query("SELECT Log FROM torrents_logs_new WHERE TorrentID = ".$TorrentID);
|
||||
$DB->query("
|
||||
SELECT Log
|
||||
FROM torrents_logs_new
|
||||
WHERE TorrentID = $TorrentID");
|
||||
list($Log) = $DB->next_record();
|
||||
if (strpos($Log, "EAC extraction") === 0) {
|
||||
$DB->query("UPDATE torrents SET LogScore = 100 WHERE ID = ".$TorrentID);
|
||||
$DB->query("UPDATE torrents_logs_new SET Score = 100, Details = '' WHERE TorrentID = ".$TorrentID);
|
||||
if (strpos($Log, 'EAC extraction') === 0) {
|
||||
$DB->query("
|
||||
UPDATE torrents
|
||||
SET LogScore = 100
|
||||
WHERE ID = $TorrentID");
|
||||
$DB->query("
|
||||
UPDATE torrents_logs_new
|
||||
SET Score = 100, Details = ''
|
||||
WHERE TorrentID = $TorrentID");
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("SELECT Name FROM torrents_group WHERE ID=$GroupID");
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM torrents_group
|
||||
WHERE ID = $GroupID");
|
||||
list($Name) = $DB->next_record(MYSQLI_NUM, false);
|
||||
|
||||
Misc::write_log("Torrent $TorrentID ($Name) in group $GroupID was edited by ".$LoggedUser['Username']." (".$LogDetails.")"); // TODO: this is probably broken
|
||||
Misc::write_log("Torrent $TorrentID ($Name) in group $GroupID was edited by ".$LoggedUser['Username']." ($LogDetails)"); // TODO: this is probably broken
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $LogDetails, 0);
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
// All done!
|
||||
|
@ -41,7 +41,10 @@
|
||||
//******************************************************************************//
|
||||
//--------------- Send PMs to users --------------------------------------------//
|
||||
|
||||
$DB->query('SELECT uid FROM xbt_snatched WHERE fid='.$TorrentID);
|
||||
$DB->query("
|
||||
SELECT uid
|
||||
FROM xbt_snatched
|
||||
WHERE fid = $TorrentID");
|
||||
|
||||
if ($DB->record_count() > 0) {
|
||||
// Save this because send_pm uses $DB to run its own query... Oops...
|
||||
|
@ -48,12 +48,19 @@
|
||||
<?
|
||||
View::show_footer();
|
||||
} else {
|
||||
$DB->query("SELECT ArtistID, AliasID, Redirect, Name FROM artists_alias WHERE Name = '$ArtistName'");
|
||||
$DB->query("
|
||||
SELECT ArtistID, AliasID, Redirect, Name
|
||||
FROM artists_alias
|
||||
WHERE Name = '$ArtistName'");
|
||||
if ($DB->record_count() == 0) {
|
||||
$Redirect = 0;
|
||||
$DB->query("INSERT INTO artists_group (Name) VALUES ('$ArtistName')");
|
||||
$DB->query("
|
||||
INSERT INTO artists_group (Name)
|
||||
VALUES ('$ArtistName')");
|
||||
$ArtistID = $DB->inserted_id();
|
||||
$DB->query("INSERT INTO artists_alias (ArtistID, Name) VALUES ('$ArtistID', '$ArtistName')");
|
||||
$DB->query("
|
||||
INSERT INTO artists_alias (ArtistID, Name)
|
||||
VALUES ('$ArtistID', '$ArtistName')");
|
||||
$AliasID = $DB->inserted_id();
|
||||
} else {
|
||||
list($ArtistID, $AliasID, $Redirect, $ArtistName) = $DB->next_record();
|
||||
@ -62,22 +69,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO torrents_group
|
||||
$DB->query("
|
||||
INSERT INTO torrents_group
|
||||
(ArtistID, NumArtists, CategoryID, Name, Year, Time, WikiBody, WikiImage, SearchText)
|
||||
VALUES
|
||||
($ArtistID, '1', '1', '$Title', '$Year', '".sqltime()."', '', '', '$SearchText')");
|
||||
$GroupID = $DB->inserted_id();
|
||||
|
||||
$DB->query("INSERT INTO torrents_artists
|
||||
(GroupID, ArtistID, AliasID, Importance, UserID) VALUES
|
||||
$DB->query("
|
||||
INSERT INTO torrents_artists
|
||||
(GroupID, ArtistID, AliasID, Importance, UserID)
|
||||
VALUES
|
||||
('$GroupID', '$ArtistID', '$AliasID', '1', '$LoggedUser[ID]')");
|
||||
|
||||
$DB->query("UPDATE torrents SET
|
||||
GroupID='$GroupID'
|
||||
$DB->query("
|
||||
UPDATE torrents
|
||||
SET GroupID = '$GroupID'
|
||||
WHERE ID = '$TorrentID'");
|
||||
|
||||
// Delete old group if needed
|
||||
$DB->query("SELECT ID FROM torrents WHERE GroupID='$OldGroupID'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents
|
||||
WHERE GroupID = '$OldGroupID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
Torrents::delete_group($OldGroupID);
|
||||
} else {
|
||||
@ -86,7 +100,7 @@
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
|
||||
$Cache->delete_value('torrent_download_'.$TorrentID);
|
||||
$Cache->delete_value("torrent_download_$TorrentID");
|
||||
|
||||
Misc::write_log("Torrent $TorrentID was edited by " . $LoggedUser['Username']);
|
||||
|
||||
|
@ -42,16 +42,24 @@
|
||||
$ThisInsert['TotalSize'] = $ExtraTotalSize;
|
||||
|
||||
$Debug->set_flag('upload: torrent decoded');
|
||||
$DB->query("SELECT ID FROM torrents WHERE info_hash='" . db_string($ThisInsert['InfoHash']) . "'");
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM torrents
|
||||
WHERE info_hash = '" . db_string($ThisInsert['InfoHash']) . "'");
|
||||
if ($DB->record_count() > 0) {
|
||||
list($ExtraID) = $DB->next_record();
|
||||
$DB->query('SELECT TorrentID FROM torrents_files WHERE TorrentID = ' . $ExtraID);
|
||||
$DB->query("
|
||||
SELECT TorrentID
|
||||
FROM torrents_files
|
||||
WHERE TorrentID = $ExtraID");
|
||||
if ($DB->record_count() > 0) {
|
||||
$Err = '<a href="torrents.php?torrentid=' . $ExtraID . '">The exact same torrent file already exists on the site!</a>';
|
||||
$Err = "<a href=\"torrents.php?torrentid=$ExtraID\">The exact same torrent file already exists on the site!</a>";
|
||||
} else {
|
||||
//One of the lost torrents.
|
||||
$DB->query("INSERT INTO torrents_files (TorrentID, File) VALUES ($ExtraID, '$ThisInsert[TorEnc]')");
|
||||
$Err = "<a href=\"torrents.php?torrentid=$ExtraID\">Thank you for fixing this torrent</a>";
|
||||
$DB->query("
|
||||
INSERT INTO torrents_files (TorrentID, File)
|
||||
VALUES ($ExtraID, '$ThisInsert[TorEnc]')");
|
||||
$Err = "<a href=\"torrents.php?torrentid=$ExtraID\">Thank you for fixing this torrent.</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,11 @@
|
||||
|
||||
$GenreTags = $Cache->get_value('genre_tags');
|
||||
if (!$GenreTags) {
|
||||
$DB->query("SELECT Name FROM tags WHERE TagType='genre' ORDER BY Name");
|
||||
$DB->query("
|
||||
SELECT Name
|
||||
FROM tags
|
||||
WHERE TagType = 'genre'
|
||||
ORDER BY Name");
|
||||
$GenreTags = $DB->collect('Name');
|
||||
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
|
||||
}
|
||||
|
@ -581,7 +581,7 @@
|
||||
foreach ($Artists as $Num => $Artist) {
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO torrents_artists (GroupID, ArtistID, AliasID, UserID, Importance)
|
||||
VALUES ($GroupID, ".$Artist['id'].", ".$Artist['aliasid'].", ".$LoggedUser['ID'].", '$Importance')");
|
||||
VALUES ($GroupID, ".$Artist['id'].', '.$Artist['aliasid'].', '.$LoggedUser['ID'].", '$Importance')");
|
||||
$Cache->increment('stats_album_count');
|
||||
}
|
||||
}
|
||||
@ -593,11 +593,14 @@
|
||||
UPDATE torrents_group
|
||||
SET Time = '".sqltime()."'
|
||||
WHERE ID = $GroupID");
|
||||
$Cache->delete_value('torrent_group_'.$GroupID);
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('detail_files_'.$GroupID);
|
||||
$Cache->delete_value("torrent_group_$GroupID");
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
$Cache->delete_value("detail_files_$GroupID");
|
||||
if ($Type == 'Music') {
|
||||
$DB->query("SELECT ReleaseType FROM torrents_group WHERE ID='$GroupID'");
|
||||
$DB->query("
|
||||
SELECT ReleaseType
|
||||
FROM torrents_group
|
||||
WHERE ID = '$GroupID'");
|
||||
list($Properties['ReleaseType']) = $DB->next_record();
|
||||
}
|
||||
}
|
||||
@ -654,8 +657,8 @@
|
||||
INSERT INTO torrents
|
||||
(GroupID, UserID, Media, Format, Encoding,
|
||||
Remastered, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber,
|
||||
Scene, HasLog, HasCue, info_hash, FileCount, FileList, FilePath, Size, Time,
|
||||
Description, LogScore, FreeTorrent, FreeLeechType)
|
||||
Scene, HasLog, HasCue, info_hash, FileCount, FileList, FilePath,
|
||||
Size, Time, Description, LogScore, FreeTorrent, FreeLeechType)
|
||||
VALUES
|
||||
($GroupID, $LoggedUser[ID], $T[Media], $T[Format], $T[Encoding], " .
|
||||
"$T[Remastered], $T[RemasterYear], $T[RemasterTitle], $T[RemasterRecordLabel], $T[RemasterCatalogueNumber], " .
|
||||
@ -670,7 +673,7 @@
|
||||
|
||||
// Prevent deletion of this torrent until the rest of the upload process is done
|
||||
// (expire the key after 10 minutes to prevent locking it for too long in case there's a fatal error below)
|
||||
$Cache->cache_value('torrent_'.$TorrentID.'_lock', true, 600);
|
||||
$Cache->cache_value("torrent_{$TorrentID}_lock", true, 600);
|
||||
|
||||
//******************************************************************************//
|
||||
//--------------- Write torrent file -------------------------------------------//
|
||||
@ -678,7 +681,7 @@
|
||||
$DB->query("
|
||||
INSERT INTO torrents_files (TorrentID, File)
|
||||
VALUES ($TorrentID, '$TorEnc')");
|
||||
Misc::write_log("Torrent $TorrentID ($LogName) (".number_format($TotalSize / (1024 * 1024), 2)." MB) was uploaded by " . $LoggedUser['Username']);
|
||||
Misc::write_log("Torrent $TorrentID ($LogName) (".number_format($TotalSize / (1024 * 1024), 2).' MB) was uploaded by ' . $LoggedUser['Username']);
|
||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], 'uploaded ('.number_format($TotalSize / (1024 * 1024), 2).' MB)', 0);
|
||||
|
||||
Torrents::update_hash($GroupID);
|
||||
@ -723,7 +726,7 @@
|
||||
array_pop($RecentUploads);
|
||||
}
|
||||
array_unshift($RecentUploads, array('ID' => $GroupID, 'Name' => trim($Properties['Title']), 'Artist' => Artists::display_artists($ArtistForm, false, true), 'WikiImage' => trim($Properties['Image'])));
|
||||
$Cache->cache_value('recent_uploads_'.$UserID, $RecentUploads, 0);
|
||||
$Cache->cache_value("recent_uploads_$UserID", $RecentUploads, 0);
|
||||
} while (0);
|
||||
}
|
||||
}
|
||||
@ -732,8 +735,10 @@
|
||||
//--------------- Contest ------------------------------------------------------//
|
||||
if ($Properties['LibraryImage'] != '') {
|
||||
$DB->query("
|
||||
INSERT INTO reportsv2 (ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, Track, Image, ExtraID, Link)
|
||||
VALUES (0, $TorrentID, 'library', '".db_string(($Properties['MultiDisc'] ? 'Multi-disc' : ''))."', 'New', '".sqltime()."', '', '".db_string($Properties['LibraryImage'])."', '', '')");
|
||||
INSERT INTO reportsv2
|
||||
(ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, Track, Image, ExtraID, Link)
|
||||
VALUES
|
||||
(0, $TorrentID, 'library', '".db_string(($Properties['MultiDisc'] ? 'Multi-disc' : ''))."', 'New', '".sqltime()."', '', '".db_string($Properties['LibraryImage'])."', '', '')");
|
||||
}
|
||||
|
||||
//******************************************************************************//
|
||||
@ -778,7 +783,7 @@
|
||||
$Announce .= ' ['.$ReleaseTypes[$Properties['ReleaseType']].']';
|
||||
}
|
||||
$Announce .= ' - ';
|
||||
$Announce .= trim($Properties['Format'])." / ".trim($Properties['Bitrate']);
|
||||
$Announce .= trim($Properties['Format']).' / '.trim($Properties['Bitrate']);
|
||||
if ($HasLog == 1) {
|
||||
$Announce .= ' / Log';
|
||||
}
|
||||
@ -798,7 +803,7 @@
|
||||
}
|
||||
$Title = $Announce;
|
||||
|
||||
$AnnounceSSL = $Announce . " - https://".SSL_SITE_URL."/torrents.php?id=$GroupID / https://".SSL_SITE_URL."/torrents.php?action=download&id=$TorrentID";
|
||||
$AnnounceSSL = "$Announce - https://".SSL_SITE_URL."/torrents.php?id=$GroupID / https://".SSL_SITE_URL."/torrents.php?action=download&id=$TorrentID";
|
||||
$Announce .= " - https://".SSL_SITE_URL."/torrents.php?id=$GroupID / https://".SSL_SITE_URL."/torrents.php?action=download&id=$TorrentID";
|
||||
|
||||
$AnnounceSSL .= ' - '.trim($Properties['TagList']);
|
||||
@ -864,23 +869,22 @@
|
||||
// Don't add notification if >2 main artists or if tracked artist isn't a main artist
|
||||
if (count($ArtistNameList) > 2 || $Artist['name'] == 'Various Artists') {
|
||||
$SQL .= " AND (ExcludeVA = '0' AND (";
|
||||
$SQL.= implode(" OR ", array_merge($ArtistNameList,$GuestArtistNameList));
|
||||
$SQL .= implode(' OR ', array_merge($ArtistNameList, $GuestArtistNameList));
|
||||
$SQL .= " OR Artists = '')) AND (";
|
||||
} else {
|
||||
$SQL .= " AND (";
|
||||
if (!empty($GuestArtistNameList)) {
|
||||
$SQL .= "(ExcludeVA = '0' AND (";
|
||||
$SQL.= implode(" OR ", $GuestArtistNameList);
|
||||
$SQL.= ")) OR ";
|
||||
$SQL .= implode(' OR ', $GuestArtistNameList);
|
||||
$SQL .= ')) OR ';
|
||||
}
|
||||
$SQL.= implode(" OR ", $ArtistNameList);
|
||||
$SQL .= implode(' OR ', $ArtistNameList);
|
||||
$SQL .= " OR Artists = '') AND (";
|
||||
}
|
||||
} else {
|
||||
$SQL .= "AND (Artists = '') AND (";
|
||||
}
|
||||
|
||||
|
||||
reset($Tags);
|
||||
$TagSQL = array();
|
||||
$NotTagSQL = array();
|
||||
@ -891,7 +895,7 @@
|
||||
$TagSQL[] = "Tags = ''";
|
||||
$SQL .= implode(' OR ', $TagSQL);
|
||||
|
||||
$SQL.= ") AND !(".implode(' OR ', $NotTagSQL).")";
|
||||
$SQL .= ") AND !(".implode(' OR ', $NotTagSQL).')';
|
||||
|
||||
$SQL .= " AND (Categories LIKE '%|".db_string(trim($Type))."|%' OR Categories = '') ";
|
||||
|
||||
@ -952,7 +956,10 @@
|
||||
}
|
||||
$SQL .= " AND UserID != '".$LoggedUser['ID']."' ";
|
||||
|
||||
$DB->query("SELECT Paranoia FROM users_main WHERE ID = $LoggedUser[ID]");
|
||||
$DB->query("
|
||||
SELECT Paranoia
|
||||
FROM users_main
|
||||
WHERE ID = $LoggedUser[ID]");
|
||||
list($Paranoia) = $DB->next_record();
|
||||
$Paranoia = unserialize($Paranoia);
|
||||
if (!is_array($Paranoia)) {
|
||||
@ -977,8 +984,8 @@
|
||||
foreach ($UserArray as $User) {
|
||||
list($FilterID, $UserID, $Passkey) = $User;
|
||||
$Rows[] = "('$UserID', '$GroupID', '$TorrentID', '$FilterID')";
|
||||
$Feed->populate('torrents_notify_'.$Passkey,$Item);
|
||||
$Cache->delete_value('notifications_new_'.$UserID);
|
||||
$Feed->populate("torrents_notify_$Passkey", $Item);
|
||||
$Cache->delete_value("notifications_new_$UserID");
|
||||
}
|
||||
$InsertSQL .= implode(',', $Rows);
|
||||
$DB->query($InsertSQL);
|
||||
@ -986,7 +993,7 @@
|
||||
|
||||
foreach ($FilterArray as $Filter) {
|
||||
list($FilterID, $UserID, $Passkey) = $Filter;
|
||||
$Feed->populate('torrents_notify_'.$FilterID.'_'.$Passkey,$Item);
|
||||
$Feed->populate("torrents_notify_{$FilterID}_$Passkey", $Item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -997,7 +1004,7 @@
|
||||
JOIN bookmarks_torrents AS b ON b.UserID = u.ID
|
||||
WHERE b.GroupID = $GroupID");
|
||||
while (list($UserID, $Passkey) = $DB->next_record()) {
|
||||
$Feed->populate('torrents_bookmarks_t_'.$Passkey, $Item);
|
||||
$Feed->populate("torrents_bookmarks_t_$Passkey", $Item);
|
||||
}
|
||||
|
||||
$Feed->populate('torrents_all', $Item);
|
||||
@ -1039,8 +1046,8 @@
|
||||
$Feed->populate('torrents_comics', $Item);
|
||||
}
|
||||
|
||||
// Clear Cache
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
// Clear cache
|
||||
$Cache->delete_value("torrents_details_$GroupID");
|
||||
|
||||
// Allow deletion of this torrent now
|
||||
$Cache->delete_value('torrent_'.$TorrentID.'_lock');
|
||||
$Cache->delete_value("torrent_{$TorrentID}_lock");
|
||||
|
@ -201,11 +201,11 @@ function checked($Checked) {
|
||||
<div id="sortable_container" style="display: none;">
|
||||
<a href="#" id="reset_sortable" class="brackets">Reset to default</a>
|
||||
<ul class="sortable_list" id="sortable">
|
||||
<?Users::release_order()?>
|
||||
<?Users::release_order($SiteOptions)?>
|
||||
</ul>
|
||||
<p><small>Note: Checked items will be hidden.</small></p>
|
||||
<script type="text/javascript" id="sortable_default">//<![CDATA[
|
||||
var sortable_list_default = <?=Users::release_order_default_js()?>;
|
||||
var sortable_list_default = <?=Users::release_order_default_js($SiteOptions)?>;
|
||||
//]]>
|
||||
</script>
|
||||
</div>
|
||||
@ -266,11 +266,11 @@ function checked($Checked) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><strong>Auto Complete</strong></td>
|
||||
<td class="label"><strong>Auto completion</strong></td>
|
||||
<td>
|
||||
<select name="autocomplete">
|
||||
<option value="0"<? if (empty($SiteOptions['AutoComplete'])) { ?> selected="selected"<? } ?>>Everywhere</option>
|
||||
<option value="2" <? if ($SiteOptions['AutoComplete'] === 2) { ?>selected="selected" <? } ?>>Searches Only</option>
|
||||
<option value="2"<? if ($SiteOptions['AutoComplete'] === 2) { ?> selected="selected"<? } ?>>Searches only</option>
|
||||
<option value="1"<? if ($SiteOptions['AutoComplete'] === 1) { ?> selected="selected"<? } ?>>Disable</option>
|
||||
</select>
|
||||
</td>
|
||||
|
@ -1,17 +1,21 @@
|
||||
<?
|
||||
authorize();
|
||||
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query('SELECT TopicID FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$DB->query('
|
||||
SELECT TopicID
|
||||
FROM users_subscriptions
|
||||
WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
if ($UserSubscriptions = $DB->collect(0)) {
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
|
||||
}
|
||||
}
|
||||
if (!empty($UserSubscriptions)) {
|
||||
$DB->query("INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
|
||||
SELECT '$LoggedUser[ID]', ID, LastPostID FROM
|
||||
forums_topics
|
||||
WHERE ID IN (".implode(',',$UserSubscriptions).")
|
||||
ON DUPLICATE KEY UPDATE PostID=LastPostID");
|
||||
$DB->query("
|
||||
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
|
||||
SELECT '$LoggedUser[ID]', ID, LastPostID
|
||||
FROM forums_topics
|
||||
WHERE ID IN (".implode(',', $UserSubscriptions).')
|
||||
ON DUPLICATE KEY UPDATE PostID = LastPostID');
|
||||
}
|
||||
$Cache->delete_value('subscriptions_user_new_'.$LoggedUser['ID']);
|
||||
header('Location: userhistory.php?action=subscriptions');
|
||||
|
@ -9,20 +9,30 @@
|
||||
$CollageID = (int) $_GET['collageid'];
|
||||
|
||||
if (!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
|
||||
$DB->query('SELECT CollageID FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$DB->query('
|
||||
SELECT CollageID
|
||||
FROM users_collage_subs
|
||||
WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
|
||||
}
|
||||
|
||||
if (($Key = array_search($CollageID, $UserSubscriptions)) !== false) {
|
||||
$DB->query('DELETE FROM users_collage_subs WHERE UserID = '.db_string($LoggedUser['ID']).' AND CollageID = '.$CollageID);
|
||||
$DB->query('
|
||||
DELETE FROM users_collage_subs
|
||||
WHERE UserID = '.db_string($LoggedUser['ID'])."
|
||||
AND CollageID = $CollageID");
|
||||
unset($UserSubscriptions[$Key]);
|
||||
Collages::decrease_subscriptions($CollageID);
|
||||
} else {
|
||||
$DB->query("INSERT IGNORE INTO users_collage_subs (UserID, CollageID, LastVisit) VALUES ($LoggedUser[ID], ".$CollageID.", NOW())");
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO users_collage_subs
|
||||
(UserID, CollageID, LastVisit)
|
||||
VALUES
|
||||
($LoggedUser[ID], $CollageID, NOW())");
|
||||
array_push($UserSubscriptions, $CollageID);
|
||||
Collages::increase_subscriptions($CollageID);
|
||||
}
|
||||
$Cache->replace_value('collage_subs_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
|
||||
$Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);
|
||||
$Cache->delete_value('collage_'.$CollageID);
|
||||
$Cache->delete_value("collage_$CollageID");
|
||||
|
@ -30,7 +30,10 @@
|
||||
|
||||
$UsersOnly = $_GET['usersonly'];
|
||||
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID = ".$UserID);
|
||||
$DB->query("
|
||||
SELECT Username
|
||||
FROM users_main
|
||||
WHERE ID = $UserID");
|
||||
list($Username)= $DB->next_record();
|
||||
View::show_header("Email history for $Username");
|
||||
|
||||
@ -44,7 +47,8 @@
|
||||
FROM users_main AS u
|
||||
LEFT JOIN users_main AS u2 ON u2.Email = u.Email AND u2.ID != '$UserID'
|
||||
LEFT JOIN geoip_country AS c ON INET_ATON(u.IP) BETWEEN c.StartIP AND c.EndIP
|
||||
WHERE u.ID='$UserID' AND u2.ID > 0
|
||||
WHERE u.ID = '$UserID'
|
||||
AND u2.ID > 0
|
||||
UNION
|
||||
SELECT
|
||||
h.Email,
|
||||
@ -54,7 +58,9 @@
|
||||
FROM users_history_emails AS h
|
||||
LEFT JOIN users_history_emails AS h2 ON h2.email = h.email and h2.UserID != '$UserID'
|
||||
LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
|
||||
WHERE h.UserID='$UserID' AND h2.UserID>0"/*AND Time != '0000-00-00 00:00:00'*/."
|
||||
WHERE h.UserID = '$UserID'
|
||||
AND h2.UserID > 0"
|
||||
/*AND Time != '0000-00-00 00:00:00'*/."
|
||||
ORDER BY Time DESC");
|
||||
} else {
|
||||
$DB->query("
|
||||
@ -74,7 +80,8 @@
|
||||
c.Code
|
||||
FROM users_history_emails AS h
|
||||
LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
|
||||
WHERE UserID='$UserID' "/*AND Time != '0000-00-00 00:00:00'*/."
|
||||
WHERE UserID = '$UserID' "
|
||||
/*AND Time != '0000-00-00 00:00:00'*/."
|
||||
ORDER BY Time DESC");
|
||||
}
|
||||
$History = $DB->to_array();
|
||||
@ -124,8 +131,12 @@
|
||||
<td />
|
||||
<td><?=time_diff($Time)?></td>
|
||||
<td><?=display_str($IP)?></td>
|
||||
<? $UserURL = "https://".SSL_SITE_URL."/user.php?id=$UserID2";
|
||||
$DB->query("SELECT Enabled FROM users_main WHERE ID = ".$UserID2);
|
||||
<?
|
||||
$UserURL = 'https://'.SSL_SITE_URL."/user.php?id=$UserID2";
|
||||
$DB->query("
|
||||
SELECT Enabled
|
||||
FROM users_main
|
||||
WHERE ID = $UserID2");
|
||||
list($Enabled) = $DB->next_record();
|
||||
$DB->set_query_id($ueQuery);
|
||||
?>
|
||||
|
@ -31,7 +31,10 @@
|
||||
|
||||
$UsersOnly = $_GET['usersonly'];
|
||||
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID = ".$UserID);
|
||||
$DB->query("
|
||||
SELECT Username
|
||||
FROM users_main
|
||||
WHERE ID = $UserID");
|
||||
list($Username)= $DB->next_record();
|
||||
View::show_header("Email history for $Username");
|
||||
|
||||
@ -49,7 +52,8 @@
|
||||
GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor,
|
||||
GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned
|
||||
FROM users_main AS m
|
||||
LEFT JOIN users_history_emails AS h ON h.Email=m.Email AND h.UserID != m.ID
|
||||
LEFT JOIN users_history_emails AS h ON h.Email = m.Email
|
||||
AND h.UserID != m.ID
|
||||
LEFT JOIN users_main AS m2 ON m2.ID = h.UserID
|
||||
LEFT JOIN users_info AS i ON i.UserID = h.UserID
|
||||
WHERE m.ID = '$UserID'"
|
||||
@ -70,7 +74,8 @@
|
||||
i2.Donor AS UsersDonor,
|
||||
i2.Warned AS UsersWarned
|
||||
FROM users_history_emails AS h2
|
||||
LEFT JOIN users_history_emails AS h3 ON h3.Email=h2.Email AND h3.UserID != h2.UserID
|
||||
LEFT JOIN users_history_emails AS h3 ON h3.Email = h2.Email
|
||||
AND h3.UserID != h2.UserID
|
||||
LEFT JOIN users_main AS m3 ON m3.ID = h3.UserID
|
||||
LEFT JOIN users_info AS i2 ON i2.UserID = h3.UserID
|
||||
WHERE h2.UserID = '$UserID'
|
||||
@ -107,7 +112,9 @@
|
||||
$Invite['EndTime'] = $Joined;
|
||||
$Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
|
||||
$Invite['IP'] = $History[0]['IP'];
|
||||
if ($Current['StartTime'] == '0000-00-00 00:00:00') { $Current['StartTime'] = $Joined; }
|
||||
if ($Current['StartTime'] == '0000-00-00 00:00:00') {
|
||||
$Current['StartTime'] = $Joined;
|
||||
}
|
||||
} else {
|
||||
foreach ($History as $Key => $Val) {
|
||||
if ($History[$Key + 1]['Time'] == '0000-00-00 00:00:00' && $Val['Time'] != '0000-00-00 00:00:00') {
|
||||
@ -281,7 +288,7 @@
|
||||
<td>Start</td>
|
||||
<td>End</td>
|
||||
<td>Age of account</td>
|
||||
<td>Signup IP</td>
|
||||
<td>Registration IP address</td>
|
||||
</tr>
|
||||
<?
|
||||
// Matches on invite email
|
||||
|
@ -23,7 +23,7 @@
|
||||
p.Level AS Class
|
||||
FROM users_main AS um
|
||||
LEFT JOIN permissions AS p ON p.ID = um.PermissionID
|
||||
WHERE um.ID = ".$UserID);
|
||||
WHERE um.ID = $UserID");
|
||||
list($Username, $Class) = $DB->next_record();
|
||||
|
||||
if (!check_perms('users_view_ips', $Class)) {
|
||||
@ -132,7 +132,7 @@ function UnBan(ip, id, elemID) {
|
||||
ORDER BY h1.StartTime DESC
|
||||
LIMIT $Limit");
|
||||
}
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($NumResults) = $DB->next_record();
|
||||
$DB->set_query_id($RS);
|
||||
|
||||
@ -204,7 +204,11 @@ function UnBan(ip, id, elemID) {
|
||||
<?=$IP?> (<?=Tools::get_country_code_by_ajax($IP)?>)<?
|
||||
if ($CanManageIPBans) {
|
||||
if (!isset($IPs[$IP])) {
|
||||
$sql = "SELECT ID, FromIP, ToIP FROM ip_bans WHERE '".Tools::ip_to_unsigned($IP)."' BETWEEN FromIP AND ToIP LIMIT 1";
|
||||
$sql = "
|
||||
SELECT ID, FromIP, ToIP
|
||||
FROM ip_bans
|
||||
WHERE '".Tools::ip_to_unsigned($IP)."' BETWEEN FromIP AND ToIP
|
||||
LIMIT 1";
|
||||
$DB->query($sql);
|
||||
|
||||
if ($DB->record_count() > 0) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
p.Level AS Class
|
||||
FROM users_main AS um
|
||||
LEFT JOIN permissions AS p ON p.ID = um.PermissionID
|
||||
WHERE um.ID = ".$UserID);
|
||||
WHERE um.ID = $UserID");
|
||||
list($Username, $Class) = $DB->next_record();
|
||||
|
||||
if (!check_perms('users_view_ips', $Class)) {
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
$UsersOnly = $_GET['usersonly'];
|
||||
|
||||
View::show_header("Tracker IP history for $Username");
|
||||
View::show_header("Tracker IP address history for $Username");
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function ShowIPs(rowname) {
|
||||
@ -53,7 +53,7 @@ function ShowIPs(rowname) {
|
||||
ORDER BY tstamp DESC
|
||||
LIMIT $Limit");
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($NumResults) = $DB->next_record();
|
||||
$DB->set_query_id($TrackerIps);
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
|
||||
|
||||
View::show_header('Post history for '.$Username,'subscriptions,comments,bbcode');
|
||||
View::show_header("Post history for $Username", 'subscriptions,comments,bbcode');
|
||||
|
||||
if ($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
@ -47,18 +47,18 @@
|
||||
$sql .= '
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.TopicID = t.ID AND l.UserID = '.$LoggedUser['ID'];
|
||||
}
|
||||
$sql .= '
|
||||
$sql .= "
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
WHERE p.AuthorID = '.$UserID.'
|
||||
AND ((f.MinClassRead <= '.$LoggedUser['Class'];
|
||||
WHERE p.AuthorID = $UserID
|
||||
AND ((f.MinClassRead <= ".$LoggedUser['Class'];
|
||||
if (!empty($RestrictedForums)) {
|
||||
$sql.='
|
||||
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
$sql .= "
|
||||
AND f.ID NOT IN ('$RestrictedForums')";
|
||||
}
|
||||
$sql .= ')';
|
||||
if (!empty($PermittedForums)) {
|
||||
$sql.='
|
||||
OR f.ID IN (\''.$PermittedForums.'\')';
|
||||
$sql .= "
|
||||
OR f.ID IN ('$PermittedForums')";
|
||||
}
|
||||
$sql .= ')';
|
||||
if ($ShowUnread) {
|
||||
@ -66,18 +66,18 @@
|
||||
AND ((t.IsLocked = \'0\' OR t.IsSticky = \'1\')
|
||||
AND (l.PostID < t.LastPostID OR l.PostID IS NULL))';
|
||||
}
|
||||
$sql .= '
|
||||
$sql .= "
|
||||
GROUP BY t.ID
|
||||
ORDER BY p.ID DESC
|
||||
LIMIT '.$Limit;
|
||||
LIMIT $Limit";
|
||||
$PostIDs = $DB->query($sql);
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($Results) = $DB->next_record();
|
||||
|
||||
if ($Results > $PerPage * ($Page - 1)) {
|
||||
$DB->set_query_id($PostIDs);
|
||||
$PostIDs = $DB->collect('ID');
|
||||
$sql = '
|
||||
$sql = "
|
||||
SELECT
|
||||
p.ID,
|
||||
p.AddedTime,
|
||||
@ -97,16 +97,21 @@
|
||||
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
|
||||
JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID
|
||||
WHERE p.ID IN ('.implode(',',$PostIDs).')
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.UserID = $UserID
|
||||
AND l.TopicID = t.ID
|
||||
WHERE p.ID IN (".implode(',', $PostIDs).')
|
||||
ORDER BY p.ID DESC';
|
||||
$Posts = $DB->query($sql);
|
||||
}
|
||||
} else {
|
||||
$sql = '
|
||||
SELECT SQL_CALC_FOUND_ROWS';
|
||||
SELECT
|
||||
SQL_CALC_FOUND_ROWS';
|
||||
if ($ShowGrouped) {
|
||||
$sql.=' * FROM (SELECT';
|
||||
$sql .= '
|
||||
*
|
||||
FROM (
|
||||
SELECT';
|
||||
}
|
||||
$sql .= '
|
||||
p.ID,
|
||||
@ -122,7 +127,7 @@
|
||||
$sql .= '
|
||||
l.PostID AS LastRead,';
|
||||
}
|
||||
$sql .= '
|
||||
$sql .= "
|
||||
t.IsLocked,
|
||||
t.IsSticky
|
||||
FROM forums_posts as p
|
||||
@ -131,19 +136,20 @@
|
||||
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
|
||||
JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID
|
||||
WHERE p.AuthorID = '.$UserID.'
|
||||
AND ((f.MinClassRead <= '.$LoggedUser['Class'];
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.UserID = $UserID
|
||||
AND l.TopicID = t.ID
|
||||
WHERE p.AuthorID = $UserID
|
||||
AND ((f.MinClassRead <= ".$LoggedUser['Class'];
|
||||
|
||||
if (!empty($RestrictedForums)) {
|
||||
$sql.='
|
||||
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
$sql .= "
|
||||
AND f.ID NOT IN ('$RestrictedForums')";
|
||||
}
|
||||
$sql .= ')';
|
||||
|
||||
if (!empty($PermittedForums)) {
|
||||
$sql.='
|
||||
OR f.ID IN (\''.$PermittedForums.'\')';
|
||||
$sql .= "
|
||||
OR f.ID IN ('$PermittedForums')";
|
||||
}
|
||||
$sql .= ')';
|
||||
|
||||
@ -164,10 +170,10 @@
|
||||
ORDER BY ID DESC';
|
||||
}
|
||||
|
||||
$sql.=' LIMIT '.$Limit;
|
||||
$sql .= " LIMIT $Limit";
|
||||
$Posts = $DB->query($sql);
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($Results) = $DB->next_record();
|
||||
|
||||
$DB->set_query_id($Posts);
|
||||
@ -194,7 +200,10 @@
|
||||
<?
|
||||
if ($ViewingOwn) {
|
||||
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
|
||||
$DB->query("
|
||||
SELECT TopicID
|
||||
FROM users_subscriptions
|
||||
WHERE UserID = '$LoggedUser[ID]'");
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
|
||||
$DB->set_query_id($Posts);
|
||||
|
@ -82,7 +82,9 @@
|
||||
unset($TorrentTable);
|
||||
|
||||
list($CollageID, $CollageName, $CollageSize, $LastVisit) = $Collage;
|
||||
$RS = $DB->query("SELECT GroupID FROM collages_torrents
|
||||
$RS = $DB->query("
|
||||
SELECT GroupID
|
||||
FROM collages_torrents
|
||||
WHERE CollageID = $CollageID
|
||||
AND AddedOn > '" . db_string($LastVisit) . "'
|
||||
ORDER BY AddedOn");
|
||||
@ -119,9 +121,9 @@
|
||||
} elseif (count($Artists) > 0) {
|
||||
$DisplayName .= Artists::display_artists(array('1' => $Artists));
|
||||
}
|
||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
$DisplayName .= "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\">$GroupName</a>";
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName = $DisplayName. " [$GroupYear]";
|
||||
$DisplayName = "$DisplayName [$GroupYear]";
|
||||
}
|
||||
if ($GroupVanityHouse) {
|
||||
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
|
||||
@ -168,8 +170,13 @@
|
||||
}
|
||||
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
|
||||
|
||||
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
if ($Torrent['RemasterTitle'] != $LastRemasterTitle
|
||||
|| $Torrent['RemasterYear'] != $LastRemasterYear
|
||||
|| $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel
|
||||
|| $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber
|
||||
|| $FirstUnknown
|
||||
|| $Torrent['Media'] != $LastMedia
|
||||
) {
|
||||
$EditionID++;
|
||||
?>
|
||||
<tr class="group_torrent groupid_<?=$CollageID . $GroupID?> edition<?=$SnatchedGroupClass?> hidden">
|
||||
@ -202,7 +209,7 @@
|
||||
|
||||
list($TorrentID, $Torrent) = each($Torrents);
|
||||
|
||||
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
$DisplayName = "<a href=\"torrents.php?id=$GroupID\" title=\"View Torrent\">$GroupName</a>";
|
||||
|
||||
if ($Torrent['IsSnatched']) {
|
||||
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
|
||||
@ -268,9 +275,10 @@
|
||||
</tr>
|
||||
<?=$TorrentTable?>
|
||||
</table>
|
||||
<? } // foreach () ?>
|
||||
<?
|
||||
} // else -- if (empty($NumResults)) ?>
|
||||
} // foreach ()
|
||||
} // else -- if (empty($NumResults))
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
|
||||
|
@ -11,23 +11,39 @@
|
||||
}
|
||||
|
||||
require(SERVER_ROOT.'/sections/forums/index.php');
|
||||
$DB->query('SELECT ID FROM forums WHERE forums.ID = (SELECT ForumID FROM forums_topics WHERE ID = '.db_string($_GET['topicid']).')');
|
||||
$DB->query('
|
||||
SELECT ID
|
||||
FROM forums
|
||||
WHERE forums.ID =
|
||||
(
|
||||
SELECT ForumID
|
||||
FROM forums_topics
|
||||
WHERE ID = '.db_string($_GET['topicid']).'
|
||||
)');
|
||||
list($ForumID) = $DB->next_record();
|
||||
if (!check_forumperm($ForumID)) {
|
||||
die();
|
||||
}
|
||||
|
||||
if (!$UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) {
|
||||
$DB->query('SELECT TopicID FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$DB->query('
|
||||
SELECT TopicID
|
||||
FROM users_subscriptions
|
||||
WHERE UserID = '.db_string($LoggedUser['ID']));
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
|
||||
}
|
||||
|
||||
if (($Key = array_search($_GET['topicid'], $UserSubscriptions)) !== false) {
|
||||
$DB->query('DELETE FROM users_subscriptions WHERE UserID = '.db_string($LoggedUser['ID']).' AND TopicID = '.db_string($_GET['topicid']));
|
||||
$DB->query('
|
||||
DELETE FROM users_subscriptions
|
||||
WHERE UserID = '.db_string($LoggedUser['ID']).'
|
||||
AND TopicID = '.db_string($_GET['topicid']));
|
||||
unset($UserSubscriptions[$Key]);
|
||||
} else {
|
||||
$DB->query("INSERT IGNORE INTO users_subscriptions (UserID, TopicID) VALUES ($LoggedUser[ID], ".db_string($_GET['topicid']).")");
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO users_subscriptions (UserID, TopicID)
|
||||
VALUES ($LoggedUser[ID], ".db_string($_GET['topicid']).")");
|
||||
array_push($UserSubscriptions, $_GET['topicid']);
|
||||
}
|
||||
$Cache->replace_value('subscriptions_user_'.$LoggedUser['ID'], $UserSubscriptions, 0);
|
||||
|
@ -37,14 +37,17 @@
|
||||
if (!is_number($UserID) || !is_number($TorrentID)) {
|
||||
error(403);
|
||||
}
|
||||
$DB->query("SELECT info_hash FROM torrents where ID = $TorrentID");
|
||||
$DB->query("
|
||||
SELECT info_hash
|
||||
FROM torrents
|
||||
WHERE ID = $TorrentID");
|
||||
if (list($InfoHash) = $DB->next_record(MYSQLI_NUM, FALSE)) {
|
||||
$DB->query("
|
||||
UPDATE users_freeleeches
|
||||
SET Expired = TRUE
|
||||
WHERE UserID = $UserID
|
||||
AND TorrentID = $TorrentID");
|
||||
$Cache->delete_value('users_tokens_'.$UserID);
|
||||
$Cache->delete_value("users_tokens_$UserID");
|
||||
Tracker::update_tracker('remove_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID));
|
||||
}
|
||||
header("Location: userhistory.php?action=token_history&userid=$UserID");
|
||||
@ -74,7 +77,7 @@
|
||||
LIMIT $Limit");
|
||||
$Tokens = $DB->to_array();
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($NumResults) = $DB->next_record();
|
||||
$Pages = Format::get_pages($Page, $NumResults, 25);
|
||||
|
||||
@ -90,7 +93,7 @@
|
||||
<td>Expired</td>
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<td>Downloaded</td>
|
||||
<td>Tokens Used</td>
|
||||
<td>Tokens used</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
<?
|
||||
@ -115,14 +118,15 @@
|
||||
<tr class="<?=($i ? 'rowa' : 'rowb')?>">
|
||||
<td><?=$Name?></td>
|
||||
<td><?=time_diff($Time)?></td>
|
||||
<td><?=($Expired ? 'Yes' : 'No')?><?=(check_perms('users_mod') && !$Expired)?" <a href=\"userhistory.php?action=token_history&expire=1&userid=$UserID&torrentid=$TorrentID\">(expire)</a>":''?>
|
||||
<td><?=($Expired ? 'Yes' : 'No')?><?=(check_perms('users_mod') && !$Expired) ? " <a href=\"userhistory.php?action=token_history&expire=1&userid=$UserID&torrentid=$TorrentID\">(expire)</a>" : ''; ?>
|
||||
</td>
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<td><?=Format::get_size($Downloaded)?></td>
|
||||
<td><?=$Uses?></td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
<? }
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<div class="linkbox"><?=$Pages?></div>
|
||||
|
14
static/functions/bbcode_sandbox.js
Normal file
14
static/functions/bbcode_sandbox.js
Normal file
@ -0,0 +1,14 @@
|
||||
$(document).ready(function() {
|
||||
$("#sandbox").keyup(function() {
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
dataType : "html",
|
||||
url : "ajax.php?action=preview",
|
||||
data : {
|
||||
"body" : $(this).val()
|
||||
}
|
||||
}).done(function(response) {
|
||||
$("#preview").html(response);
|
||||
});
|
||||
});
|
||||
});
|
8
static/functions/jquery-ui.js
vendored
8
static/functions/jquery-ui.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user