mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-12 18:36:29 +00:00
Empty commit
This commit is contained in:
parent
186c5ca897
commit
3b10c502d6
@ -63,7 +63,7 @@ function article($ArticleID, $Error = true) {
|
|||||||
LEFT JOIN users_main AS u ON u.ID=w.Author
|
LEFT JOIN users_main AS u ON u.ID=w.Author
|
||||||
WHERE w.ID='$ArticleID'
|
WHERE w.ID='$ArticleID'
|
||||||
GROUP BY w.ID");
|
GROUP BY w.ID");
|
||||||
if (!$DB->record_count() && $Error) {
|
if (!$DB->has_results() && $Error) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
$Contents = $DB->to_array();
|
$Contents = $DB->to_array();
|
||||||
|
@ -62,7 +62,7 @@ function set_up() {
|
|||||||
ORDER BY ass.Score DESC
|
ORDER BY ass.Score DESC
|
||||||
LIMIT 14");
|
LIMIT 14");
|
||||||
|
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ function make_tree() {
|
|||||||
AND TreePosition > $TreePosition
|
AND TreePosition > $TreePosition
|
||||||
ORDER BY TreePosition ASC
|
ORDER BY TreePosition ASC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
list($MaxPosition) = $DB->next_record(MYSQLI_NUM, false);
|
list($MaxPosition) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
} else {
|
} else {
|
||||||
$MaxPosition = false;
|
$MaxPosition = false;
|
||||||
|
@ -5,20 +5,20 @@ class LastFM {
|
|||||||
|
|
||||||
public static function get_artist_events($ArtistID, $Artist, $Limit = 15) {
|
public static function get_artist_events($ArtistID, $Artist, $Limit = 15) {
|
||||||
global $Cache;
|
global $Cache;
|
||||||
$ArtistEvents = $Cache->get_value('artist_events_' . $ArtistID);
|
$ArtistEvents = $Cache->get_value("artist_events_$ArtistID");
|
||||||
if (empty($ArtistEvents)) {
|
if (empty($ArtistEvents)) {
|
||||||
$ArtistEvents = self::lastfm_request("artist.getEvents", array("artist" => $Artist, "limit" => $Limit));
|
$ArtistEvents = self::lastfm_request("artist.getEvents", array("artist" => $Artist, "limit" => $Limit));
|
||||||
$Cache->cache_value('artist_events_' . $ArtistID, $ArtistEvents, 432000);
|
$Cache->cache_value("artist_events_$ArtistID", $ArtistEvents, 432000);
|
||||||
}
|
}
|
||||||
return $ArtistEvents;
|
return $ArtistEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_user_info($Username) {
|
public static function get_user_info($Username) {
|
||||||
global $Cache;
|
global $Cache;
|
||||||
$Response = $Cache->get_value('lastfm_user_info_' . $Username);
|
$Response = $Cache->get_value("lastfm_user_info_$Username");
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
$Response = self::lastfm_request("user.getInfo", array("user" => $Username));
|
$Response = self::lastfm_request("user.getInfo", array("user" => $Username));
|
||||||
$Cache->cache_value('lastfm_user_info_' . $Username, $Response, 86400);
|
$Cache->cache_value("lastfm_user_info_$Username", $Response, 86400);
|
||||||
}
|
}
|
||||||
return $Response;
|
return $Response;
|
||||||
}
|
}
|
||||||
@ -28,8 +28,8 @@ public static function compare_user_with($Username1, $Limit = 15) {
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT username
|
SELECT username
|
||||||
FROM lastfm_users
|
FROM lastfm_users
|
||||||
WHERE ID='$LoggedUser[ID]'");
|
WHERE ID = '$LoggedUser[ID]'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
list($Username2) = $DB->next_record();
|
list($Username2) = $DB->next_record();
|
||||||
//Make sure the usernames are in the correct order to avoid dupe cache keys.
|
//Make sure the usernames are in the correct order to avoid dupe cache keys.
|
||||||
if (strcasecmp($Username1, $Username2)) {
|
if (strcasecmp($Username1, $Username2)) {
|
||||||
@ -37,11 +37,11 @@ public static function compare_user_with($Username1, $Limit = 15) {
|
|||||||
$Username1 = $Username2;
|
$Username1 = $Username2;
|
||||||
$Username2 = $Temp;
|
$Username2 = $Temp;
|
||||||
}
|
}
|
||||||
$Response = $Cache->get_value('lastfm_compare_' . $Username1 . '_' . $Username2);
|
$Response = $Cache->get_value("lastfm_compare_$Username1" . "_$Username2");
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
$Response = self::lastfm_request("tasteometer.compare", array("type1" => "user", "type2" => "user", "value1" => $Username1, "value2" => $Username2, "limit" => $Limit));
|
$Response = self::lastfm_request("tasteometer.compare", array("type1" => "user", "type2" => "user", "value1" => $Username1, "value2" => $Username2, "limit" => $Limit));
|
||||||
$Response = json_encode($Response);
|
$Response = json_encode($Response);
|
||||||
$Cache->cache_value('lastfm_compare_' . $Username1 . '_' . $Username2, $Response, 86400);
|
$Cache->cache_value("lastfm_compare_$Username1" . "_$Username2", $Response, 86400);
|
||||||
}
|
}
|
||||||
return $Response;
|
return $Response;
|
||||||
}
|
}
|
||||||
@ -49,69 +49,69 @@ public static function compare_user_with($Username1, $Limit = 15) {
|
|||||||
|
|
||||||
public static function get_last_played_track($Username) {
|
public static function get_last_played_track($Username) {
|
||||||
global $Cache;
|
global $Cache;
|
||||||
$Response = $Cache->get_value('lastfm_last_played_track_' . $Username);
|
$Response = $Cache->get_value("lastfm_last_played_track_$Username");
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
$Response = self::lastfm_request("user.getRecentTracks", array("user" => $Username, "limit" => 1));
|
$Response = self::lastfm_request("user.getRecentTracks", array("user" => $Username, "limit" => 1));
|
||||||
// Take the single last played track out of the response.
|
// Take the single last played track out of the response.
|
||||||
$Response = $Response['recenttracks']['track'];
|
$Response = $Response['recenttracks']['track'];
|
||||||
$Response = json_encode($Response);
|
$Response = json_encode($Response);
|
||||||
$Cache->cache_value('lastfm_last_played_track_' . $Username, $Response, 7200);
|
$Cache->cache_value("lastfm_last_played_track_$Username", $Response, 7200);
|
||||||
}
|
}
|
||||||
return $Response;
|
return $Response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_top_artists($Username, $Limit = 15) {
|
public static function get_top_artists($Username, $Limit = 15) {
|
||||||
global $Cache;
|
global $Cache;
|
||||||
$Response = $Cache->get_value('lastfm_top_artists_' . $Username);
|
$Response = $Cache->get_value("lastfm_top_artists_$Username");
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$Response = self::lastfm_request("user.getTopArtists", array("user" => $Username, "limit" => $Limit));
|
$Response = self::lastfm_request("user.getTopArtists", array("user" => $Username, "limit" => $Limit));
|
||||||
$Response = json_encode($Response);
|
$Response = json_encode($Response);
|
||||||
$Cache->cache_value('lastfm_top_artists_' . $Username, $Response, 86400);
|
$Cache->cache_value("lastfm_top_artists_$Username", $Response, 86400);
|
||||||
}
|
}
|
||||||
return $Response;
|
return $Response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_top_albums($Username, $Limit = 15) {
|
public static function get_top_albums($Username, $Limit = 15) {
|
||||||
global $Cache;
|
global $Cache;
|
||||||
$Response = $Cache->get_value('lastfm_top_albums_' . $Username);
|
$Response = $Cache->get_value("lastfm_top_albums_$Username");
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
sleep(2);
|
sleep(2);
|
||||||
$Response = self::lastfm_request("user.getTopAlbums", array("user" => $Username, "limit" => $Limit));
|
$Response = self::lastfm_request("user.getTopAlbums", array("user" => $Username, "limit" => $Limit));
|
||||||
$Response = json_encode($Response);
|
$Response = json_encode($Response);
|
||||||
$Cache->cache_value('lastfm_top_albums_' . $Username, $Response, 86400);
|
$Cache->cache_value("lastfm_top_albums_$Username", $Response, 86400);
|
||||||
}
|
}
|
||||||
return $Response;
|
return $Response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_top_tracks($Username, $Limit = 15) {
|
public static function get_top_tracks($Username, $Limit = 15) {
|
||||||
global $Cache;
|
global $Cache;
|
||||||
$Response = $Cache->get_value('lastfm_top_tracks_' . $Username);
|
$Response = $Cache->get_value("lastfm_top_tracks_$Username");
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
sleep(3);
|
sleep(3);
|
||||||
$Response = self::lastfm_request("user.getTopTracks", array("user" => $Username, "limit" => $Limit));
|
$Response = self::lastfm_request("user.getTopTracks", array("user" => $Username, "limit" => $Limit));
|
||||||
$Response = json_encode($Response);
|
$Response = json_encode($Response);
|
||||||
$Cache->cache_value('lastfm_top_tracks_' . $Username, $Response, 86400);
|
$Cache->cache_value("lastfm_top_tracks_$Username", $Response, 86400);
|
||||||
}
|
}
|
||||||
return $Response;
|
return $Response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function clear_cache($Username, $Uid) {
|
public static function clear_cache($Username, $Uid) {
|
||||||
global $Cache, $LoggedUser, $DB;
|
global $Cache, $LoggedUser, $DB;
|
||||||
$Response = $Cache->get_value('lastfm_clear_cache_' . $LoggedUser . '_' . $_GET['id']);
|
$Response = $Cache->get_value("lastfm_clear_cache_$LoggedUser" . '_' . $_GET['id']);
|
||||||
if (empty($Response)) {
|
if (empty($Response)) {
|
||||||
// Prevent clearing the cache on the same uid page for the next 10 minutes.
|
// Prevent clearing the cache on the same uid page for the next 10 minutes.
|
||||||
$Response = $Cache->cache_value('lastfm_clear_cache_' . $LoggedUser . '_' . $Uid, $Username, 600);
|
$Response = $Cache->cache_value("lastfm_clear_cache_$LoggedUser" . "_$Uid", $Username, 600);
|
||||||
$Cache->delete_value('lastfm_user_info_' . $Username);
|
$Cache->delete_value("lastfm_user_info_$Username");
|
||||||
$Cache->delete_value('lastfm_last_played_track_' . $Username);
|
$Cache->delete_value("lastfm_last_played_track_$Username");
|
||||||
$Cache->delete_value('lastfm_top_artists_' . $Username);
|
$Cache->delete_value("lastfm_top_artists_$Username");
|
||||||
$Cache->delete_value('lastfm_top_albums_' . $Username);
|
$Cache->delete_value("lastfm_top_albums_$Username");
|
||||||
$Cache->delete_value('lastfm_top_tracks_' . $Username);
|
$Cache->delete_value("lastfm_top_tracks_$Username");
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT username
|
SELECT username
|
||||||
FROM lastfm_users
|
FROM lastfm_users
|
||||||
WHERE ID='$LoggedUser[ID]'");
|
WHERE ID = '$LoggedUser[ID]'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
list($Username2) = $DB->next_record();
|
list($Username2) = $DB->next_record();
|
||||||
//Make sure the usernames are in the correct order to avoid dupe cache keys.
|
//Make sure the usernames are in the correct order to avoid dupe cache keys.
|
||||||
if (strcasecmp($Username, $Username2)) {
|
if (strcasecmp($Username, $Username2)) {
|
||||||
@ -119,7 +119,7 @@ public static function clear_cache($Username, $Uid) {
|
|||||||
$Username = $Username2;
|
$Username = $Username2;
|
||||||
$Username2 = $Temp;
|
$Username2 = $Temp;
|
||||||
}
|
}
|
||||||
$Cache->delete_value('lastfm_compare_' . $Username . '_' . $Username2);
|
$Cache->delete_value("lastfm_compare_$Username" . "_$Username2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ private static function lastfm_request($Method, $Args) {
|
|||||||
$Url = LASTFM_API_URL . $Method;
|
$Url = LASTFM_API_URL . $Method;
|
||||||
if (is_array($Args)) {
|
if (is_array($Args)) {
|
||||||
foreach ($Args as $Key => $Value) {
|
foreach ($Args as $Key => $Value) {
|
||||||
$Url .= "&" . $Key . "=" . urlencode($Value);
|
$Url .= "&$Key=" . urlencode($Value);
|
||||||
}
|
}
|
||||||
$Url .= "&format=json&api_key=" . LASTFM_API_KEY;
|
$Url .= "&format=json&api_key=" . LASTFM_API_KEY;
|
||||||
|
|
||||||
@ -145,6 +145,4 @@ private static function lastfm_request($Method, $Args) {
|
|||||||
return json_decode($Return, true);
|
return json_decode($Return, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
|
|||||||
SELECT Username
|
SELECT Username
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE ID=".$AuthorID);
|
WHERE ID=".$AuthorID);
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
list($AuthorName) = $DB->next_record();
|
list($AuthorName) = $DB->next_record();
|
||||||
@ -393,7 +393,7 @@ public static function get_alias_tag($BadTag) {
|
|||||||
FROM tag_aliases
|
FROM tag_aliases
|
||||||
WHERE BadTag = '$BadTag'
|
WHERE BadTag = '$BadTag'
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
list($AliasTag) = $DB->next_record();
|
list($AliasTag) = $DB->next_record();
|
||||||
return $AliasTag;
|
return $AliasTag;
|
||||||
}
|
}
|
||||||
|
@ -298,6 +298,14 @@ function record_count() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* returns true if the query exists and there were records found
|
||||||
|
* returns false if the query does not exist or if there were 0 records returned
|
||||||
|
*/
|
||||||
|
function has_results() {
|
||||||
|
return ($this->QueryID && $this->record_count() !== 0);
|
||||||
|
}
|
||||||
|
|
||||||
function affected_rows() {
|
function affected_rows() {
|
||||||
if ($this->LinkID) {
|
if ($this->LinkID) {
|
||||||
return mysqli_affected_rows($this->LinkID);
|
return mysqli_affected_rows($this->LinkID);
|
||||||
|
@ -221,7 +221,7 @@ public static function get_votes_array($RequestID) {
|
|||||||
LEFT JOIN users_main AS u ON u.ID=rv.UserID
|
LEFT JOIN users_main AS u ON u.ID=rv.UserID
|
||||||
WHERE rv.RequestID = $RequestID
|
WHERE rv.RequestID = $RequestID
|
||||||
ORDER BY rv.Bounty DESC");
|
ORDER BY rv.Bounty DESC");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(0);
|
error(0);
|
||||||
} else {
|
} else {
|
||||||
$Votes = $DB->to_array();
|
$Votes = $DB->to_array();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
/*-- Script Start Class --------------------------------*/
|
/*-- Script Start Class --------------------------------*/
|
||||||
/*------------------------------------------------------*/
|
/*------------------------------------------------------*/
|
||||||
/* This isnt really a class but a way to tie other */
|
/* This isnt really a class but a way to tie other */
|
||||||
@ -194,9 +194,9 @@
|
|||||||
$FileName = 'zip.class';
|
$FileName = 'zip.class';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
die("Couldn't import class " . $ClassName);
|
die("Couldn't import class $ClassName");
|
||||||
}
|
}
|
||||||
require_once(SERVER_ROOT.'/classes/' . $FileName . '.php');
|
require_once(SERVER_ROOT . "/classes/$FileName.php");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -227,7 +227,7 @@
|
|||||||
$LoginCookie = $Enc->decrypt($_COOKIE['session']);
|
$LoginCookie = $Enc->decrypt($_COOKIE['session']);
|
||||||
}
|
}
|
||||||
if (isset($LoginCookie)) {
|
if (isset($LoginCookie)) {
|
||||||
list($SessionID, $LoggedUser['ID']) = explode("|~|", $Enc->decrypt($LoginCookie));
|
list($SessionID, $LoggedUser['ID']) = explode('|~|', $Enc->decrypt($LoginCookie));
|
||||||
$LoggedUser['ID'] = (int)$LoggedUser['ID'];
|
$LoggedUser['ID'] = (int)$LoggedUser['ID'];
|
||||||
|
|
||||||
$UserID = $LoggedUser['ID']; //TODO: UserID should not be LoggedUser
|
$UserID = $LoggedUser['ID']; //TODO: UserID should not be LoggedUser
|
||||||
@ -236,7 +236,7 @@
|
|||||||
logout();
|
logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
$UserSessions = $Cache->get_value('users_sessions_'.$UserID);
|
$UserSessions = $Cache->get_value("users_sessions_$UserID");
|
||||||
if (!is_array($UserSessions)) {
|
if (!is_array($UserSessions)) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
@ -246,11 +246,11 @@
|
|||||||
IP,
|
IP,
|
||||||
LastUpdate
|
LastUpdate
|
||||||
FROM users_sessions
|
FROM users_sessions
|
||||||
WHERE UserID='$UserID'
|
WHERE UserID = '$UserID'
|
||||||
AND Active = 1
|
AND Active = 1
|
||||||
ORDER BY LastUpdate DESC");
|
ORDER BY LastUpdate DESC");
|
||||||
$UserSessions = $DB->to_array('SessionID',MYSQLI_ASSOC);
|
$UserSessions = $DB->to_array('SessionID',MYSQLI_ASSOC);
|
||||||
$Cache->cache_value('users_sessions_'.$UserID, $UserSessions, 0);
|
$Cache->cache_value("users_sessions_$UserID", $UserSessions, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!array_key_exists($SessionID, $UserSessions)) {
|
if (!array_key_exists($SessionID, $UserSessions)) {
|
||||||
@ -263,7 +263,7 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT Enabled
|
SELECT Enabled
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE ID='$LoggedUser[ID]'");
|
WHERE ID = '$LoggedUser[ID]'");
|
||||||
list($Enabled) = $DB->next_record();
|
list($Enabled) = $DB->next_record();
|
||||||
$Cache->cache_value('enabled_'.$LoggedUser['ID'], $Enabled, 0);
|
$Cache->cache_value('enabled_'.$LoggedUser['ID'], $Enabled, 0);
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio
|
SELECT Uploaded AS BytesUploaded, Downloaded AS BytesDownloaded, RequiredRatio
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE ID='$LoggedUser[ID]'");
|
WHERE ID = '$LoggedUser[ID]'");
|
||||||
$UserStats = $DB->next_record(MYSQLI_ASSOC);
|
$UserStats = $DB->next_record(MYSQLI_ASSOC);
|
||||||
$Cache->cache_value('user_stats_'.$LoggedUser['ID'], $UserStats, 3600);
|
$Cache->cache_value('user_stats_'.$LoggedUser['ID'], $UserStats, 3600);
|
||||||
}
|
}
|
||||||
@ -293,13 +293,13 @@
|
|||||||
// Create LoggedUser array
|
// Create LoggedUser array
|
||||||
$LoggedUser = array_merge($HeavyInfo, $LightInfo, $Permissions, $UserStats);
|
$LoggedUser = array_merge($HeavyInfo, $LightInfo, $Permissions, $UserStats);
|
||||||
|
|
||||||
$LoggedUser['RSS_Auth']=md5($LoggedUser['ID'].RSS_HASH.$LoggedUser['torrent_pass']);
|
$LoggedUser['RSS_Auth'] = md5($LoggedUser['ID'] . RSS_HASH . $LoggedUser['torrent_pass']);
|
||||||
|
|
||||||
// $LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
|
// $LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
|
||||||
$LoggedUser['RatioWatch'] = (
|
$LoggedUser['RatioWatch'] = (
|
||||||
$LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' &&
|
$LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00'
|
||||||
time() < strtotime($LoggedUser['RatioWatchEnds']) &&
|
&& time() < strtotime($LoggedUser['RatioWatchEnds'])
|
||||||
($LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio']) > $LoggedUser['BytesUploaded']
|
&& ($LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio']) > $LoggedUser['BytesUploaded']
|
||||||
);
|
);
|
||||||
if (!isset($LoggedUser['ID'])) {
|
if (!isset($LoggedUser['ID'])) {
|
||||||
$Debug->log_var($LightInfo, 'LightInfo');
|
$Debug->log_var($LightInfo, 'LightInfo');
|
||||||
@ -315,31 +315,33 @@
|
|||||||
$Cache->CanClear = check_perms('admin_clear_cache');
|
$Cache->CanClear = check_perms('admin_clear_cache');
|
||||||
|
|
||||||
// Because we <3 our staff
|
// Because we <3 our staff
|
||||||
if (check_perms('site_disable_ip_history')) { $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; }
|
if (check_perms('site_disable_ip_history')) {
|
||||||
|
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||||
|
}
|
||||||
|
|
||||||
// Update LastUpdate every 10 minutes
|
// Update LastUpdate every 10 minutes
|
||||||
if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
|
if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_main
|
UPDATE users_main
|
||||||
SET LastAccess='".sqltime()."'
|
SET LastAccess = '".sqltime()."'
|
||||||
WHERE ID='$LoggedUser[ID]'");
|
WHERE ID = '$LoggedUser[ID]'");
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_sessions
|
UPDATE users_sessions
|
||||||
SET
|
SET
|
||||||
IP='".$_SERVER['REMOTE_ADDR']."',
|
IP = '".$_SERVER['REMOTE_ADDR']."',
|
||||||
Browser='$Browser',
|
Browser = '$Browser',
|
||||||
OperatingSystem='$OperatingSystem',
|
OperatingSystem = '$OperatingSystem',
|
||||||
LastUpdate='".sqltime()."'
|
LastUpdate = '".sqltime()."'
|
||||||
WHERE UserID='$LoggedUser[ID]'
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
AND SessionID='".db_string($SessionID)."'");
|
AND SessionID = '".db_string($SessionID)."'");
|
||||||
$Cache->begin_transaction('users_sessions_'.$UserID);
|
$Cache->begin_transaction("users_sessions_$UserID");
|
||||||
$Cache->delete_row($SessionID);
|
$Cache->delete_row($SessionID);
|
||||||
$Cache->insert_front($SessionID,array(
|
$Cache->insert_front($SessionID,array(
|
||||||
'SessionID'=>$SessionID,
|
'SessionID' => $SessionID,
|
||||||
'Browser'=>$Browser,
|
'Browser' => $Browser,
|
||||||
'OperatingSystem'=>$OperatingSystem,
|
'OperatingSystem' => $OperatingSystem,
|
||||||
'IP'=>$_SERVER['REMOTE_ADDR'],
|
'IP' => $_SERVER['REMOTE_ADDR'],
|
||||||
'LastUpdate'=>sqltime()
|
'LastUpdate' => sqltime()
|
||||||
));
|
));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
}
|
}
|
||||||
@ -351,7 +353,7 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT ID, Label
|
SELECT ID, Label
|
||||||
FROM users_notify_filters
|
FROM users_notify_filters
|
||||||
WHERE UserID='$LoggedUser[ID]'");
|
WHERE UserID = '$LoggedUser[ID]'");
|
||||||
$LoggedUser['Notify'] = $DB->to_array('ID');
|
$LoggedUser['Notify'] = $DB->to_array('ID');
|
||||||
$Cache->cache_value('notify_filters_'.$LoggedUser['ID'], $LoggedUser['Notify'], 2592000);
|
$Cache->cache_value('notify_filters_'.$LoggedUser['ID'], $LoggedUser['Notify'], 2592000);
|
||||||
}
|
}
|
||||||
@ -374,10 +376,10 @@
|
|||||||
$NewIP = db_string($_SERVER['REMOTE_ADDR']);
|
$NewIP = db_string($_SERVER['REMOTE_ADDR']);
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_history_ips
|
UPDATE users_history_ips
|
||||||
SET EndTime='".sqltime()."'
|
SET EndTime = '".sqltime()."'
|
||||||
WHERE EndTime IS NULL
|
WHERE EndTime IS NULL
|
||||||
AND UserID='$LoggedUser[ID]'
|
AND UserID = '$LoggedUser[ID]'
|
||||||
AND IP='$CurIP'");
|
AND IP = '$CurIP'");
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT IGNORE INTO users_history_ips
|
INSERT IGNORE INTO users_history_ips
|
||||||
(UserID, IP, StartTime)
|
(UserID, IP, StartTime)
|
||||||
@ -387,8 +389,8 @@
|
|||||||
$ipcc = Tools::geoip($NewIP);
|
$ipcc = Tools::geoip($NewIP);
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_main
|
UPDATE users_main
|
||||||
SET IP='$NewIP', ipcc='$ipcc'
|
SET IP = '$NewIP', ipcc = '$ipcc'
|
||||||
WHERE ID='$LoggedUser[ID]'");
|
WHERE ID = '$LoggedUser[ID]'");
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
|
$Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
|
||||||
$Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR']));
|
$Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR']));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
@ -403,7 +405,7 @@
|
|||||||
$DB->query('
|
$DB->query('
|
||||||
SELECT
|
SELECT
|
||||||
ID,
|
ID,
|
||||||
LOWER(REPLACE(Name," ","_")) AS Name,
|
LOWER(REPLACE(Name, " ", "_")) AS Name,
|
||||||
Name AS ProperName
|
Name AS ProperName
|
||||||
FROM stylesheets');
|
FROM stylesheets');
|
||||||
$Stylesheets = $DB->to_array('ID', MYSQLI_BOTH);
|
$Stylesheets = $DB->to_array('ID', MYSQLI_BOTH);
|
||||||
@ -434,8 +436,8 @@ function logout() {
|
|||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
DELETE FROM users_sessions
|
DELETE FROM users_sessions
|
||||||
WHERE UserID='$LoggedUser[ID]'
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
AND SessionID='".db_string($SessionID)."'");
|
AND SessionID = '".db_string($SessionID)."'");
|
||||||
|
|
||||||
$Cache->begin_transaction('users_sessions_'.$LoggedUser['ID']);
|
$Cache->begin_transaction('users_sessions_'.$LoggedUser['ID']);
|
||||||
$Cache->delete_row($SessionID);
|
$Cache->delete_row($SessionID);
|
||||||
|
@ -53,11 +53,11 @@ function search($Query = '', $CachePrefix = '', $CacheLength = 0, $ReturnData =
|
|||||||
$Filters = array();
|
$Filters = array();
|
||||||
foreach ($this->Filters as $Name => $Values) {
|
foreach ($this->Filters as $Name => $Values) {
|
||||||
foreach ($Values as $Value) {
|
foreach ($Values as $Value) {
|
||||||
$Filters[] = $Name." - ".$Value;
|
$Filters[] = "$Name - $Value";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Queries[] = array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime - $QueryStartTime) * 1000);
|
$this->Queries[] = array("Params: $Query Filters: ".implode(', ', $Filters).' Indicies: '.$this->Index, ($QueryEndTime - $QueryStartTime) * 1000);
|
||||||
$this->Time += ($QueryEndTime - $QueryStartTime) * 1000;
|
$this->Time += ($QueryEndTime - $QueryStartTime) * 1000;
|
||||||
|
|
||||||
if ($Result === false) {
|
if ($Result === false) {
|
||||||
@ -65,7 +65,7 @@ function search($Query = '', $CachePrefix = '', $CacheLength = 0, $ReturnData =
|
|||||||
send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed');
|
send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed');
|
||||||
$Cache->cache_value('sphinx_crash_reported', 1, 3600);
|
$Cache->cache_value('sphinx_crash_reported', 1, 3600);
|
||||||
}
|
}
|
||||||
send_irc('PRIVMSG '.LAB_CHAN.' :Search for "'.$Query.'" ('.str_replace("\n",'',print_r($this->Filters, true)).') failed: '.$this->GetLastError());
|
send_irc('PRIVMSG '.LAB_CHAN." :Search for \"$Query\" (".str_replace("\n", '', print_r($this->Filters, true)).') failed: '.$this->GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->TotalResults = $Result['total_found'];
|
$this->TotalResults = $Result['total_found'];
|
||||||
@ -89,7 +89,7 @@ function search($Query = '', $CachePrefix = '', $CacheLength = 0, $ReturnData =
|
|||||||
foreach ($MatchIDs as $Match) {
|
foreach ($MatchIDs as $Match) {
|
||||||
$Matches[$Match] = $Matches[$Match]['attrs'];
|
$Matches[$Match] = $Matches[$Match]['attrs'];
|
||||||
if (!empty($CachePrefix)) {
|
if (!empty($CachePrefix)) {
|
||||||
$Data = $Cache->get_value($CachePrefix.'_'.$Match);
|
$Data = $Cache->get_value($CachePrefix."_$Match");
|
||||||
if ($Data == false) {
|
if ($Data == false) {
|
||||||
$NotFound[] = $Match;
|
$NotFound[] = $Match;
|
||||||
continue;
|
continue;
|
||||||
@ -128,7 +128,7 @@ function search($Query = '', $CachePrefix = '', $CacheLength = 0, $ReturnData =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$Matches = array('matches'=>$Matches,'notfound'=>$NotFound);
|
$Matches = array('matches' => $Matches, 'notfound' => $NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $Matches;
|
return $Matches;
|
||||||
@ -157,7 +157,7 @@ function set_filter($Name, $Vals, $Exclude = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function set_filter_range($Name, $Min, $Max, $Exclude) {
|
function set_filter_range($Name, $Min, $Max, $Exclude) {
|
||||||
$this->Filters[$Name] = array($Min.'-'.$Max);
|
$this->Filters[$Name] = array("$Min-$Max");
|
||||||
$this->SetFilterRange($Name, $Min, $Max, $Exclude);
|
$this->SetFilterRange($Name, $Min, $Max, $Exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ public static function warn_user($UserID, $Duration, $Reason) {
|
|||||||
FROM users_info
|
FROM users_info
|
||||||
WHERE UserID=$UserID
|
WHERE UserID=$UserID
|
||||||
AND Warned != '0000-00-00 00:00:00'");
|
AND Warned != '0000-00-00 00:00:00'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
//User was already warned, appending new warning to old.
|
//User was already warned, appending new warning to old.
|
||||||
list($OldDate) = $DB->next_record();
|
list($OldDate) = $DB->next_record();
|
||||||
$NewExpDate = date('Y-m-d H:i:s', strtotime($OldDate) + $Duration);
|
$NewExpDate = date('Y-m-d H:i:s', strtotime($OldDate) + $Duration);
|
||||||
|
@ -172,7 +172,7 @@ function music_form($GenreTags) {
|
|||||||
RemasterRecordLabel DESC,
|
RemasterRecordLabel DESC,
|
||||||
RemasterCatalogueNumber DESC");
|
RemasterCatalogueNumber DESC");
|
||||||
|
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
$GroupRemasters = $DB->to_array(false, MYSQLI_BOTH, false);
|
$GroupRemasters = $DB->to_array(false, MYSQLI_BOTH, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ public static function delete_group($GroupID) {
|
|||||||
SELECT CollageID
|
SELECT CollageID
|
||||||
FROM collages_torrents
|
FROM collages_torrents
|
||||||
WHERE GroupID = '$GroupID'");
|
WHERE GroupID = '$GroupID'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
$CollageIDs = $DB->collect('CollageID');
|
$CollageIDs = $DB->collect('CollageID');
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE collages
|
UPDATE collages
|
||||||
@ -484,7 +484,7 @@ public static function update_hash($GroupID) {
|
|||||||
SELECT Score
|
SELECT Score
|
||||||
FROM torrents_votes
|
FROM torrents_votes
|
||||||
WHERE GroupID = $GroupID");
|
WHERE GroupID = $GroupID");
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
list($VoteScore) = $DB->next_record();
|
list($VoteScore) = $DB->next_record();
|
||||||
} else {
|
} else {
|
||||||
$VoteScore = 0;
|
$VoteScore = 0;
|
||||||
@ -498,7 +498,7 @@ public static function update_hash($GroupID) {
|
|||||||
WHERE ta.GroupID = $GroupID
|
WHERE ta.GroupID = $GroupID
|
||||||
AND ta.Importance IN ('1', '4', '5', '6')
|
AND ta.Importance IN ('1', '4', '5', '6')
|
||||||
GROUP BY ta.GroupID");
|
GROUP BY ta.GroupID");
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
} else {
|
} else {
|
||||||
$ArtistName = '';
|
$ArtistName = '';
|
||||||
@ -566,7 +566,7 @@ public static function regenerate_filelist($TorrentID) {
|
|||||||
JOIN torrents AS t ON t.ID = tf.TorrentID
|
JOIN torrents AS t ON t.ID = tf.TorrentID
|
||||||
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||||
WHERE tf.TorrentID = $TorrentID");
|
WHERE tf.TorrentID = $TorrentID");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
|
list($GroupID, $Contents) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
if (Misc::is_new_torrent($Contents)) {
|
if (Misc::is_new_torrent($Contents)) {
|
||||||
$Tor = new BencodeTorrent($Contents);
|
$Tor = new BencodeTorrent($Contents);
|
||||||
@ -764,7 +764,7 @@ public static function freeleech_groups($GroupIDs, $FreeNeutral = 1, $FreeLeechT
|
|||||||
SELECT ID
|
SELECT ID
|
||||||
FROM torrents
|
FROM torrents
|
||||||
WHERE GroupID IN ('.implode(', ', $GroupIDs).')');
|
WHERE GroupID IN ('.implode(', ', $GroupIDs).')');
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
$TorrentIDs = $DB->collect('ID');
|
$TorrentIDs = $DB->collect('ID');
|
||||||
Torrents::freeleech_torrents($TorrentIDs, $FreeNeutral, $FreeLeechType);
|
Torrents::freeleech_torrents($TorrentIDs, $FreeNeutral, $FreeLeechType);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ private static function build_table($MemKey, $Query) {
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT MIN(Val)
|
SELECT MIN(Val)
|
||||||
FROM temp_stats
|
FROM temp_stats
|
||||||
GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
|
GROUP BY CEIL(ID / (".(int)$UserCount." / 100));");
|
||||||
|
|
||||||
$Table = $DB->to_array();
|
$Table = $DB->to_array();
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ private static function table_query($TableName) {
|
|||||||
$Query = "
|
$Query = "
|
||||||
SELECT Uploaded
|
SELECT Uploaded
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE Enabled='1'
|
WHERE Enabled = '1'
|
||||||
AND Uploaded > 0
|
AND Uploaded > 0
|
||||||
ORDER BY Uploaded;";
|
ORDER BY Uploaded;";
|
||||||
break;
|
break;
|
||||||
@ -54,7 +54,7 @@ private static function table_query($TableName) {
|
|||||||
$Query = "
|
$Query = "
|
||||||
SELECT Downloaded
|
SELECT Downloaded
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE Enabled='1'
|
WHERE Enabled = '1'
|
||||||
AND Downloaded > 0
|
AND Downloaded > 0
|
||||||
ORDER BY Downloaded;";
|
ORDER BY Downloaded;";
|
||||||
break;
|
break;
|
||||||
@ -62,8 +62,8 @@ private static function table_query($TableName) {
|
|||||||
$Query = "
|
$Query = "
|
||||||
SELECT COUNT(t.ID) AS Uploads
|
SELECT COUNT(t.ID) AS Uploads
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN torrents AS t ON t.UserID=um.ID
|
JOIN torrents AS t ON t.UserID = um.ID
|
||||||
WHERE um.Enabled='1'
|
WHERE um.Enabled = '1'
|
||||||
GROUP BY um.ID
|
GROUP BY um.ID
|
||||||
ORDER BY Uploads;";
|
ORDER BY Uploads;";
|
||||||
break;
|
break;
|
||||||
@ -71,8 +71,8 @@ private static function table_query($TableName) {
|
|||||||
$Query = "
|
$Query = "
|
||||||
SELECT COUNT(r.ID) AS Requests
|
SELECT COUNT(r.ID) AS Requests
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN requests AS r ON r.FillerID=um.ID
|
JOIN requests AS r ON r.FillerID = um.ID
|
||||||
WHERE um.Enabled='1'
|
WHERE um.Enabled = '1'
|
||||||
GROUP BY um.ID
|
GROUP BY um.ID
|
||||||
ORDER BY Requests;";
|
ORDER BY Requests;";
|
||||||
break;
|
break;
|
||||||
@ -80,8 +80,8 @@ private static function table_query($TableName) {
|
|||||||
$Query = "
|
$Query = "
|
||||||
SELECT COUNT(p.ID) AS Posts
|
SELECT COUNT(p.ID) AS Posts
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN forums_posts AS p ON p.AuthorID=um.ID
|
JOIN forums_posts AS p ON p.AuthorID = um.ID
|
||||||
WHERE um.Enabled='1'
|
WHERE um.Enabled = '1'
|
||||||
GROUP BY um.ID
|
GROUP BY um.ID
|
||||||
ORDER BY Posts;";
|
ORDER BY Posts;";
|
||||||
break;
|
break;
|
||||||
@ -89,17 +89,16 @@ private static function table_query($TableName) {
|
|||||||
$Query = "
|
$Query = "
|
||||||
SELECT SUM(rv.Bounty) AS Bounty
|
SELECT SUM(rv.Bounty) AS Bounty
|
||||||
FROM users_main AS um
|
FROM users_main AS um
|
||||||
JOIN requests_votes AS rv ON rv.UserID=um.ID
|
JOIN requests_votes AS rv ON rv.UserID = um.ID
|
||||||
WHERE um.Enabled='1'
|
WHERE um.Enabled = '1' " .
|
||||||
GROUP BY um.ID
|
"GROUP BY um.ID
|
||||||
ORDER BY Bounty;";
|
ORDER BY Bounty;";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'artists':
|
case 'artists':
|
||||||
$Query = "
|
$Query = "
|
||||||
SELECT COUNT(ta.ArtistID) AS Artists
|
SELECT COUNT(ta.ArtistID) AS Artists
|
||||||
FROM torrents_artists AS ta
|
FROM torrents_artists AS ta
|
||||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
JOIN torrents_group AS tg ON tg.ID = ta.GroupID
|
||||||
JOIN torrents AS t ON t.GroupID = tg.ID
|
JOIN torrents AS t ON t.GroupID = tg.ID
|
||||||
WHERE t.UserID != ta.UserID
|
WHERE t.UserID != ta.UserID
|
||||||
GROUP BY tg.ID
|
GROUP BY tg.ID
|
||||||
@ -118,13 +117,13 @@ public static function get_rank($TableName, $Value) {
|
|||||||
$Table = $Cache->get_value(PREFIX.$TableName);
|
$Table = $Cache->get_value(PREFIX.$TableName);
|
||||||
if (!$Table) {
|
if (!$Table) {
|
||||||
//Cache lock!
|
//Cache lock!
|
||||||
$Lock = $Cache->get_value(PREFIX.$TableName."_lock");
|
$Lock = $Cache->get_value(PREFIX.$TableName.'_lock');
|
||||||
if ($Lock) {
|
if ($Lock) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$Cache->cache_value(PREFIX.$TableName."_lock", '1', 300);
|
$Cache->cache_value(PREFIX.$TableName.'_lock', '1', 300);
|
||||||
$Table = self::build_table(PREFIX.$TableName, self::table_query($TableName));
|
$Table = self::build_table(PREFIX.$TableName, self::table_query($TableName));
|
||||||
$Cache->delete_value(PREFIX.$TableName."_lock");
|
$Cache->delete_value(PREFIX.$TableName.'_lock');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$LastPercentile = 0;
|
$LastPercentile = 0;
|
||||||
|
@ -46,7 +46,7 @@ public static function get_classes() {
|
|||||||
*/
|
*/
|
||||||
public static function user_info($UserID) {
|
public static function user_info($UserID) {
|
||||||
global $DB, $Cache, $Classes, $SSL;
|
global $DB, $Cache, $Classes, $SSL;
|
||||||
$UserInfo = $Cache->get_value('user_info_'.$UserID);
|
$UserInfo = $Cache->get_value("user_info_$UserID");
|
||||||
// the !isset($UserInfo['Paranoia']) can be removed after a transition period
|
// the !isset($UserInfo['Paranoia']) can be removed after a transition period
|
||||||
if (empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia']) || empty($UserInfo['Class'])) {
|
if (empty($UserInfo) || empty($UserInfo['ID']) || !isset($UserInfo['Paranoia']) || empty($UserInfo['Class'])) {
|
||||||
$OldQueryID = $DB->get_query_id();
|
$OldQueryID = $DB->get_query_id();
|
||||||
@ -67,12 +67,23 @@ public static function user_info($UserID) {
|
|||||||
m.Visible,
|
m.Visible,
|
||||||
GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels
|
GROUP_CONCAT(ul.PermissionID SEPARATOR ',') AS Levels
|
||||||
FROM users_main AS m
|
FROM users_main AS m
|
||||||
INNER JOIN users_info AS i ON i.UserID=m.ID
|
INNER JOIN users_info AS i ON i.UserID = m.ID
|
||||||
LEFT JOIN users_levels AS ul ON ul.UserID = m.ID
|
LEFT JOIN users_levels AS ul ON ul.UserID = m.ID
|
||||||
WHERE m.ID='$UserID'
|
WHERE m.ID = '$UserID'
|
||||||
GROUP BY m.ID");
|
GROUP BY m.ID");
|
||||||
if ($DB->record_count() == 0) { // Deleted user, maybe?
|
if (!$DB->has_results()) { // Deleted user, maybe?
|
||||||
$UserInfo = array('ID'=>'','Username'=>'','PermissionID'=>0,'Artist'=>false,'Donor'=>false,'Warned'=>'0000-00-00 00:00:00','Avatar'=>'','Enabled'=>0,'Title'=>'', 'CatchupTime'=>0, 'Visible'=>'1');
|
$UserInfo = array(
|
||||||
|
'ID' => '',
|
||||||
|
'Username' => '',
|
||||||
|
'PermissionID' => 0,
|
||||||
|
'Artist' => false,
|
||||||
|
'Donor' => false,
|
||||||
|
'Warned' => '0000-00-00 00:00:00',
|
||||||
|
'Avatar' => '',
|
||||||
|
'Enabled' => 0,
|
||||||
|
'Title' => '',
|
||||||
|
'CatchupTime' => 0,
|
||||||
|
'Visible' => '1');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$UserInfo = $DB->next_record(MYSQLI_ASSOC, array('Paranoia', 'Title'));
|
$UserInfo = $DB->next_record(MYSQLI_ASSOC, array('Paranoia', 'Title'));
|
||||||
@ -98,12 +109,12 @@ public static function user_info($UserID) {
|
|||||||
}
|
}
|
||||||
$UserInfo['EffectiveClass'] = $EffectiveClass;
|
$UserInfo['EffectiveClass'] = $EffectiveClass;
|
||||||
|
|
||||||
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
|
$Cache->cache_value("user_info_$UserID", $UserInfo, 2592000);
|
||||||
$DB->set_query_id($OldQueryID);
|
$DB->set_query_id($OldQueryID);
|
||||||
}
|
}
|
||||||
if (strtotime($UserInfo['Warned']) < time()) {
|
if (strtotime($UserInfo['Warned']) < time()) {
|
||||||
$UserInfo['Warned'] = '0000-00-00 00:00:00';
|
$UserInfo['Warned'] = '0000-00-00 00:00:00';
|
||||||
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
|
$Cache->cache_value("user_info_$UserID", $UserInfo, 2592000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $UserInfo;
|
return $UserInfo;
|
||||||
@ -120,7 +131,7 @@ public static function user_info($UserID) {
|
|||||||
public static function user_heavy_info($UserID) {
|
public static function user_heavy_info($UserID) {
|
||||||
global $DB, $Cache;
|
global $DB, $Cache;
|
||||||
|
|
||||||
$HeavyInfo = $Cache->get_value('user_info_heavy_'.$UserID);
|
$HeavyInfo = $Cache->get_value("user_info_heavy_$UserID");
|
||||||
if (empty($HeavyInfo)) {
|
if (empty($HeavyInfo)) {
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
@ -153,8 +164,8 @@ public static function user_heavy_info($UserID) {
|
|||||||
m.FLTokens,
|
m.FLTokens,
|
||||||
m.PermissionID
|
m.PermissionID
|
||||||
FROM users_main AS m
|
FROM users_main AS m
|
||||||
INNER JOIN users_info AS i ON i.UserID=m.ID
|
INNER JOIN users_info AS i ON i.UserID = m.ID
|
||||||
WHERE m.ID='$UserID'");
|
WHERE m.ID = '$UserID'");
|
||||||
$HeavyInfo = $DB->next_record(MYSQLI_ASSOC, array('CustomPermissions', 'SiteOptions'));
|
$HeavyInfo = $DB->next_record(MYSQLI_ASSOC, array('CustomPermissions', 'SiteOptions'));
|
||||||
|
|
||||||
if (!empty($HeavyInfo['CustomPermissions'])) {
|
if (!empty($HeavyInfo['CustomPermissions'])) {
|
||||||
@ -214,7 +225,7 @@ public static function user_heavy_info($UserID) {
|
|||||||
}
|
}
|
||||||
unset($HeavyInfo['SiteOptions']);
|
unset($HeavyInfo['SiteOptions']);
|
||||||
|
|
||||||
$Cache->cache_value('user_info_heavy_'.$UserID, $HeavyInfo, 0);
|
$Cache->cache_value("user_info_heavy_$UserID", $HeavyInfo, 0);
|
||||||
}
|
}
|
||||||
return $HeavyInfo;
|
return $HeavyInfo;
|
||||||
}
|
}
|
||||||
@ -257,7 +268,7 @@ public static function update_site_options($UserID, $NewOptions) {
|
|||||||
WHERE UserID = $UserID");
|
WHERE UserID = $UserID");
|
||||||
|
|
||||||
// Update cache
|
// Update cache
|
||||||
$Cache->cache_value('user_info_heavy_'.$UserID, $HeavyInfo, 0);
|
$Cache->cache_value("user_info_heavy_$UserID", $HeavyInfo, 0);
|
||||||
|
|
||||||
// Update $LoggedUser if the options are changed for the current
|
// Update $LoggedUser if the options are changed for the current
|
||||||
if ($LoggedUser['ID'] == $UserID) {
|
if ($LoggedUser['ID'] == $UserID) {
|
||||||
@ -302,7 +313,7 @@ public static function release_order(&$SiteOptions, $Default = false) {
|
|||||||
$Val = (isset($RT[$Key]) ? $RT[$Key] : 'Error');
|
$Val = (isset($RT[$Key]) ? $RT[$Key] : 'Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ID = $Key . '_' . (int) !!$Checked;
|
$ID = "$Key_" . (int) !!$Checked;
|
||||||
|
|
||||||
// The HTML is indented this far for proper indentation in the generated HTML
|
// The HTML is indented this far for proper indentation in the generated HTML
|
||||||
// on user.php?action=edit
|
// on user.php?action=edit
|
||||||
@ -530,17 +541,17 @@ public static function get_bookmarks ($UserID)
|
|||||||
|
|
||||||
$UserID = (int) $UserID;
|
$UserID = (int) $UserID;
|
||||||
|
|
||||||
if (($Data = $Cache->get_value('bookmarks_group_ids_' . $UserID))) {
|
if (($Data = $Cache->get_value("bookmarks_group_ids_$UserID"))) {
|
||||||
list($GroupIDs, $BookmarkData) = $Data;
|
list($GroupIDs, $BookmarkData) = $Data;
|
||||||
} else {
|
} else {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT GroupID, Sort, `Time`
|
SELECT GroupID, Sort, `Time`
|
||||||
FROM bookmarks_torrents
|
FROM bookmarks_torrents
|
||||||
WHERE UserID=$UserID
|
WHERE UserID = $UserID
|
||||||
ORDER BY Sort, `Time` ASC");
|
ORDER BY Sort, `Time` ASC");
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
$BookmarkData = $DB->to_array('GroupID', MYSQLI_ASSOC);
|
$BookmarkData = $DB->to_array('GroupID', MYSQLI_ASSOC);
|
||||||
$Cache->cache_value('bookmarks_group_ids_' . $UserID,
|
$Cache->cache_value("bookmarks_group_ids_$UserID",
|
||||||
array($GroupIDs, $BookmarkData), 3600);
|
array($GroupIDs, $BookmarkData), 3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +570,7 @@ public static function get_bookmarks ($UserID)
|
|||||||
* @param string $ReturnHTML
|
* @param string $ReturnHTML
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $ReturnHTML = True) {
|
public static function show_avatar($Avatar, $Username, $Setting, $Size = 150, $ReturnHTML = True) {
|
||||||
global $LoggedUser;
|
global $LoggedUser;
|
||||||
$Avatar = ImageTools::process($Avatar);
|
$Avatar = ImageTools::process($Avatar);
|
||||||
// case 1 is avatars disabled
|
// case 1 is avatars disabled
|
||||||
|
@ -34,14 +34,14 @@ public static function get_user_votes($UserID) {
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$UserVotes = $Cache->get_value('voted_albums_'.$UserID);
|
$UserVotes = $Cache->get_value("voted_albums_$UserID");
|
||||||
if ($UserVotes === false) {
|
if ($UserVotes === false) {
|
||||||
$DB->query('
|
$DB->query("
|
||||||
SELECT GroupID, Type
|
SELECT GroupID, Type
|
||||||
FROM users_votes
|
FROM users_votes
|
||||||
WHERE UserID='.$UserID);
|
WHERE UserID = $UserID");
|
||||||
$UserVotes = $DB->to_array('GroupID', MYSQL_ASSOC, false);
|
$UserVotes = $DB->to_array('GroupID', MYSQL_ASSOC, false);
|
||||||
$Cache->cache_value('voted_albums_'.$UserID, $UserVotes);
|
$Cache->cache_value("voted_albums_$UserID", $UserVotes);
|
||||||
}
|
}
|
||||||
return $UserVotes;
|
return $UserVotes;
|
||||||
}
|
}
|
||||||
@ -56,18 +56,18 @@ public static function get_user_votes($UserID) {
|
|||||||
public static function get_group_votes($GroupID) {
|
public static function get_group_votes($GroupID) {
|
||||||
global $DB, $Cache;
|
global $DB, $Cache;
|
||||||
|
|
||||||
$GroupVotes = $Cache->get_value('votes_'.$GroupID);
|
$GroupVotes = $Cache->get_value("votes_$GroupID");
|
||||||
if ($GroupVotes === false) {
|
if ($GroupVotes === false) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT Ups AS Ups, Total AS Total
|
SELECT Ups AS Ups, Total AS Total
|
||||||
FROM torrents_votes
|
FROM torrents_votes
|
||||||
WHERE GroupID = $GroupID");
|
WHERE GroupID = $GroupID");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$GroupVotes = array('Ups' => 0, 'Total' => 0);
|
$GroupVotes = array('Ups' => 0, 'Total' => 0);
|
||||||
} else {
|
} else {
|
||||||
$GroupVotes = $DB->next_record(MYSQLI_ASSOC, false);
|
$GroupVotes = $DB->next_record(MYSQLI_ASSOC, false);
|
||||||
}
|
}
|
||||||
$Cache->cache_value('votes_'.$GroupID, $GroupVotes, 259200); // 3 days
|
$Cache->cache_value("votes_$GroupID", $GroupVotes, 259200); // 3 days
|
||||||
}
|
}
|
||||||
return $GroupVotes;
|
return $GroupVotes;
|
||||||
}
|
}
|
||||||
@ -215,11 +215,11 @@ public static function get_rank_all($GroupID) {
|
|||||||
if ($Rankings === false) {
|
if ($Rankings === false) {
|
||||||
$Rankings = array();
|
$Rankings = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$DB->query("
|
$DB->query('
|
||||||
SELECT GroupID
|
SELECT GroupID
|
||||||
FROM torrents_votes
|
FROM torrents_votes
|
||||||
ORDER BY Score DESC
|
ORDER BY Score DESC
|
||||||
LIMIT 100");
|
LIMIT 100');
|
||||||
while (list($GID) = $DB->next_record()) {
|
while (list($GID) = $DB->next_record()) {
|
||||||
$Rankings[$GID] = ++$i;
|
$Rankings[$GID] = ++$i;
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ public static function get_rank_year($GroupID, $Year) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Rankings = $Cache->get_value('voting_ranks_year_'.$Year);
|
$Rankings = $Cache->get_value("voting_ranks_year_$Year");
|
||||||
if ($Rankings === false) {
|
if ($Rankings === false) {
|
||||||
$Rankings = array();
|
$Rankings = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -260,7 +260,7 @@ public static function get_rank_year($GroupID, $Year) {
|
|||||||
while (list($GID) = $DB->next_record()) {
|
while (list($GID) = $DB->next_record()) {
|
||||||
$Rankings[$GID] = ++$i;
|
$Rankings[$GID] = ++$i;
|
||||||
}
|
}
|
||||||
$Cache->cache_value('voting_ranks_year_'.$Year , $Rankings, 259200); // 3 days
|
$Cache->cache_value("voting_ranks_year_$Year", $Rankings, 259200); // 3 days
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isset($Rankings[$GroupID]) ? $Rankings[$GroupID] : false);
|
return (isset($Rankings[$GroupID]) ? $Rankings[$GroupID] : false);
|
||||||
@ -287,7 +287,7 @@ public static function get_rank_decade($GroupID, $Year) {
|
|||||||
// First year of the decade
|
// First year of the decade
|
||||||
$Year = $Year - ($Year % 10);
|
$Year = $Year - ($Year % 10);
|
||||||
|
|
||||||
$Rankings = $Cache->get_value('voting_ranks_decade_'.$Year);
|
$Rankings = $Cache->get_value("voting_ranks_decade_$Year");
|
||||||
if ($Rankings === false) {
|
if ($Rankings === false) {
|
||||||
$Rankings = array();
|
$Rankings = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -302,7 +302,7 @@ public static function get_rank_decade($GroupID, $Year) {
|
|||||||
while (list($GID) = $DB->next_record()) {
|
while (list($GID) = $DB->next_record()) {
|
||||||
$Rankings[$GID] = ++$i;
|
$Rankings[$GID] = ++$i;
|
||||||
}
|
}
|
||||||
$Cache->cache_value('voting_ranks_decade_'.$Year , $Rankings, 259200); // 3 days
|
$Cache->cache_value("voting_ranks_decade_$Year", $Rankings, 259200); // 3 days
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isset($Rankings[$GroupID]) ? $Rankings[$GroupID] : false);
|
return (isset($Rankings[$GroupID]) ? $Rankings[$GroupID] : false);
|
||||||
|
@ -364,7 +364,7 @@ class="stat"
|
|||||||
FROM news
|
FROM news
|
||||||
ORDER BY Time DESC
|
ORDER BY Time DESC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($DB->record_count() == 1) {
|
if ($DB->record_count() === 1) {
|
||||||
list($CurrentNews) = $DB->next_record();
|
list($CurrentNews) = $DB->next_record();
|
||||||
} else {
|
} else {
|
||||||
$CurrentNews = -1;
|
$CurrentNews = -1;
|
||||||
@ -385,7 +385,7 @@ class="stat"
|
|||||||
WHERE Important = 1
|
WHERE Important = 1
|
||||||
ORDER BY Time DESC
|
ORDER BY Time DESC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($DB->record_count() == 1) {
|
if ($DB->record_count() === 1) {
|
||||||
list($CurrentBlog) = $DB->next_record();
|
list($CurrentBlog) = $DB->next_record();
|
||||||
} else {
|
} else {
|
||||||
$CurrentBlog = -1;
|
$CurrentBlog = -1;
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
2013-07-08 by alderaan
|
||||||
|
Add "has_results()" function for MySQL class to replace "record_count() === 0" conditional checks
|
||||||
|
|
||||||
|
2013-07-06 by draculesti
|
||||||
|
Bounty amount after tax shown on request pages
|
||||||
|
|
||||||
2013-07-04 by Ajax
|
2013-07-04 by Ajax
|
||||||
added collages to api
|
added collages to api
|
||||||
|
|
||||||
|
@ -3,7 +3,11 @@ INSTALLATION NOTES
|
|||||||
memcached -d -m 5120 -s /var/run/memcached.sock -a 0777 -t16 -C -u root
|
memcached -d -m 5120 -s /var/run/memcached.sock -a 0777 -t16 -C -u root
|
||||||
This gives it 5 gigs of RAM; you probably want to set that a bit lower!
|
This gives it 5 gigs of RAM; you probably want to set that a bit lower!
|
||||||
2. Run gazelle.sql (preferably as root) to create the database, the table, and the default data.
|
2. Run gazelle.sql (preferably as root) to create the database, the table, and the default data.
|
||||||
3. Install sphinx - we recommend you use the included sphinx.conf
|
3. Install Sphinx - we recommend you use the included sphinx.conf. You can copy this to
|
||||||
|
/etc/sphinx/sphinx.conf. You need to fill in the details of the SQL server though!
|
||||||
|
|
||||||
|
You might also need to create the /var/data/sphinx folder.
|
||||||
|
|
||||||
For documentation, read http://www.sphinxsearch.com/docs/current.html
|
For documentation, read http://www.sphinxsearch.com/docs/current.html
|
||||||
|
|
||||||
After you've installed sphinx, create the indices:
|
After you've installed sphinx, create the indices:
|
||||||
@ -14,17 +18,17 @@ INSTALLATION NOTES
|
|||||||
5. Sign up. The first user is made a SysOp!
|
5. Sign up. The first user is made a SysOp!
|
||||||
6. Set up cron jobs. You need a cron job for the schedule, a cron job for
|
6. Set up cron jobs. You need a cron job for the schedule, a cron job for
|
||||||
the peerupdate (all groups are cached, but the peer counts change often,
|
the peerupdate (all groups are cached, but the peer counts change often,
|
||||||
so peerupdate is a script to update them), and the two sphinx indices.
|
so peerupdate is a script to update them), and the two Sphinx indices.
|
||||||
These are our cron jobs:
|
These are our cron jobs. SCHEDULE_KEY is the same as in classes/config.php:
|
||||||
|
|
||||||
0,15,30,45 * * * * /usr/local/bin/php /var/www/vhosts/what/schedule.php SCHEDULE_KEY >> /root/schedule.log
|
0,15,30,45 * * * * /usr/local/bin/php /var/www/vhosts/what/schedule.php SCHEDULE_KEY >> /root/schedule.log
|
||||||
10,25,40,55 * * * * /usr/local/bin/php /var/www/vhosts/what/peerupdate.php SCHEDULE_KEY >> /root/peerupdate.log
|
10,25,40,55 * * * * /usr/local/bin/php /var/www/vhosts/what/peerupdate.php SCHEDULE_KEY >> /root/peerupdate.log
|
||||||
* * * * * /usr/local/bin/indexer -c /etc/sphinx/sphinx.conf --rotate delta
|
* * * * * /usr/local/bin/indexer -c /etc/sphinx/sphinx.conf --rotate delta
|
||||||
5 0,12 * * * /usr/local/bin/indexer -c /etc/sphinx/sphinx.conf --rotate --all
|
5 0,12 * * * /usr/local/bin/indexer -c /etc/sphinx/sphinx.conf --rotate --all
|
||||||
|
|
||||||
7. You're probably going to want geoip information, so first you need to fill in the geoip_country tables by visiting /tools.php?action=update_geoip .
|
7. You're probably going to want IP geolocation information, so first you need to fill in the geoip_country tables by visiting /tools.php?action=update_geoip
|
||||||
After that finishes parsing information from maxmind, you may want to map users to countries by running:
|
After that finishes parsing information from MaxMind, you may want to map users to countries by running:
|
||||||
"INSERT INTO users_geodistribution (Code, Users) SELECT g.Code, COUNT(u.ID) AS Users FROM geoip_country AS g JOIN users_main AS u ON INET_ATON(u.IP) BETWEEN g.StartIP AND g.EndIP WHERE u.Enabled='1' GROUP BY g.Code ORDER BY Users DESC"
|
"INSERT INTO users_geodistribution (Code, Users) SELECT g.Code, COUNT(u.ID) AS Users FROM geoip_country AS g JOIN users_main AS u ON INET_ATON(u.IP) BETWEEN g.StartIP AND g.EndIP WHERE u.Enabled = '1' GROUP BY g.Code ORDER BY Users DESC"
|
||||||
This will fill in the table needed for stats.
|
This will fill in the table needed for stats.
|
||||||
|
|
||||||
8. Start modifying stuff. Hopefully, everything will have gone smoothly so far and nothing will have exploded (ha ha ha)
|
8. Start modifying stuff. Hopefully, everything will have gone smoothly so far and nothing will have exploded (ha ha ha)
|
||||||
|
@ -12,16 +12,19 @@
|
|||||||
FROM news
|
FROM news
|
||||||
ORDER BY Time DESC
|
ORDER BY Time DESC
|
||||||
LIMIT 5");
|
LIMIT 5");
|
||||||
$News = $DB->to_array(false,MYSQLI_NUM,false);
|
$News = $DB->to_array(false, MYSQLI_NUM, false);
|
||||||
$Cache->cache_value('news',$News,3600 * 24 * 30);
|
$Cache->cache_value('news', $News, 3600 * 24 * 30);
|
||||||
$Cache->cache_value('news_latest_id', $News[0][0], 0);
|
$Cache->cache_value('news_latest_id', $News[0][0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($LoggedUser['LastReadNews'] != $News[0][0]) {
|
if ($LoggedUser['LastReadNews'] != $News[0][0]) {
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||||
$Cache->update_row(false, array('LastReadNews' => $News[0][0]));
|
$Cache->update_row(false, array('LastReadNews' => $News[0][0]));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
$DB->query("UPDATE users_info SET LastReadNews = '".$News[0][0]."' WHERE UserID = ".$UserID);
|
$DB->query("
|
||||||
|
UPDATE users_info
|
||||||
|
SET LastReadNews = '".$News[0][0]."'
|
||||||
|
WHERE UserID = $UserID");
|
||||||
$LoggedUser['LastReadNews'] = $News[0][0];
|
$LoggedUser['LastReadNews'] = $News[0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,11 +38,11 @@
|
|||||||
b.Time,
|
b.Time,
|
||||||
b.ThreadID
|
b.ThreadID
|
||||||
FROM blog AS b
|
FROM blog AS b
|
||||||
LEFT JOIN users_main AS um ON b.UserID=um.ID
|
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||||
ORDER BY Time DESC
|
ORDER BY Time DESC
|
||||||
LIMIT 20");
|
LIMIT 20");
|
||||||
$Blog = $DB->to_array();
|
$Blog = $DB->to_array();
|
||||||
$Cache->cache_value('blog',$Blog,1209600);
|
$Cache->cache_value('blog', $Blog, 1209600);
|
||||||
}
|
}
|
||||||
$JsonBlog = array();
|
$JsonBlog = array();
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
@ -57,7 +60,7 @@
|
|||||||
$JsonAnnouncements = array();
|
$JsonAnnouncements = array();
|
||||||
$Count = 0;
|
$Count = 0;
|
||||||
foreach ($News as $NewsItem) {
|
foreach ($News as $NewsItem) {
|
||||||
list($NewsID,$Title,$Body,$NewsTime) = $NewsItem;
|
list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
|
||||||
if (strtotime($NewsTime) > time()) {
|
if (strtotime($NewsTime) > time()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,10 @@ function compare($X, $Y) {
|
|||||||
if (empty($ArtistID)) {
|
if (empty($ArtistID)) {
|
||||||
if (!empty($_GET['artistname'])) {
|
if (!empty($_GET['artistname'])) {
|
||||||
$Name = db_string(trim($_GET['artistname']));
|
$Name = db_string(trim($_GET['artistname']));
|
||||||
$DB->query("SELECT ArtistID FROM artists_alias WHERE Name LIKE '$Name'");
|
$DB->query("
|
||||||
|
SELECT ArtistID
|
||||||
|
FROM artists_alias
|
||||||
|
WHERE Name LIKE '$Name'");
|
||||||
if (!(list($ArtistID) = $DB->next_record(MYSQLI_NUM, false))) {
|
if (!(list($ArtistID) = $DB->next_record(MYSQLI_NUM, false))) {
|
||||||
json_die("failure");
|
json_die("failure");
|
||||||
}
|
}
|
||||||
@ -32,13 +35,13 @@ function compare($X, $Y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
|
if (!empty($_GET['revisionid'])) { // if they're viewing an old revision
|
||||||
$RevisionID=$_GET['revisionid'];
|
$RevisionID = $_GET['revisionid'];
|
||||||
if (!is_number($RevisionID)) {
|
if (!is_number($RevisionID)) {
|
||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
$Data = $Cache->get_value("artist_$ArtistID"."_revision_$RevisionID");
|
$Data = $Cache->get_value("artist_$ArtistID"."_revision_$RevisionID");
|
||||||
} else { // viewing the live version
|
} else { // viewing the live version
|
||||||
$Data = $Cache->get_value('artist_'.$ArtistID);
|
$Data = $Cache->get_value("artist_$ArtistID");
|
||||||
$RevisionID = false;
|
$RevisionID = false;
|
||||||
}
|
}
|
||||||
if ($Data) {
|
if ($Data) {
|
||||||
@ -52,8 +55,8 @@ function compare($X, $Y) {
|
|||||||
wiki.body,
|
wiki.body,
|
||||||
a.VanityHouse
|
a.VanityHouse
|
||||||
FROM wiki_artists AS wiki
|
FROM wiki_artists AS wiki
|
||||||
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
LEFT JOIN artists_group AS a ON wiki.RevisionID = a.RevisionID
|
||||||
WHERE wiki.RevisionID='$RevisionID' ";
|
WHERE wiki.RevisionID = '$RevisionID' ";
|
||||||
} else {
|
} else {
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
@ -62,13 +65,13 @@ function compare($X, $Y) {
|
|||||||
wiki.body,
|
wiki.body,
|
||||||
a.VanityHouse
|
a.VanityHouse
|
||||||
FROM artists_group AS a
|
FROM artists_group AS a
|
||||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID=a.RevisionID
|
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID = a.RevisionID
|
||||||
WHERE a.ArtistID='$ArtistID' ";
|
WHERE a.ArtistID = '$ArtistID' ";
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY a.ArtistID";
|
$sql .= " GROUP BY a.ArtistID";
|
||||||
$DB->query($sql);
|
$DB->query($sql);
|
||||||
|
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
json_die("failure");
|
json_die("failure");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +79,7 @@ function compare($X, $Y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Requests
|
// Requests
|
||||||
$Requests = $Cache->get_value('artists_requests_'.$ArtistID);
|
$Requests = $Cache->get_value("artists_requests_$ArtistID");
|
||||||
if (!is_array($Requests)) {
|
if (!is_array($Requests)) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
@ -88,33 +91,33 @@ function compare($X, $Y) {
|
|||||||
COUNT(rv.UserID) AS Votes,
|
COUNT(rv.UserID) AS Votes,
|
||||||
SUM(rv.Bounty) AS Bounty
|
SUM(rv.Bounty) AS Bounty
|
||||||
FROM requests AS r
|
FROM requests AS r
|
||||||
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
LEFT JOIN requests_votes AS rv ON rv.RequestID = r.ID
|
||||||
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
LEFT JOIN requests_artists AS ra ON r.ID = ra.RequestID
|
||||||
WHERE ra.ArtistID = ".$ArtistID."
|
WHERE ra.ArtistID = $ArtistID
|
||||||
AND r.TorrentID = 0
|
AND r.TorrentID = 0
|
||||||
GROUP BY r.ID
|
GROUP BY r.ID
|
||||||
ORDER BY Votes DESC");
|
ORDER BY Votes DESC");
|
||||||
|
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
$Requests = $DB->to_array();
|
$Requests = $DB->to_array();
|
||||||
} else {
|
} else {
|
||||||
$Requests = array();
|
$Requests = array();
|
||||||
}
|
}
|
||||||
$Cache->cache_value('artists_requests_'.$ArtistID, $Requests);
|
$Cache->cache_value("artists_requests_$ArtistID", $Requests);
|
||||||
}
|
}
|
||||||
$NumRequests = count($Requests);
|
$NumRequests = count($Requests);
|
||||||
|
|
||||||
if (($Importances = $Cache->get_value('artist_groups_'.$ArtistID)) === false) {
|
if (($Importances = $Cache->get_value("artist_groups_$ArtistID")) === false) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
|
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
|
||||||
FROM torrents_artists AS ta
|
FROM torrents_artists AS ta
|
||||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
JOIN torrents_group AS tg ON tg.ID = ta.GroupID
|
||||||
WHERE ta.ArtistID='$ArtistID'
|
WHERE ta.ArtistID = '$ArtistID'
|
||||||
ORDER BY tg.Year DESC, tg.Name DESC");
|
ORDER BY tg.Year DESC, tg.Name DESC");
|
||||||
$GroupIDs = $DB->collect('GroupID');
|
$GroupIDs = $DB->collect('GroupID');
|
||||||
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
|
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
|
||||||
$Cache->cache_value('artist_groups_'.$ArtistID, $Importances, 0);
|
$Cache->cache_value("artist_groups_$ArtistID", $Importances, 0);
|
||||||
} else {
|
} else {
|
||||||
$GroupIDs = array();
|
$GroupIDs = array();
|
||||||
foreach ($Importances as $Group) {
|
foreach ($Importances as $Group) {
|
||||||
@ -122,7 +125,7 @@ function compare($X, $Y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($GroupIDs) > 0) {
|
if (count($GroupIDs) > 0) {
|
||||||
$TorrentList = Torrents::get_groups($GroupIDs, true,true);
|
$TorrentList = Torrents::get_groups($GroupIDs, true, true);
|
||||||
$TorrentList = $TorrentList['matches'];
|
$TorrentList = $TorrentList['matches'];
|
||||||
} else {
|
} else {
|
||||||
$TorrentList = array();
|
$TorrentList = array();
|
||||||
@ -182,7 +185,6 @@ function compare($X, $Y) {
|
|||||||
foreach ($ArtistGroup as &$Artist) {
|
foreach ($ArtistGroup as &$Artist) {
|
||||||
$Artist['id'] = (int) $Artist['id'];
|
$Artist['id'] = (int) $Artist['id'];
|
||||||
$Artist['aliasid'] = (int) $Artist['aliasid'];
|
$Artist['aliasid'] = (int) $Artist['aliasid'];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,12 +195,12 @@ function compare($X, $Y) {
|
|||||||
|
|
||||||
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
|
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
|
||||||
|
|
||||||
$TagList = explode(' ',str_replace('_','.',$TagList));
|
$TagList = explode(' ',str_replace('_', '.', $TagList));
|
||||||
|
|
||||||
// $Tags array is for the sidebar on the right
|
// $Tags array is for the sidebar on the right
|
||||||
foreach ($TagList as $Tag) {
|
foreach ($TagList as $Tag) {
|
||||||
if (!isset($Tags[$Tag])) {
|
if (!isset($Tags[$Tag])) {
|
||||||
$Tags[$Tag] = array('name'=>$Tag, 'count'=>1);
|
$Tags[$Tag] = array('name' => $Tag, 'count' => 1);
|
||||||
} else {
|
} else {
|
||||||
$Tags[$Tag]['count']++;
|
$Tags[$Tag]['count']++;
|
||||||
}
|
}
|
||||||
@ -262,10 +264,10 @@ function compare($X, $Y) {
|
|||||||
ass.Score,
|
ass.Score,
|
||||||
ass.SimilarID
|
ass.SimilarID
|
||||||
FROM artists_similar AS s1
|
FROM artists_similar AS s1
|
||||||
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID
|
JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID AND s1.ArtistID != s2.ArtistID
|
||||||
JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID
|
JOIN artists_similar_scores AS ass ON ass.SimilarID = s1.SimilarID
|
||||||
JOIN artists_group AS a ON a.ArtistID=s2.ArtistID
|
JOIN artists_group AS a ON a.ArtistID = s2.ArtistID
|
||||||
WHERE s1.ArtistID='$ArtistID'
|
WHERE s1.ArtistID = '$ArtistID'
|
||||||
ORDER BY ass.Score DESC
|
ORDER BY ass.Score DESC
|
||||||
LIMIT 30
|
LIMIT 30
|
||||||
");
|
");
|
||||||
@ -309,11 +311,16 @@ function compare($X, $Y) {
|
|||||||
$notificationsEnabled = false;
|
$notificationsEnabled = false;
|
||||||
if (check_perms('site_torrents_notify')) {
|
if (check_perms('site_torrents_notify')) {
|
||||||
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
|
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
|
||||||
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' AND Label='Artist notifications' LIMIT 1");
|
$DB->query("
|
||||||
|
SELECT ID, Artists
|
||||||
|
FROM users_notify_filters
|
||||||
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
|
AND Label = 'Artist notifications'
|
||||||
|
LIMIT 1");
|
||||||
$Notify = $DB->next_record(MYSQLI_ASSOC, false);
|
$Notify = $DB->next_record(MYSQLI_ASSOC, false);
|
||||||
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
|
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
|
||||||
}
|
}
|
||||||
if (stripos($Notify['Artists'], '|'.$Name.'|') === false) {
|
if (stripos($Notify['Artists'], "|$Name|") === false) {
|
||||||
$notificationsEnabled = false;
|
$notificationsEnabled = false;
|
||||||
} else {
|
} else {
|
||||||
$notificationsEnabled = true;
|
$notificationsEnabled = true;
|
||||||
@ -325,7 +332,7 @@ function compare($X, $Y) {
|
|||||||
if ($RevisionID) {
|
if ($RevisionID) {
|
||||||
$Key = "artist_$ArtistID"."_revision_$RevisionID";
|
$Key = "artist_$ArtistID"."_revision_$RevisionID";
|
||||||
} else {
|
} else {
|
||||||
$Key = 'artist_'.$ArtistID;
|
$Key = "artist_$ArtistID";
|
||||||
}
|
}
|
||||||
|
|
||||||
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
|
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include(SERVER_ROOT.'/sections/torrents/functions.php');
|
include(SERVER_ROOT.'/sections/torrents/functions.php');
|
||||||
|
|
||||||
// The "order by x" links on columns headers
|
// The "order by x" links on columns headers
|
||||||
function header_link($SortKey,$DefaultWay = 'desc') {
|
function header_link($SortKey, $DefaultWay = 'desc') {
|
||||||
global $OrderBy,$OrderWay;
|
global $OrderBy,$OrderWay;
|
||||||
if ($SortKey == $OrderBy) {
|
if ($SortKey == $OrderBy) {
|
||||||
if ($OrderWay == 'desc') {
|
if ($OrderWay == 'desc') {
|
||||||
@ -17,48 +15,60 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
$NewWay = $DefaultWay;
|
$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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Start default parameters and validation **/
|
/** Start default parameters and validation **/
|
||||||
// Setting default search options
|
// Setting default search options
|
||||||
if (!empty($_GET['setdefault'])) {
|
if (!empty($_GET['setdefault'])) {
|
||||||
$UnsetList = array('page','setdefault');
|
$UnsetList = array('page', 'setdefault');
|
||||||
$UnsetRegexp = '/(&|^)('.implode('|',$UnsetList).')=.*?(&|$)/i';
|
$UnsetRegexp = '/(&|^)('.implode('|', $UnsetList).')=.*?(&|$)/i';
|
||||||
|
|
||||||
$DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
$DB->query("
|
||||||
list($SiteOptions)=$DB->next_record(MYSQLI_NUM, false);
|
SELECT SiteOptions
|
||||||
|
FROM users_info
|
||||||
|
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||||
|
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
if (!empty($SiteOptions)) {
|
if (!empty($SiteOptions)) {
|
||||||
$SiteOptions = unserialize($SiteOptions);
|
$SiteOptions = unserialize($SiteOptions);
|
||||||
} else {
|
} else {
|
||||||
$SiteOptions = array();
|
$SiteOptions = array();
|
||||||
}
|
}
|
||||||
$SiteOptions['DefaultSearch'] = preg_replace($UnsetRegexp,'',$_SERVER['QUERY_STRING']);
|
$SiteOptions['DefaultSearch'] = preg_replace($UnsetRegexp, '', $_SERVER['QUERY_STRING']);
|
||||||
$DB->query("UPDATE users_info SET SiteOptions='".db_string(serialize($SiteOptions))."' WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
$DB->query("
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
UPDATE users_info
|
||||||
$Cache->update_row(false, array('DefaultSearch'=>$SiteOptions['DefaultSearch']));
|
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' => $SiteOptions['DefaultSearch']));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
// Clearing default search options
|
// Clearing default search options
|
||||||
} elseif (!empty($_GET['cleardefault'])) {
|
} elseif (!empty($_GET['cleardefault'])) {
|
||||||
$DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
$DB->query("
|
||||||
list($SiteOptions)=$DB->next_record(MYSQLI_NUM, false);
|
SELECT SiteOptions
|
||||||
$SiteOptions=unserialize($SiteOptions);
|
FROM users_info
|
||||||
|
WHERE UserID = '".db_string($LoggedUser['ID'])."'");
|
||||||
|
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
|
$SiteOptions = unserialize($SiteOptions);
|
||||||
$SiteOptions['DefaultSearch']='';
|
$SiteOptions['DefaultSearch']='';
|
||||||
$DB->query("UPDATE users_info SET SiteOptions='".db_string(serialize($SiteOptions))."' WHERE UserID='".db_string($LoggedUser['ID'])."'");
|
$DB->query("
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
UPDATE users_info
|
||||||
$Cache->update_row(false, array('DefaultSearch'=>''));
|
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);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
// Use default search options
|
// Use default search options
|
||||||
} elseif (empty($_SERVER['QUERY_STRING']) || (count($_GET) == 1 && isset($_GET['page']))) {
|
} elseif (empty($_SERVER['QUERY_STRING']) || (count($_GET) === 1 && isset($_GET['page']))) {
|
||||||
if (!empty($LoggedUser['DefaultSearch'])) {
|
if (!empty($LoggedUser['DefaultSearch'])) {
|
||||||
if (!empty($_GET['page'])) {
|
if (!empty($_GET['page'])) {
|
||||||
$Page = $_GET['page'];
|
$Page = $_GET['page'];
|
||||||
parse_str($LoggedUser['DefaultSearch'],$_GET);
|
parse_str($LoggedUser['DefaultSearch'], $_GET);
|
||||||
$_GET['page'] = $Page;
|
$_GET['page'] = $Page;
|
||||||
} else {
|
} else {
|
||||||
parse_str($LoggedUser['DefaultSearch'],$_GET);
|
parse_str($LoggedUser['DefaultSearch'], $_GET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,9 +123,9 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
|
|
||||||
/** Start preparation of property arrays **/
|
/** Start preparation of property arrays **/
|
||||||
array_pop($Bitrates); // remove 'other'
|
array_pop($Bitrates); // remove 'other'
|
||||||
$SearchBitrates = array_merge($Bitrates, array('v0','v1','v2','24bit'));
|
$SearchBitrates = array_merge($Bitrates, array('v0', 'v1', 'v2', '24bit'));
|
||||||
|
|
||||||
foreach ($SearchBitrates as $ID=>$Val) {
|
foreach ($SearchBitrates as $ID => $Val) {
|
||||||
$SearchBitrates[$ID] = strtolower($Val);
|
$SearchBitrates[$ID] = strtolower($Val);
|
||||||
}
|
}
|
||||||
foreach ($Formats as $ID => $Val) {
|
foreach ($Formats as $ID => $Val) {
|
||||||
@ -163,7 +173,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Collect all entered search terms to find out whether to enable the NOT operator
|
// Collect all entered search terms to find out whether to enable the NOT operator
|
||||||
$GroupFields = array('artistname','groupname', 'recordlabel', 'cataloguenumber', 'taglist');
|
$GroupFields = array('artistname', 'groupname', 'recordlabel', 'cataloguenumber', 'taglist');
|
||||||
$TorrentFields = array('remastertitle', 'remasteryear', 'remasterrecordlabel', 'remastercataloguenumber', 'encoding', 'format', 'media');
|
$TorrentFields = array('remastertitle', 'remasteryear', 'remasterrecordlabel', 'remastercataloguenumber', 'encoding', 'format', 'media');
|
||||||
$SearchWords = array();
|
$SearchWords = array();
|
||||||
foreach (array('artistname', 'groupname', 'recordlabel', 'cataloguenumber',
|
foreach (array('artistname', 'groupname', 'recordlabel', 'cataloguenumber',
|
||||||
@ -182,7 +192,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
foreach ($Words as $Word) {
|
foreach ($Words as $Word) {
|
||||||
$Word = trim($Word);
|
$Word = trim($Word);
|
||||||
if ($Word[0] == '!' && strlen($Word) >= 2) {
|
if ($Word[0] == '!' && strlen($Word) >= 2) {
|
||||||
if (strpos($Word,'!',1) === false) {
|
if (strpos($Word, '!', 1) === false) {
|
||||||
$SearchWords[$Search]['exclude'][] = $Word;
|
$SearchWords[$Search]['exclude'][] = $Word;
|
||||||
} else {
|
} else {
|
||||||
$SearchWords[$Search]['include'][] = $Word;
|
$SearchWords[$Search]['include'][] = $Word;
|
||||||
@ -200,7 +210,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
//Simple search
|
//Simple search
|
||||||
if (!empty($_GET['searchstr'])) {
|
if (!empty($_GET['searchstr'])) {
|
||||||
$SearchString = trim($_GET['searchstr']);
|
$SearchString = trim($_GET['searchstr']);
|
||||||
$Words = explode(' ',strtolower($SearchString));
|
$Words = explode(' ', strtolower($SearchString));
|
||||||
if (!empty($Words)) {
|
if (!empty($Words)) {
|
||||||
$FilterBitrates = $FilterFormats = array();
|
$FilterBitrates = $FilterFormats = array();
|
||||||
$BasicSearch = array('include' => array(), 'exclude' => array());
|
$BasicSearch = array('include' => array(), 'exclude' => array());
|
||||||
@ -209,7 +219,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
if ($Word[0] == '!' && strlen($Word) >= 2) {
|
if ($Word[0] == '!' && strlen($Word) >= 2) {
|
||||||
if ($Word == '!100%') {
|
if ($Word == '!100%') {
|
||||||
$_GET['haslog'] = '-1';
|
$_GET['haslog'] = '-1';
|
||||||
} elseif (strpos($Word,'!',1) === false) {
|
} elseif (strpos($Word, '!', 1) === false) {
|
||||||
$BasicSearch['exclude'][] = $Word;
|
$BasicSearch['exclude'][] = $Word;
|
||||||
} else {
|
} else {
|
||||||
$BasicSearch['include'][] = $Word;
|
$BasicSearch['include'][] = $Word;
|
||||||
@ -238,7 +248,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
}
|
}
|
||||||
if (!empty($BasicSearch['exclude'])) {
|
if (!empty($BasicSearch['exclude'])) {
|
||||||
foreach ($BasicSearch['exclude'] as $Word) {
|
foreach ($BasicSearch['exclude'] as $Word) {
|
||||||
$QueryParts[] = '!'.Sphinxql::escape_string(substr($Word,1));
|
$QueryParts[] = '!'.Sphinxql::escape_string(substr($Word, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($FilterBitrates)) {
|
if (!empty($FilterBitrates)) {
|
||||||
@ -274,7 +284,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
}
|
}
|
||||||
if (!empty($Tags['exclude'])) {
|
if (!empty($Tags['exclude'])) {
|
||||||
foreach ($Tags['exclude'] as &$Tag) {
|
foreach ($Tags['exclude'] as &$Tag) {
|
||||||
$Tag = '!'.Sphinxql::escape_string(substr($Tag,1));
|
$Tag = '!'.Sphinxql::escape_string(substr($Tag, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +326,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
}
|
}
|
||||||
if (!empty($Words['exclude'])) {
|
if (!empty($Words['exclude'])) {
|
||||||
foreach ($Words['exclude'] as $Word) {
|
foreach ($Words['exclude'] as $Word) {
|
||||||
$QueryParts[] = '!'.Sphinxql::escape_string(substr($Word,1));
|
$QueryParts[] = '!'.Sphinxql::escape_string(substr($Word, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($QueryParts)) {
|
if (!empty($QueryParts)) {
|
||||||
@ -330,7 +340,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
if (!empty($_GET['year'])) {
|
if (!empty($_GET['year'])) {
|
||||||
$Years = explode('-', $_GET['year']);
|
$Years = explode('-', $_GET['year']);
|
||||||
if (is_number($Years[0]) || (empty($Years[0]) && !empty($Years[1]) && is_number($Years[1]))) {
|
if (is_number($Years[0]) || (empty($Years[0]) && !empty($Years[1]) && is_number($Years[1]))) {
|
||||||
if (count($Years) == 1) {
|
if (count($Years) === 1) {
|
||||||
$SphQL->where('year', (int)$Years[0]);
|
$SphQL->where('year', (int)$Years[0]);
|
||||||
$SphQLTor->where('year', (int)$Years[0]);
|
$SphQLTor->where('year', (int)$Years[0]);
|
||||||
} else {
|
} else {
|
||||||
@ -346,7 +356,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['haslog']) && $_GET['haslog']!=='') {
|
if (isset($_GET['haslog']) && $_GET['haslog'] !== '') {
|
||||||
if ($_GET['haslog'] == 100) {
|
if ($_GET['haslog'] == 100) {
|
||||||
$SphQL->where('logscore', 100);
|
$SphQL->where('logscore', 100);
|
||||||
$SphQLTor->where('logscore', 100);
|
$SphQLTor->where('logscore', 100);
|
||||||
@ -367,7 +377,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
$Filtered = true;
|
$Filtered = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (array('hascue','scene','vanityhouse','releasetype') as $Search) {
|
foreach (array('hascue', 'scene', 'vanityhouse', 'releasetype') as $Search) {
|
||||||
if (isset($_GET[$Search]) && $_GET[$Search] !== '') {
|
if (isset($_GET[$Search]) && $_GET[$Search] !== '') {
|
||||||
$SphQL->where($Search, $_GET[$Search]);
|
$SphQL->where($Search, $_GET[$Search]);
|
||||||
// Release type is group specific
|
// Release type is group specific
|
||||||
@ -420,7 +430,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
if (isset($Random) && $GroupResults) {
|
if (isset($Random) && $GroupResults) {
|
||||||
// ORDER BY RAND() can't be used together with GROUP BY, so we need some special tactics
|
// ORDER BY RAND() can't be used together with GROUP BY, so we need some special tactics
|
||||||
$Page = 1;
|
$Page = 1;
|
||||||
$SphQL->limit(0, 5*TORRENTS_PER_PAGE, 5*TORRENTS_PER_PAGE);
|
$SphQL->limit(0, 5 * TORRENTS_PER_PAGE, 5 * TORRENTS_PER_PAGE);
|
||||||
$SphQLResult = $SphQL->query();
|
$SphQLResult = $SphQL->query();
|
||||||
$TotalCount = $SphQLResult->get_meta('total_found');
|
$TotalCount = $SphQLResult->get_meta('total_found');
|
||||||
$Results = $SphQLResult->to_array('groupid');
|
$Results = $SphQLResult->to_array('groupid');
|
||||||
@ -482,7 +492,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of all torrent ids that match the search query
|
// Get a list of all torrent IDs that match the search query
|
||||||
$SphQLTor->where('id', $TorrentIDs)->limit(0, count($TorrentIDs), count($TorrentIDs));
|
$SphQLTor->where('id', $TorrentIDs)->limit(0, count($TorrentIDs), count($TorrentIDs));
|
||||||
$SphQLResultTor = $SphQLTor->query();
|
$SphQLResultTor = $SphQLTor->query();
|
||||||
$TorrentIDs = array_fill_keys($SphQLResultTor->collect('id'), true);
|
$TorrentIDs = array_fill_keys($SphQLResultTor->collect('id'), true);
|
||||||
@ -492,14 +502,15 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
|
|
||||||
if ($TorrentCount == 0) {
|
if ($TorrentCount == 0) {
|
||||||
|
|
||||||
$DB->query("SELECT
|
$DB->query("
|
||||||
tags.Name,
|
SELECT
|
||||||
((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score
|
tags.Name,
|
||||||
|
((COUNT(tags.Name) - 2) * (SUM(tt.PositiveVotes) - SUM(tt.NegativeVotes))) / (tags.Uses * 0.8) AS Score
|
||||||
FROM xbt_snatched AS s
|
FROM xbt_snatched AS s
|
||||||
INNER JOIN torrents AS t ON t.ID=s.fid
|
INNER JOIN torrents AS t ON t.ID = s.fid
|
||||||
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
|
INNER JOIN torrents_group AS g ON t.GroupID = g.ID
|
||||||
INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID
|
INNER JOIN torrents_tags AS tt ON tt.GroupID = g.ID
|
||||||
INNER JOIN tags ON tags.ID=tt.TagID
|
INNER JOIN tags ON tags.ID = tt.TagID
|
||||||
WHERE s.uid = '$LoggedUser[ID]'
|
WHERE s.uid = '$LoggedUser[ID]'
|
||||||
AND tt.TagID != '13679'
|
AND tt.TagID != '13679'
|
||||||
AND tt.TagID != '4820'
|
AND tt.TagID != '4820'
|
||||||
@ -553,7 +564,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
$Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]);
|
$Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList']));
|
$TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
|
||||||
$JsonArtists = array();
|
$JsonArtists = array();
|
||||||
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
|
||||||
unset($ExtendedArtists[2]);
|
unset($ExtendedArtists[2]);
|
||||||
@ -578,7 +589,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
} else {
|
} else {
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
}
|
}
|
||||||
if ($GroupResults && (count($Torrents) > 1 || isset($GroupedCategories[$CategoryID-1]))) {
|
if ($GroupResults && (count($Torrents) > 1 || isset($GroupedCategories[$CategoryID - 1]))) {
|
||||||
// These torrents are in a group
|
// These torrents are in a group
|
||||||
$LastRemasterYear = '-';
|
$LastRemasterYear = '-';
|
||||||
$LastRemasterTitle = '';
|
$LastRemasterTitle = '';
|
||||||
@ -602,7 +613,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
$FirstUnknown = !isset($FirstUnknown);
|
$FirstUnknown = !isset($FirstUnknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($GroupedCategories[$CategoryID-1])
|
if (isset($GroupedCategories[$CategoryID - 1])
|
||||||
&& ($Data['RemasterTitle'] != $LastRemasterTitle
|
&& ($Data['RemasterTitle'] != $LastRemasterTitle
|
||||||
|| $Data['RemasterYear'] != $LastRemasterYear
|
|| $Data['RemasterYear'] != $LastRemasterYear
|
||||||
|| $Data['RemasterRecordLabel'] != $LastRemasterRecordLabel
|
|| $Data['RemasterRecordLabel'] != $LastRemasterRecordLabel
|
||||||
@ -614,19 +625,34 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
if ($Data['Remastered'] && $Data['RemasterYear'] != 0) {
|
if ($Data['Remastered'] && $Data['RemasterYear'] != 0) {
|
||||||
|
|
||||||
$RemasterName = $Data['RemasterYear'];
|
$RemasterName = $Data['RemasterYear'];
|
||||||
$AddExtra = " - ";
|
$AddExtra = ' - ';
|
||||||
if ($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; }
|
if ($Data['RemasterRecordLabel']) {
|
||||||
if ($Data['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Data['RemasterCatalogueNumber']); $AddExtra=' / '; }
|
$RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']);
|
||||||
if ($Data['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Data['RemasterTitle']); $AddExtra=' / '; }
|
$AddExtra = ' / ';
|
||||||
|
}
|
||||||
|
if ($Data['RemasterCatalogueNumber']) {
|
||||||
|
$RemasterName .= $AddExtra.display_str($Data['RemasterCatalogueNumber']);
|
||||||
|
$AddExtra = ' / ';
|
||||||
|
}
|
||||||
|
if ($Data['RemasterTitle']) {
|
||||||
|
$RemasterName .= $AddExtra.display_str($Data['RemasterTitle']);
|
||||||
|
$AddExtra = ' / ';
|
||||||
|
}
|
||||||
$RemasterName .= $AddExtra.display_str($Data['Media']);
|
$RemasterName .= $AddExtra.display_str($Data['Media']);
|
||||||
} else {
|
} else {
|
||||||
$AddExtra = " / ";
|
$AddExtra = ' / ';
|
||||||
if (!$Data['Remastered']) {
|
if (!$Data['Remastered']) {
|
||||||
$MasterName = "Original Release";
|
$MasterName = 'Original Release';
|
||||||
if ($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
|
if ($GroupRecordLabel) {
|
||||||
if ($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
|
$MasterName .= $AddExtra.$GroupRecordLabel;
|
||||||
|
$AddExtra = ' / ';
|
||||||
|
}
|
||||||
|
if ($GroupCatalogueNumber) {
|
||||||
|
$MasterName .= $AddExtra.$GroupCatalogueNumber;
|
||||||
|
$AddExtra = ' / ';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$MasterName = "Unknown Release(s)";
|
$MasterName = 'Unknown Release(s)';
|
||||||
}
|
}
|
||||||
$MasterName .= $AddExtra.display_str($Data['Media']);
|
$MasterName .= $AddExtra.display_str($Data['Media']);
|
||||||
}
|
}
|
||||||
@ -694,7 +720,7 @@ function header_link($SortKey,$DefaultWay = 'desc') {
|
|||||||
'groupName' => $GroupName,
|
'groupName' => $GroupName,
|
||||||
'torrentId' => (int) $TorrentID,
|
'torrentId' => (int) $TorrentID,
|
||||||
'tags' => $TagList,
|
'tags' => $TagList,
|
||||||
'category' => $Categories[$CategoryID-1],
|
'category' => $Categories[$CategoryID - 1],
|
||||||
'fileCount' => (int) $Data['FileCount'],
|
'fileCount' => (int) $Data['FileCount'],
|
||||||
'groupTime' => (string) strtotime($Data['Time']),
|
'groupTime' => (string) strtotime($Data['Time']),
|
||||||
'size' => (int) $Data['Size'],
|
'size' => (int) $Data['Size'],
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT File
|
SELECT File
|
||||||
FROM torrents_files
|
FROM torrents_files
|
||||||
WHERE TorrentID='$TorrentID'");
|
WHERE TorrentID = '$TorrentID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
echo('Torrent not found.');
|
echo('Torrent not found.');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
WHERE ID = '$CollageID'";
|
WHERE ID = '$CollageID'";
|
||||||
$DB->query($sql);
|
$DB->query($sql);
|
||||||
|
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
json_die("failure");
|
json_die("failure");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@ function check_paranoia_here($Setting) {
|
|||||||
|
|
||||||
if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) {
|
if (check_paranoia_here('seeding+') || check_paranoia_here('leeching+')) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(x.uid)
|
SELECT IF(remaining = 0, 'Seeding', 'Leeching') AS Type, COUNT(x.uid)
|
||||||
FROM xbt_files_users AS x
|
FROM xbt_files_users AS x
|
||||||
INNER JOIN torrents AS t ON t.ID=x.fid
|
INNER JOIN torrents AS t ON t.ID = x.fid
|
||||||
WHERE x.uid='$UserID'
|
WHERE x.uid = '$UserID'
|
||||||
AND x.active=1
|
AND x.active = 1
|
||||||
GROUP BY Type");
|
GROUP BY Type");
|
||||||
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
|
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
|
||||||
if (check_paranoia('seeding+')) {
|
if (check_paranoia('seeding+')) {
|
||||||
@ -42,7 +42,7 @@ function check_paranoia_here($Setting) {
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT COUNT(x.uid), COUNT(DISTINCT x.fid)
|
SELECT COUNT(x.uid), COUNT(DISTINCT x.fid)
|
||||||
FROM xbt_snatched AS x
|
FROM xbt_snatched AS x
|
||||||
INNER JOIN torrents AS t ON t.ID=x.fid
|
INNER JOIN torrents AS t ON t.ID = x.fid
|
||||||
WHERE x.uid = '$UserID'");
|
WHERE x.uid = '$UserID'");
|
||||||
list($Snatched, $UniqueSnatched) = $DB->next_record(MYSQLI_NUM, false);
|
list($Snatched, $UniqueSnatched) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
$CommStats['snatched'] = number_format($Snatched);
|
$CommStats['snatched'] = number_format($Snatched);
|
||||||
@ -57,8 +57,8 @@ function check_paranoia_here($Setting) {
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID)
|
SELECT COUNT(ud.UserID), COUNT(DISTINCT ud.TorrentID)
|
||||||
FROM users_downloads AS ud
|
FROM users_downloads AS ud
|
||||||
JOIN torrents AS t ON t.ID=ud.TorrentID
|
JOIN torrents AS t ON t.ID = ud.TorrentID
|
||||||
WHERE ud.UserID='$UserID'");
|
WHERE ud.UserID = '$UserID'");
|
||||||
list($NumDownloads, $UniqueDownloads) = $DB->next_record(MYSQLI_NUM, false);
|
list($NumDownloads, $UniqueDownloads) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
$CommStats['downloaded'] = number_format($NumDownloads);
|
$CommStats['downloaded'] = number_format($NumDownloads);
|
||||||
$CommStats['udownloaded'] = number_format($UniqueDownloads);
|
$CommStats['udownloaded'] = number_format($UniqueDownloads);
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
$Pages = Format::get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9);
|
$Pages = Format::get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9);
|
||||||
|
|
||||||
if (count($Forum) == 0) {
|
if (count($Forum) === 0) {
|
||||||
print
|
print
|
||||||
json_encode(
|
json_encode(
|
||||||
array(
|
array(
|
||||||
@ -100,18 +100,18 @@
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
|
// forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
|
||||||
$DB->query('
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
l.TopicID,
|
l.TopicID,
|
||||||
l.PostID,
|
l.PostID,
|
||||||
CEIL(( SELECT COUNT(ID)
|
CEIL(( SELECT COUNT(ID)
|
||||||
FROM forums_posts
|
FROM forums_posts
|
||||||
WHERE forums_posts.TopicID = l.TopicID
|
WHERE forums_posts.TopicID = l.TopicID
|
||||||
AND forums_posts.ID <= l.PostID) / '.$PerPage.'
|
AND forums_posts.ID <= l.PostID) / $PerPage
|
||||||
) AS Page
|
) AS Page
|
||||||
FROM forums_last_read_topics AS l
|
FROM forums_last_read_topics AS l
|
||||||
WHERE TopicID IN('.implode(', ', array_keys($Forum)).')
|
WHERE TopicID IN(".implode(', ', array_keys($Forum)).')
|
||||||
AND UserID=\''.$LoggedUser['ID'].'\'');
|
AND UserID = \''.$LoggedUser['ID'].'\'');
|
||||||
|
|
||||||
// Turns the result set into a multi-dimensional array, with
|
// Turns the result set into a multi-dimensional array, with
|
||||||
// forums_last_read_topics.TopicID as the key.
|
// forums_last_read_topics.TopicID as the key.
|
||||||
|
@ -97,7 +97,7 @@ function get_forum_info($ForumID) {
|
|||||||
LEFT JOIN forums_topics ON forums_topics.ForumID = forums.ID
|
LEFT JOIN forums_topics ON forums_topics.ForumID = forums.ID
|
||||||
WHERE forums.ID = '$ForumID'
|
WHERE forums.ID = '$ForumID'
|
||||||
GROUP BY ForumID");
|
GROUP BY ForumID");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Makes an array, with $Forum['Name'], etc.
|
// Makes an array, with $Forum['Name'], etc.
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
FROM pm_conversations_users
|
FROM pm_conversations_users
|
||||||
WHERE UserID='$UserID'
|
WHERE UserID='$UserID'
|
||||||
AND ConvID='$ConvID'");
|
AND ConvID='$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
print json_encode(array('status' => 'failure'));
|
print json_encode(array('status' => 'failure'));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,12 @@
|
|||||||
$MyNews = $LoggedUser['LastReadNews'];
|
$MyNews = $LoggedUser['LastReadNews'];
|
||||||
$CurrentNews = $Cache->get_value('news_latest_id');
|
$CurrentNews = $Cache->get_value('news_latest_id');
|
||||||
if ($CurrentNews === false) {
|
if ($CurrentNews === false) {
|
||||||
$DB->query("SELECT ID FROM news ORDER BY Time DESC LIMIT 1");
|
$DB->query("
|
||||||
if ($DB->record_count() == 1) {
|
SELECT ID
|
||||||
|
FROM news
|
||||||
|
ORDER BY Time DESC
|
||||||
|
LIMIT 1");
|
||||||
|
if ($DB->record_count() === 1) {
|
||||||
list($CurrentNews) = $DB->next_record();
|
list($CurrentNews) = $DB->next_record();
|
||||||
} else {
|
} else {
|
||||||
$CurrentNews = -1;
|
$CurrentNews = -1;
|
||||||
@ -24,7 +28,12 @@
|
|||||||
|
|
||||||
$NewMessages = $Cache->get_value('inbox_new_' . $LoggedUser['ID']);
|
$NewMessages = $Cache->get_value('inbox_new_' . $LoggedUser['ID']);
|
||||||
if ($NewMessages === false) {
|
if ($NewMessages === false) {
|
||||||
$DB->query("SELECT COUNT(UnRead) FROM pm_conversations_users WHERE UserID='" . $LoggedUser['ID'] . "' AND UnRead = '1' AND InInbox = '1'");
|
$DB->query("
|
||||||
|
SELECT COUNT(UnRead)
|
||||||
|
FROM pm_conversations_users
|
||||||
|
WHERE UserID = '" . $LoggedUser['ID'] . "'
|
||||||
|
AND UnRead = '1'
|
||||||
|
AND InInbox = '1'");
|
||||||
list($NewMessages) = $DB->next_record();
|
list($NewMessages) = $DB->next_record();
|
||||||
$Cache->cache_value('inbox_new_' . $LoggedUser['ID'], $NewMessages, 0);
|
$Cache->cache_value('inbox_new_' . $LoggedUser['ID'], $NewMessages, 0);
|
||||||
}
|
}
|
||||||
@ -32,7 +41,11 @@
|
|||||||
if (check_perms('site_torrents_notify')) {
|
if (check_perms('site_torrents_notify')) {
|
||||||
$NewNotifications = $Cache->get_value('notifications_new_' . $LoggedUser['ID']);
|
$NewNotifications = $Cache->get_value('notifications_new_' . $LoggedUser['ID']);
|
||||||
if ($NewNotifications === false) {
|
if ($NewNotifications === false) {
|
||||||
$DB->query("SELECT COUNT(UserID) FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='1'");
|
$DB->query("
|
||||||
|
SELECT COUNT(UserID)
|
||||||
|
FROM users_notify_torrents
|
||||||
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
|
AND UnRead = '1'");
|
||||||
list($NewNotifications) = $DB->next_record();
|
list($NewNotifications) = $DB->next_record();
|
||||||
/* if ($NewNotifications && !check_perms('site_torrents_notify')) {
|
/* if ($NewNotifications && !check_perms('site_torrents_notify')) {
|
||||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'");
|
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'");
|
||||||
@ -46,8 +59,12 @@
|
|||||||
$MyNews = $LoggedUser['LastReadNews'];
|
$MyNews = $LoggedUser['LastReadNews'];
|
||||||
$CurrentNews = $Cache->get_value('news_latest_id');
|
$CurrentNews = $Cache->get_value('news_latest_id');
|
||||||
if ($CurrentNews === false) {
|
if ($CurrentNews === false) {
|
||||||
$DB->query("SELECT ID FROM news ORDER BY Time DESC LIMIT 1");
|
$DB->query("
|
||||||
if ($DB->record_count() == 1) {
|
SELECT ID
|
||||||
|
FROM news
|
||||||
|
ORDER BY Time DESC
|
||||||
|
LIMIT 1");
|
||||||
|
if ($DB->record_count() === 1) {
|
||||||
list($CurrentNews) = $DB->next_record();
|
list($CurrentNews) = $DB->next_record();
|
||||||
} else {
|
} else {
|
||||||
$CurrentNews = -1;
|
$CurrentNews = -1;
|
||||||
@ -59,8 +76,13 @@
|
|||||||
$MyBlog = $LoggedUser['LastReadBlog'];
|
$MyBlog = $LoggedUser['LastReadBlog'];
|
||||||
$CurrentBlog = $Cache->get_value('blog_latest_id');
|
$CurrentBlog = $Cache->get_value('blog_latest_id');
|
||||||
if ($CurrentBlog === false) {
|
if ($CurrentBlog === false) {
|
||||||
$DB->query("SELECT ID FROM blog WHERE Important = 1 ORDER BY Time DESC LIMIT 1");
|
$DB->query("
|
||||||
if ($DB->record_count() == 1) {
|
SELECT ID
|
||||||
|
FROM blog
|
||||||
|
WHERE Important = 1
|
||||||
|
ORDER BY Time DESC
|
||||||
|
LIMIT 1");
|
||||||
|
if ($DB->record_count() === 1) {
|
||||||
list($CurrentBlog) = $DB->next_record();
|
list($CurrentBlog) = $DB->next_record();
|
||||||
} else {
|
} else {
|
||||||
$CurrentBlog = -1;
|
$CurrentBlog = -1;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
FROM bad_passwords
|
FROM bad_passwords
|
||||||
WHERE Password='$Password'");
|
WHERE Password='$Password'");
|
||||||
|
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$IsGoodPassword = true;
|
$IsGoodPassword = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
if (!empty($_GET['filter_cat'])) {
|
if (!empty($_GET['filter_cat'])) {
|
||||||
$CategoryArray = array_keys($_GET['filter_cat']);
|
$CategoryArray = array_keys($_GET['filter_cat']);
|
||||||
if (count($CategoryArray) != count($Categories)) {
|
if (count($CategoryArray) !== count($Categories)) {
|
||||||
foreach ($CategoryArray as $Key => $Index) {
|
foreach ($CategoryArray as $Key => $Index) {
|
||||||
if (!isset($Categories[$Index - 1])) {
|
if (!isset($Categories[$Index - 1])) {
|
||||||
unset($CategoryArray[$Key]);
|
unset($CategoryArray[$Key]);
|
||||||
@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
if (!empty($_GET['releases'])) {
|
if (!empty($_GET['releases'])) {
|
||||||
$ReleaseArray = $_GET['releases'];
|
$ReleaseArray = $_GET['releases'];
|
||||||
if (count($ReleaseArray) != count($ReleaseTypes)) {
|
if (count($ReleaseArray) !== count($ReleaseTypes)) {
|
||||||
foreach ($ReleaseArray as $Index => $Value) {
|
foreach ($ReleaseArray as $Index => $Value) {
|
||||||
if (!isset($ReleaseTypes[$Value])) {
|
if (!isset($ReleaseTypes[$Value])) {
|
||||||
unset($ReleaseArray[$Index]);
|
unset($ReleaseArray[$Index]);
|
||||||
@ -139,7 +139,7 @@
|
|||||||
|
|
||||||
if (!empty($_GET['formats'])) {
|
if (!empty($_GET['formats'])) {
|
||||||
$FormatArray = $_GET['formats'];
|
$FormatArray = $_GET['formats'];
|
||||||
if (count($FormatArray) != count($Formats)) {
|
if (count($FormatArray) !== count($Formats)) {
|
||||||
$FormatNameArray = array();
|
$FormatNameArray = array();
|
||||||
foreach ($FormatArray as $Index => $MasterIndex) {
|
foreach ($FormatArray as $Index => $MasterIndex) {
|
||||||
if (isset($Formats[$MasterIndex])) {
|
if (isset($Formats[$MasterIndex])) {
|
||||||
@ -155,7 +155,7 @@
|
|||||||
|
|
||||||
if (!empty($_GET['media'])) {
|
if (!empty($_GET['media'])) {
|
||||||
$MediaArray = $_GET['media'];
|
$MediaArray = $_GET['media'];
|
||||||
if (count($MediaArray) != count($Media)) {
|
if (count($MediaArray) !== count($Media)) {
|
||||||
$MediaNameArray = array();
|
$MediaNameArray = array();
|
||||||
foreach ($MediaArray as $Index => $MasterIndex) {
|
foreach ($MediaArray as $Index => $MasterIndex) {
|
||||||
if (isset($Media[$MasterIndex])) {
|
if (isset($Media[$MasterIndex])) {
|
||||||
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
if (!empty($_GET['bitrates'])) {
|
if (!empty($_GET['bitrates'])) {
|
||||||
$BitrateArray = $_GET['bitrates'];
|
$BitrateArray = $_GET['bitrates'];
|
||||||
if (count($BitrateArray) != count($Bitrates)) {
|
if (count($BitrateArray) !== count($Bitrates)) {
|
||||||
$BitrateNameArray = array();
|
$BitrateNameArray = array();
|
||||||
foreach ($BitrateArray as $Index => $MasterIndex) {
|
foreach ($BitrateArray as $Index => $MasterIndex) {
|
||||||
if (isset($Bitrates[$MasterIndex])) {
|
if (isset($Bitrates[$MasterIndex])) {
|
||||||
@ -230,25 +230,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ($CurrentOrder) {
|
switch ($CurrentOrder) {
|
||||||
case 'votes' :
|
case 'votes':
|
||||||
$OrderBy = 'Votes';
|
$OrderBy = 'Votes';
|
||||||
break;
|
break;
|
||||||
case 'bounty' :
|
case 'bounty':
|
||||||
$OrderBy = 'Bounty';
|
$OrderBy = 'Bounty';
|
||||||
break;
|
break;
|
||||||
case 'created' :
|
case 'created':
|
||||||
$OrderBy = 'TimeAdded';
|
$OrderBy = 'TimeAdded';
|
||||||
break;
|
break;
|
||||||
case 'lastvote' :
|
case 'lastvote':
|
||||||
$OrderBy = 'LastVote';
|
$OrderBy = 'LastVote';
|
||||||
break;
|
break;
|
||||||
case 'filled' :
|
case 'filled':
|
||||||
$OrderBy = 'TimeFilled';
|
$OrderBy = 'TimeFilled';
|
||||||
break;
|
break;
|
||||||
case 'year' :
|
case 'year':
|
||||||
$OrderBy = 'Year';
|
$OrderBy = 'Year';
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
$OrderBy = 'TimeAdded';
|
$OrderBy = 'TimeAdded';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@
|
|||||||
$SS->SetSortMode($Way, $OrderBy);
|
$SS->SetSortMode($Way, $OrderBy);
|
||||||
|
|
||||||
if (count($Queries) > 0) {
|
if (count($Queries) > 0) {
|
||||||
$Query = implode(' ',$Queries);
|
$Query = implode(' ', $Queries);
|
||||||
} else {
|
} else {
|
||||||
$Query = '';
|
$Query = '';
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
WHERE f.UserID = '$LoggedUser[ID]'
|
WHERE f.UserID = '$LoggedUser[ID]'
|
||||||
AND f.FriendID = '$FriendID'");
|
AND f.FriendID = '$FriendID'");
|
||||||
|
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
echo json_encode(array("status" => "error", "response" => "Not on friend list."));
|
echo json_encode(array("status" => "error", "response" => "Not on friend list."));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
WHERE m.ID = $UserID
|
WHERE m.ID = $UserID
|
||||||
GROUP BY AuthorID");
|
GROUP BY AuthorID");
|
||||||
|
|
||||||
if ($DB->record_count() == 0) { // If user doesn't exist
|
if (!$DB->has_results()) { // If user doesn't exist
|
||||||
json_die("failure", "no such user");
|
json_die("failure", "no such user");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ function check_paranoia_here($Setting) {
|
|||||||
FROM friends
|
FROM friends
|
||||||
WHERE UserID = '$LoggedUser[ID]'
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
AND FriendID = '$UserID'");
|
AND FriendID = '$UserID'");
|
||||||
if ($DB->record_count() != 0) {
|
if ($DB->has_results()) {
|
||||||
$Friend = true;
|
$Friend = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
SELECT AliasID, ArtistID, Name, Redirect
|
SELECT AliasID, ArtistID, Name, Redirect
|
||||||
FROM artists_alias
|
FROM artists_alias
|
||||||
WHERE Name = '".$DBAliasName."'");
|
WHERE Name = '".$DBAliasName."'");
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
while (list($CloneAliasID, $CloneArtistID, $CloneAliasName, $CloneRedirect) = $DB->next_record(MYSQLI_NUM, false)) {
|
while (list($CloneAliasID, $CloneArtistID, $CloneAliasName, $CloneRedirect) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||||
if (!strcasecmp($CloneAliasName, $AliasName)) {
|
if (!strcasecmp($CloneAliasName, $AliasName)) {
|
||||||
break;
|
break;
|
||||||
@ -57,7 +57,7 @@
|
|||||||
if (!$CloneAliasID) {
|
if (!$CloneAliasID) {
|
||||||
if ($Redirect) {
|
if ($Redirect) {
|
||||||
$DB->query("SELECT ArtistID, Redirect FROM artists_alias WHERE AliasID = $Redirect");
|
$DB->query("SELECT ArtistID, Redirect FROM artists_alias WHERE AliasID = $Redirect");
|
||||||
if (!$DB->record_count()) {
|
if (!$DB->has_results()) {
|
||||||
error('Cannot redirect to a nonexistent artist alias.');
|
error('Cannot redirect to a nonexistent artist alias.');
|
||||||
}
|
}
|
||||||
list($FoundArtistID, $FoundRedirect) = $DB->next_record();
|
list($FoundArtistID, $FoundRedirect) = $DB->next_record();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='up'");
|
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='up'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
|
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ function compare($X, $Y) {
|
|||||||
GROUP BY a.ArtistID";
|
GROUP BY a.ArtistID";
|
||||||
$DB->query($sql);
|
$DB->query($sql);
|
||||||
|
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ function compare($X, $Y) {
|
|||||||
GROUP BY r.ID
|
GROUP BY r.ID
|
||||||
ORDER BY Votes DESC");
|
ORDER BY Votes DESC");
|
||||||
|
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
$Requests = $DB->to_array();
|
$Requests = $DB->to_array();
|
||||||
} else {
|
} else {
|
||||||
$Requests = array();
|
$Requests = array();
|
||||||
@ -553,10 +553,10 @@ function compare($X, $Y) {
|
|||||||
|
|
||||||
if (check_perms('zip_downloader')) {
|
if (check_perms('zip_downloader')) {
|
||||||
if (isset($LoggedUser['Collector'])) {
|
if (isset($LoggedUser['Collector'])) {
|
||||||
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
|
list($ZIPList, $ZIPPrefs) = $LoggedUser['Collector'];
|
||||||
$ZIPList = explode(':',$ZIPList);
|
$ZIPList = explode(':', $ZIPList);
|
||||||
} else {
|
} else {
|
||||||
$ZIPList = array('00','11');
|
$ZIPList = array('00', '11');
|
||||||
$ZIPPrefs = 1;
|
$ZIPPrefs = 1;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -572,7 +572,7 @@ function compare($X, $Y) {
|
|||||||
<li id="list<?=$ListItem?>">
|
<li id="list<?=$ListItem?>">
|
||||||
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
|
<input type="hidden" name="list[]" value="<?=$ListItem?>" />
|
||||||
<span style="float: left;"><?=$ZIPOptions[$ListItem]['2']?></span>
|
<span style="float: left;"><?=$ZIPOptions[$ListItem]['2']?></span>
|
||||||
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>');return false;" style="float: right;" class="brackets" title="Remove format from the Collector">X</a></span>
|
<span class="remove remove_collector"><a href="#" onclick="remove_selection('<?=$ListItem?>'); return false;" style="float: right;" class="brackets" title="Remove format from the Collector">X</a></span>
|
||||||
<br style="clear: all;" />
|
<br style="clear: all;" />
|
||||||
</li>
|
</li>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
@ -583,7 +583,7 @@ function compare($X, $Y) {
|
|||||||
$LastGroupID = -1;
|
$LastGroupID = -1;
|
||||||
|
|
||||||
foreach ($ZIPOptions as $Option) {
|
foreach ($ZIPOptions as $Option) {
|
||||||
list($GroupID,$OptionID,$OptName) = $Option;
|
list($GroupID, $OptionID, $OptName) = $Option;
|
||||||
|
|
||||||
if ($GroupID != $LastGroupID) {
|
if ($GroupID != $LastGroupID) {
|
||||||
$LastGroupID = $GroupID;
|
$LastGroupID = $GroupID;
|
||||||
|
@ -20,16 +20,19 @@
|
|||||||
|
|
||||||
View::show_header('Artist deleted');
|
View::show_header('Artist deleted');
|
||||||
|
|
||||||
$DB->query('SELECT Name FROM artists_group WHERE ArtistID='.$ArtistID);
|
$DB->query("
|
||||||
|
SELECT Name
|
||||||
|
FROM artists_group
|
||||||
|
WHERE ArtistID = $ArtistID");
|
||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query('
|
$DB->query("
|
||||||
SELECT tg.Name, tg.ID
|
SELECT tg.Name, tg.ID
|
||||||
FROM torrents_group AS tg
|
FROM torrents_group AS tg
|
||||||
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
|
LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID
|
||||||
WHERE ta.ArtistID='.$ArtistID);
|
WHERE ta.ArtistID = $ArtistID");
|
||||||
$Count = $DB->record_count();
|
$Count = $DB->record_count();
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
There are still torrents that have <a href="artist.php?id=<?=$ArtistID?>" title="View Artist"><?=$Name?></a> as an artist.<br />
|
There are still torrents that have <a href="artist.php?id=<?=$ArtistID?>" title="View Artist"><?=$Name?></a> as an artist.<br />
|
||||||
@ -51,13 +54,13 @@
|
|||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query('
|
$DB->query("
|
||||||
SELECT r.Title, r.ID
|
SELECT r.Title, r.ID
|
||||||
FROM requests AS r
|
FROM requests AS r
|
||||||
LEFT JOIN requests_artists AS ra ON ra.RequestID=r.ID
|
LEFT JOIN requests_artists AS ra ON ra.RequestID = r.ID
|
||||||
WHERE ra.ArtistID='.$ArtistID);
|
WHERE ra.ArtistID = $ArtistID");
|
||||||
$Count += $DB->record_count();
|
$Count += $DB->record_count();
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
There are still requests that have <a href="artist.php?id=<?=$ArtistID?>" title="View Artist"><?=$Name?></a> as an artist.<br />
|
There are still requests that have <a href="artist.php?id=<?=$ArtistID?>" title="View Artist"><?=$Name?></a> as an artist.<br />
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
|
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
|
||||||
WHERE aa.AliasID=".$AliasID);
|
WHERE aa.AliasID=".$AliasID);
|
||||||
|
|
||||||
if ($DB->record_count() == 1) {
|
if ($DB->record_count() === 1) {
|
||||||
//This is the last alias on the artist
|
//This is the last alias on the artist
|
||||||
error("That alias is the last alias for that artist; removing it would cause bad things to happen.");
|
error("That alias is the last alias for that artist; removing it would cause bad things to happen.");
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@
|
|||||||
SELECT GroupID
|
SELECT GroupID
|
||||||
FROM torrents_artists
|
FROM torrents_artists
|
||||||
WHERE AliasID='$AliasID'");
|
WHERE AliasID='$AliasID'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
list($GroupID) = $DB->next_record();
|
list($GroupID) = $DB->next_record();
|
||||||
if ($GroupID != 0) {
|
if ($GroupID != 0) {
|
||||||
error("That alias still has the group (<a href=\"torrents.php?id=$GroupID\">$GroupID</a>) attached. Fix that first.");
|
error("That alias still has the group (<a href=\"torrents.php?id=$GroupID\">$GroupID</a>) attached. Fix that first.");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
authorize();
|
authorize();
|
||||||
$SimilarID = db_string($_GET['similarid']);
|
$SimilarID = db_string($_GET['similarid']);
|
||||||
|
|
||||||
@ -8,16 +8,25 @@
|
|||||||
if (!check_perms('site_delete_tag')) {
|
if (!check_perms('site_delete_tag')) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
$DB->query("SELECT ArtistID FROM artists_similar WHERE SimilarID='$SimilarID'");
|
$DB->query("
|
||||||
|
SELECT ArtistID
|
||||||
|
FROM artists_similar
|
||||||
|
WHERE SimilarID = '$SimilarID'");
|
||||||
$ArtistIDs = $DB->to_array();
|
$ArtistIDs = $DB->to_array();
|
||||||
$DB->query("DELETE FROM artists_similar WHERE SimilarID='$SimilarID'");
|
$DB->query("
|
||||||
$DB->query("DELETE FROM artists_similar_scores WHERE SimilarID='$SimilarID'");
|
DELETE FROM artists_similar
|
||||||
$DB->query("DELETE FROM artists_similar_votes WHERE SimilarID='$SimilarID'");
|
WHERE SimilarID = '$SimilarID'");
|
||||||
|
$DB->query("
|
||||||
|
DELETE FROM artists_similar_scores
|
||||||
|
WHERE SimilarID = '$SimilarID'");
|
||||||
|
$DB->query("
|
||||||
|
DELETE FROM artists_similar_votes
|
||||||
|
WHERE SimilarID = '$SimilarID'");
|
||||||
|
|
||||||
foreach ($ArtistIDs as $ArtistID) {
|
foreach ($ArtistIDs as $ArtistID) {
|
||||||
list($ArtistID) = $ArtistID;
|
list($ArtistID) = $ArtistID;
|
||||||
$Cache->delete_value('artist_'.$ArtistID); // Delete artist cache
|
$Cache->delete_value("artist_$ArtistID"); // Delete artist cache
|
||||||
$Cache->delete_value('similar_positions_'.$ArtistID);
|
$Cache->delete_value("similar_positions_$ArtistID");
|
||||||
}
|
}
|
||||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||||
?>
|
?>
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
|
|
||||||
$DB->query("SELECT GroupID, Importance FROM torrents_artists WHERE ArtistID='$ArtistID'");
|
$DB->query("SELECT GroupID, Importance FROM torrents_artists WHERE ArtistID='$ArtistID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
$Releases = $DB->to_array('GroupID', MYSQLI_ASSOC, false);
|
$Releases = $DB->to_array('GroupID', MYSQLI_ASSOC, false);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
LEFT JOIN wiki_artists ON wiki_artists.RevisionID = a.RevisionID
|
LEFT JOIN wiki_artists ON wiki_artists.RevisionID = a.RevisionID
|
||||||
WHERE a.ArtistID = '$ArtistID'");
|
WHERE a.ArtistID = '$ArtistID'");
|
||||||
|
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error("Cannot find an artist with the ID {$ArtistID}: See the <a href=\"log.php?search=Artist+$ArtistID\">site log</a>.");
|
error("Cannot find an artist with the ID {$ArtistID}: See the <a href=\"log.php?search=Artist+$ArtistID\">site log</a>.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,20 +52,22 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
CEIL((
|
CEIL((
|
||||||
SELECT COUNT(ID)+1
|
SELECT COUNT(ID) + 1
|
||||||
FROM artist_comments AS ac
|
FROM artist_comments AS ac
|
||||||
WHERE ac.ArtistID='" . db_string($ArtistID) . "'
|
WHERE ac.ArtistID = '" . db_string($ArtistID) . "'
|
||||||
)/" . TORRENT_COMMENTS_PER_PAGE . "
|
) / " . TORRENT_COMMENTS_PER_PAGE . "
|
||||||
) AS Pages");
|
) AS Pages");
|
||||||
list($Pages) = $DB->next_record();
|
list($Pages) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO artist_comments (ArtistID,AuthorID,AddedTime,Body)
|
INSERT INTO artist_comments
|
||||||
VALUES ('" . db_string($ArtistID) . "', '" . db_string($LoggedUser['ID']) . "','" . sqltime() . "','" . db_string($_POST['body']) . "')");
|
(ArtistID, AuthorID, AddedTime, Body)
|
||||||
|
VALUES
|
||||||
|
('" . db_string($ArtistID) . "', '" . db_string($LoggedUser['ID']) . "', '" . sqltime() . "', '" . db_string($_POST['body']) . "')");
|
||||||
$PostID = $DB->inserted_id();
|
$PostID = $DB->inserted_id();
|
||||||
|
|
||||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
$Cache->begin_transaction('artist_comments_' . $ArtistID . '_catalogue_' . $CatalogueID);
|
$Cache->begin_transaction("artist_comments_$ArtistID" . "_catalogue_$CatalogueID");
|
||||||
$Post = array(
|
$Post = array(
|
||||||
'ID' => $PostID,
|
'ID' => $PostID,
|
||||||
'AuthorID' => $LoggedUser['ID'],
|
'AuthorID' => $LoggedUser['ID'],
|
||||||
@ -77,9 +79,9 @@
|
|||||||
);
|
);
|
||||||
$Cache->insert('', $Post);
|
$Cache->insert('', $Post);
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
$Cache->increment('artist_comments_' . $ArtistID);
|
$Cache->increment("artist_comments_$ArtistID");
|
||||||
|
|
||||||
header('Location: artist.php?id=' . $ArtistID . '&page=' . $Pages);
|
header("Location: artist.php?id=$ArtistID&page=$Pages");
|
||||||
break;
|
break;
|
||||||
case 'warn' :
|
case 'warn' :
|
||||||
include(SERVER_ROOT . '/sections/artist/warn.php');
|
include(SERVER_ROOT . '/sections/artist/warn.php');
|
||||||
@ -105,7 +107,10 @@
|
|||||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
$DB->query("SELECT Body FROM artist_comments WHERE ID='" . db_string($_GET['post']) . "'");
|
$DB->query("
|
||||||
|
SELECT Body
|
||||||
|
FROM artist_comments
|
||||||
|
WHERE ID = '" . db_string($_GET['post']) . "'");
|
||||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||||
echo trim($Body);
|
echo trim($Body);
|
||||||
break;
|
break;
|
||||||
@ -124,35 +129,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get topicid, forumid, number of pages
|
// Get topicid, forumid, number of pages
|
||||||
$DB->query("
|
$DB->query('
|
||||||
SELECT
|
SELECT
|
||||||
ArtistID,
|
ArtistID,
|
||||||
CEIL(COUNT(ac.ID)/" . TORRENT_COMMENTS_PER_PAGE . ") AS Pages,
|
CEIL(COUNT(ac.ID) / ' . TORRENT_COMMENTS_PER_PAGE . ') AS Pages,
|
||||||
CEIL(SUM(IF(ac.ID<=" . $_GET['postid'] . ",1,0))/" . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
CEIL(SUM(IF(ac.ID <= ' . $_GET['postid'] . ', 1, 0)) / ' . TORRENT_COMMENTS_PER_PAGE . ') AS Page
|
||||||
FROM artist_comments AS ac
|
FROM artist_comments AS ac
|
||||||
WHERE ac.ArtistID=(
|
WHERE ac.ArtistID = (
|
||||||
SELECT ArtistID
|
SELECT ArtistID
|
||||||
FROM artist_comments
|
FROM artist_comments
|
||||||
WHERE ID=" . $_GET['postid'] . "
|
WHERE ID = ' . $_GET['postid'] . '
|
||||||
)
|
)
|
||||||
GROUP BY ac.ArtistID");
|
GROUP BY ac.ArtistID');
|
||||||
list($ArtistID, $Pages, $Page) = $DB->next_record();
|
list($ArtistID, $Pages, $Page) = $DB->next_record();
|
||||||
|
|
||||||
// $Pages = number of pages in the thread
|
// $Pages = number of pages in the thread
|
||||||
// $Page = which page the post is on
|
// $Page = which page the post is on
|
||||||
// These are set for cache clearing.
|
// These are set for cache clearing.
|
||||||
|
|
||||||
$DB->query("DELETE FROM artist_comments WHERE ID='" . db_string($_GET['postid']) . "'");
|
$DB->query("
|
||||||
|
DELETE FROM artist_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
|
//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);
|
$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);
|
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
||||||
$Cache->delete_value('artist_comments_' . $ArtistID . '_catalogue_' . $i);
|
$Cache->delete_value("artist_comments_$ArtistID" . "_catalogue_$i");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete thread info cache (eg. number of pages)
|
// Delete thread info cache (eg. number of pages)
|
||||||
$Cache->delete_value('artist_comments_' . $ArtistID);
|
$Cache->delete_value("artist_comments_$ArtistID");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -175,7 +182,7 @@
|
|||||||
ac.ArtistID,
|
ac.ArtistID,
|
||||||
ac.AddedTime
|
ac.AddedTime
|
||||||
FROM artist_comments AS ac
|
FROM artist_comments AS ac
|
||||||
WHERE ac.ID='" . db_string($_POST['post']) . "'");
|
WHERE ac.ID = '" . db_string($_POST['post']) . "'");
|
||||||
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
|
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
@ -188,7 +195,7 @@
|
|||||||
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,11 +206,11 @@
|
|||||||
Body = '" . db_string($_POST['body']) . "',
|
Body = '" . db_string($_POST['body']) . "',
|
||||||
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
||||||
EditedTime = '" . sqltime() . "'
|
EditedTime = '" . sqltime() . "'
|
||||||
WHERE ID='" . db_string($_POST['post']) . "'");
|
WHERE ID = '" . db_string($_POST['post']) . "'");
|
||||||
|
|
||||||
// Update the cache
|
// Update the cache
|
||||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
$Cache->begin_transaction('artist_comments_' . $ArtistID . '_catalogue_' . $CatalogueID);
|
$Cache->begin_transaction("artist_comments_$ArtistID" . "_catalogue_$CatalogueID");
|
||||||
|
|
||||||
$Cache->update_row($_POST['key'], array(
|
$Cache->update_row($_POST['key'], array(
|
||||||
'ID' => $_POST['post'],
|
'ID' => $_POST['post'],
|
||||||
@ -217,8 +224,10 @@
|
|||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
INSERT INTO comments_edits
|
||||||
VALUES ('artist', " . db_string($_POST['post']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
|
(Page, PostID, EditUser, EditTime, Body)
|
||||||
|
VALUES
|
||||||
|
('artist', " . 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
|
// This gets sent to the browser, which echoes it in place of the old body
|
||||||
echo $Text->full_format($_POST['body']);
|
echo $Text->full_format($_POST['body']);
|
||||||
@ -275,7 +284,7 @@
|
|||||||
SELECT ArtistID, Name
|
SELECT ArtistID, Name
|
||||||
FROM artists_alias
|
FROM artists_alias
|
||||||
WHERE Name LIKE '" . db_string($NameSearch) . "'");
|
WHERE Name LIKE '" . db_string($NameSearch) . "'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) {
|
if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) {
|
||||||
header('Location: torrents.php?action=advanced&artistname=' . urlencode($_GET['artistname']));
|
header('Location: torrents.php?action=advanced&artistname=' . urlencode($_GET['artistname']));
|
||||||
} else {
|
} else {
|
||||||
@ -284,17 +293,17 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
list($FirstID, $Name) = $DB->next_record(MYSQLI_NUM, false);
|
list($FirstID, $Name) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
if ($DB->record_count() == 1 || !strcasecmp($Name, $NameSearch)) {
|
if ($DB->record_count() === 1 || !strcasecmp($Name, $NameSearch)) {
|
||||||
header('Location: artist.php?id=' . $FirstID);
|
header("Location: artist.php?id=$FirstID");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
while (list($ID, $Name) = $DB->next_record(MYSQLI_NUM, false)) {
|
while (list($ID, $Name) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||||
if (!strcasecmp($Name, $NameSearch)) {
|
if (!strcasecmp($Name, $NameSearch)) {
|
||||||
header('Location: artist.php?id=' . $ID);
|
header("Location: artist.php?id=$ID");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header('Location: artist.php?id=' . $FirstID);
|
header("Location: artist.php?id=$FirstID");
|
||||||
die();
|
die();
|
||||||
} else {
|
} else {
|
||||||
header('Location: torrents.php');
|
header('Location: torrents.php');
|
||||||
|
@ -21,31 +21,33 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT ID, Artists
|
SELECT ID, Artists
|
||||||
FROM users_notify_filters
|
FROM users_notify_filters
|
||||||
WHERE Label='Artist notifications'
|
WHERE Label = 'Artist notifications'
|
||||||
AND UserID='$LoggedUser[ID]'
|
AND UserID = '$LoggedUser[ID]'
|
||||||
ORDER BY ID
|
ORDER BY ID
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
} else {
|
} else {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT ID, Artists
|
SELECT ID, Artists
|
||||||
FROM users_notify_filters
|
FROM users_notify_filters
|
||||||
WHERE ID='$Notify[ID]'");
|
WHERE ID = '$Notify[ID]'");
|
||||||
}
|
}
|
||||||
if (empty($Notify) && $DB->record_count() == 0) {
|
if (empty($Notify) && !$DB->has_results()) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO users_notify_filters (UserID, Label, Artists)
|
INSERT INTO users_notify_filters
|
||||||
VALUES ('$LoggedUser[ID]', 'Artist notifications', '|".db_string($ArtistAliases)."|')");
|
(UserID, Label, Artists)
|
||||||
|
VALUES
|
||||||
|
('$LoggedUser[ID]', 'Artist notifications', '|".db_string($ArtistAliases)."|')");
|
||||||
$FilterID = $DB->inserted_id();
|
$FilterID = $DB->inserted_id();
|
||||||
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
||||||
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
|
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
|
||||||
} else {
|
} else {
|
||||||
list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, FALSE);
|
list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, FALSE);
|
||||||
if (stripos($ArtistNames,$ArtistAliases) === false) {
|
if (stripos($ArtistNames, $ArtistAliases) === false) {
|
||||||
$ArtistNames.=$ArtistAliases.'|';
|
$ArtistNames .= "$ArtistAliases|";
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_notify_filters
|
UPDATE users_notify_filters
|
||||||
SET Artists='".db_string($ArtistNames)."'
|
SET Artists = '".db_string($ArtistNames)."'
|
||||||
WHERE ID='$ID'");
|
WHERE ID = '$ID'");
|
||||||
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
|
||||||
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
|
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
|
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($OldName) = $DB->next_record(MYSQLI_NUM, false);
|
list($OldName) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
|
@ -20,16 +20,16 @@
|
|||||||
$URL = "https://". SSL_SITE_URL."/artist.php?id=$ArtistID&postid=$PostID#post$PostID";
|
$URL = "https://". SSL_SITE_URL."/artist.php?id=$ArtistID&postid=$PostID#post$PostID";
|
||||||
if ($Length != 'verbal') {
|
if ($Length != 'verbal') {
|
||||||
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
|
||||||
Tools::warn_user($UserID, $Time, "$URL - ". $Reason);
|
Tools::warn_user($UserID, $Time, "$URL - $Reason");
|
||||||
$Subject = 'You have received a warning';
|
$Subject = 'You have received a warning';
|
||||||
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n" . $PrivateMessage;
|
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n$PrivateMessage";
|
||||||
$WarnTime = time_plus($Time);
|
$WarnTime = time_plus($Time);
|
||||||
$AdminComment = date('Y-m-d').' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $URL - $Reason\n\n";
|
$AdminComment = date('Y-m-d') . " - Warned until $WarnTime by " . $LoggedUser['Username'] . "\nReason: $URL - $Reason\n\n";
|
||||||
} else {
|
} else {
|
||||||
$Subject = 'You have received a verbal warning';
|
$Subject = 'You have received a verbal warning';
|
||||||
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
|
$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";
|
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
|
||||||
Tools::update_user_notes($UserID,$AdminComment);
|
Tools::update_user_notes($UserID, $AdminComment);
|
||||||
}
|
}
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO users_warnings_forums (UserID, Comment)
|
INSERT INTO users_warnings_forums (UserID, Comment)
|
||||||
@ -45,7 +45,7 @@
|
|||||||
ac.ArtistID,
|
ac.ArtistID,
|
||||||
ac.AddedTime
|
ac.AddedTime
|
||||||
FROM artist_comments AS ac
|
FROM artist_comments AS ac
|
||||||
WHERE ac.ID='$PostID'");
|
WHERE ac.ID = '$PostID'");
|
||||||
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
|
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
@ -62,11 +62,11 @@
|
|||||||
Body = '" . db_string($Body) . "',
|
Body = '" . db_string($Body) . "',
|
||||||
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
||||||
EditedTime = '" . sqltime() . "'
|
EditedTime = '" . sqltime() . "'
|
||||||
WHERE ID='$PostID'");
|
WHERE ID = '$PostID'");
|
||||||
|
|
||||||
// Update the cache
|
// Update the cache
|
||||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
$Cache->begin_transaction('artist_comments_' . $ArtistID . '_catalogue_' . $CatalogueID);
|
$Cache->begin_transaction("artist_comments_$ArtistID" . "_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->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);
|
$Cache->commit_transaction(0);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
WHERE SimilarID='$SimilarID'
|
WHERE SimilarID='$SimilarID'
|
||||||
AND UserID='$UserID'
|
AND UserID='$UserID'
|
||||||
AND Way='$Way'");
|
AND Way='$Way'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
if ($Way == 'down') {
|
if ($Way == 'down') {
|
||||||
$Score = 'Score-100';
|
$Score = 'Score-100';
|
||||||
} elseif ($Way == 'up') {
|
} elseif ($Way == 'up') {
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
if (check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
|
||||||
$DB->query("DELETE FROM torrents_bad_files WHERE TorrentID = ".$_GET['remove']);
|
$DB->query('
|
||||||
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$_GET['remove']);
|
DELETE FROM torrents_bad_files
|
||||||
|
WHERE TorrentID = '.$_GET['remove']);
|
||||||
|
$DB->query('
|
||||||
|
SELECT GroupID
|
||||||
|
FROM torrents
|
||||||
|
WHERE ID = '.$_GET['remove']);
|
||||||
list($GroupID) = $DB->next_record();
|
list($GroupID) = $DB->next_record();
|
||||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
$Cache->delete_value("torrents_details_$GroupID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -12,7 +17,7 @@
|
|||||||
$Join = '';
|
$Join = '';
|
||||||
$All = true;
|
$All = true;
|
||||||
} else {
|
} else {
|
||||||
$Join = "JOIN xbt_snatched as x ON x.fid=tfi.TorrentID AND x.uid = ".$LoggedUser['ID'];
|
$Join = 'JOIN xbt_snatched as x ON x.fid = tfi.TorrentID AND x.uid = '.$LoggedUser['ID'];
|
||||||
$All = false;
|
$All = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,17 +66,17 @@
|
|||||||
} else {
|
} else {
|
||||||
$DisplayName = '';
|
$DisplayName = '';
|
||||||
}
|
}
|
||||||
$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) {
|
if ($GroupYear > 0) {
|
||||||
$DisplayName.=" [$GroupYear]";
|
$DisplayName .= " [$GroupYear]";
|
||||||
}
|
}
|
||||||
if ($ReleaseType > 0) {
|
if ($ReleaseType > 0) {
|
||||||
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']';
|
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
|
||||||
}
|
}
|
||||||
|
|
||||||
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
|
||||||
if ($ExtraInfo) {
|
if ($ExtraInfo) {
|
||||||
$DisplayName.=' - '.$ExtraInfo;
|
$DisplayName .= " - $ExtraInfo";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr class="torrent torrent_row<?=$GroupFlags['IsSnatched'] ? ' snatched_torrent"' : ''?>">
|
<tr class="torrent torrent_row<?=$GroupFlags['IsSnatched'] ? ' snatched_torrent"' : ''?>">
|
||||||
@ -86,7 +91,8 @@
|
|||||||
<div class="tags"><?=$TorrentTags->format()?></div>
|
<div class="tags"><?=$TorrentTags->format()?></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<? } ?>
|
<?
|
||||||
|
} ?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT t.GroupID, x.fid
|
SELECT t.GroupID, x.fid
|
||||||
FROM ".($SeedingOnly ? 'xbt_files_users' : 'xbt_snatched')." AS x
|
FROM ".($SeedingOnly ? 'xbt_files_users' : 'xbt_snatched')." AS x
|
||||||
JOIN torrents AS t ON t.ID=x.fid
|
JOIN torrents AS t ON t.ID = x.fid
|
||||||
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||||
WHERE t.Format='FLAC'
|
WHERE t.Format = 'FLAC'
|
||||||
AND ((t.LogScore = '100' AND t.Media = 'CD')
|
AND ((t.LogScore = '100' AND t.Media = 'CD')
|
||||||
OR t.Media != 'CD')
|
OR t.Media != 'CD')
|
||||||
AND tg.CategoryID = 1
|
AND tg.CategoryID = 1
|
||||||
AND x.uid='$UserID'" .
|
AND x.uid = '$UserID'" .
|
||||||
($SeedingOnly ? ' AND x.active = 1 AND x.remaining = 0' : ''));
|
($SeedingOnly ? ' AND x.active = 1 AND x.remaining = 0' : ''));
|
||||||
|
|
||||||
$SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true);
|
$SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true);
|
||||||
@ -57,8 +57,10 @@
|
|||||||
AND t.Format IN ('FLAC', 'MP3')
|
AND t.Format IN ('FLAC', 'MP3')
|
||||||
GROUP BY t.GroupID, RemIdent");
|
GROUP BY t.GroupID, RemIdent");
|
||||||
|
|
||||||
//$DB->query('SELECT * FROM t');
|
/*$DB->query('
|
||||||
|
SELECT *
|
||||||
|
FROM t');
|
||||||
|
*/
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT GroupID
|
SELECT GroupID
|
||||||
FROM temp_sections_better_snatch
|
FROM temp_sections_better_snatch
|
||||||
@ -131,7 +133,7 @@
|
|||||||
foreach ($Encodings as $Encoding) {
|
foreach ($Encodings as $Encoding) {
|
||||||
if (!isset($Edition['Formats'][$Encoding])) {
|
if (!isset($Edition['Formats'][$Encoding])) {
|
||||||
++$edition_miss;
|
++$edition_miss;
|
||||||
++$Counter['miss_'.$Encoding];
|
++$Counter["miss_$Encoding"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$Counter['miss_total'] += $edition_miss;
|
$Counter['miss_total'] += $edition_miss;
|
||||||
@ -194,7 +196,7 @@
|
|||||||
$DisplayName .= " [$GroupYear]";
|
$DisplayName .= " [$GroupYear]";
|
||||||
}
|
}
|
||||||
if ($ReleaseType > 0) {
|
if ($ReleaseType > 0) {
|
||||||
$DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";
|
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
|
||||||
}
|
}
|
||||||
$DisplayName .= ' ['.$Edition['Medium'].']';
|
$DisplayName .= ' ['.$Edition['Medium'].']';
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
SELECT ForumID
|
SELECT ForumID
|
||||||
FROM forums_topics
|
FROM forums_topics
|
||||||
WHERE ID = $ThreadID");
|
WHERE ID = $ThreadID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error('No such thread exists!');
|
error('No such thread exists!');
|
||||||
header('Location: blog.php');
|
header('Location: blog.php');
|
||||||
}
|
}
|
||||||
@ -135,7 +135,8 @@
|
|||||||
<div class="thin">
|
<div class="thin">
|
||||||
<?
|
<?
|
||||||
if (!$Blog = $Cache->get_value('blog')) {
|
if (!$Blog = $Cache->get_value('blog')) {
|
||||||
$DB->query("SELECT
|
$DB->query("
|
||||||
|
SELECT
|
||||||
b.ID,
|
b.ID,
|
||||||
um.Username,
|
um.Username,
|
||||||
b.Title,
|
b.Title,
|
||||||
@ -143,18 +144,21 @@
|
|||||||
b.Time,
|
b.Time,
|
||||||
b.ThreadID
|
b.ThreadID
|
||||||
FROM blog AS b
|
FROM blog AS b
|
||||||
LEFT JOIN users_main AS um ON b.UserID=um.ID
|
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||||
ORDER BY Time DESC
|
ORDER BY Time DESC
|
||||||
LIMIT 20");
|
LIMIT 20");
|
||||||
$Blog = $DB->to_array();
|
$Blog = $DB->to_array();
|
||||||
$Cache->cache_value('Blog',$Blog,1209600);
|
$Cache->cache_value('Blog', $Blog, 1209600);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($LoggedUser['LastReadBlog'] < $Blog[0][0]) {
|
if ($LoggedUser['LastReadBlog'] < $Blog[0][0]) {
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
|
$Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']);
|
||||||
$Cache->update_row(false, array('LastReadBlog' => $Blog[0][0]));
|
$Cache->update_row(false, array('LastReadBlog' => $Blog[0][0]));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
$DB->query("UPDATE users_info SET LastReadBlog = '".$Blog[0][0]."' WHERE UserID = ".$LoggedUser['ID']);
|
$DB->query("
|
||||||
|
UPDATE users_info
|
||||||
|
SET LastReadBlog = '".$Blog[0][0]."'
|
||||||
|
WHERE UserID = ".$LoggedUser['ID']);
|
||||||
$LoggedUser['LastReadBlog'] = $Blog[0][0];
|
$LoggedUser['LastReadBlog'] = $Blog[0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +180,8 @@
|
|||||||
<em><a href="forums.php?action=viewthread&threadid=<?=$ThreadID?>">Discuss this post here</a></em>
|
<em><a href="forums.php?action=viewthread&threadid=<?=$ThreadID?>">Discuss this post here</a></em>
|
||||||
<? if (check_perms('admin_manage_blog')) { ?>
|
<? if (check_perms('admin_manage_blog')) { ?>
|
||||||
<a href="blog.php?action=deadthread&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Remove link</a>
|
<a href="blog.php?action=deadthread&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Remove link</a>
|
||||||
<? }
|
<?
|
||||||
|
}
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,9 +23,12 @@
|
|||||||
FROM $Table
|
FROM $Table
|
||||||
WHERE UserID='$LoggedUser[ID]'
|
WHERE UserID='$LoggedUser[ID]'
|
||||||
AND $Col='".db_string($_GET['id'])."'");
|
AND $Col='".db_string($_GET['id'])."'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
if ($Type === 'torrent') {
|
if ($Type === 'torrent') {
|
||||||
$DB->query('SELECT MAX(Sort) FROM `bookmarks_torrents` WHERE UserID =' . $LoggedUser['ID']);
|
$DB->query('
|
||||||
|
SELECT MAX(Sort)
|
||||||
|
FROM `bookmarks_torrents`
|
||||||
|
WHERE UserID = ' . $LoggedUser['ID']);
|
||||||
list($Sort) = $DB->next_record();
|
list($Sort) = $DB->next_record();
|
||||||
if (!$Sort) $Sort = 0;
|
if (!$Sort) $Sort = 0;
|
||||||
$Sort += 1;
|
$Sort += 1;
|
||||||
@ -47,7 +50,7 @@
|
|||||||
FROM torrents_group
|
FROM torrents_group
|
||||||
WHERE ID = '$GroupID'");
|
WHERE ID = '$GroupID'");
|
||||||
list($GroupTitle, $Year, $Body, $TagList) = $DB->next_record();
|
list($GroupTitle, $Year, $Body, $TagList) = $DB->next_record();
|
||||||
$TagList = str_replace('_','.',$TagList);
|
$TagList = str_replace('_', '.', $TagList);
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT ID, Format, Encoding, HasLog, HasCue, LogScore, Media, Scene, FreeTorrent, UserID
|
SELECT ID, Format, Encoding, HasLog, HasCue, LogScore, Media, Scene, FreeTorrent, UserID
|
||||||
@ -58,25 +61,25 @@
|
|||||||
$Title = $GroupTitle;
|
$Title = $GroupTitle;
|
||||||
list($TorrentID, $Format, $Bitrate, $HasLog, $HasCue, $LogScore, $Media, $Scene, $Freeleech, $UploaderID) = $Torrent;
|
list($TorrentID, $Format, $Bitrate, $HasLog, $HasCue, $LogScore, $Media, $Scene, $Freeleech, $UploaderID) = $Torrent;
|
||||||
$Title .= " [$Year] - ";
|
$Title .= " [$Year] - ";
|
||||||
$Title .= $Format." / ".$Bitrate;
|
$Title .= "$Format / $Bitrate";
|
||||||
if ($HasLog == "'1'") {
|
if ($HasLog == "'1'") {
|
||||||
$Title .= " / Log";
|
$Title .= ' / Log';
|
||||||
}
|
}
|
||||||
if ($HasLog) {
|
if ($HasLog) {
|
||||||
$Title .= " / ".$LogScore.'%';
|
$Title .= " / $LogScore%";
|
||||||
}
|
}
|
||||||
if ($HasCue == "'1'") {
|
if ($HasCue == "'1'") {
|
||||||
$Title .= " / Cue";
|
$Title .= ' / Cue';
|
||||||
}
|
}
|
||||||
$Title .= " / ".trim($Media);
|
$Title .= ' / '.trim($Media);
|
||||||
if ($Scene == '1') {
|
if ($Scene == '1') {
|
||||||
$Title .= " / Scene";
|
$Title .= ' / Scene';
|
||||||
}
|
}
|
||||||
if ($Freeleech == '1') {
|
if ($Freeleech == '1') {
|
||||||
$Title .= " / Freeleech!";
|
$Title .= ' / Freeleech!';
|
||||||
}
|
}
|
||||||
if ($Freeleech == '2') {
|
if ($Freeleech == '2') {
|
||||||
$Title .= " / Neutral leech!";
|
$Title .= ' / Neutral leech!';
|
||||||
}
|
}
|
||||||
|
|
||||||
$UploaderInfo = Users::user_info($UploaderID);
|
$UploaderInfo = Users::user_info($UploaderID);
|
||||||
@ -84,12 +87,15 @@
|
|||||||
$Text->strip_bbcode($Body),
|
$Text->strip_bbcode($Body),
|
||||||
'torrents.php?action=download&authkey=[[AUTHKEY]]&torrent_pass=[[PASSKEY]]&id='.$TorrentID,
|
'torrents.php?action=download&authkey=[[AUTHKEY]]&torrent_pass=[[PASSKEY]]&id='.$TorrentID,
|
||||||
$UploaderInfo['Username'],
|
$UploaderInfo['Username'],
|
||||||
'torrents.php?id='.$GroupID,
|
"torrents.php?id=$GroupID",
|
||||||
trim($TagList));
|
trim($TagList));
|
||||||
$Feed->populate('torrents_bookmarks_t_'.$LoggedUser['torrent_pass'], $Item);
|
$Feed->populate('torrents_bookmarks_t_'.$LoggedUser['torrent_pass'], $Item);
|
||||||
}
|
}
|
||||||
} elseif ($Type == 'request') {
|
} elseif ($Type == 'request') {
|
||||||
$DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'");
|
$DB->query("
|
||||||
|
SELECT UserID
|
||||||
|
FROM $Table
|
||||||
|
WHERE $Col = '".db_string($_GET['id'])."'");
|
||||||
$Bookmarkers = $DB->collect('UserID');
|
$Bookmarkers = $DB->collect('UserID');
|
||||||
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
|
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
function get_font() {
|
function get_font() {
|
||||||
global $CaptchaFonts;
|
global $CaptchaFonts;
|
||||||
return SERVER_ROOT.'/classes/fonts/'.$CaptchaFonts[mt_rand(0,count($CaptchaFonts)-1)];
|
return SERVER_ROOT.'/classes/fonts/'.$CaptchaFonts[mt_rand(0, count($CaptchaFonts) - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_captcha_img() {
|
function make_captcha_img() {
|
||||||
@ -19,27 +19,27 @@ function make_captcha_img() {
|
|||||||
$CaptchaString = '';
|
$CaptchaString = '';
|
||||||
|
|
||||||
for ($i = 0; $i < $Length; $i++) {
|
for ($i = 0; $i < $Length; $i++) {
|
||||||
$CaptchaString.=$Chars[mt_rand(0,strlen($Chars) - 1)];
|
$CaptchaString .= $Chars[mt_rand(0,strlen($Chars) - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($x = 0; $x < $Length; $x++) {
|
for ($x = 0; $x < $Length; $x++) {
|
||||||
$FontDisplay[$x]['size'] = mt_rand(24,32);
|
$FontDisplay[$x]['size'] = mt_rand(24, 32);
|
||||||
$FontDisplay[$x]['top'] = mt_rand($FontDisplay[$x]['size'] + 5,$ImageHeight - ($FontDisplay[$x]['size'] / 2));
|
$FontDisplay[$x]['top'] = mt_rand($FontDisplay[$x]['size'] + 5, $ImageHeight - ($FontDisplay[$x]['size'] / 2));
|
||||||
$FontDisplay[$x]['angle'] = mt_rand(-30,30);
|
$FontDisplay[$x]['angle'] = mt_rand(-30, 30);
|
||||||
$FontDisplay[$x]['font'] = get_font();
|
$FontDisplay[$x]['font'] = get_font();
|
||||||
}
|
}
|
||||||
|
|
||||||
$Img = imagecreatetruecolor($ImageWidth,$ImageHeight);
|
$Img = imagecreatetruecolor($ImageWidth, $ImageHeight);
|
||||||
$BGImg = imagecreatefrompng(SERVER_ROOT.'/captcha/'.$CaptchaBGs[mt_rand(0,count($CaptchaBGs) - 1)]);
|
$BGImg = imagecreatefrompng(SERVER_ROOT.'/captcha/'.$CaptchaBGs[mt_rand(0, count($CaptchaBGs) - 1)]);
|
||||||
imagecopymerge($Img,$BGImg,0,0,0,0,300,75,50);
|
imagecopymerge($Img, $BGImg, 0, 0, 0, 0, 300, 75, 50);
|
||||||
|
|
||||||
$ForeColor = imagecolorallocatealpha($Img,255,255,255,65);
|
$ForeColor = imagecolorallocatealpha($Img, 255, 255, 255, 65);
|
||||||
|
|
||||||
for ($i = 0; $i < strlen($CaptchaString); $i++) {
|
for ($i = 0; $i < strlen($CaptchaString); $i++) {
|
||||||
$CharX = (($ImageWidth / $Length) * ($i + 1)) - (($ImageWidth / $Length) * 0.75);
|
$CharX = (($ImageWidth / $Length) * ($i + 1)) - (($ImageWidth / $Length) * 0.75);
|
||||||
imagettftext($Img,$FontDisplay[$i]['size'],$FontDisplay[$i]['angle'],$CharX,
|
imagettftext($Img,$FontDisplay[$i]['size'], $FontDisplay[$i]['angle'], $CharX,
|
||||||
$FontDisplay[$i]['top'],$ForeColor,
|
$FontDisplay[$i]['top'], $ForeColor,
|
||||||
$FontDisplay[$i]['font'],$CaptchaString[$i]
|
$FontDisplay[$i]['font'], $CaptchaString[$i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
enforce_login();
|
enforce_login();
|
||||||
View::show_header('IRC');
|
View::show_header('IRC');
|
||||||
|
|
||||||
$DB->query("SELECT IRCKey FROM users_main WHERE ID = $LoggedUser[ID]");
|
$DB->query("
|
||||||
|
SELECT IRCKey
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = $LoggedUser[ID]");
|
||||||
list($IRCKey) = $DB->next_record();
|
list($IRCKey) = $DB->next_record();
|
||||||
|
|
||||||
if (empty($IRCKey)) {
|
if (empty($IRCKey)) {
|
||||||
|
@ -21,7 +21,7 @@ function add_artist($CollageID, $ArtistID) {
|
|||||||
FROM collages_artists
|
FROM collages_artists
|
||||||
WHERE CollageID = '$CollageID'
|
WHERE CollageID = '$CollageID'
|
||||||
AND ArtistID = '$ArtistID'");
|
AND ArtistID = '$ArtistID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT IGNORE INTO collages_artists
|
INSERT IGNORE INTO collages_artists
|
||||||
(CollageID, ArtistID, UserID, Sort, AddedOn)
|
(CollageID, ArtistID, UserID, Sort, AddedOn)
|
||||||
@ -147,7 +147,7 @@ function add_artist($CollageID, $ArtistID) {
|
|||||||
SELECT ArtistID
|
SELECT ArtistID
|
||||||
FROM artists_group
|
FROM artists_group
|
||||||
WHERE ArtistID = '$ArtistID'");
|
WHERE ArtistID = '$ArtistID'");
|
||||||
if (!$DB->record_count()) {
|
if (!$DB->has_results()) {
|
||||||
$Err = "One of the entered URLs ($URL) does not correspond to an artist on the site.";
|
$Err = "One of the entered URLs ($URL) does not correspond to an artist on the site.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ function add_torrent($CollageID, $GroupID) {
|
|||||||
FROM collages_torrents
|
FROM collages_torrents
|
||||||
WHERE CollageID = '$CollageID'
|
WHERE CollageID = '$CollageID'
|
||||||
AND GroupID = '$GroupID'");
|
AND GroupID = '$GroupID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT IGNORE INTO collages_torrents
|
INSERT IGNORE INTO collages_torrents
|
||||||
(CollageID, GroupID, UserID, Sort, AddedOn)
|
(CollageID, GroupID, UserID, Sort, AddedOn)
|
||||||
@ -147,7 +147,7 @@ function add_torrent($CollageID, $GroupID) {
|
|||||||
SELECT ID
|
SELECT ID
|
||||||
FROM torrents_group
|
FROM torrents_group
|
||||||
WHERE ID = '$GroupID'");
|
WHERE ID = '$GroupID'");
|
||||||
if (!$DB->record_count()) {
|
if (!$DB->has_results()) {
|
||||||
$Err = "One of the entered URLs ($URL) does not correspond to a torrent group on the site.";
|
$Err = "One of the entered URLs ($URL) does not correspond to a torrent group on the site.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -142,28 +142,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($Categories)) {
|
if (!empty($Categories)) {
|
||||||
$SQL.=" AND CategoryID IN(".db_string(implode(',',$Categories)).")";
|
$SQL .= " AND CategoryID IN(".db_string(implode(',', $Categories)).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['action'] == 'mine') {
|
if ($_GET['action'] == 'mine') {
|
||||||
$SQL = $BaseSQL;
|
$SQL = $BaseSQL;
|
||||||
$SQL .= " AND c.UserID='".$LoggedUser['ID']."' AND c.CategoryID=0";
|
$SQL .= "
|
||||||
|
AND c.UserID = '".$LoggedUser['ID']."'
|
||||||
|
AND c.CategoryID = 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
$SQL.=" ORDER BY $Order $Way LIMIT $Limit ";
|
$SQL .= "
|
||||||
|
ORDER BY $Order $Way
|
||||||
|
LIMIT $Limit";
|
||||||
$DB->query($SQL);
|
$DB->query($SQL);
|
||||||
$Collages = $DB->to_array();
|
$Collages = $DB->to_array();
|
||||||
$DB->query("SELECT FOUND_ROWS()");
|
$DB->query('SELECT FOUND_ROWS()');
|
||||||
list($NumResults) = $DB->next_record();
|
list($NumResults) = $DB->next_record();
|
||||||
|
|
||||||
View::show_header(($BookmarkView)?'Your bookmarked collages':'Browse collages');
|
View::show_header(($BookmarkView) ? 'Your bookmarked collages' : 'Browse collages');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<? if ($BookmarkView) { ?>
|
<? if ($BookmarkView) { ?>
|
||||||
<h2>Your bookmarked collages</h2>
|
<h2>Your bookmarked collages</h2>
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<h2>Browse collages<?=(!empty($UserLink) ? (isset($CollageIDs) ? ' with contributions by '.$UserLink : ' started by '.$UserLink) : '')?></h2>
|
<h2>Browse collages<?=(!empty($UserLink) ? (isset($CollageIDs) ? " with contributions by $UserLink" : " started by $UserLink") : '')?></h2>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</div>
|
</div>
|
||||||
<? if (!$BookmarkView) { ?>
|
<? if (!$BookmarkView) { ?>
|
||||||
@ -232,7 +236,12 @@
|
|||||||
<? }
|
<? }
|
||||||
if (check_perms('site_collages_personal')) {
|
if (check_perms('site_collages_personal')) {
|
||||||
|
|
||||||
$DB->query("SELECT ID FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
$DB->query("
|
||||||
|
SELECT ID
|
||||||
|
FROM collages
|
||||||
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
|
AND CategoryID = '0'
|
||||||
|
AND Deleted = '0'");
|
||||||
$CollageCount = $DB->record_count();
|
$CollageCount = $DB->record_count();
|
||||||
|
|
||||||
if ($CollageCount == 1) {
|
if ($CollageCount == 1) {
|
||||||
@ -300,7 +309,7 @@
|
|||||||
|
|
||||||
//Print results
|
//Print results
|
||||||
?>
|
?>
|
||||||
<tr class="row<?=$Row?><?=($BookmarkView) ? ' bookmark_'.$ID : ''?>">
|
<tr class="row<?=$Row?><?=($BookmarkView) ? " bookmark_$ID" : ''; ?>">
|
||||||
<td>
|
<td>
|
||||||
<a href="collages.php?action=search&cats[<?=(int)$CategoryID?>]=1"><?=$CollageCats[(int)$CategoryID]?></a>
|
<a href="collages.php?action=search&cats[<?=(int)$CategoryID?>]=1"><?=$CollageCats[(int)$CategoryID]?></a>
|
||||||
</td>
|
</td>
|
||||||
@ -308,7 +317,7 @@
|
|||||||
<a href="collages.php?id=<?=$ID?>"><?=$Name?></a>
|
<a href="collages.php?id=<?=$ID?>"><?=$Name?></a>
|
||||||
<? if ($BookmarkView) { ?>
|
<? if ($BookmarkView) { ?>
|
||||||
<span style="float: right;">
|
<span style="float: right;">
|
||||||
<a href="#" onclick="Unbookmark('collage', <?=$ID?>,'');return false;" class="brackets">Remove bookmark</a>
|
<a href="#" onclick="Unbookmark('collage', <?=$ID?>, ''); return false;" class="brackets">Remove bookmark</a>
|
||||||
</span>
|
</span>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<div class="tags"><?=$TorrentTags->format('collages.php?action=search&tags=')?></div>
|
<div class="tags"><?=$TorrentTags->format('collages.php?action=search&tags=')?></div>
|
||||||
|
@ -24,7 +24,7 @@ function compare($X, $Y) {
|
|||||||
list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers)) = each($Data);
|
list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers)) = each($Data);
|
||||||
} else {
|
} else {
|
||||||
$DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser, Updated, Subscribers FROM collages WHERE ID='$CollageID'");
|
$DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser, Updated, Subscribers FROM collages WHERE ID='$CollageID'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $DB->next_record();
|
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $DB->next_record();
|
||||||
$TorrentList = '';
|
$TorrentList = '';
|
||||||
$CollageList = '';
|
$CollageList = '';
|
||||||
|
@ -6,14 +6,22 @@
|
|||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT UserID, CategoryID, Locked, MaxGroups, MaxGroupsPerUser FROM collages WHERE ID='$CollageID'");
|
$DB->query("
|
||||||
|
SELECT UserID, CategoryID, Locked, MaxGroups, MaxGroupsPerUser
|
||||||
|
FROM collages
|
||||||
|
WHERE ID = '$CollageID'");
|
||||||
list($UserID, $CategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
|
list($UserID, $CategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser) = $DB->next_record();
|
||||||
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
|
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT ID,Deleted FROM collages WHERE Name='".db_string($_POST['name'])."' AND ID!='$CollageID' LIMIT 1");
|
$DB->query("
|
||||||
if ($DB->record_count()) {
|
SELECT ID, Deleted
|
||||||
|
FROM collages
|
||||||
|
WHERE Name = '".db_string($_POST['name'])."'
|
||||||
|
AND ID != '$CollageID'
|
||||||
|
LIMIT 1");
|
||||||
|
if ($DB->has_results()) {
|
||||||
list($ID, $Deleted) = $DB->next_record();
|
list($ID, $Deleted) = $DB->next_record();
|
||||||
if ($Deleted) {
|
if ($Deleted) {
|
||||||
$Err = 'A collage with that name already exists but needs to be recovered, please <a href="staffpm.php">contact</a> the staff team!';
|
$Err = 'A collage with that name already exists but needs to be recovered, please <a href="staffpm.php">contact</a> the staff team!';
|
||||||
@ -25,11 +33,11 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$TagList = explode(',',$_POST['tags']);
|
$TagList = explode(',', $_POST['tags']);
|
||||||
foreach ($TagList as $ID=>$Tag) {
|
foreach ($TagList as $ID => $Tag) {
|
||||||
$TagList[$ID] = Misc::sanitize_tag($Tag);
|
$TagList[$ID] = Misc::sanitize_tag($Tag);
|
||||||
}
|
}
|
||||||
$TagList = implode(' ',$TagList);
|
$TagList = implode(' ', $TagList);
|
||||||
|
|
||||||
$Updates = array("Description='".db_string($_POST['description'])."', TagList='".db_string($TagList)."'");
|
$Updates = array("Description='".db_string($_POST['description'])."', TagList='".db_string($TagList)."'");
|
||||||
|
|
||||||
@ -40,32 +48,39 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['featured']) && $CategoryID == 0 && (($LoggedUser['ID'] == $UserID && check_perms('site_collages_personal')) || check_perms('site_collages_delete'))) {
|
if (isset($_POST['featured']) && $CategoryID == 0 && (($LoggedUser['ID'] == $UserID && check_perms('site_collages_personal')) || check_perms('site_collages_delete'))) {
|
||||||
$DB->query("UPDATE collages SET Featured=0 WHERE CategoryID=0 and UserID=$UserID");
|
$DB->query("
|
||||||
$Updates[] = 'Featured=1';
|
UPDATE collages
|
||||||
|
SET Featured = 0
|
||||||
|
WHERE CategoryID = 0 \
|
||||||
|
AND UserID = $UserID");
|
||||||
|
$Updates[] = 'Featured = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_perms('site_collages_delete') || ($CategoryID == 0 && $UserID == $LoggedUser['ID'] && check_perms('site_collages_renamepersonal'))) {
|
if (check_perms('site_collages_delete') || ($CategoryID == 0 && $UserID == $LoggedUser['ID'] && check_perms('site_collages_renamepersonal'))) {
|
||||||
$Updates[] = "Name='".db_string($_POST['name'])."'";
|
$Updates[] = "Name = '".db_string($_POST['name'])."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['category']) && !empty($CollageCats[$_POST['category']]) && $_POST['category'] != $CategoryID && ($_POST['category'] != 0 || check_perms('site_collages_delete'))) {
|
if (isset($_POST['category']) && !empty($CollageCats[$_POST['category']]) && $_POST['category'] != $CategoryID && ($_POST['category'] != 0 || check_perms('site_collages_delete'))) {
|
||||||
$Updates[] = 'CategoryID='.$_POST['category'];
|
$Updates[] = 'CategoryID = '.$_POST['category'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_perms('site_collages_delete')) {
|
if (check_perms('site_collages_delete')) {
|
||||||
if (isset($_POST['locked']) != $Locked) {
|
if (isset($_POST['locked']) != $Locked) {
|
||||||
$Updates[] = 'Locked=' . ($Locked ? "'0'" : "'1'");
|
$Updates[] = 'Locked = ' . ($Locked ? "'0'" : "'1'");
|
||||||
}
|
}
|
||||||
if (isset($_POST['maxgroups']) && ($_POST['maxgroups'] == 0 || is_number($_POST['maxgroups'])) && $_POST['maxgroups'] != $MaxGroups) {
|
if (isset($_POST['maxgroups']) && ($_POST['maxgroups'] == 0 || is_number($_POST['maxgroups'])) && $_POST['maxgroups'] != $MaxGroups) {
|
||||||
$Updates[] = 'MaxGroups=' . $_POST['maxgroups'];
|
$Updates[] = 'MaxGroups = ' . $_POST['maxgroups'];
|
||||||
}
|
}
|
||||||
if (isset($_POST['maxgroups']) && ($_POST['maxgroupsperuser'] == 0 || is_number($_POST['maxgroupsperuser'])) && $_POST['maxgroupsperuser'] != $MaxGroupsPerUser) {
|
if (isset($_POST['maxgroups']) && ($_POST['maxgroupsperuser'] == 0 || is_number($_POST['maxgroupsperuser'])) && $_POST['maxgroupsperuser'] != $MaxGroupsPerUser) {
|
||||||
$Updates[] = 'MaxGroupsPerUser=' . $_POST['maxgroupsperuser'];
|
$Updates[] = 'MaxGroupsPerUser = ' . $_POST['maxgroupsperuser'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($Updates)) {
|
if (!empty($Updates)) {
|
||||||
$DB->query("UPDATE collages SET ".implode(', ', $Updates)." WHERE ID=$CollageID");
|
$DB->query('
|
||||||
|
UPDATE collages
|
||||||
|
SET '.implode(', ', $Updates)."
|
||||||
|
WHERE ID = $CollageID");
|
||||||
}
|
}
|
||||||
$Cache->delete_value('collage_'.$CollageID);
|
$Cache->delete_value('collage_'.$CollageID);
|
||||||
header('Location: collages.php?id='.$CollageID);
|
header('Location: collages.php?id='.$CollageID);
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
<tr id="collagename">
|
<tr id="collagename">
|
||||||
<td class="label"><strong>Name</strong></td>
|
<td class="label"><strong>Name</strong></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text"<?=$NoName ? ' class="hidden"' : '' ?> name="name" size="60" id="namebox" value="<?=display_str($Name)?>" />
|
<input type="text"<?=$NoName ? ' class="hidden"' : ''; ?> name="name" size="60" id="namebox" value="<?=display_str($Name)?>" />
|
||||||
<span id="personal"<?=$NoName ? '' : ' class="hidden"' ?> style="font-style: oblique;"><strong><?=$LoggedUser['Username']?>'s personal collage</strong></span>
|
<span id="personal"<?=$NoName ? '' : ' class="hidden"'; ?> style="font-style: oblique;"><strong><?=$LoggedUser['Username']?>'s personal collage</strong></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -40,12 +40,17 @@
|
|||||||
<?
|
<?
|
||||||
array_shift($CollageCats);
|
array_shift($CollageCats);
|
||||||
|
|
||||||
foreach ($CollageCats as $CatID=>$CatName) : ?>
|
foreach ($CollageCats as $CatID=>$CatName) { ?>
|
||||||
<option value="<?=$CatID + 1 ?>"<?=(($CatID + 1 == $Category) ? ' selected="selected"' : '')?>><?=$CatName?></option>
|
<option value="<?=$CatID + 1 ?>"<?=(($CatID + 1 == $Category) ? ' selected="selected"' : '')?>><?=$CatName?></option>
|
||||||
<?
|
<?
|
||||||
endforeach;
|
}
|
||||||
|
|
||||||
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM collages
|
||||||
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
|
AND CategoryID = '0'
|
||||||
|
AND Deleted = '0'");
|
||||||
list($CollageCount) = $DB->next_record();
|
list($CollageCount) = $DB->next_record();
|
||||||
if (($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
|
if (($CollageCount < $LoggedUser['Permissions']['MaxCollages']) && check_perms('site_collages_personal')) { ?>
|
||||||
<option value="0"<?=(($Category === '0') ? ' selected="selected"' : '')?>>Personal</option>
|
<option value="0"<?=(($Category === '0') ? ' selected="selected"' : '')?>>Personal</option>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
$P['name'] = db_string($name);
|
$P['name'] = db_string($name);
|
||||||
$DB->query("SELECT ID FROM collages WHERE Name='".$P['name']."'");
|
$DB->query("SELECT ID FROM collages WHERE Name='".$P['name']."'");
|
||||||
$i = 2;
|
$i = 2;
|
||||||
while ($DB->record_count() != 0) {
|
while ($DB->has_results()) {
|
||||||
$P['name'] = db_string($name." no. $i");
|
$P['name'] = db_string($name." no. $i");
|
||||||
$DB->query("SELECT ID FROM collages WHERE Name='".$P['name']."'");
|
$DB->query("SELECT ID FROM collages WHERE Name='".$P['name']."'");
|
||||||
$i++;
|
$i++;
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
if (!$Err) {
|
if (!$Err) {
|
||||||
$DB->query("SELECT ID,Deleted FROM collages WHERE Name='$P[name]'");
|
$DB->query("SELECT ID,Deleted FROM collages WHERE Name='$P[name]'");
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
list($ID, $Deleted) = $DB->next_record();
|
list($ID, $Deleted) = $DB->next_record();
|
||||||
if ($Deleted) {
|
if ($Deleted) {
|
||||||
$Err = "That collection already exists but needs to be recovered; please <a href=\"staffpm.php\">contact</a> the staff team!";
|
$Err = "That collection already exists but needs to be recovered; please <a href=\"staffpm.php\">contact</a> the staff team!";
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
SELECT Name
|
SELECT Name
|
||||||
FROM collages
|
FROM collages
|
||||||
WHERE ID = $CollageID");
|
WHERE ID = $CollageID");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error('Collage is completely deleted');
|
error('Collage is completely deleted');
|
||||||
} else {
|
} else {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
if ($UserID != $AuthorID && !check_perms('site_moderate_forums')) {
|
if ($UserID != $AuthorID && !check_perms('site_moderate_forums')) {
|
||||||
die('Permission denied');
|
die('Permission denied');
|
||||||
}
|
}
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
die('Post not found!');
|
die('Post not found!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
* @returns void, prints output
|
* @returns void, prints output
|
||||||
*/
|
*/
|
||||||
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
|
function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorID, $AddedTime, $EditedTime) {
|
||||||
global $Text,$HeavyInfo;
|
global $Text, $HeavyInfo;
|
||||||
$UserInfo = Users::user_info($UserID);
|
$UserInfo = Users::user_info($UserID);
|
||||||
$postheader = 'by <strong>' . Users::format_username($UserID, true, true, true, true, false) . '</strong> '
|
$postheader = 'by <strong>' . Users::format_username($UserID, true, true, true, true, false) . '</strong> '
|
||||||
. time_diff($AddedTime) . $postheader;
|
. time_diff($AddedTime) . $postheader;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<table class="forum_post box vertical_margin<?=$noavatar ? ' noavatar' : '' ?>" id="post<?=$PostID?>">
|
<table class="forum_post box vertical_margin<?=$noavatar ? ' noavatar' : ''; ?>" id="post<?=$PostID?>">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<? if (Users::has_avatars_enabled()) { ?>
|
<? if (Users::has_avatars_enabled()) { ?>
|
||||||
<col class="col_avatar" />
|
<col class="col_avatar" />
|
||||||
@ -27,7 +27,7 @@ function comment_body($UserID, $PostID, $postheader, $permalink, $Body, $EditorI
|
|||||||
<col class="col_post_body" />
|
<col class="col_post_body" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr class="colhead_dark">
|
<tr class="colhead_dark">
|
||||||
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
|
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1; ?>">
|
||||||
<span style="float: left;"><a href="<?=$permalink ?>">#<?=$PostID?></a>
|
<span style="float: left;"><a href="<?=$permalink ?>">#<?=$PostID?></a>
|
||||||
<?=$postheader ?>
|
<?=$postheader ?>
|
||||||
</span>
|
</span>
|
||||||
|
@ -30,18 +30,30 @@
|
|||||||
$Result .= fgets ($Socket, 1024);
|
$Result .= fgets ($Socket, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($Result,'VERIFIED') !== false || check_perms('site_debug')) {
|
if (strpos($Result, 'VERIFIED') !== false || check_perms('site_debug')) {
|
||||||
if ($_POST['mc_gross'] >= PAYPAL_MINIMUM) {
|
if ($_POST['mc_gross'] >= PAYPAL_MINIMUM) {
|
||||||
if ($_POST['mc_currency'] == PAYPAL_CURRENCY) {
|
if ($_POST['mc_currency'] == PAYPAL_CURRENCY) {
|
||||||
if ($_POST['business'] == PAYPAL_ADDRESS) {
|
if ($_POST['business'] == PAYPAL_ADDRESS) {
|
||||||
if (($_POST['payment_status'] == "Completed") || ($_POST['payment_status'] == "Pending")) {
|
if (($_POST['payment_status'] == 'Completed') || ($_POST['payment_status'] == 'Pending')) {
|
||||||
$DB->query('SELECT Donor FROM users_info WHERE UserID=\''.$_POST['custom'].'\'');
|
$DB->query('
|
||||||
|
SELECT Donor
|
||||||
|
FROM users_info
|
||||||
|
WHERE UserID = \''.$_POST['custom'].'\'');
|
||||||
list($Donor) = $DB->next_record();
|
list($Donor) = $DB->next_record();
|
||||||
if ($Donor == 0) {
|
if ($Donor == 0) {
|
||||||
//First time donor
|
//First time donor
|
||||||
$DB->query('UPDATE users_main SET Invites = Invites + \''.DONOR_INVITES.'\' WHERE ID=\''.$_POST['custom'].'\'');
|
$DB->query('
|
||||||
$DB->query('UPDATE users_info SET Donor = \'1\' WHERE UserID=\''.$_POST['custom'].'\'');
|
UPDATE users_main
|
||||||
$DB->query('SELECT Invites FROM users_main WHERE ID=\''.$_POST['custom'].'\'');
|
SET Invites = Invites + \''.DONOR_INVITES.'\'
|
||||||
|
WHERE ID = \''.$_POST['custom'].'\'');
|
||||||
|
$DB->query('
|
||||||
|
UPDATE users_info
|
||||||
|
SET Donor = \'1\'
|
||||||
|
WHERE UserID = \''.$_POST['custom'].'\'');
|
||||||
|
$DB->query('
|
||||||
|
SELECT Invites
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = \''.$_POST['custom'].'\'');
|
||||||
list($Invites) = $DB->next_record();
|
list($Invites) = $DB->next_record();
|
||||||
$Cache->begin_transaction('user_info_'.$_POST['custom']);
|
$Cache->begin_transaction('user_info_'.$_POST['custom']);
|
||||||
$Cache->update_row(false, array('Donor' => 1));
|
$Cache->update_row(false, array('Donor' => 1));
|
||||||
@ -65,23 +77,32 @@
|
|||||||
Misc::send_pm($_POST['custom'], 0, 'Thank you for your donation', 'Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Unfortunately however this donation was less than the specified minimum donation of '.PAYPAL_MINIMUM.' '.PAYPAL_CURRENCY.' and while we are grateful, no special privileges have been awarded to you.');
|
Misc::send_pm($_POST['custom'], 0, 'Thank you for your donation', 'Your donation from '.$_POST['payer_email'].' of '.$_POST['mc_gross'].' '.PAYPAL_CURRENCY.' has been successfully processed. Unfortunately however this donation was less than the specified minimum donation of '.PAYPAL_MINIMUM.' '.PAYPAL_CURRENCY.' and while we are grateful, no special privileges have been awarded to you.');
|
||||||
} else {
|
} else {
|
||||||
//Failed pending donation
|
//Failed pending donation
|
||||||
$Message = "User https://".SSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of ".$TotalDonated." ".PAYPAL_CURRENCY." at ".$DonationTime." UTC from ".$_POST['payer_email']." returned.";
|
$Message = "User https://".SSL_SITE_URL."/user.php?id=".$_POST['custom']." had donation of $TotalDonated ".PAYPAL_CURRENCY." at $DonationTime UTC from ".$_POST['payer_email'].' returned.';
|
||||||
$DB->query('
|
$DB->query('
|
||||||
SELECT SUM(Amount), MIN(Time)
|
SELECT SUM(Amount), MIN(Time)
|
||||||
FROM donations
|
FROM donations
|
||||||
WHERE UserID=\''.$_POST['custom'].'\';');
|
WHERE UserID = \''.$_POST['custom'].'\';');
|
||||||
list($TotalDonated,$DonationTime) = $DB->next_record();
|
list($TotalDonated, $DonationTime) = $DB->next_record();
|
||||||
if ($TotalDonated+$_POST['mc_gross'] == 0) {
|
if ($TotalDonated + $_POST['mc_gross'] == 0) {
|
||||||
$DB->query("SELECT Invites FROM users_main WHERE ID='".$_POST['custom']."'");
|
$DB->query("
|
||||||
|
SELECT Invites
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = '".$_POST['custom']."'");
|
||||||
list($Invites) = $DB->next_record();
|
list($Invites) = $DB->next_record();
|
||||||
if (($Invites - DONOR_INVITES) >= 0) {
|
if (($Invites - DONOR_INVITES) >= 0) {
|
||||||
$NewInvites = $Invites - DONOR_INVITES;
|
$NewInvites = $Invites - DONOR_INVITES;
|
||||||
} else {
|
} else {
|
||||||
$NewInvites = 0;
|
$NewInvites = 0;
|
||||||
$Message .= " They had already used at least one of their donation gained invites.";
|
$Message .= ' They had already used at least one of their donation gained invites.';
|
||||||
}
|
}
|
||||||
$DB->query("UPDATE users_main SET Invites = ".$NewInvites." WHERE ID='".$_POST['custom']."'");
|
$DB->query("
|
||||||
$DB->query('UPDATE users_info SET Donor = \'0\' WHERE UserID=\''.$_POST['custom'].'\'');
|
UPDATE users_main
|
||||||
|
SET Invites = $NewInvites
|
||||||
|
WHERE ID = '".$_POST['custom']."'");
|
||||||
|
$DB->query('
|
||||||
|
UPDATE users_info
|
||||||
|
SET Donor = \'0\'
|
||||||
|
WHERE UserID = \''.$_POST['custom'].'\'');
|
||||||
$Cache->begin_transaction('user_info_'.$_POST['custom']);
|
$Cache->begin_transaction('user_info_'.$_POST['custom']);
|
||||||
$Cache->update_row(false, array('Donor' => 0));
|
$Cache->update_row(false, array('Donor' => 0));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
@ -91,15 +112,14 @@
|
|||||||
Misc::send_pm($_POST['custom'], 0, 'Notice of donation failure', 'PapPal has just notified us that the donation you sent from '.$_POST['payer_email'].' of '.$TotalDonated.' '.PAYPAL_CURRENCY.' at '.$DonationTime.' UTC has been revoked. Because of this your special privileges have been revoked, and your invites removed.');
|
Misc::send_pm($_POST['custom'], 0, 'Notice of donation failure', 'PapPal has just notified us that the donation you sent from '.$_POST['payer_email'].' of '.$TotalDonated.' '.PAYPAL_CURRENCY.' at '.$DonationTime.' UTC has been revoked. Because of this your special privileges have been revoked, and your invites removed.');
|
||||||
|
|
||||||
|
|
||||||
send_irc("PRIVMSG ".BOT_REPORT_CHAN." :".$Message);
|
send_irc("PRIVMSG ".BOT_REPORT_CHAN." :$Message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_info
|
UPDATE users_info
|
||||||
SET
|
SET AdminComment = CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment)
|
||||||
AdminComment=CONCAT('".sqltime()." - User donated ".db_string($_POST['mc_gross'])." ".db_string(PAYPAL_CURRENCY)." from ".db_string($_POST['payer_email']).".\n',AdminComment)
|
WHERE UserID = '".$_POST['custom']."'");
|
||||||
WHERE UserID='".$_POST['custom']."'");
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO donations
|
INSERT INTO donations
|
||||||
(UserID, Amount, Email, Time)
|
(UserID, Amount, Email, Time)
|
||||||
@ -110,11 +130,11 @@
|
|||||||
INSERT INTO ip_bans
|
INSERT INTO ip_bans
|
||||||
(FromIP, ToIP, Reason)
|
(FromIP, ToIP, Reason)
|
||||||
VALUES
|
VALUES
|
||||||
('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."','".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')");
|
('".Tools::ip_to_unsigned($_SERVER['REMOTE_ADDR'])."', '".ip2long($_SERVER['REMOTE_ADDR'])."', 'Attempted to exploit donation system.')");
|
||||||
}
|
}
|
||||||
fclose ($Socket);
|
fclose ($Socket);
|
||||||
if (check_perms('site_debug')) {
|
if (check_perms('site_debug')) {
|
||||||
include(SERVER_ROOT.'/sections/donate/donate.php');
|
include(SERVER_ROOT.'/sections/donate/donate.php');
|
||||||
}
|
}
|
||||||
$Cache->cache_value('debug_donate',array($Result,$_POST),0);
|
$Cache->cache_value('debug_donate', array($Result, $_POST), 0);
|
||||||
?>
|
?>
|
||||||
|
@ -8,14 +8,20 @@
|
|||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
if (!check_perms('site_moderate_forums')) {
|
if (!check_perms('site_moderate_forums')) {
|
||||||
$DB->query("SELECT ForumID FROM forums_topics WHERE ID = $ThreadID");
|
$DB->query("
|
||||||
|
SELECT ForumID
|
||||||
|
FROM forums_topics
|
||||||
|
WHERE ID = $ThreadID");
|
||||||
list($ForumID) = $DB->next_record();
|
list($ForumID) = $DB->next_record();
|
||||||
if (!in_array($ForumID, $ForumsRevealVoters)) {
|
if (!in_array($ForumID, $ForumsRevealVoters)) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$DB->query("SELECT Answers FROM forums_polls WHERE TopicID = ".$ThreadID);
|
$DB->query("
|
||||||
if ($DB->record_count() < 1) {
|
SELECT Answers
|
||||||
|
FROM forums_polls
|
||||||
|
WHERE TopicID = $ThreadID");
|
||||||
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +33,7 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE forums_polls
|
UPDATE forums_polls
|
||||||
SET Answers = '".db_string($Answers)."'
|
SET Answers = '".db_string($Answers)."'
|
||||||
WHERE TopicID = ".$ThreadID);
|
WHERE TopicID = $ThreadID");
|
||||||
$Cache->delete_value('polls_'.$ThreadID);
|
$Cache->delete_value("polls_$ThreadID");
|
||||||
|
|
||||||
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
|
header("Location: forums.php?action=viewthread&threadid=$ThreadID");
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
SELECT
|
SELECT
|
||||||
TopicID,
|
TopicID,
|
||||||
ForumID,
|
ForumID,
|
||||||
CEIL(COUNT(p.ID)/".POSTS_PER_PAGE.") AS Pages,
|
CEIL(COUNT(p.ID) / ".POSTS_PER_PAGE.") AS Pages,
|
||||||
CEIL(SUM(IF(p.ID<='$PostID',1,0))/".POSTS_PER_PAGE.") AS Page,
|
CEIL(SUM(IF(p.ID <= '$PostID', 1, 0)) / ".POSTS_PER_PAGE.") AS Page,
|
||||||
StickyPostID
|
StickyPostID
|
||||||
FROM forums_posts AS p
|
FROM forums_posts AS p
|
||||||
JOIN forums_topics AS t ON t.ID=p.TopicID
|
JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||||
WHERE p.TopicID=(
|
WHERE p.TopicID = (
|
||||||
SELECT TopicID
|
SELECT TopicID
|
||||||
FROM forums_posts
|
FROM forums_posts
|
||||||
WHERE ID='$PostID'
|
WHERE ID = '$PostID'
|
||||||
)
|
)
|
||||||
GROUP BY t.ID");
|
GROUP BY t.ID");
|
||||||
list($TopicID, $ForumID, $Pages, $Page, $StickyPostID) = $DB->next_record();
|
list($TopicID, $ForumID, $Pages, $Page, $StickyPostID) = $DB->next_record();
|
||||||
@ -33,30 +33,35 @@
|
|||||||
// $Page = which page the post is on
|
// $Page = which page the post is on
|
||||||
// These are set for cache clearing.
|
// These are set for cache clearing.
|
||||||
|
|
||||||
$DB->query("DELETE FROM forums_posts WHERE ID='$PostID'");
|
$DB->query("
|
||||||
|
DELETE FROM forums_posts
|
||||||
|
WHERE ID = '$PostID'");
|
||||||
|
|
||||||
$DB->query("SELECT MAX(ID) FROM forums_posts WHERE TopicID='$TopicID'");
|
$DB->query("
|
||||||
|
SELECT MAX(ID)
|
||||||
|
FROM forums_posts
|
||||||
|
WHERE TopicID = '$TopicID'");
|
||||||
list($LastID) = $DB->next_record();
|
list($LastID) = $DB->next_record();
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE forums AS f, forums_topics AS t
|
UPDATE forums AS f, forums_topics AS t
|
||||||
SET f.NumPosts=f.NumPosts-1, t.NumPosts=t.NumPosts-1
|
SET f.NumPosts = f.NumPosts - 1, t.NumPosts = t.NumPosts - 1
|
||||||
WHERE f.ID='$ForumID'
|
WHERE f.ID = '$ForumID'
|
||||||
AND t.ID='$TopicID'");
|
AND t.ID = '$TopicID'");
|
||||||
|
|
||||||
if ($LastID < $PostID) { // Last post in a topic was removed
|
if ($LastID < $PostID) { // Last post in a topic was removed
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT p.AuthorID, u.Username, p.AddedTime
|
SELECT p.AuthorID, u.Username, p.AddedTime
|
||||||
FROM forums_posts AS p
|
FROM forums_posts AS p
|
||||||
LEFT JOIN users_main AS u ON u.ID = p.AuthorID
|
LEFT JOIN users_main AS u ON u.ID = p.AuthorID
|
||||||
WHERE p.ID='$LastID'");
|
WHERE p.ID = '$LastID'");
|
||||||
list($LastAuthorID, $LastAuthorName, $LastTime) = $DB->next_record();
|
list($LastAuthorID, $LastAuthorName, $LastTime) = $DB->next_record();
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE forums_topics
|
UPDATE forums_topics
|
||||||
SET
|
SET
|
||||||
LastPostID='$LastID',
|
LastPostID = '$LastID',
|
||||||
LastPostAuthorID='$LastAuthorID',
|
LastPostAuthorID = '$LastAuthorID',
|
||||||
LastPostTime='$LastTime'
|
LastPostTime = '$LastTime'
|
||||||
WHERE ID='$TopicID'");
|
WHERE ID = '$TopicID'");
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
t.ID,
|
t.ID,
|
||||||
@ -67,7 +72,7 @@
|
|||||||
u.Username
|
u.Username
|
||||||
FROM forums_topics AS t
|
FROM forums_topics AS t
|
||||||
LEFT JOIN users_main AS u ON u.ID = t.LastPostAuthorID
|
LEFT JOIN users_main AS u ON u.ID = t.LastPostAuthorID
|
||||||
WHERE ForumID='$ForumID'
|
WHERE ForumID = '$ForumID'
|
||||||
AND t.ID != '$TopicID'
|
AND t.ID != '$TopicID'
|
||||||
ORDER BY LastPostID DESC
|
ORDER BY LastPostID DESC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
@ -77,12 +82,12 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE forums
|
UPDATE forums
|
||||||
SET
|
SET
|
||||||
LastPostTopicID='$LastTopicID',
|
LastPostTopicID = '$LastTopicID',
|
||||||
LastPostID='$LastTopicPostID',
|
LastPostID = '$LastTopicPostID',
|
||||||
LastPostAuthorID='$LastTopicAuthorID',
|
LastPostAuthorID = '$LastTopicAuthorID',
|
||||||
LastPostTime='$LastTopicPostTime'
|
LastPostTime = '$LastTopicPostTime'
|
||||||
WHERE ID='$ForumID'
|
WHERE ID = '$ForumID'
|
||||||
AND LastPostTopicID='$TopicID'");
|
AND LastPostTopicID = '$TopicID'");
|
||||||
$UpdateArrayForums = array(
|
$UpdateArrayForums = array(
|
||||||
'NumPosts' => '-1',
|
'NumPosts' => '-1',
|
||||||
'LastPostID' => $LastTopicPostID,
|
'LastPostID' => $LastTopicPostID,
|
||||||
@ -94,11 +99,11 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE forums
|
UPDATE forums
|
||||||
SET
|
SET
|
||||||
LastPostID='$LastID',
|
LastPostID = '$LastID',
|
||||||
LastPostAuthorID='$LastAuthorID',
|
LastPostAuthorID = '$LastAuthorID',
|
||||||
LastPostTime='$LastTime'
|
LastPostTime = '$LastTime'
|
||||||
WHERE ID='$ForumID'
|
WHERE ID = '$ForumID'
|
||||||
AND LastPostTopicID='$TopicID'");
|
AND LastPostTopicID = '$TopicID'");
|
||||||
$UpdateArrayForums = array(
|
$UpdateArrayForums = array(
|
||||||
'NumPosts' => '-1',
|
'NumPosts' => '-1',
|
||||||
'LastPostID' => $LastID,
|
'LastPostID' => $LastID,
|
||||||
@ -122,10 +127,10 @@
|
|||||||
$ThisCatalogue = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
$ThisCatalogue = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
$LastCatalogue = floor((POSTS_PER_PAGE * $Pages - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
$LastCatalogue = floor((POSTS_PER_PAGE * $Pages - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
||||||
$Cache->delete_value('thread_'.$TopicID.'_catalogue_'.$i);
|
$Cache->delete_value("thread_$TopicID"."_catalogue_$i");
|
||||||
}
|
}
|
||||||
|
|
||||||
$Cache->begin_transaction('thread_'.$TopicID.'_info');
|
$Cache->begin_transaction("thread_$TopicID".'_info');
|
||||||
$Cache->update_row(false, $UpdateArrayThread);
|
$Cache->update_row(false, $UpdateArrayThread);
|
||||||
$Cache->commit_transaction();
|
$Cache->commit_transaction();
|
||||||
|
|
||||||
@ -133,5 +138,5 @@
|
|||||||
$Cache->update_row($ForumID, $UpdateArrayForums);
|
$Cache->update_row($ForumID, $UpdateArrayForums);
|
||||||
$Cache->commit_transaction();
|
$Cache->commit_transaction();
|
||||||
|
|
||||||
$Cache->delete_value('forums_'.$ForumID);
|
$Cache->delete_value("forums_$ForumID");
|
||||||
?>
|
?>
|
||||||
|
@ -8,14 +8,20 @@
|
|||||||
$PollOption = $_GET['vote'];
|
$PollOption = $_GET['vote'];
|
||||||
|
|
||||||
if (is_number($ThreadID) && is_number($PollOption)) {
|
if (is_number($ThreadID) && is_number($PollOption)) {
|
||||||
$DB->query("SELECT ForumID FROM forums_topics WHERE ID = $ThreadID");
|
$DB->query("
|
||||||
|
SELECT ForumID
|
||||||
|
FROM forums_topics
|
||||||
|
WHERE ID = $ThreadID");
|
||||||
list($ForumID) = $DB->next_record();
|
list($ForumID) = $DB->next_record();
|
||||||
if (!in_array($ForumID, $ForumsRevealVoters)) {
|
if (!in_array($ForumID, $ForumsRevealVoters)) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT Answers FROM forums_polls WHERE TopicID = $ThreadID");
|
$DB->query("
|
||||||
if ($DB->record_count() < 1) {
|
SELECT Answers
|
||||||
|
FROM forums_polls
|
||||||
|
WHERE TopicID = $ThreadID");
|
||||||
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,9 +39,8 @@
|
|||||||
WHERE Vote = $PollOption
|
WHERE Vote = $PollOption
|
||||||
AND TopicID = $ThreadID");
|
AND TopicID = $ThreadID");
|
||||||
|
|
||||||
$Cache->delete_value('polls_'.$ThreadID);
|
$Cache->delete_value("polls_$ThreadID");
|
||||||
header('Location: forums.php?action=viewthread&threadid='.$ThreadID);
|
header("Location: forums.php?action=viewthread&threadid=$ThreadID");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
FROM subscribed_forums
|
FROM subscribed_forums
|
||||||
WHERE ForumID='$ForumID'
|
WHERE ForumID='$ForumID'
|
||||||
AND SubscriberID='$LoggedUser[ID]'");
|
AND SubscriberID='$LoggedUser[ID]'");
|
||||||
if ($DB->record_count() == 0) { ?>
|
if (!$DB->has_results()) { ?>
|
||||||
<a href="forums.php?action=forum_subscribe&perform=add&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
|
<a href="forums.php?action=forum_subscribe&perform=add&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Subscribe to forum</a>
|
||||||
<? } else { ?>
|
<? } else { ?>
|
||||||
<a href="forums.php?action=forum_subscribe&perform=remove&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Unsubscribe from forum</a>
|
<a href="forums.php?action=forum_subscribe&perform=remove&forumid=<?=$ForumID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Unsubscribe from forum</a>
|
||||||
|
@ -19,7 +19,7 @@ function get_thread_info($ThreadID, $Return = true, $SelectiveCache = false, $Ap
|
|||||||
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
||||||
WHERE t.ID = '$ThreadID'
|
WHERE t.ID = '$ThreadID'
|
||||||
GROUP BY fp.TopicID");
|
GROUP BY fp.TopicID");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
if (!$ApiCall) {
|
if (!$ApiCall) {
|
||||||
error(404);
|
error(404);
|
||||||
} else {
|
} else {
|
||||||
@ -84,7 +84,7 @@ function get_forum_info($ForumID) {
|
|||||||
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
|
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
|
||||||
WHERE forums.ID='$ForumID'
|
WHERE forums.ID='$ForumID'
|
||||||
GROUP BY ForumID");
|
GROUP BY ForumID");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Makes an array, with $Forum['Name'], etc.
|
// Makes an array, with $Forum['Name'], etc.
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
unset($ForumCats);
|
unset($ForumCats);
|
||||||
$ForumCats = $Cache->get_value('forums_categories');
|
$ForumCats = $Cache->get_value('forums_categories');
|
||||||
if ($ForumCats === false) {
|
if ($ForumCats === false) {
|
||||||
$DB->query('SELECT ID, Name FROM forums_categories');
|
$DB->query('
|
||||||
|
SELECT ID, Name
|
||||||
|
FROM forums_categories');
|
||||||
$ForumCats = array();
|
$ForumCats = array();
|
||||||
while (list($ID, $Name) = $DB->next_record()) {
|
while (list($ID, $Name) = $DB->next_record()) {
|
||||||
$ForumCats[$ID] = $Name;
|
$ForumCats[$ID] = $Name;
|
||||||
@ -50,7 +52,10 @@
|
|||||||
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
|
||||||
foreach ($Forums as $ForumID => $Forum) {
|
foreach ($Forums as $ForumID => $Forum) {
|
||||||
if (count($Forum['SpecificRules'])) {
|
if (count($Forum['SpecificRules'])) {
|
||||||
$DB->query('SELECT ThreadID FROM forums_specific_rules WHERE ForumID = '.$ForumID);
|
$DB->query("
|
||||||
|
SELECT ThreadID
|
||||||
|
FROM forums_specific_rules
|
||||||
|
WHERE ForumID = $ForumID");
|
||||||
$ThreadIDs = $DB->collect('ThreadID');
|
$ThreadIDs = $DB->collect('ThreadID');
|
||||||
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
|
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
$TopicIDs = array();
|
$TopicIDs = array();
|
||||||
foreach ($Forums as $Forum) {
|
foreach ($Forums as $Forum) {
|
||||||
if (!empty($Forum['LastPostTopicID'])) {
|
if (!empty($Forum['LastPostTopicID'])) {
|
||||||
$TopicIDs[]=$Forum['LastPostTopicID'];
|
$TopicIDs[] = $Forum['LastPostTopicID'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,11 +23,11 @@
|
|||||||
SELECT COUNT(ID)
|
SELECT COUNT(ID)
|
||||||
FROM forums_posts
|
FROM forums_posts
|
||||||
WHERE forums_posts.TopicID = l.TopicID
|
WHERE forums_posts.TopicID = l.TopicID
|
||||||
AND forums_posts.ID<=l.PostID
|
AND forums_posts.ID <= l.PostID
|
||||||
)/$PerPage) AS Page
|
) / $PerPage) AS Page
|
||||||
FROM forums_last_read_topics AS l
|
FROM forums_last_read_topics AS l
|
||||||
WHERE TopicID IN(".implode(',',$TopicIDs).")
|
WHERE TopicID IN(".implode(',', $TopicIDs).")
|
||||||
AND UserID='$LoggedUser[ID]'");
|
AND UserID = '$LoggedUser[ID]'");
|
||||||
$LastRead = $DB->to_array('TopicID', MYSQLI_ASSOC);
|
$LastRead = $DB->to_array('TopicID', MYSQLI_ASSOC);
|
||||||
} else {
|
} else {
|
||||||
$LastRead = array();
|
$LastRead = array();
|
||||||
@ -43,7 +43,10 @@
|
|||||||
$Row = 'a';
|
$Row = 'a';
|
||||||
$LastCategoryID = 0;
|
$LastCategoryID = 0;
|
||||||
$OpenTable = false;
|
$OpenTable = false;
|
||||||
$DB->query("SELECT RestrictedForums FROM users_info WHERE UserID = ".$LoggedUser['ID']);
|
$DB->query('
|
||||||
|
SELECT RestrictedForums
|
||||||
|
FROM users_info
|
||||||
|
WHERE UserID = '.$LoggedUser['ID']);
|
||||||
list($RestrictedForums) = $DB->next_record();
|
list($RestrictedForums) = $DB->next_record();
|
||||||
$RestrictedForums = explode(',', $RestrictedForums);
|
$RestrictedForums = explode(',', $RestrictedForums);
|
||||||
$PermittedForums = array_keys($LoggedUser['PermittedForums']);
|
$PermittedForums = array_keys($LoggedUser['PermittedForums']);
|
||||||
@ -52,7 +55,7 @@
|
|||||||
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead > $LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
|
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead > $LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$Row = (($Row == 'a') ? 'b' : 'a');
|
$Row = (($Row === 'a') ? 'b' : 'a');
|
||||||
$ForumDescription = display_str($ForumDescription);
|
$ForumDescription = display_str($ForumDescription);
|
||||||
|
|
||||||
if ($CategoryID != $LastCategoryID) {
|
if ($CategoryID != $LastCategoryID) {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
||||||
WHERE t.ID = '$TopicID'
|
WHERE t.ID = '$TopicID'
|
||||||
GROUP BY fp.TopicID");
|
GROUP BY fp.TopicID");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC);
|
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC);
|
||||||
|
@ -32,7 +32,10 @@
|
|||||||
// Searching for posts by a specific user
|
// Searching for posts by a specific user
|
||||||
if (!empty($_GET['user'])) {
|
if (!empty($_GET['user'])) {
|
||||||
$User = trim($_GET['user']);
|
$User = trim($_GET['user']);
|
||||||
$DB->query("SELECT ID FROM users_main WHERE Username='".db_string($User)."'");
|
$DB->query("
|
||||||
|
SELECT ID
|
||||||
|
FROM users_main
|
||||||
|
WHERE Username = '".db_string($User)."'");
|
||||||
list($AuthorID) = $DB->next_record();
|
list($AuthorID) = $DB->next_record();
|
||||||
if ($AuthorID === null) {
|
if ($AuthorID === null) {
|
||||||
$AuthorID = 0;
|
$AuthorID = 0;
|
||||||
@ -254,21 +257,21 @@
|
|||||||
JOIN forums AS f ON f.ID=t.ForumID
|
JOIN forums AS f ON f.ID=t.ForumID
|
||||||
WHERE ((f.MinClassRead<='$LoggedUser[Class]'";
|
WHERE ((f.MinClassRead<='$LoggedUser[Class]'";
|
||||||
if (!empty($RestrictedForums)) {
|
if (!empty($RestrictedForums)) {
|
||||||
$sql.=" AND f.ID NOT IN ('".$RestrictedForums."')";
|
$sql .= " AND f.ID NOT IN ('$RestrictedForums')";
|
||||||
}
|
}
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
if (!empty($PermittedForums)) {
|
if (!empty($PermittedForums)) {
|
||||||
$sql.=' OR f.ID IN (\''.$PermittedForums.'\')';
|
$sql .= " OR f.ID IN ('$PermittedForums')";
|
||||||
}
|
}
|
||||||
$sql .= ') AND ';
|
$sql .= ') AND ';
|
||||||
$sql .= "t.Title LIKE '%";
|
$sql .= "t.Title LIKE '%";
|
||||||
$sql .= implode("%' AND t.Title LIKE '%", $Words);
|
$sql .= implode("%' AND t.Title LIKE '%", $Words);
|
||||||
$sql .= "%' ";
|
$sql .= "%' ";
|
||||||
if (isset($SearchForums)) {
|
if (isset($SearchForums)) {
|
||||||
$sql.=" AND f.ID IN ($SearchForums)";
|
$sql .= " AND f.ID IN ($SearchForums)";
|
||||||
}
|
}
|
||||||
if (isset($AuthorID)) {
|
if (isset($AuthorID)) {
|
||||||
$sql.=" AND t.AuthorID='$AuthorID' ";
|
$sql .= " AND t.AuthorID = '$AuthorID' ";
|
||||||
}
|
}
|
||||||
$sql .= "
|
$sql .= "
|
||||||
ORDER BY t.LastPostTime DESC
|
ORDER BY t.LastPostTime DESC
|
||||||
@ -291,13 +294,13 @@
|
|||||||
<td><?=((!empty($ThreadID)) ? 'Post begins' : 'Topic')?></td>
|
<td><?=((!empty($ThreadID)) ? 'Post begins' : 'Topic')?></td>
|
||||||
<td>Time</td>
|
<td>Time</td>
|
||||||
</tr>
|
</tr>
|
||||||
<? if ($DB->record_count() == 0) { ?>
|
<? if (!$DB->has_results()) { ?>
|
||||||
<tr><td colspan="3">Nothing found<?=((isset($AuthorID) && $AuthorID == 0) ? ' (unknown username)' : '')?>!</td></tr>
|
<tr><td colspan="3">Nothing found<?=((isset($AuthorID) && $AuthorID == 0) ? ' (unknown username)' : '')?>!</td></tr>
|
||||||
<? }
|
<? }
|
||||||
|
|
||||||
$Row = 'a'; // For the pretty colours
|
$Row = 'a'; // For the pretty colours
|
||||||
while (list($ID, $Title, $ForumID, $ForumName, $LastTime, $PostID, $Body) = $DB->next_record()) {
|
while (list($ID, $Title, $ForumID, $ForumName, $LastTime, $PostID, $Body) = $DB->next_record()) {
|
||||||
$Row = (($Row == 'a') ? 'b' : 'a');
|
$Row = (($Row === 'a') ? 'b' : 'a');
|
||||||
// Print results
|
// Print results
|
||||||
?>
|
?>
|
||||||
<tr class="row<?=$Row?>">
|
<tr class="row<?=$Row?>">
|
||||||
@ -311,7 +314,7 @@
|
|||||||
<?=Format::cut_string($Title, 80); ?>
|
<?=Format::cut_string($Title, 80); ?>
|
||||||
<? }
|
<? }
|
||||||
if ($Type == 'body') { ?>
|
if ($Type == 'body') { ?>
|
||||||
<a href="#" onclick="$('#post_<?=$PostID?>_text').gtoggle(); return false;">(show)</a> <span style="float: right;" class="last_read" title="Jump to post"><a href="forums.php?action=viewthread&threadid=<?=$ID?><? if (!empty($PostID)) { echo '&postid='.$PostID.'#post'.$PostID; } ?>"></a></span>
|
<a href="#" onclick="$('#post_<?=$PostID?>_text').gtoggle(); return false;">(show)</a> <span style="float: right;" class="last_read" title="Jump to post"><a href="forums.php?action=viewthread&threadid=<?=$ID?><? if (!empty($PostID)) { echo "&postid=$PostID#post$PostID"; } ?>"></a></span>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
WHERE TopicID=$ThreadID
|
WHERE TopicID=$ThreadID
|
||||||
GROUP BY TopicID");
|
GROUP BY TopicID");
|
||||||
|
|
||||||
if ($DB->record_count()) {
|
if ($DB->has_results()) {
|
||||||
list($Pages,$Page) = $DB->next_record();
|
list($Pages,$Page) = $DB->next_record();
|
||||||
if ($Delete) {
|
if ($Delete) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
|
@ -142,33 +142,33 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE forums_topics
|
UPDATE forums_topics
|
||||||
SET
|
SET
|
||||||
NumPosts = NumPosts+1,
|
NumPosts = NumPosts + 1,
|
||||||
LastPostID = '$PostID',
|
LastPostID = '$PostID',
|
||||||
LastPostAuthorID = '".$LoggedUser['ID']."',
|
LastPostAuthorID = '".$LoggedUser['ID']."',
|
||||||
LastPostTime = '$SQLTime'
|
LastPostTime = '$SQLTime'
|
||||||
WHERE ID = '$TopicID'");
|
WHERE ID = '$TopicID'");
|
||||||
|
|
||||||
//if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block
|
// if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block
|
||||||
if ($Forum = $Cache->get_value('forums_'.$ForumID)) {
|
if ($Forum = $Cache->get_value('forums_'.$ForumID)) {
|
||||||
list($Forum,,,$Stickies) = $Forum;
|
list($Forum,,,$Stickies) = $Forum;
|
||||||
|
|
||||||
//if the topic is already on this page
|
// if the topic is already on this page
|
||||||
if (array_key_exists($TopicID, $Forum)) {
|
if (array_key_exists($TopicID, $Forum)) {
|
||||||
$Thread = $Forum[$TopicID];
|
$Thread = $Forum[$TopicID];
|
||||||
unset($Forum[$TopicID]);
|
unset($Forum[$TopicID]);
|
||||||
$Thread['NumPosts'] = $Thread['NumPosts'] + 1; //Increment post count
|
$Thread['NumPosts'] = $Thread['NumPosts'] + 1; // Increment post count
|
||||||
$Thread['LastPostID'] = $PostID; //Set postid for read/unread
|
$Thread['LastPostID'] = $PostID; // Set post ID for read/unread
|
||||||
$Thread['LastPostTime'] = $SQLTime; //Time of last post
|
$Thread['LastPostTime'] = $SQLTime; // Time of last post
|
||||||
$Thread['LastPostAuthorID'] = $LoggedUser['ID']; //Last poster id
|
$Thread['LastPostAuthorID'] = $LoggedUser['ID']; // Last poster ID
|
||||||
$Part2 = array($TopicID=>$Thread); //Bumped thread
|
$Part2 = array($TopicID => $Thread); // Bumped thread
|
||||||
|
|
||||||
//if we're bumping from an older page
|
// if we're bumping from an older page
|
||||||
} else {
|
} else {
|
||||||
//Remove the last thread from the index
|
// Remove the last thread from the index
|
||||||
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
|
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
|
||||||
array_pop($Forum);
|
array_pop($Forum);
|
||||||
}
|
}
|
||||||
//Never know if we get a page full of stickies...
|
// Never know if we get a page full of stickies...
|
||||||
if ($Stickies < TOPICS_PER_PAGE || $ThreadInfo['IsSticky'] == 1) {
|
if ($Stickies < TOPICS_PER_PAGE || $ThreadInfo['IsSticky'] == 1) {
|
||||||
//Pull the data for the thread we're bumping
|
//Pull the data for the thread we're bumping
|
||||||
$DB->query("
|
$DB->query("
|
||||||
@ -216,7 +216,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$Forum = $Part1 + $Part2 + $Part3; //Merge it
|
$Forum = $Part1 + $Part2 + $Part3; //Merge it
|
||||||
}
|
}
|
||||||
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
|
$Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
|
||||||
|
|
||||||
//Update the forum root
|
//Update the forum root
|
||||||
$Cache->begin_transaction('forums_list');
|
$Cache->begin_transaction('forums_list');
|
||||||
@ -241,7 +241,7 @@
|
|||||||
$CatalogueID = floor((POSTS_PER_PAGE * ceil($ThreadInfo['Posts'] / POSTS_PER_PAGE) - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
$CatalogueID = floor((POSTS_PER_PAGE * ceil($ThreadInfo['Posts'] / POSTS_PER_PAGE) - POSTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
|
|
||||||
//Insert the post into the thread catalogue (block of 500 posts)
|
//Insert the post into the thread catalogue (block of 500 posts)
|
||||||
$Cache->begin_transaction('thread_'.$TopicID.'_catalogue_'.$CatalogueID);
|
$Cache->begin_transaction("thread_$TopicID"."_catalogue_$CatalogueID");
|
||||||
$Cache->insert('', array(
|
$Cache->insert('', array(
|
||||||
'ID'=>$PostID,
|
'ID'=>$PostID,
|
||||||
'AuthorID'=>$LoggedUser['ID'],
|
'AuthorID'=>$LoggedUser['ID'],
|
||||||
@ -254,22 +254,25 @@
|
|||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
//Update the thread info
|
//Update the thread info
|
||||||
$Cache->begin_transaction('thread_'.$TopicID.'_info');
|
$Cache->begin_transaction("thread_$TopicID".'_info');
|
||||||
$Cache->update_row(false, array('Posts'=>'+1', 'LastPostAuthorID'=>$LoggedUser['ID']));
|
$Cache->update_row(false, array('Posts' => '+1', 'LastPostAuthorID' => $LoggedUser['ID']));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
//Increment this now to make sure we redirect to the correct page
|
//Increment this now to make sure we redirect to the correct page
|
||||||
$ThreadInfo['Posts']++;
|
$ThreadInfo['Posts']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT UserID FROM users_subscriptions WHERE TopicID = ".$TopicID);
|
$DB->query("
|
||||||
if ($DB->record_count() > 0) {
|
SELECT UserID
|
||||||
|
FROM users_subscriptions
|
||||||
|
WHERE TopicID = $TopicID");
|
||||||
|
if ($DB->has_results()) {
|
||||||
$Subscribers = $DB->collect('UserID');
|
$Subscribers = $DB->collect('UserID');
|
||||||
foreach ($Subscribers as $Subscriber) {
|
foreach ($Subscribers as $Subscriber) {
|
||||||
$Cache->delete_value('subscriptions_user_new_'.$Subscriber);
|
$Cache->delete_value("subscriptions_user_new_$Subscriber");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Forums::quote_notify($Body, $PostID, 'forums', $TopicID);
|
Forums::quote_notify($Body, $PostID, 'forums', $TopicID);
|
||||||
|
|
||||||
header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.ceil($ThreadInfo['Posts'] / $PerPage));
|
header("Location: forums.php?action=viewthread&threadid=$TopicID&page=".ceil($ThreadInfo['Posts'] / $PerPage));
|
||||||
die();
|
die();
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
if ($LoggedUser['DisablePosting']) {
|
if ($LoggedUser['DisablePosting']) {
|
||||||
error('Your posting privileges have been removed.', true);
|
error('Your posting privileges have been removed.', true);
|
||||||
}
|
}
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(404,true);
|
error(404,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
authorize();
|
authorize();
|
||||||
if (!is_number($_GET['friendid'])) {
|
if (!is_number($_GET['friendid'])) {
|
||||||
error(404);
|
error(404);
|
||||||
@ -6,14 +6,18 @@
|
|||||||
$FriendID = db_string($_GET['friendid']);
|
$FriendID = db_string($_GET['friendid']);
|
||||||
|
|
||||||
// Check if the user $FriendID exists
|
// Check if the user $FriendID exists
|
||||||
$DB->query("SELECT 1 FROM users_main WHERE ID = '$FriendID'");
|
$DB->query("
|
||||||
if ($DB->record_count() == 0) {
|
SELECT 1
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = '$FriendID'");
|
||||||
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT IGNORE INTO friends
|
INSERT IGNORE INTO friends
|
||||||
(UserID, FriendID)
|
(UserID, FriendID)
|
||||||
VALUES ('$LoggedUser[ID]', '$FriendID')");
|
VALUES
|
||||||
|
('$LoggedUser[ID]', '$FriendID')");
|
||||||
|
|
||||||
header('Location: friends.php');
|
header('Location: friends.php');
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
m.LastAccess,
|
m.LastAccess,
|
||||||
i.Avatar
|
i.Avatar
|
||||||
FROM friends AS f
|
FROM friends AS f
|
||||||
JOIN users_main AS m ON f.FriendID=m.ID
|
JOIN users_main AS m ON f.FriendID = m.ID
|
||||||
JOIN users_info AS i ON f.FriendID=i.UserID
|
JOIN users_info AS i ON f.FriendID = i.UserID
|
||||||
WHERE f.UserID='$UserID'
|
WHERE f.UserID = '$UserID'
|
||||||
ORDER BY Username
|
ORDER BY Username
|
||||||
LIMIT $Limit");
|
LIMIT $Limit");
|
||||||
$Friends = $DB->to_array(false, MYSQLI_BOTH, array(6, 'Paranoia'));
|
$Friends = $DB->to_array(false, MYSQLI_BOTH, array(6, 'Paranoia'));
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
FROM pm_conversations_users
|
FROM pm_conversations_users
|
||||||
WHERE UserID='$UserID'
|
WHERE UserID='$UserID'
|
||||||
AND ConvID='$ConvID'");
|
AND ConvID='$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
list($InInbox, $InSentbox) = $DB->next_record();
|
list($InInbox, $InSentbox) = $DB->next_record();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
AND InInbox='1'
|
AND InInbox='1'
|
||||||
AND (ForwardedTo=0 OR ForwardedTo=UserID)
|
AND (ForwardedTo=0 OR ForwardedTo=UserID)
|
||||||
AND ConvID='$ConvID'");
|
AND ConvID='$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@
|
|||||||
AND (ForwardedTo = 0 OR ForwardedTo = UserID)
|
AND (ForwardedTo = 0 OR ForwardedTo = UserID)
|
||||||
AND InInbox='1'
|
AND InInbox='1'
|
||||||
AND ConvID='$ConvID'");
|
AND ConvID='$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT IGNORE INTO pm_conversations_users
|
INSERT IGNORE INTO pm_conversations_users
|
||||||
(UserID, ConvID, InInbox, InSentbox, ReceivedDate)
|
(UserID, ConvID, InInbox, InSentbox, ReceivedDate)
|
||||||
|
@ -44,12 +44,12 @@
|
|||||||
$sql .= (($Section == 'sentbox') ? ' cu.SentDate ' : ' cu.ReceivedDate ');
|
$sql .= (($Section == 'sentbox') ? ' cu.SentDate ' : ' cu.ReceivedDate ');
|
||||||
$sql .= "AS Date
|
$sql .= "AS Date
|
||||||
FROM pm_conversations AS c
|
FROM pm_conversations AS c
|
||||||
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID=c.ID AND cu.UserID='$UserID'
|
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID = c.ID AND cu.UserID = '$UserID'
|
||||||
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID=c.ID AND cu2.UserID!='$UserID' AND cu2.ForwardedTo=0
|
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID = c.ID AND cu2.UserID != '$UserID' AND cu2.ForwardedTo = 0
|
||||||
LEFT JOIN users_main AS um ON um.ID=cu2.UserID";
|
LEFT JOIN users_main AS um ON um.ID = cu2.UserID";
|
||||||
|
|
||||||
if (!empty($_GET['search']) && $_GET['searchtype'] == 'message') {
|
if (!empty($_GET['search']) && $_GET['searchtype'] == 'message') {
|
||||||
$sql .= ' JOIN pm_messages AS m ON c.ID=m.ConvID';
|
$sql .= ' JOIN pm_messages AS m ON c.ID = m.ConvID';
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE ';
|
$sql .= ' WHERE ';
|
||||||
if (!empty($_GET['search'])) {
|
if (!empty($_GET['search'])) {
|
||||||
@ -65,9 +65,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= (($Section == 'sentbox') ? ' cu.InSentbox' : ' cu.InInbox');
|
$sql .= (($Section == 'sentbox') ? ' cu.InSentbox' : ' cu.InInbox');
|
||||||
$sql .= "='1'";
|
$sql .= " = '1'";
|
||||||
|
|
||||||
$sql .="
|
$sql .= "
|
||||||
GROUP BY c.ID
|
GROUP BY c.ID
|
||||||
ORDER BY cu.Sticky, $Sort
|
ORDER BY cu.Sticky, $Sort
|
||||||
LIMIT $Limit";
|
LIMIT $Limit";
|
||||||
@ -105,8 +105,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<input type="text" name="search" value="<?=(!empty($_GET['search']) ? display_str($_GET['search']) : 'Search '.($Section == 'sentbox' ? 'Sentbox' : 'Inbox'))?>" style="width: 98%;"
|
<input type="text" name="search" value="<?=(!empty($_GET['search']) ? display_str($_GET['search']) : 'Search '.($Section == 'sentbox' ? 'Sentbox' : 'Inbox'))?>" style="width: 98%;"
|
||||||
onfocus="if (this.value == 'Search <?=(($Section == 'sentbox') ? 'Sentbox' : 'Inbox')?>') this.value='';"
|
onfocus="if (this.value == 'Search <?=(($Section == 'sentbox') ? 'Sentbox' : 'Inbox')?>') { this.value = ''; }"
|
||||||
onblur="if (this.value == '') this.value='Search <?=(($Section == 'sentbox') ? 'Sentbox' : 'Inbox')?>';"
|
onblur="if (this.value == '') { this.value = 'Search <?=(($Section == 'sentbox') ? 'Sentbox' : 'Inbox')?>'; }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -119,7 +119,7 @@
|
|||||||
|
|
||||||
<table class="message_table checkboxes">
|
<table class="message_table checkboxes">
|
||||||
<tr class="colhead">
|
<tr class="colhead">
|
||||||
<td width="10"><input type="checkbox" onclick="toggleChecks('messageform',this)" /></td>
|
<td width="10"><input type="checkbox" onclick="toggleChecks('messageform', this);" /></td>
|
||||||
<td width="50%">Subject</td>
|
<td width="50%">Subject</td>
|
||||||
<td><?=(($Section == 'sentbox') ? 'Receiver' : 'Sender')?></td>
|
<td><?=(($Section == 'sentbox') ? 'Receiver' : 'Sender')?></td>
|
||||||
<td>Date</td>
|
<td>Date</td>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
FROM pm_conversations_users
|
FROM pm_conversations_users
|
||||||
WHERE UserID = '$LoggedUser[ID]'
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
AND ConvID = '$ConvID'");
|
AND ConvID = '$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
SELECT UserID
|
SELECT UserID
|
||||||
FROM pm_conversations_users
|
FROM pm_conversations_users
|
||||||
WHERE UserID='$UserID' AND ConvID='$ConvID'");
|
WHERE UserID='$UserID' AND ConvID='$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
include(SERVER_ROOT.'/classes/text.class.php');
|
include(SERVER_ROOT.'/classes/text.class.php');
|
||||||
$Text = new TEXT(true);
|
$Text = new TEXT(true);
|
||||||
|
|
||||||
@ -12,14 +12,14 @@
|
|||||||
Time
|
Time
|
||||||
FROM news
|
FROM news
|
||||||
ORDER BY Time DESC
|
ORDER BY Time DESC
|
||||||
LIMIT " . $NewsCount);
|
LIMIT $NewsCount");
|
||||||
$News = $DB->to_array(false, MYSQLI_NUM, false);
|
$News = $DB->to_array(false, MYSQLI_NUM, false);
|
||||||
$Cache->cache_value('news', $News, 3600 * 24 * 30);
|
$Cache->cache_value('news', $News, 3600 * 24 * 30);
|
||||||
$Cache->cache_value('news_latest_id', $News[0][0], 0);
|
$Cache->cache_value('news_latest_id', $News[0][0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($LoggedUser['LastReadNews'] != $News[0][0]) {
|
if ($LoggedUser['LastReadNews'] != $News[0][0]) {
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$UserID);
|
$Cache->begin_transaction("user_info_heavy_$UserID");
|
||||||
$Cache->update_row(false, array('LastReadNews' => $News[0][0]));
|
$Cache->update_row(false, array('LastReadNews' => $News[0][0]));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
$DB->query("
|
$DB->query("
|
||||||
@ -29,7 +29,7 @@
|
|||||||
$LoggedUser['LastReadNews'] = $News[0][0];
|
$LoggedUser['LastReadNews'] = $News[0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
View::show_header('News','bbcode,news_ajax');
|
View::show_header('News', 'bbcode,news_ajax');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
if (check_perms('users_mod')) {
|
if (check_perms('users_mod')) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="head colhead_dark">
|
<div class="head colhead_dark">
|
||||||
<strong><a href="staffblog.php">Latest staff blog posts</a></strong>
|
<strong><a href="staffblog.php">Latest staff blog posts</a></strong>
|
||||||
@ -54,7 +53,7 @@
|
|||||||
b.Body,
|
b.Body,
|
||||||
b.Time
|
b.Time
|
||||||
FROM staff_blog AS b
|
FROM staff_blog AS b
|
||||||
LEFT JOIN users_main AS um ON b.UserID=um.ID
|
LEFT JOIN users_main AS um ON b.UserID = um.ID
|
||||||
ORDER BY Time DESC");
|
ORDER BY Time DESC");
|
||||||
$Blog = $DB->to_array(false, MYSQLI_NUM);
|
$Blog = $DB->to_array(false, MYSQLI_NUM);
|
||||||
$Cache->cache_value('staff_blog', $Blog, 1209600);
|
$Cache->cache_value('staff_blog', $Blog, 1209600);
|
||||||
@ -141,7 +140,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
|
if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
|
||||||
$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();
|
list($UserCount) = $DB->next_record();
|
||||||
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
$Cache->cache_value('stats_user_count', $UserCount, 0); //inf cache
|
||||||
}
|
}
|
||||||
@ -151,37 +153,56 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
if (($UserStats = $Cache->get_value('stats_users')) === false) {
|
if (($UserStats = $Cache->get_value('stats_users')) === false) {
|
||||||
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600 * 24)."'");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM users_main
|
||||||
|
WHERE Enabled = '1'
|
||||||
|
AND LastAccess > '".time_minus(3600 * 24)."'");
|
||||||
list($UserStats['Day']) = $DB->next_record();
|
list($UserStats['Day']) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600 * 24 * 7)."'");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM users_main
|
||||||
|
WHERE Enabled = '1'
|
||||||
|
AND LastAccess > '".time_minus(3600 * 24 * 7)."'");
|
||||||
list($UserStats['Week']) = $DB->next_record();
|
list($UserStats['Week']) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("SELECT COUNT(ID) FROM users_main WHERE Enabled='1' AND LastAccess>'".time_minus(3600 * 24 * 30)."'");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM users_main
|
||||||
|
WHERE Enabled = '1'
|
||||||
|
AND LastAccess > '".time_minus(3600 * 24 * 30)."'");
|
||||||
list($UserStats['Month']) = $DB->next_record();
|
list($UserStats['Month']) = $DB->next_record();
|
||||||
|
|
||||||
$Cache->cache_value('stats_users',$UserStats,0);
|
$Cache->cache_value('stats_users', $UserStats, 0);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100,2)?>%)</li>
|
<li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)</li>
|
||||||
<li>Users active this week: <?=number_format($UserStats['Week'])?> (<?=number_format($UserStats['Week'] / $UserCount * 100,2)?>%)</li>
|
<li>Users active this week: <?=number_format($UserStats['Week'])?> (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)</li>
|
||||||
<li>Users active this month: <?=number_format($UserStats['Month'])?> (<?=number_format($UserStats['Month'] / $UserCount * 100,2)?>%)</li>
|
<li>Users active this month: <?=number_format($UserStats['Month'])?> (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)</li>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
|
if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
|
||||||
$DB->query("SELECT COUNT(ID) FROM torrents");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM torrents");
|
||||||
list($TorrentCount) = $DB->next_record();
|
list($TorrentCount) = $DB->next_record();
|
||||||
$Cache->cache_value('stats_torrent_count', $TorrentCount, 0); //inf cache
|
$Cache->cache_value('stats_torrent_count', $TorrentCount, 0); //inf cache
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($AlbumCount = $Cache->get_value('stats_album_count')) === false) {
|
if (($AlbumCount = $Cache->get_value('stats_album_count')) === false) {
|
||||||
$DB->query("SELECT COUNT(ID) FROM torrents_group WHERE CategoryID='1'");
|
$DB->query("
|
||||||
|
SELECT COUNT(ID)
|
||||||
|
FROM torrents_group
|
||||||
|
WHERE CategoryID = '1'");
|
||||||
list($AlbumCount) = $DB->next_record();
|
list($AlbumCount) = $DB->next_record();
|
||||||
$Cache->cache_value('stats_album_count', $AlbumCount, 0); //inf cache
|
$Cache->cache_value('stats_album_count', $AlbumCount, 0); //inf cache
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
|
if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
|
||||||
$DB->query("SELECT COUNT(ArtistID) FROM artists_group");
|
$DB->query("
|
||||||
|
SELECT COUNT(ArtistID)
|
||||||
|
FROM artists_group");
|
||||||
list($ArtistCount) = $DB->next_record();
|
list($ArtistCount) = $DB->next_record();
|
||||||
$Cache->cache_value('stats_artist_count', $ArtistCount, 0); //inf cache
|
$Cache->cache_value('stats_artist_count', $ArtistCount, 0); //inf cache
|
||||||
}
|
}
|
||||||
@ -219,7 +240,7 @@
|
|||||||
list($FilledCount) = $DB->next_record();
|
list($FilledCount) = $DB->next_record();
|
||||||
$Cache->cache_value('stats_requests', array($RequestCount, $FilledCount), 11280);
|
$Cache->cache_value('stats_requests', array($RequestCount, $FilledCount), 11280);
|
||||||
} else {
|
} else {
|
||||||
list($RequestCount,$FilledCount) = $RequestStats;
|
list($RequestCount, $FilledCount) = $RequestStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -240,17 +261,17 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid)
|
SELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid)
|
||||||
FROM xbt_files_users
|
FROM xbt_files_users
|
||||||
WHERE active=1
|
WHERE active = 1
|
||||||
GROUP BY Type");
|
GROUP BY Type");
|
||||||
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
|
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
|
||||||
$SeederCount = $PeerCount['Seeding'][1] ?: 0;
|
$SeederCount = $PeerCount['Seeding'][1] ?: 0;
|
||||||
$LeecherCount = $PeerCount['Leeching'][1] ?: 0;
|
$LeecherCount = $PeerCount['Leeching'][1] ?: 0;
|
||||||
$Cache->cache_value('stats_peers', array($LeecherCount,$SeederCount), 0);
|
$Cache->cache_value('stats_peers', array($LeecherCount, $SeederCount), 0);
|
||||||
$Cache->delete_value('stats_peers_lock');
|
$Cache->delete_value('stats_peers_lock');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$PeerStatsLocked = false;
|
$PeerStatsLocked = false;
|
||||||
list($LeecherCount,$SeederCount) = $PeerStats;
|
list($LeecherCount, $SeederCount) = $PeerStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$PeerStatsLocked) {
|
if (!$PeerStatsLocked) {
|
||||||
@ -305,7 +326,7 @@
|
|||||||
$Votes[$i] = 0;
|
$Votes[$i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$Cache->cache_value('polls_'.$TopicID, array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
$Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
||||||
} else {
|
} else {
|
||||||
list($Question, $Answers, $Votes, $Featured, $Closed) = $Poll;
|
list($Question, $Answers, $Votes, $Featured, $Closed) = $Poll;
|
||||||
}
|
}
|
||||||
@ -321,8 +342,8 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT Vote
|
SELECT Vote
|
||||||
FROM forums_polls_votes
|
FROM forums_polls_votes
|
||||||
WHERE UserID='".$LoggedUser['ID']."'
|
WHERE UserID = '".$LoggedUser['ID']."'
|
||||||
AND TopicID='$TopicID'");
|
AND TopicID = '$TopicID'");
|
||||||
list($UserResponse) = $DB->next_record();
|
list($UserResponse) = $DB->next_record();
|
||||||
if (!empty($UserResponse) && $UserResponse != 0) {
|
if (!empty($UserResponse) && $UserResponse != 0) {
|
||||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||||
@ -364,7 +385,7 @@
|
|||||||
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
|
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br /><br />
|
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br /><br />
|
||||||
<input type="button" onclick="ajax.post('index.php','poll',function(response) {$('#poll_container').raw().innerHTML = response});" value="Vote" />
|
<input type="button" onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );" value="Vote" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
@ -391,8 +412,8 @@
|
|||||||
tg.Name,
|
tg.Name,
|
||||||
tg.TagList
|
tg.TagList
|
||||||
FROM torrents_recommended AS tr
|
FROM torrents_recommended AS tr
|
||||||
JOIN torrents_group AS tg ON tg.ID=tr.GroupID
|
JOIN torrents_group AS tg ON tg.ID = tr.GroupID
|
||||||
LEFT JOIN users_main AS u ON u.ID=tr.UserID
|
LEFT JOIN users_main AS u ON u.ID = tr.UserID
|
||||||
ORDER BY tr.Time DESC
|
ORDER BY tr.Time DESC
|
||||||
LIMIT 10");
|
LIMIT 10");
|
||||||
$Recommend = $DB->to_array();
|
$Recommend = $DB->to_array();
|
||||||
@ -444,7 +465,7 @@
|
|||||||
}
|
}
|
||||||
$Count = 0;
|
$Count = 0;
|
||||||
foreach ($News as $NewsItem) {
|
foreach ($News as $NewsItem) {
|
||||||
list($NewsID,$Title,$Body,$NewsTime) = $NewsItem;
|
list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
|
||||||
if (strtotime($NewsTime) > time()) {
|
if (strtotime($NewsTime) > time()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -487,16 +508,18 @@ function contest() {
|
|||||||
SUM(Points),
|
SUM(Points),
|
||||||
Username
|
Username
|
||||||
FROM users_points AS up
|
FROM users_points AS up
|
||||||
JOIN users_main AS um ON um.ID=up.UserID
|
JOIN users_main AS um ON um.ID = up.UserID
|
||||||
GROUP BY UserID
|
GROUP BY UserID
|
||||||
ORDER BY SUM(Points) DESC
|
ORDER BY SUM(Points) DESC
|
||||||
LIMIT 20");
|
LIMIT 20");
|
||||||
$Contest = $DB->to_array();
|
$Contest = $DB->to_array();
|
||||||
|
|
||||||
$DB->query("SELECT SUM(Points) FROM users_points");
|
$DB->query("
|
||||||
|
SELECT SUM(Points)
|
||||||
|
FROM users_points");
|
||||||
list($TotalPoints) = $DB->next_record();
|
list($TotalPoints) = $DB->next_record();
|
||||||
|
|
||||||
$Cache->cache_value('contest', array($Contest,$TotalPoints), 600);
|
$Cache->cache_value('contest', array($Contest, $TotalPoints), 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -510,9 +533,7 @@ function contest() {
|
|||||||
list($UserID, $Points, $Username) = $User;
|
list($UserID, $Points, $Username) = $User;
|
||||||
?>
|
?>
|
||||||
<li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Points)?>)</li>
|
<li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Points)?>)</li>
|
||||||
<?
|
<? } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ol>
|
</ol>
|
||||||
Total uploads: <?=$TotalPoints?><br />
|
Total uploads: <?=$TotalPoints?><br />
|
||||||
<a href="index.php?action=scoreboard">Full scoreboard</a>
|
<a href="index.php?action=scoreboard">Full scoreboard</a>
|
||||||
@ -520,5 +541,4 @@ function contest() {
|
|||||||
</div>
|
</div>
|
||||||
<!-- END contest Section -->
|
<!-- END contest Section -->
|
||||||
<? } // contest()
|
<? } // contest()
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<? if ($QueryStatus) { ?>
|
<? if ($QueryStatus) { ?>
|
||||||
<tr class="nobr"><td colspan="2">Search request failed (<?=$QueryError?>).</td></tr>
|
<tr class="nobr"><td colspan="2">Search request failed (<?=$QueryError?>).</td></tr>
|
||||||
<? } elseif ($DB->record_count() == 0) { ?>
|
<? } elseif (!$DB->has_results()) { ?>
|
||||||
<tr class="nobr"><td colspan="2">Nothing found!</td></tr>
|
<tr class="nobr"><td colspan="2">Nothing found!</td></tr>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
if (!empty($_GET['page']) && is_number($_GET['page'])) {
|
if (!empty($_GET['page']) && is_number($_GET['page'])) {
|
||||||
$Page = min(SPHINX_MAX_MATCHES / LOG_ENTRIES_PER_PAGE, $_GET['page']);
|
$Page = min(SPHINX_MAX_MATCHES / LOG_ENTRIES_PER_PAGE, $_GET['page']);
|
||||||
$Offset = ($Page - 1) * LOG_ENTRIES_PER_PAGE;
|
$Offset = ($Page - 1) * LOG_ENTRIES_PER_PAGE;
|
||||||
@ -7,7 +7,11 @@
|
|||||||
$Offset = 0;
|
$Offset = 0;
|
||||||
}
|
}
|
||||||
if (empty($_GET['search']) || trim($_GET['search']) == '') {
|
if (empty($_GET['search']) || trim($_GET['search']) == '') {
|
||||||
$Log = $DB->query("SELECT ID, Message, Time FROM log ORDER BY ID DESC LIMIT $Offset, ".LOG_ENTRIES_PER_PAGE);
|
$Log = $DB->query("
|
||||||
|
SELECT ID, Message, Time
|
||||||
|
FROM log
|
||||||
|
ORDER BY ID DESC
|
||||||
|
LIMIT $Offset, ".LOG_ENTRIES_PER_PAGE);
|
||||||
$NumResults = $DB->record_count();
|
$NumResults = $DB->record_count();
|
||||||
if (!$NumResults) {
|
if (!$NumResults) {
|
||||||
$TotalMatches = 0;
|
$TotalMatches = 0;
|
||||||
@ -40,8 +44,13 @@
|
|||||||
$TotalMatches = min(SPHINX_MAX_MATCHES, $Result->get_meta('total_found'));
|
$TotalMatches = min(SPHINX_MAX_MATCHES, $Result->get_meta('total_found'));
|
||||||
if ($NumResults > 0) {
|
if ($NumResults > 0) {
|
||||||
$LogIDs = $Result->collect('id');
|
$LogIDs = $Result->collect('id');
|
||||||
$Log = $DB->query("SELECT ID, Message, Time FROM log WHERE ID IN (".implode(',', $LogIDs).") ORDER BY ID DESC");
|
$Log = $DB->query('
|
||||||
|
SELECT ID, Message, Time
|
||||||
|
FROM log
|
||||||
|
WHERE ID IN ('.implode(',', $LogIDs).')
|
||||||
|
ORDER BY ID DESC');
|
||||||
} else {
|
} else {
|
||||||
$Log = $DB->query("SET @nothing = 0");
|
$Log = $DB->query('
|
||||||
|
SET @nothing = 0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
/*-- TODO ---------------------------//
|
/*-- TODO ---------------------------//
|
||||||
Add the JavaScript validation into the display page using the class
|
Add the JavaScript validation into the display page using the class
|
||||||
@ -37,10 +37,10 @@
|
|||||||
m.ipcc,
|
m.ipcc,
|
||||||
i.ResetExpires
|
i.ResetExpires
|
||||||
FROM users_main AS m
|
FROM users_main AS m
|
||||||
INNER JOIN users_info AS i ON i.UserID=m.ID
|
INNER JOIN users_info AS i ON i.UserID = m.ID
|
||||||
WHERE i.ResetKey='".db_string($_REQUEST['key'])."'
|
WHERE i.ResetKey = '".db_string($_REQUEST['key'])."'
|
||||||
AND i.ResetKey != ''
|
AND i.ResetKey != ''
|
||||||
AND m.Enabled='1'");
|
AND m.Enabled = '1'");
|
||||||
list($UserID, $Email, $Country, $Expires) = $DB->next_record();
|
list($UserID, $Email, $Country, $Expires) = $DB->next_record();
|
||||||
|
|
||||||
if ($UserID && strtotime($Expires) > time()) {
|
if ($UserID && strtotime($Expires) > time()) {
|
||||||
@ -59,11 +59,11 @@
|
|||||||
users_main AS m,
|
users_main AS m,
|
||||||
users_info AS i
|
users_info AS i
|
||||||
SET
|
SET
|
||||||
m.PassHash='".db_string(Users::make_crypt_hash($_REQUEST['password']))."',
|
m.PassHash = '".db_string(Users::make_crypt_hash($_REQUEST['password']))."',
|
||||||
i.ResetKey='',
|
i.ResetKey = '',
|
||||||
i.ResetExpires='0000-00-00 00:00:00'
|
i.ResetExpires = '0000-00-00 00:00:00'
|
||||||
WHERE m.ID='".db_string($UserID)."'
|
WHERE m.ID = '".db_string($UserID)."'
|
||||||
AND i.UserID=m.ID");
|
AND i.UserID = m.ID");
|
||||||
$Reset = true; // Past tense form of "to reset", meaning that password has now been reset
|
$Reset = true; // Past tense form of "to reset", meaning that password has now been reset
|
||||||
|
|
||||||
|
|
||||||
@ -81,9 +81,9 @@
|
|||||||
// If his key has expired, clear all the reset information
|
// If his key has expired, clear all the reset information
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_info
|
UPDATE users_info
|
||||||
SET ResetKey='',
|
SET ResetKey = '',
|
||||||
ResetExpires='0000-00-00 00:00:00'
|
ResetExpires = '0000-00-00 00:00:00'
|
||||||
WHERE UserID='$UserID'");
|
WHERE UserID = '$UserID'");
|
||||||
$_SESSION['reseterr'] = 'The link you were given has expired.'; // Error message to display on form
|
$_SESSION['reseterr'] = 'The link you were given has expired.'; // Error message to display on form
|
||||||
}
|
}
|
||||||
// Show him the first form (enter email address)
|
// Show him the first form (enter email address)
|
||||||
@ -137,17 +137,17 @@
|
|||||||
$Sent = 1; // If $Sent is 1, recover_step1.php displays a success message
|
$Sent = 1; // If $Sent is 1, recover_step1.php displays a success message
|
||||||
|
|
||||||
//Log out all of the users current sessions
|
//Log out all of the users current sessions
|
||||||
$Cache->delete_value('user_info_'.$UserID);
|
$Cache->delete_value("user_info_$UserID");
|
||||||
$Cache->delete_value('user_info_heavy_'.$UserID);
|
$Cache->delete_value("user_info_heavy_$UserID");
|
||||||
$Cache->delete_value('user_stats_'.$UserID);
|
$Cache->delete_value("user_stats_$UserID");
|
||||||
$Cache->delete_value('enabled_'.$UserID);
|
$Cache->delete_value("enabled_$UserID");
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT SessionID
|
SELECT SessionID
|
||||||
FROM users_sessions
|
FROM users_sessions
|
||||||
WHERE UserID='$UserID'");
|
WHERE UserID = '$UserID'");
|
||||||
while (list($SessionID) = $DB->next_record()) {
|
while (list($SessionID) = $DB->next_record()) {
|
||||||
$Cache->delete_value('session_'.$UserID.'_'.$SessionID);
|
$Cache->delete_value("session_$UserID"."_$SessionID");
|
||||||
}
|
}
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_sessions
|
UPDATE users_sessions
|
||||||
@ -199,29 +199,35 @@ function log_attempt($UserID) {
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE login_attempts
|
UPDATE login_attempts
|
||||||
SET
|
SET
|
||||||
LastAttempt='".sqltime()."',
|
LastAttempt = '".sqltime()."',
|
||||||
Attempts='".db_string($Attempts)."',
|
Attempts = '".db_string($Attempts)."',
|
||||||
BannedUntil='".db_string($BannedUntil)."',
|
BannedUntil = '".db_string($BannedUntil)."',
|
||||||
Bans=Bans+1
|
Bans = Bans + 1
|
||||||
WHERE ID='".db_string($AttemptID)."'");
|
WHERE ID = '".db_string($AttemptID)."'");
|
||||||
|
|
||||||
if ($Bans > 9) { // Automated bruteforce prevention
|
if ($Bans > 9) { // Automated bruteforce prevention
|
||||||
$DB->query("SELECT Reason FROM ip_bans WHERE ".$IP." BETWEEN FromIP AND ToIP");
|
$DB->query("
|
||||||
if ($DB->record_count() > 0) {
|
SELECT Reason
|
||||||
|
FROM ip_bans
|
||||||
|
WHERE $IP BETWEEN FromIP AND ToIP");
|
||||||
|
if ($DB->has_results()) {
|
||||||
//Ban exists already, only add new entry if not for same reason
|
//Ban exists already, only add new entry if not for same reason
|
||||||
list($Reason) = $DB->next_record(MYSQLI_BOTH, false);
|
list($Reason) = $DB->next_record(MYSQLI_BOTH, false);
|
||||||
if ($Reason != 'Automated ban per >60 failed login attempts') {
|
if ($Reason != 'Automated ban per >60 failed login attempts') {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE ip_bans
|
UPDATE ip_bans
|
||||||
SET Reason = CONCAT('Automated ban per >60 failed login attempts AND ', Reason)
|
SET Reason = CONCAT('Automated ban per >60 failed login attempts AND ', Reason)
|
||||||
WHERE FromIP = $IP AND ToIP = $IP");
|
WHERE FromIP = $IP
|
||||||
|
AND ToIP = $IP");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//No ban
|
//No ban
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT IGNORE INTO ip_bans (FromIP, ToIP, Reason)
|
INSERT IGNORE INTO ip_bans
|
||||||
VALUES ('$IP','$IP', 'Automated ban per >60 failed login attempts')");
|
(FromIP, ToIP, Reason)
|
||||||
$Cache->delete_value('ip_bans_'.$IPA);
|
VALUES
|
||||||
|
('$IP','$IP', 'Automated ban per >60 failed login attempts')");
|
||||||
|
$Cache->delete_value("ip_bans_$IPA");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -229,16 +235,18 @@ function log_attempt($UserID) {
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE login_attempts
|
UPDATE login_attempts
|
||||||
SET
|
SET
|
||||||
LastAttempt='".sqltime()."',
|
LastAttempt = '".sqltime()."',
|
||||||
Attempts='".db_string($Attempts)."',
|
Attempts = '".db_string($Attempts)."',
|
||||||
BannedUntil='0000-00-00 00:00:00'
|
BannedUntil = '0000-00-00 00:00:00'
|
||||||
WHERE ID='".db_string($AttemptID)."'");
|
WHERE ID = '".db_string($AttemptID)."'");
|
||||||
}
|
}
|
||||||
} else { // User has not attempted to log in recently
|
} else { // User has not attempted to log in recently
|
||||||
$Attempts = 1;
|
$Attempts = 1;
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO login_attempts (UserID,IP,LastAttempt,Attempts)
|
INSERT INTO login_attempts
|
||||||
VALUES ('".db_string($UserID)."','".db_string($IPStr)."','".sqltime()."',1)");
|
(UserID, IP, LastAttempt, Attempts)
|
||||||
|
VALUES
|
||||||
|
('".db_string($UserID)."', '".db_string($IPStr)."', '".sqltime()."', 1)");
|
||||||
}
|
}
|
||||||
} // end log_attempt function
|
} // end log_attempt function
|
||||||
|
|
||||||
@ -261,7 +269,7 @@ function log_attempt($UserID) {
|
|||||||
Secret,
|
Secret,
|
||||||
Enabled
|
Enabled
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE Username='".db_string($_POST['username'])."'
|
WHERE Username = '".db_string($_POST['username'])."'
|
||||||
AND Username != ''");
|
AND Username != ''");
|
||||||
list($UserID, $PermissionID, $CustomPermissions, $PassHash, $Secret, $Enabled) = $DB->next_record(MYSQLI_NUM, array(2));
|
list($UserID, $PermissionID, $CustomPermissions, $PassHash, $Secret, $Enabled) = $DB->next_record(MYSQLI_NUM, array(2));
|
||||||
if (strtotime($BannedUntil) < time()) {
|
if (strtotime($BannedUntil) < time()) {
|
||||||
@ -300,33 +308,33 @@ function log_attempt($UserID) {
|
|||||||
INSERT INTO users_sessions
|
INSERT INTO users_sessions
|
||||||
(UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA)
|
(UserID, SessionID, KeepLogged, Browser, OperatingSystem, IP, LastUpdate, FullUA)
|
||||||
VALUES
|
VALUES
|
||||||
('$UserID', '".db_string($SessionID)."', '$KeepLogged', '$Browser','$OperatingSystem', '".db_string($_SERVER['REMOTE_ADDR'])."', '".sqltime()."', '".db_string($_SERVER['HTTP_USER_AGENT'])."')");
|
('$UserID', '".db_string($SessionID)."', '$KeepLogged', '$Browser', '$OperatingSystem', '".db_string($_SERVER['REMOTE_ADDR'])."', '".sqltime()."', '".db_string($_SERVER['HTTP_USER_AGENT'])."')");
|
||||||
|
|
||||||
$Cache->begin_transaction('users_sessions_'.$UserID);
|
$Cache->begin_transaction("users_sessions_$UserID");
|
||||||
$Cache->insert_front($SessionID,array(
|
$Cache->insert_front($SessionID, array(
|
||||||
'SessionID'=>$SessionID,
|
'SessionID' => $SessionID,
|
||||||
'Browser'=>$Browser,
|
'Browser' => $Browser,
|
||||||
'OperatingSystem'=>$OperatingSystem,
|
'OperatingSystem' => $OperatingSystem,
|
||||||
'IP'=>$_SERVER['REMOTE_ADDR'],
|
'IP' => $_SERVER['REMOTE_ADDR'],
|
||||||
'LastUpdate'=>sqltime()
|
'LastUpdate' => sqltime()
|
||||||
));
|
));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
$Sql = "
|
$Sql = "
|
||||||
UPDATE users_main
|
UPDATE users_main
|
||||||
SET
|
SET
|
||||||
LastLogin='".sqltime()."',
|
LastLogin = '".sqltime()."',
|
||||||
LastAccess='".sqltime()."'";
|
LastAccess = '".sqltime()."'";
|
||||||
|
|
||||||
$Sql .= "
|
$Sql .= "
|
||||||
WHERE ID='".db_string($UserID)."'";
|
WHERE ID = '".db_string($UserID)."'";
|
||||||
|
|
||||||
$DB->query($Sql);
|
$DB->query($Sql);
|
||||||
|
|
||||||
if (!empty($_COOKIE['redirect'])) {
|
if (!empty($_COOKIE['redirect'])) {
|
||||||
$URL = $_COOKIE['redirect'];
|
$URL = $_COOKIE['redirect'];
|
||||||
setcookie('redirect', '', time() - 60 * 60 * 24, '/', '', false);
|
setcookie('redirect', '', time() - 60 * 60 * 24, '/', '', false);
|
||||||
header('Location: '.$URL);
|
header("Location: $URL");
|
||||||
die();
|
die();
|
||||||
} else {
|
} else {
|
||||||
header('Location: index.php');
|
header('Location: index.php');
|
||||||
|
@ -17,17 +17,34 @@
|
|||||||
|
|
||||||
$Cache->InternalCache = false; // We don't want PHP to cache all results internally
|
$Cache->InternalCache = false; // We don't want PHP to cache all results internally
|
||||||
$DB->query("TRUNCATE TABLE torrents_peerlists_compare");
|
$DB->query("TRUNCATE TABLE torrents_peerlists_compare");
|
||||||
$DB->query("INSERT INTO torrents_peerlists_compare
|
$DB->query("
|
||||||
SELECT ID, GroupID, Seeders, Leechers, Snatched FROM torrents
|
INSERT INTO torrents_peerlists_compare
|
||||||
ON DUPLICATE KEY UPDATE Seeders=VALUES(Seeders), Leechers=VALUES(Leechers), Snatches=VALUES(Snatches)");
|
SELECT ID, GroupID, Seeders, Leechers, Snatched
|
||||||
$DB->query("CREATE TEMPORARY TABLE tpc_temp
|
FROM torrents
|
||||||
(TorrentID int, GroupID int, Seeders int, Leechers int, Snatched int,
|
ON DUPLICATE KEY UPDATE
|
||||||
PRIMARY KEY (GroupID,TorrentID))");
|
Seeders = VALUES(Seeders),
|
||||||
$DB->query("INSERT INTO tpc_temp SELECT t2.* FROM torrents_peerlists t1 JOIN torrents_peerlists_compare t2 USING(TorrentID)
|
Leechers = VALUES(Leechers),
|
||||||
WHERE t1.Seeders != t2.Seeders OR t1.Leechers != t2.Leechers OR t1.Snatches != t2.Snatches");
|
Snatches = VALUES(Snatches)");
|
||||||
|
$DB->query("
|
||||||
|
CREATE TEMPORARY TABLE tpc_temp
|
||||||
|
(TorrentID int, GroupID int, Seeders int, Leechers int, Snatched int,
|
||||||
|
PRIMARY KEY (GroupID, TorrentID))");
|
||||||
|
$DB->query("
|
||||||
|
INSERT INTO tpc_temp
|
||||||
|
SELECT t2.*
|
||||||
|
FROM torrents_peerlists t1
|
||||||
|
JOIN torrents_peerlists_compare t2
|
||||||
|
USING(TorrentID)
|
||||||
|
WHERE t1.Seeders != t2.Seeders
|
||||||
|
OR t1.Leechers != t2.Leechers
|
||||||
|
OR t1.Snatches != t2.Snatches");
|
||||||
|
|
||||||
$StepSize = 30000;
|
$StepSize = 30000;
|
||||||
$DB->query("SELECT * FROM tpc_temp ORDER BY GroupID ASC, TorrentID ASC LIMIT $StepSize");
|
$DB->query("
|
||||||
|
SELECT *
|
||||||
|
FROM tpc_temp
|
||||||
|
ORDER BY GroupID ASC, TorrentID ASC
|
||||||
|
LIMIT $StepSize");
|
||||||
|
|
||||||
$RowNum = 0;
|
$RowNum = 0;
|
||||||
$LastGroupID = 0;
|
$LastGroupID = 0;
|
||||||
@ -35,7 +52,7 @@
|
|||||||
list($TorrentID, $GroupID, $Seeders, $Leechers, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
list($TorrentID, $GroupID, $Seeders, $Leechers, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
while ($TorrentID) {
|
while ($TorrentID) {
|
||||||
if ($LastGroupID != $GroupID) {
|
if ($LastGroupID != $GroupID) {
|
||||||
$CachedData = $Cache->get_value('torrent_group_'.$GroupID);
|
$CachedData = $Cache->get_value("torrent_group_$GroupID");
|
||||||
if ($CachedData !== false) {
|
if ($CachedData !== false) {
|
||||||
if (isset($CachedData['ver']) && $CachedData['ver'] == CACHE::GROUP_VERSION) {
|
if (isset($CachedData['ver']) && $CachedData['ver'] == CACHE::GROUP_VERSION) {
|
||||||
$CachedStats = &$CachedData['d']['Torrents'];
|
$CachedStats = &$CachedData['d']['Torrents'];
|
||||||
@ -56,23 +73,31 @@
|
|||||||
unset($OldValues);
|
unset($OldValues);
|
||||||
}
|
}
|
||||||
if (!($RowNum % $StepSize)) {
|
if (!($RowNum % $StepSize)) {
|
||||||
$DB->query("SELECT * FROM tpc_temp WHERE GroupID > $GroupID OR (GroupID = $GroupID AND TorrentID > $TorrentID)
|
$DB->query("
|
||||||
ORDER BY GroupID ASC, TorrentID ASC LIMIT $StepSize");
|
SELECT *
|
||||||
|
FROM tpc_temp
|
||||||
|
WHERE GroupID > $GroupID
|
||||||
|
OR (GroupID = $GroupID AND TorrentID > $TorrentID)
|
||||||
|
ORDER BY GroupID ASC, TorrentID ASC
|
||||||
|
LIMIT $StepSize");
|
||||||
}
|
}
|
||||||
$LastGroupID = $GroupID;
|
$LastGroupID = $GroupID;
|
||||||
list($TorrentID, $GroupID, $Seeders, $Leechers, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
list($TorrentID, $GroupID, $Seeders, $Leechers, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
||||||
}
|
}
|
||||||
if ($Changed) {
|
if ($Changed) {
|
||||||
$Cache->cache_value('torrent_group_'.$LastGroupID, $CachedData, 0);
|
$Cache->cache_value("torrent_group_$LastGroupID", $CachedData, 0);
|
||||||
unset($CachedStats);
|
unset($CachedStats);
|
||||||
$UpdatedKeys++;
|
$UpdatedKeys++;
|
||||||
$Changed = false;
|
$Changed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Updated %d keys, skipped %d keys in %.6fs (%d kB memory)\n", $UpdatedKeys, $UncachedGroups, microtime(true)-$ScriptStartTime, memory_get_usage(true)>>10);
|
printf("Updated %d keys, skipped %d keys in %.6fs (%d kB memory)\n", $UpdatedKeys, $UncachedGroups, microtime(true) - $ScriptStartTime, memory_get_usage(true) >> 10);
|
||||||
|
|
||||||
$DB->query("TRUNCATE TABLE torrents_peerlists");
|
$DB->query("TRUNCATE TABLE torrents_peerlists");
|
||||||
$DB->query("INSERT INTO torrents_peerlists SELECT * FROM torrents_peerlists_compare");
|
$DB->query("
|
||||||
|
INSERT INTO torrents_peerlists
|
||||||
|
SELECT *
|
||||||
|
FROM torrents_peerlists_compare");
|
||||||
|
|
||||||
if (check_perms('admin_schedule')) {
|
if (check_perms('admin_schedule')) {
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
SELECT InviterID, Email
|
SELECT InviterID, Email
|
||||||
FROM invites
|
FROM invites
|
||||||
WHERE InviteKey = '".db_string($_REQUEST['invite'])."'");
|
WHERE InviteKey = '".db_string($_REQUEST['invite'])."'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$Err = 'Invite does not exist.';
|
$Err = 'Invite does not exist.';
|
||||||
$InviterID = 0;
|
$InviterID = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -164,7 +164,7 @@
|
|||||||
|
|
||||||
// If the inviter doesn't have an invite tree
|
// 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
|
// Note: This should never happen unless you've transferred from another database, like What.CD did
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT MAX(TreeID) + 1
|
SELECT MAX(TreeID) + 1
|
||||||
FROM invite_tree");
|
FROM invite_tree");
|
||||||
@ -244,7 +244,7 @@
|
|||||||
SELECT InviteKey
|
SELECT InviteKey
|
||||||
FROM invites
|
FROM invites
|
||||||
WHERE InviteKey = '".db_string($_GET['invite'])."'");
|
WHERE InviteKey = '".db_string($_GET['invite'])."'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error('Invite not found!');
|
error('Invite not found!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
SELECT Username
|
SELECT Username
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No user with the reported ID found';
|
$Error = 'No user with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
@ -58,7 +58,7 @@
|
|||||||
SELECT Title
|
SELECT Title
|
||||||
FROM requests
|
FROM requests
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No request with the reported ID found';
|
$Error = 'No request with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
@ -71,7 +71,7 @@
|
|||||||
SELECT Name
|
SELECT Name
|
||||||
FROM collages
|
FROM collages
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No collage with the reported ID found';
|
$Error = 'No collage with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
@ -84,7 +84,7 @@
|
|||||||
SELECT Title
|
SELECT Title
|
||||||
FROM forums_topics
|
FROM forums_topics
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No forum thread with the reported ID found';
|
$Error = 'No forum thread with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Title) = $DB->next_record();
|
list($Title) = $DB->next_record();
|
||||||
@ -110,7 +110,7 @@
|
|||||||
) AS PostNum
|
) AS PostNum
|
||||||
FROM forums_posts AS p
|
FROM forums_posts AS p
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No forum post with the reported ID found';
|
$Error = 'No forum post with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
|
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
|
||||||
@ -130,7 +130,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM requests_comments AS rc
|
FROM requests_comments AS rc
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No request comment with the reported ID found';
|
$Error = 'No request comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($RequestID, $Body, $PostNum) = $DB->next_record();
|
list($RequestID, $Body, $PostNum) = $DB->next_record();
|
||||||
@ -151,7 +151,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM torrents_comments AS tc
|
FROM torrents_comments AS tc
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No torrent comment with the reported ID found';
|
$Error = 'No torrent comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($GroupID, $Body, $PostNum) = $DB->next_record();
|
list($GroupID, $Body, $PostNum) = $DB->next_record();
|
||||||
@ -172,7 +172,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM collages_comments AS cc
|
FROM collages_comments AS cc
|
||||||
WHERE ID=$ThingID");
|
WHERE ID=$ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Error = 'No collage comment with the reported ID found';
|
$Error = 'No collage comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($CollageID, $Body, $PostNum) = $DB->next_record();
|
list($CollageID, $Body, $PostNum) = $DB->next_record();
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
SELECT Username
|
SELECT Username
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE ID = $ID");
|
WHERE ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
@ -32,7 +32,7 @@
|
|||||||
SELECT Title, Description, TorrentID, CategoryID, Year
|
SELECT Title, Description, TorrentID, CategoryID, Year
|
||||||
FROM requests
|
FROM requests
|
||||||
WHERE ID = $ID");
|
WHERE ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
|
list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
|
||||||
@ -46,7 +46,7 @@
|
|||||||
SELECT Title, Description, TorrentID
|
SELECT Title, Description, TorrentID
|
||||||
FROM requests
|
FROM requests
|
||||||
WHERE ID = $ID");
|
WHERE ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Name, $Desc, $Filled) = $DB->next_record();
|
list($Name, $Desc, $Filled) = $DB->next_record();
|
||||||
@ -57,7 +57,7 @@
|
|||||||
SELECT Name, Description
|
SELECT Name, Description
|
||||||
FROM collages
|
FROM collages
|
||||||
WHERE ID = $ID");
|
WHERE ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Name, $Desc) = $DB->next_record();
|
list($Name, $Desc) = $DB->next_record();
|
||||||
@ -69,7 +69,7 @@
|
|||||||
FROM forums_topics AS ft
|
FROM forums_topics AS ft
|
||||||
JOIN users_main AS um ON um.ID = ft.AuthorID
|
JOIN users_main AS um ON um.ID = ft.AuthorID
|
||||||
WHERE ft.ID = $ID");
|
WHERE ft.ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Title, $ForumID, $Username) = $DB->next_record();
|
list($Title, $ForumID, $Username) = $DB->next_record();
|
||||||
@ -91,7 +91,7 @@
|
|||||||
FROM forums_posts AS fp
|
FROM forums_posts AS fp
|
||||||
JOIN users_main AS um ON um.ID = fp.AuthorID
|
JOIN users_main AS um ON um.ID = fp.AuthorID
|
||||||
WHERE fp.ID = $ID");
|
WHERE fp.ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Body, $TopicID, $Username) = $DB->next_record();
|
list($Body, $TopicID, $Username) = $DB->next_record();
|
||||||
@ -127,7 +127,7 @@
|
|||||||
FROM $Table AS $Short
|
FROM $Table AS $Short
|
||||||
JOIN users_main AS um ON um.ID = $Short.$Column
|
JOIN users_main AS um ON um.ID = $Short.$Column
|
||||||
WHERE $Short.ID = $ID");
|
WHERE $Short.ID = $ID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
list($Body, $Username) = $DB->next_record();
|
list($Body, $Username) = $DB->next_record();
|
||||||
|
@ -113,7 +113,7 @@
|
|||||||
SELECT Username
|
SELECT Username
|
||||||
FROM users_main
|
FROM users_main
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No user with the reported ID found';
|
echo 'No user with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
@ -126,7 +126,7 @@
|
|||||||
SELECT Title
|
SELECT Title
|
||||||
FROM requests
|
FROM requests
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No request with the reported ID found';
|
echo 'No request with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
@ -138,7 +138,7 @@
|
|||||||
SELECT Name
|
SELECT Name
|
||||||
FROM collages
|
FROM collages
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No collage with the reported ID found';
|
echo 'No collage with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Name) = $DB->next_record();
|
list($Name) = $DB->next_record();
|
||||||
@ -150,7 +150,7 @@
|
|||||||
SELECT Title
|
SELECT Title
|
||||||
FROM forums_topics
|
FROM forums_topics
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No forum thread with the reported ID found';
|
echo 'No forum thread with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($Title) = $DB->next_record();
|
list($Title) = $DB->next_record();
|
||||||
@ -175,7 +175,7 @@
|
|||||||
) AS PostNum
|
) AS PostNum
|
||||||
FROM forums_posts AS p
|
FROM forums_posts AS p
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No forum post with the reported ID found';
|
echo 'No forum post with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
|
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
|
||||||
@ -194,7 +194,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM requests_comments AS rc
|
FROM requests_comments AS rc
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No request comment with the reported ID found';
|
echo 'No request comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($RequestID, $Body, $PostNum) = $DB->next_record();
|
list($RequestID, $Body, $PostNum) = $DB->next_record();
|
||||||
@ -214,7 +214,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM torrents_comments AS tc
|
FROM torrents_comments AS tc
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No torrent comment with the reported ID found';
|
echo 'No torrent comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($GroupID, $Body, $PostNum) = $DB->next_record();
|
list($GroupID, $Body, $PostNum) = $DB->next_record();
|
||||||
@ -234,7 +234,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM artist_comments AS ac
|
FROM artist_comments AS ac
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No comment with the reported ID found';
|
echo 'No comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($ArtistID, $Body, $PostNum) = $DB->next_record();
|
list($ArtistID, $Body, $PostNum) = $DB->next_record();
|
||||||
@ -255,7 +255,7 @@
|
|||||||
) AS CommentNum
|
) AS CommentNum
|
||||||
FROM collages_comments AS cc
|
FROM collages_comments AS cc
|
||||||
WHERE ID = $ThingID");
|
WHERE ID = $ThingID");
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
echo 'No collage comment with the reported ID found';
|
echo 'No collage comment with the reported ID found';
|
||||||
} else {
|
} else {
|
||||||
list($CollageID, $Body, $PostNum) = $DB->next_record();
|
list($CollageID, $Body, $PostNum) = $DB->next_record();
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
FROM pm_conversations_users
|
FROM pm_conversations_users
|
||||||
WHERE UserID = '$LoggedUser[ID]'
|
WHERE UserID = '$LoggedUser[ID]'
|
||||||
AND ConvID = '$ConvID'");
|
AND ConvID = '$ConvID'");
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(403);
|
error(403);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
FROM torrents_group AS tg
|
FROM torrents_group AS tg
|
||||||
JOIN torrents AS t ON t.GroupID=tg.ID
|
JOIN torrents AS t ON t.GroupID=tg.ID
|
||||||
WHERE t.ID = ".$TorrentID);
|
WHERE t.ID = ".$TorrentID);
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
$Err = 'No torrent with that ID exists!';
|
$Err = 'No torrent with that ID exists!';
|
||||||
} else {
|
} else {
|
||||||
list($CategoryID) = $DB->next_record();
|
list($CategoryID) = $DB->next_record();
|
||||||
@ -69,7 +69,7 @@
|
|||||||
WHERE TorrentID=$TorrentID
|
WHERE TorrentID=$TorrentID
|
||||||
AND ReporterID=".db_string($LoggedUser['ID'])."
|
AND ReporterID=".db_string($LoggedUser['ID'])."
|
||||||
AND ReportedTime > '".time_minus(3)."'");
|
AND ReportedTime > '".time_minus(3)."'");
|
||||||
if ($DB->record_count() > 0) {
|
if ($DB->has_results()) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
ORDER BY ReportedTime ASC
|
ORDER BY ReportedTime ASC
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
|
|
||||||
if ($DB->record_count() < 1) {
|
if (!$DB->has_results()) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@
|
|||||||
WHERE rep.Status != 'Resolved'
|
WHERE rep.Status != 'Resolved'
|
||||||
AND req.TimeFilled > '2010-03-04 02:31:49'
|
AND req.TimeFilled > '2010-03-04 02:31:49'
|
||||||
AND req.TorrentID=$TorrentID");
|
AND req.TorrentID=$TorrentID");
|
||||||
$Requests = ($DB->record_count());
|
$Requests = ($DB->has_results());
|
||||||
if ($Requests > 0) {
|
if ($Requests > 0) {
|
||||||
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
|
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
|
||||||
?>
|
?>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
||||||
$ReportType = $Types[$CategoryID][$_POST['type']];
|
$ReportType = $Types[$CategoryID][$_POST['type']];
|
||||||
} else if (array_key_exists($_POST['type'],$Types['master'])) {
|
} else if (array_key_exists($_POST['type'], $Types['master'])) {
|
||||||
$ReportType = $Types['master'][$_POST['type']];
|
$ReportType = $Types['master'][$_POST['type']];
|
||||||
} else {
|
} else {
|
||||||
//There was a type but it wasn't an option!
|
//There was a type but it wasn't an option!
|
||||||
@ -46,13 +46,13 @@
|
|||||||
if ($Recipient == 'Uploader') {
|
if ($Recipient == 'Uploader') {
|
||||||
$ToID = $_POST['uploaderid'];
|
$ToID = $_POST['uploaderid'];
|
||||||
if ($Report) {
|
if ($Report) {
|
||||||
$Message = "You uploaded [url=https://".SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]the above torrent[/url]. It has been reported for the reason: ".$ReportType['title']."\n\n".$Message;
|
$Message = "You uploaded [url=https://".SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]the above torrent[/url]. It has been reported for the reason: ".$ReportType['title']."\n\n$Message";
|
||||||
} else {
|
} else {
|
||||||
$Message = "I am PMing you as you are the uploader of [url=https://".SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]the above torrent[/url].\n\n".$Message;
|
$Message = "I am PMing you as you are the uploader of [url=https://".SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]the above torrent[/url].\n\n$Message";
|
||||||
}
|
}
|
||||||
} else if ($Recipient == 'Reporter') {
|
} else if ($Recipient == 'Reporter') {
|
||||||
$ToID = $_POST['reporterid'];
|
$ToID = $_POST['reporterid'];
|
||||||
$Message = "You reported [url=https://".SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]the above torrent[/url] for the reason ".$ReportType['title'].":\n[quote]".$_POST['report_reason']."[/quote]\n".$Message;
|
$Message = "You reported [url=https://".SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]the above torrent[/url] for the reason ".$ReportType['title'].":\n[quote]".$_POST['report_reason']."[/quote]\n$Message";
|
||||||
} else {
|
} else {
|
||||||
$Err = "Something went horribly wrong";
|
$Err = "Something went horribly wrong";
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,14 @@
|
|||||||
$Message = db_string($_POST['comment']);
|
$Message = db_string($_POST['comment']);
|
||||||
//Message can be blank!
|
//Message can be blank!
|
||||||
|
|
||||||
$DB->query("SELECT ModComment FROM reportsv2 WHERE ID=".$ReportID);
|
$DB->query("
|
||||||
|
SELECT ModComment
|
||||||
|
FROM reportsv2
|
||||||
|
WHERE ID = $ReportID");
|
||||||
list($ModComment) = $DB->next_record();
|
list($ModComment) = $DB->next_record();
|
||||||
if (isset($ModComment)) {
|
if (isset($ModComment)) {
|
||||||
$DB->query("Update reportsv2 SET ModComment='".$Message."' WHERE ID=".$ReportID);
|
$DB->query("
|
||||||
|
UPDATE reportsv2
|
||||||
|
SET ModComment = '$Message'
|
||||||
|
WHERE ID = $ReportID");
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT tg.CategoryID, t.GroupID
|
SELECT tg.CategoryID, t.GroupID
|
||||||
FROM torrents_group AS tg
|
FROM torrents_group AS tg
|
||||||
LEFT JOIN torrents AS t ON t.GroupID=tg.ID
|
LEFT JOIN torrents AS t ON t.GroupID = tg.ID
|
||||||
WHERE t.ID=" . $_GET['id']);
|
WHERE t.ID = " . $_GET['id']);
|
||||||
list($CategoryID, $GroupID) = $DB->next_record();
|
list($CategoryID, $GroupID) = $DB->next_record();
|
||||||
$Artists = Artists::get_artist($GroupID);
|
$Artists = Artists::get_artist($GroupID);
|
||||||
$TorrentCache = get_group_info($GroupID, true, $RevisionID);
|
$TorrentCache = get_group_info($GroupID, true, $RevisionID);
|
||||||
@ -46,22 +46,22 @@
|
|||||||
//Get the artist name, group name etc.
|
//Get the artist name, group name etc.
|
||||||
$Artists = Artists::get_artist($GroupID);
|
$Artists = Artists::get_artist($GroupID);
|
||||||
if ($Artists) {
|
if ($Artists) {
|
||||||
$DisplayName = '<span dir="ltr">' . Artists::display_artists($Artists, true) . '<a href="torrents.php?torrentid=' . $TorrentID . '">' .$DisplayName . '</a></span>';
|
$DisplayName = '<span dir="ltr">' . Artists::display_artists($Artists, true) . "<a href=\"torrents.php?torrentid=$TorrentID\">$DisplayName</a></span>";
|
||||||
$AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
|
$AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
|
||||||
$Title = $AltName;
|
$Title = $AltName;
|
||||||
}
|
}
|
||||||
if ($GroupYear > 0) {
|
if ($GroupYear > 0) {
|
||||||
$DisplayName.= " [$GroupYear]";
|
$DisplayName .= " [$GroupYear]";
|
||||||
$AltName.= " [$GroupYear]";
|
$AltName .= " [$GroupYear]";
|
||||||
$Title.= " [$GroupYear]";
|
$Title .= " [$GroupYear]";
|
||||||
}
|
}
|
||||||
if ($GroupVanityHouse) {
|
if ($GroupVanityHouse) {
|
||||||
$DisplayName.=' [Vanity House]';
|
$DisplayName .=' [Vanity House]';
|
||||||
$AltName.=' [Vanity House]';
|
$AltName .=' [Vanity House]';
|
||||||
}
|
}
|
||||||
if ($GroupCategoryID == 1) {
|
if ($GroupCategoryID == 1) {
|
||||||
$DisplayName.=' [' . $ReleaseTypes[$ReleaseType] . ']';
|
$DisplayName .=' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||||
$AltName.=' [' . $ReleaseTypes[$ReleaseType] . ']';
|
$AltName .=' [' . $ReleaseTypes[$ReleaseType] . ']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,85 +37,107 @@
|
|||||||
$ID = '';
|
$ID = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$Order = "ORDER BY r.ReportedTime ASC";
|
$Order = 'ORDER BY r.ReportedTime ASC';
|
||||||
|
|
||||||
if (!$ID) {
|
if (!$ID) {
|
||||||
switch ($View) {
|
switch ($View) {
|
||||||
case 'resolved' :
|
case 'resolved':
|
||||||
$Title = 'All the old smelly reports';
|
$Title = 'All the old smelly reports';
|
||||||
$Where = "WHERE r.Status = 'Resolved'";
|
$Where = "WHERE r.Status = 'Resolved'";
|
||||||
$Order = 'ORDER BY r.LastChangeTime DESC';
|
$Order = 'ORDER BY r.LastChangeTime DESC';
|
||||||
break;
|
break;
|
||||||
case 'unauto' :
|
case 'unauto':
|
||||||
$Title = 'New reports, not auto assigned!';
|
$Title = 'New reports, not auto assigned!';
|
||||||
$Where = "WHERE r.Status = 'New'";
|
$Where = "WHERE r.Status = 'New'";
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
error(404);
|
error(404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch ($View) {
|
switch ($View) {
|
||||||
case 'staff' :
|
case 'staff':
|
||||||
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
|
$DB->query("
|
||||||
|
SELECT Username
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = $ID");
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
if ($Username) {
|
if ($Username) {
|
||||||
$Title = $Username."'s in-progress reports";
|
$Title = "$Username's in-progress reports";
|
||||||
} else {
|
} else {
|
||||||
$Title = $ID."'s in-progress reports";
|
$Title = "$ID's in-progress reports";
|
||||||
}
|
}
|
||||||
$Where = "WHERE r.Status = 'InProgress' AND r.ResolverID = ".$ID;
|
$Where = "
|
||||||
|
WHERE r.Status = 'InProgress'
|
||||||
|
AND r.ResolverID = $ID";
|
||||||
break;
|
break;
|
||||||
case 'resolver' :
|
case 'resolver':
|
||||||
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
|
$DB->query("
|
||||||
|
SELECT Username
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = $ID");
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
if ($Username) {
|
if ($Username) {
|
||||||
$Title = $Username."'s resolved reports";
|
$Title = "$Username's resolved reports";
|
||||||
} else {
|
} else {
|
||||||
$Title = $ID."'s resolved reports";
|
$Title = "$ID's resolved reports";
|
||||||
}
|
}
|
||||||
$Where = "WHERE r.Status = 'Resolved' AND r.ResolverID = ".$ID;
|
$Where = "
|
||||||
|
WHERE r.Status = 'Resolved'
|
||||||
|
AND r.ResolverID = $ID";
|
||||||
$Order = 'ORDER BY r.LastChangeTime DESC';
|
$Order = 'ORDER BY r.LastChangeTime DESC';
|
||||||
break;
|
break;
|
||||||
case 'group' :
|
case 'group':
|
||||||
$Title = "Unresolved reports for the group $ID";
|
$Title = "Unresolved reports for the group $ID";
|
||||||
$Where = "WHERE r.Status != 'Resolved' AND tg.ID = ".$ID;
|
$Where = "
|
||||||
|
WHERE r.Status != 'Resolved'
|
||||||
|
AND tg.ID = $ID";
|
||||||
break;
|
break;
|
||||||
case 'torrent' :
|
case 'torrent':
|
||||||
$Title = 'All reports for the torrent '.$ID;
|
$Title = "All reports for the torrent $ID";
|
||||||
$Where = 'WHERE r.TorrentID = '.$ID;
|
$Where = "WHERE r.TorrentID = $ID";
|
||||||
break;
|
break;
|
||||||
case 'report' :
|
case 'report':
|
||||||
$Title = 'Viewing resolution of report '.$ID;
|
$Title = "Viewing resolution of report $ID";
|
||||||
$Where = 'WHERE r.ID = '.$ID;
|
$Where = "WHERE r.ID = $ID";
|
||||||
break;
|
break;
|
||||||
case 'reporter' :
|
case 'reporter':
|
||||||
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
|
$DB->query("
|
||||||
|
SELECT Username
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = $ID");
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
if ($Username) {
|
if ($Username) {
|
||||||
$Title = 'All torrents reported by '.$Username;
|
$Title = "All torrents reported by $Username";
|
||||||
} else {
|
} else {
|
||||||
$Title = 'All torrents reported by user '.$ID;
|
$Title = "All torrents reported by user $ID";
|
||||||
}
|
}
|
||||||
$Where = 'WHERE r.ReporterID = '.$ID;
|
$Where = "WHERE r.ReporterID = $ID";
|
||||||
$Order = 'ORDER BY r.ReportedTime DESC';
|
$Order = 'ORDER BY r.ReportedTime DESC';
|
||||||
break;
|
break;
|
||||||
case 'uploader' :
|
case 'uploader':
|
||||||
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
|
$DB->query("
|
||||||
|
SELECT Username
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = $ID");
|
||||||
list($Username) = $DB->next_record();
|
list($Username) = $DB->next_record();
|
||||||
if ($Username) {
|
if ($Username) {
|
||||||
$Title = 'All reports for torrents uploaded by '.$Username;
|
$Title = "All reports for torrents uploaded by $Username";
|
||||||
} else {
|
} else {
|
||||||
$Title = 'All reports for torrents uploaded by user '.$ID;
|
$Title = "All reports for torrents uploaded by user $ID";
|
||||||
}
|
}
|
||||||
$Where = "WHERE r.Status != 'Resolved' AND t.UserID = ".$ID;
|
$Where = "
|
||||||
|
WHERE r.Status != 'Resolved'
|
||||||
|
AND t.UserID = $ID";
|
||||||
break;
|
break;
|
||||||
case 'type':
|
case 'type':
|
||||||
$Title = 'All new reports for the chosen type';
|
$Title = 'All new reports for the chosen type';
|
||||||
$Where = "WHERE r.Status = 'New' AND r.Type = '".$ID."'";
|
$Where = "
|
||||||
|
WHERE r.Status = 'New'
|
||||||
|
AND r.Type = '$ID'";
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
error(404);
|
error(404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -170,13 +192,13 @@
|
|||||||
t.UserID AS UploaderID,
|
t.UserID AS UploaderID,
|
||||||
uploader.Username
|
uploader.Username
|
||||||
FROM reportsv2 AS r
|
FROM reportsv2 AS r
|
||||||
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
|
LEFT JOIN torrents AS t ON t.ID = r.TorrentID
|
||||||
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
|
LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||||
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
|
LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1'
|
||||||
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
|
LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID
|
||||||
LEFT JOIN users_main AS resolver ON resolver.ID=r.ResolverID
|
LEFT JOIN users_main AS resolver ON resolver.ID = r.ResolverID
|
||||||
LEFT JOIN users_main AS reporter ON reporter.ID=r.ReporterID
|
LEFT JOIN users_main AS reporter ON reporter.ID = r.ReporterID
|
||||||
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
|
LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
|
||||||
$Where
|
$Where
|
||||||
GROUP BY r.ID
|
GROUP BY r.ID
|
||||||
$Order
|
$Order
|
||||||
@ -227,17 +249,17 @@
|
|||||||
|
|
||||||
list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime,
|
list($ReportID, $ReporterID, $ReporterName, $TorrentID, $Type, $UserComment, $ResolverID, $ResolverName, $Status, $ReportedTime, $LastChangeTime,
|
||||||
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
|
$ModComment, $Tracks, $Images, $ExtraIDs, $Links, $LogMessage, $GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
|
||||||
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = Misc::display_array($Report, array("ModComment"));
|
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasCue, $HasLog, $LogScore, $UploaderID, $UploaderName) = Misc::display_array($Report, array('ModComment'));
|
||||||
|
|
||||||
if (!$GroupID && $Status != 'Resolved') {
|
if (!$GroupID && $Status != 'Resolved') {
|
||||||
//Torrent already deleted
|
//Torrent already deleted
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE reportsv2
|
UPDATE reportsv2
|
||||||
SET
|
SET
|
||||||
Status='Resolved',
|
Status = 'Resolved',
|
||||||
LastChangeTime='".sqltime()."',
|
LastChangeTime = '".sqltime()."',
|
||||||
ModComment='Report already dealt with (torrent deleted)'
|
ModComment = 'Report already dealt with (torrent deleted)'
|
||||||
WHERE ID=".$ReportID);
|
WHERE ID = $ReportID");
|
||||||
$Cache->decrement('num_torrent_reportsv2');
|
$Cache->decrement('num_torrent_reportsv2');
|
||||||
?>
|
?>
|
||||||
<div id="report<?=$ReportID?>">
|
<div id="report<?=$ReportID?>">
|
||||||
@ -256,7 +278,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if (array_key_exists($Type, $Types[$CategoryID])) {
|
if (array_key_exists($Type, $Types[$CategoryID])) {
|
||||||
$ReportType = $Types[$CategoryID][$Type];
|
$ReportType = $Types[$CategoryID][$Type];
|
||||||
} elseif (array_key_exists($Type,$Types['master'])) {
|
} elseif (array_key_exists($Type, $Types['master'])) {
|
||||||
$ReportType = $Types['master'][$Type];
|
$ReportType = $Types['master'][$Type];
|
||||||
} else {
|
} else {
|
||||||
//There was a type but it wasn't an option!
|
//There was a type but it wasn't an option!
|
||||||
@ -323,11 +345,12 @@
|
|||||||
<div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
|
<div style="text-align: right;">was reported by <a href="user.php?id=<?=$ReporterID?>"><?=$ReporterName?></a> <?=time_diff($ReportedTime)?> for the reason: <strong><?=$ReportType['title']?></strong></div>
|
||||||
<? if ($Status != 'Resolved') {
|
<? if ($Status != 'Resolved') {
|
||||||
|
|
||||||
$DB->query("SELECT r.ID
|
$DB->query("
|
||||||
FROM reportsv2 AS r
|
SELECT r.ID
|
||||||
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
|
FROM reportsv2 AS r
|
||||||
WHERE r.Status != 'Resolved'
|
LEFT JOIN torrents AS t ON t.ID = r.TorrentID
|
||||||
AND t.GroupID=$GroupID");
|
WHERE r.Status != 'Resolved'
|
||||||
|
AND t.GroupID = $GroupID");
|
||||||
$GroupOthers = ($DB->record_count() - 1);
|
$GroupOthers = ($DB->record_count() - 1);
|
||||||
|
|
||||||
if ($GroupOthers > 0) { ?>
|
if ($GroupOthers > 0) { ?>
|
||||||
@ -336,11 +359,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<? }
|
<? }
|
||||||
|
|
||||||
$DB->query("SELECT t.UserID
|
$DB->query("
|
||||||
FROM reportsv2 AS r
|
SELECT t.UserID
|
||||||
JOIN torrents AS t ON t.ID=r.TorrentID
|
FROM reportsv2 AS r
|
||||||
WHERE r.Status != 'Resolved'
|
JOIN torrents AS t ON t.ID = r.TorrentID
|
||||||
AND t.UserID=$UploaderID");
|
WHERE r.Status != 'Resolved'
|
||||||
|
AND t.UserID = $UploaderID");
|
||||||
$UploaderOthers = ($DB->record_count() - 1);
|
$UploaderOthers = ($DB->record_count() - 1);
|
||||||
|
|
||||||
if ($UploaderOthers > 0) { ?>
|
if ($UploaderOthers > 0) { ?>
|
||||||
@ -349,18 +373,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<? }
|
<? }
|
||||||
|
|
||||||
$DB->query("SELECT DISTINCT req.ID,
|
$DB->query("
|
||||||
req.FillerID,
|
SELECT DISTINCT req.ID,
|
||||||
um.Username,
|
req.FillerID,
|
||||||
req.TimeFilled
|
um.Username,
|
||||||
FROM requests AS req
|
req.TimeFilled
|
||||||
LEFT JOIN torrents AS t ON t.ID=req.TorrentID
|
FROM requests AS req
|
||||||
LEFT JOIN reportsv2 AS rep ON rep.TorrentID=t.ID
|
LEFT JOIN torrents AS t ON t.ID = req.TorrentID
|
||||||
JOIN users_main AS um ON um.ID=req.FillerID
|
LEFT JOIN reportsv2 AS rep ON rep.TorrentID = t.ID
|
||||||
WHERE rep.Status != 'Resolved'
|
JOIN users_main AS um ON um.ID = req.FillerID
|
||||||
AND req.TimeFilled > '2010-03-04 02:31:49'
|
WHERE rep.Status != 'Resolved'
|
||||||
AND req.TorrentID = $TorrentID");
|
AND req.TimeFilled > '2010-03-04 02:31:49'
|
||||||
$Requests = ($DB->record_count());
|
AND req.TorrentID = $TorrentID");
|
||||||
|
$Requests = ($DB->has_results());
|
||||||
if ($Requests > 0) {
|
if ($Requests > 0) {
|
||||||
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
|
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
|
||||||
?>
|
?>
|
||||||
@ -439,11 +464,11 @@
|
|||||||
t.UserID AS UploaderID,
|
t.UserID AS UploaderID,
|
||||||
uploader.Username
|
uploader.Username
|
||||||
FROM torrents AS t
|
FROM torrents AS t
|
||||||
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
|
LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||||
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
|
LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1'
|
||||||
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
|
LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID
|
||||||
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
|
LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID
|
||||||
WHERE t.ID='$ExtraID'
|
WHERE t.ID = '$ExtraID'
|
||||||
GROUP BY tg.ID");
|
GROUP BY tg.ID");
|
||||||
|
|
||||||
list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle,
|
list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle,
|
||||||
@ -481,7 +506,7 @@
|
|||||||
$Images = explode(' ', $Images);
|
$Images = explode(' ', $Images);
|
||||||
foreach ($Images as $Image) {
|
foreach ($Images as $Image) {
|
||||||
?>
|
?>
|
||||||
<img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=ImageTools::process($Image)?>" alt="Relevant image" />
|
<img style="max-width: 200px;" onclick="lightbox.init(this, 200);" src="<?=ImageTools::process($Image)?>" alt="Relevant image" />
|
||||||
<?
|
<?
|
||||||
} ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
@ -506,7 +531,7 @@
|
|||||||
<td class="label">Report comment:</td>
|
<td class="label">Report comment:</td>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<input type="text" name="comment" id="comment<?=$ReportID?>" size="45" value="<?=$ModComment?>" />
|
<input type="text" name="comment" id="comment<?=$ReportID?>" size="45" value="<?=$ModComment?>" />
|
||||||
<input type="button" value="Update now" onclick="UpdateComment(<?=$ReportID?>)" />
|
<input type="button" value="Update now" onclick="UpdateComment(<?=$ReportID?>);" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -514,7 +539,7 @@
|
|||||||
<a href="javascript:Load('<?=$ReportID?>')" title="Click here to reset the resolution options to their default values.">Resolve</a>
|
<a href="javascript:Load('<?=$ReportID?>')" title="Click here to reset the resolution options to their default values.">Resolve</a>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<select name="resolve_type" id="resolve_type<?=$ReportID?>" onchange="ChangeResolve(<?=$ReportID?>)">
|
<select name="resolve_type" id="resolve_type<?=$ReportID?>" onchange="ChangeResolve(<?=$ReportID?>);">
|
||||||
<?
|
<?
|
||||||
$TypeList = $Types['master'] + $Types[$CategoryID];
|
$TypeList = $Types['master'] + $Types[$CategoryID];
|
||||||
$Priorities = array();
|
$Priorities = array();
|
||||||
@ -550,7 +575,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span title="Update resolve type">
|
<span title="Update resolve type">
|
||||||
<input type="button" name="update_resolve" id="update_resolve<?=$ReportID?>" value="Update now" onclick="UpdateResolve(<?=$ReportID?>)" />
|
<input type="button" name="update_resolve" id="update_resolve<?=$ReportID?>" value="Update now" onclick="UpdateResolve(<?=$ReportID?>);" />
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
@ -567,7 +592,7 @@
|
|||||||
<span title="Uploader: Appended to the regular message unless using "Send now". Reporter: Must be used with "Send now".">
|
<span title="Uploader: Appended to the regular message unless using "Send now". Reporter: Must be used with "Send now".">
|
||||||
<textarea name="uploader_pm" id="uploader_pm<?=$ReportID?>" cols="50" rows="1"></textarea>
|
<textarea name="uploader_pm" id="uploader_pm<?=$ReportID?>" cols="50" rows="1"></textarea>
|
||||||
</span>
|
</span>
|
||||||
<input type="button" value="Send now" onclick="SendPM(<?=$ReportID?>)" />
|
<input type="button" value="Send now" onclick="SendPM(<?=$ReportID?>);" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -577,7 +602,7 @@
|
|||||||
$Extras = explode(' ', $ExtraIDs);
|
$Extras = explode(' ', $ExtraIDs);
|
||||||
$Value = '';
|
$Value = '';
|
||||||
foreach ($Extras as $ExtraID) {
|
foreach ($Extras as $ExtraID) {
|
||||||
$Value .= 'https://'.SSL_SITE_URL.'/torrents.php?torrentid='.$ExtraID.' ';
|
$Value .= 'https://'.SSL_SITE_URL."/torrents.php?torrentid=$ExtraID ";
|
||||||
}
|
}
|
||||||
echo 'value="'.trim($Value).'"';
|
echo 'value="'.trim($Value).'"';
|
||||||
} ?>/>
|
} ?>/>
|
||||||
@ -638,10 +663,10 @@
|
|||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
Load('<?=$ReportID?>');
|
Load('<?=$ReportID?>');
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<?
|
<?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
foreach ($ReportType['report_fields'] as $Field => $Value) {
|
foreach ($ReportType['report_fields'] as $Field => $Value) {
|
||||||
if ($Value == '1') {
|
if ($Value == '1') {
|
||||||
if (empty($_POST[$Field])) {
|
if (empty($_POST[$Field])) {
|
||||||
$Err = "You are missing a required field (".$Field.") for a ".$ReportType['title']." report.";
|
$Err = "You are missing a required field ($Field) for a ".$ReportType['title'].' report.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@
|
|||||||
$Err = "The extra permalinks you gave included the link to the torrent you're reporting!";
|
$Err = "The extra permalinks you gave included the link to the torrent you're reporting!";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$Err = "The permalink was incorrect. It should look like https://".SSL_SITE_URL."/torrents.php?torrentid=12345";
|
$Err = 'The permalink was incorrect. It should look like https://'.SSL_SITE_URL.'/torrents.php?torrentid=12345';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ExtraIDs = '';
|
$ExtraIDs = '';
|
||||||
@ -86,7 +86,7 @@
|
|||||||
if (preg_match('/([0-9]+( [0-9]+)*)|All/is', $_POST['track'], $Matches)) {
|
if (preg_match('/([0-9]+( [0-9]+)*)|All/is', $_POST['track'], $Matches)) {
|
||||||
$Tracks = $Matches[0];
|
$Tracks = $Matches[0];
|
||||||
} else {
|
} else {
|
||||||
$Err = 'Tracks should be given in a space separated list of numbers (no other characters)';
|
$Err = 'Tracks should be given in a space-separated list of numbers with no other characters.';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$Tracks = '';
|
$Tracks = '';
|
||||||
@ -98,8 +98,11 @@
|
|||||||
$Err = 'As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)';
|
$Err = 'As useful as blank reports are, could you be a tiny bit more helpful? (Leave a comment)';
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT ID FROM torrents WHERE ID=".$TorrentID);
|
$DB->query("
|
||||||
if ($DB->record_count() < 1) {
|
SELECT ID
|
||||||
|
FROM torrents
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
|
if (!$DB->has_results()) {
|
||||||
$Err = "A torrent with that ID doesn't exist!";
|
$Err = "A torrent with that ID doesn't exist!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,22 +112,28 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("SELECT ID FROM reportsv2 WHERE TorrentID=".$TorrentID." AND ReporterID=".db_string($LoggedUser['ID'])." AND ReportedTime > '".time_minus(3)."'");
|
$DB->query("
|
||||||
if ($DB->record_count() > 0) {
|
SELECT ID
|
||||||
header('Location: torrents.php?torrentid='.$TorrentID);
|
FROM reportsv2
|
||||||
|
WHERE TorrentID = $TorrentID
|
||||||
|
AND ReporterID = ".db_string($LoggedUser['ID'])."
|
||||||
|
AND ReportedTime > '".time_minus(3)."'");
|
||||||
|
if ($DB->has_results()) {
|
||||||
|
header("Location: torrents.php?torrentid=$TorrentID");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("INSERT INTO reportsv2
|
$DB->query("
|
||||||
(ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, Track, Image, ExtraID, Link)
|
INSERT INTO reportsv2
|
||||||
VALUES
|
(ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, Track, Image, ExtraID, Link)
|
||||||
(".db_string($LoggedUser['ID']).", $TorrentID, '".db_string($Type)."', '$Extra', 'New', '".sqltime()."', '".db_string($Tracks)."', '".db_string($Images)."', '".db_string($ExtraIDs)."', '".db_string($Links)."')");
|
VALUES
|
||||||
|
(".db_string($LoggedUser['ID']).", $TorrentID, '".db_string($Type)."', '$Extra', 'New', '".sqltime()."', '".db_string($Tracks)."', '".db_string($Images)."', '".db_string($ExtraIDs)."', '".db_string($Links)."')");
|
||||||
|
|
||||||
$ReportID = $DB->inserted_id();
|
$ReportID = $DB->inserted_id();
|
||||||
|
|
||||||
|
|
||||||
$Cache->delete_value('reports_torrent_'.$TorrentID);
|
$Cache->delete_value("reports_torrent_$TorrentID");
|
||||||
|
|
||||||
$Cache->increment('num_torrent_reportsv2');
|
$Cache->increment('num_torrent_reportsv2');
|
||||||
header('Location: torrents.php?torrentid='.$TorrentID);
|
header("Location: torrents.php?torrentid=$TorrentID");
|
||||||
?>
|
?>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?
|
<?
|
||||||
/*
|
/*
|
||||||
* This is the backend of the AJAXy reports resolve (When you press the shiny submit button).
|
* This is the backend of the AJAXy reports resolve (When you press the shiny submit button).
|
||||||
* This page shouldn't output anything except in error, if you do want output, it will be put
|
* This page shouldn't output anything except in error. If you do want output, it will be put
|
||||||
* straight into the table where the report used to be. Currently output is only given when
|
* straight into the table where the report used to be. Currently output is only given when
|
||||||
* a collision occurs or a POST attack is detected.
|
* a collision occurs or a POST attack is detected.
|
||||||
*/
|
*/
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//Don't escape: Log message, Admin message
|
//Don't escape: Log message, Admin message
|
||||||
$Escaped = db_array($_POST, array('log_message','admin_message', 'raw_name'));
|
$Escaped = db_array($_POST, array('log_message', 'admin_message', 'raw_name'));
|
||||||
|
|
||||||
//If we're here from the delete torrent page instead of the reports page.
|
//If we're here from the delete torrent page instead of the reports page.
|
||||||
if (!isset($Escaped['from_delete'])) {
|
if (!isset($Escaped['from_delete'])) {
|
||||||
@ -58,35 +58,35 @@
|
|||||||
$TorrentID = $Escaped['torrentid'];
|
$TorrentID = $Escaped['torrentid'];
|
||||||
$RawName = $Escaped['raw_name'];
|
$RawName = $Escaped['raw_name'];
|
||||||
|
|
||||||
if (isset($Escaped['delete']) && $Cache->get_value('torrent_'.$TorrentID.'_lock')) {
|
if (isset($Escaped['delete']) && $Cache->get_value("torrent_$TorrentID".'_lock')) {
|
||||||
echo 'You requested to delete the torrent '.$TorrentID.', but this is currently not possible because the upload process is still running. Please try again later.';
|
echo "You requested to delete the torrent $TorrentID, but this is currently not possible because the upload process is still running. Please try again later.";
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($Escaped['resolve_type'] == "manual" || $Escaped['resolve_type'] == "dismiss" ) && $Report) {
|
if (($Escaped['resolve_type'] == 'manual' || $Escaped['resolve_type'] == 'dismiss') && $Report) {
|
||||||
if ($Escaped['comment']) {
|
if ($Escaped['comment']) {
|
||||||
$Comment = $Escaped['comment'];
|
$Comment = $Escaped['comment'];
|
||||||
} else {
|
} else {
|
||||||
if ($Escaped['resolve_type'] == "manual") {
|
if ($Escaped['resolve_type'] == 'manual') {
|
||||||
$Comment = "Report was resolved manually";
|
$Comment = 'Report was resolved manually.';
|
||||||
} elseif ($Escaped['resolve_type'] == "dismiss") {
|
} elseif ($Escaped['resolve_type'] == 'dismiss') {
|
||||||
$Comment = "Report was dismissed as invalid";
|
$Comment = 'Report was dismissed as invalid.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE reportsv2
|
UPDATE reportsv2
|
||||||
SET
|
SET
|
||||||
Status='Resolved',
|
Status = 'Resolved',
|
||||||
LastChangeTime='".sqltime()."',
|
LastChangeTime = '".sqltime()."',
|
||||||
ModComment = '$Comment',
|
ModComment = '$Comment',
|
||||||
ResolverID='".$LoggedUser['ID']."'
|
ResolverID = '".$LoggedUser['ID']."'
|
||||||
WHERE ID='$ReportID'
|
WHERE ID = '$ReportID'
|
||||||
AND Status != 'Resolved'");
|
AND Status != 'Resolved'");
|
||||||
|
|
||||||
if ($DB->affected_rows() > 0) {
|
if ($DB->affected_rows() > 0) {
|
||||||
$Cache->delete_value('num_torrent_reportsv2');
|
$Cache->delete_value('num_torrent_reportsv2');
|
||||||
$Cache->delete_value('reports_torrent_'.$TorrentID);
|
$Cache->delete_value("reports_torrent_$TorrentID");
|
||||||
} else {
|
} else {
|
||||||
//Someone beat us to it. Inform the staffer.
|
//Someone beat us to it. Inform the staffer.
|
||||||
?>
|
?>
|
||||||
@ -108,7 +108,7 @@
|
|||||||
die();
|
die();
|
||||||
} elseif (array_key_exists($_POST['resolve_type'], $Types[$CategoryID])) {
|
} elseif (array_key_exists($_POST['resolve_type'], $Types[$CategoryID])) {
|
||||||
$ResolveType = $Types[$CategoryID][$_POST['resolve_type']];
|
$ResolveType = $Types[$CategoryID][$_POST['resolve_type']];
|
||||||
} elseif (array_key_exists($_POST['resolve_type'],$Types['master'])) {
|
} elseif (array_key_exists($_POST['resolve_type'], $Types['master'])) {
|
||||||
$ResolveType = $Types['master'][$_POST['resolve_type']];
|
$ResolveType = $Types['master'][$_POST['resolve_type']];
|
||||||
} else {
|
} else {
|
||||||
//There was a type but it wasn't an option!
|
//There was a type but it wasn't an option!
|
||||||
@ -116,17 +116,19 @@
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$DB->query("
|
||||||
$DB->query("SELECT ID FROM torrents WHERE ID = ".$TorrentID);
|
SELECT ID
|
||||||
$TorrentExists = ($DB->record_count() > 0);
|
FROM torrents
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
|
$TorrentExists = ($DB->has_results());
|
||||||
if (!$TorrentExists) {
|
if (!$TorrentExists) {
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE reportsv2
|
UPDATE reportsv2
|
||||||
SET Status='Resolved',
|
SET Status = 'Resolved',
|
||||||
LastChangeTime='".sqltime()."',
|
LastChangeTime = '".sqltime()."',
|
||||||
ResolverID='".$LoggedUser['ID']."',
|
ResolverID = '".$LoggedUser['ID']."',
|
||||||
ModComment='Report already dealt with (Torrent deleted)'
|
ModComment = 'Report already dealt with (torrent deleted).'
|
||||||
WHERE ID=".$ReportID);
|
WHERE ID = $ReportID");
|
||||||
|
|
||||||
$Cache->decrement('num_torrent_reportsv2');
|
$Cache->decrement('num_torrent_reportsv2');
|
||||||
}
|
}
|
||||||
@ -135,10 +137,10 @@
|
|||||||
//Resolve with a parallel check
|
//Resolve with a parallel check
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE reportsv2
|
UPDATE reportsv2
|
||||||
SET Status='Resolved',
|
SET Status = 'Resolved',
|
||||||
LastChangeTime='".sqltime()."',
|
LastChangeTime = '".sqltime()."',
|
||||||
ResolverID='".$LoggedUser['ID']."'
|
ResolverID = '".$LoggedUser['ID']."'
|
||||||
WHERE ID=$ReportID
|
WHERE ID = $ReportID
|
||||||
AND Status != 'Resolved'");
|
AND Status != 'Resolved'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,72 +158,98 @@
|
|||||||
$Upload = false;
|
$Upload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_POST['resolve_type'] == 'tags_lots') {
|
||||||
if ($_POST['resolve_type'] == "tags_lots") {
|
$DB->query("
|
||||||
$DB->query("INSERT IGNORE INTO torrents_bad_tags (TorrentID, UserID, TimeAdded) VALUES (".$TorrentID.", ".$LoggedUser['ID']." , '".sqltime()."')");
|
INSERT IGNORE INTO torrents_bad_tags
|
||||||
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
|
(TorrentID, UserID, TimeAdded)
|
||||||
|
VALUES
|
||||||
|
($TorrentID, ".$LoggedUser['ID']." , '".sqltime()."')");
|
||||||
|
$DB->query("
|
||||||
|
SELECT GroupID
|
||||||
|
FROM torrents
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
list($GroupID) = $DB->next_record();
|
list($GroupID) = $DB->next_record();
|
||||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
$Cache->delete_value("torrents_details_$GroupID");
|
||||||
$SendPM = true;
|
$SendPM = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['resolve_type'] == "folders_bad") {
|
if ($_POST['resolve_type'] == 'folders_bad') {
|
||||||
$DB->query("INSERT IGNORE INTO torrents_bad_folders (TorrentID, UserID, TimeAdded) VALUES (".$TorrentID.", ".$LoggedUser['ID'].", '".sqltime()."')");
|
$DB->query("
|
||||||
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
|
INSERT IGNORE INTO torrents_bad_folders
|
||||||
|
(TorrentID, UserID, TimeAdded)
|
||||||
|
VALUES
|
||||||
|
($TorrentID, ".$LoggedUser['ID'].", '".sqltime()."')");
|
||||||
|
$DB->query("
|
||||||
|
SELECT GroupID
|
||||||
|
FROM torrents
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
list($GroupID) = $DB->next_record();
|
list($GroupID) = $DB->next_record();
|
||||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
$Cache->delete_value("torrents_details_$GroupID");
|
||||||
$SendPM = true;
|
$SendPM = true;
|
||||||
}
|
}
|
||||||
if ($_POST['resolve_type'] == "filename") {
|
if ($_POST['resolve_type'] == 'filename') {
|
||||||
$DB->query("INSERT IGNORE INTO torrents_bad_files (TorrentID, UserID, TimeAdded) VALUES (".$TorrentID.", ".$LoggedUser['ID'].", '".sqltime()."')");
|
$DB->query("
|
||||||
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
|
INSERT IGNORE INTO torrents_bad_files
|
||||||
|
(TorrentID, UserID, TimeAdded)
|
||||||
|
VALUES
|
||||||
|
($TorrentID, ".$LoggedUser['ID'].", '".sqltime()."')");
|
||||||
|
$DB->query("
|
||||||
|
SELECT GroupID
|
||||||
|
FROM torrents
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
list($GroupID) = $DB->next_record();
|
list($GroupID) = $DB->next_record();
|
||||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
$Cache->delete_value("torrents_details_$GroupID");
|
||||||
$SendPM = true;
|
$SendPM = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Log and delete
|
//Log and delete
|
||||||
if (isset($Escaped['delete']) && check_perms('users_mod')) {
|
if (isset($Escaped['delete']) && check_perms('users_mod')) {
|
||||||
$DB->query("SELECT Username FROM users_main WHERE ID = ".$UploaderID);
|
$DB->query("
|
||||||
|
SELECT Username
|
||||||
|
FROM users_main
|
||||||
|
WHERE ID = $UploaderID");
|
||||||
list($UpUsername) = $DB->next_record();
|
list($UpUsername) = $DB->next_record();
|
||||||
$Log = "Torrent ".$TorrentID." (".$RawName.") uploaded by ".$UpUsername." was deleted by ".$LoggedUser['Username'];
|
$Log = "Torrent $TorrentID ($RawName) uploaded by $UpUsername was deleted by ".$LoggedUser['Username'];
|
||||||
$Log .= ($Escaped['resolve_type'] == 'custom' ? "" : " for the reason: ".$ResolveType['title'].".");
|
$Log .= ($Escaped['resolve_type'] == 'custom' ? '' : ' for the reason: '.$ResolveType['title'].".");
|
||||||
if (isset($Escaped['log_message']) && $Escaped['log_message'] != "") {
|
if (isset($Escaped['log_message']) && $Escaped['log_message'] != '') {
|
||||||
$Log .= " ( ".$Escaped['log_message']." )";
|
$Log .= ' ( '.$Escaped['log_message'].' )';
|
||||||
}
|
}
|
||||||
$DB->query("SELECT GroupID, hex(info_hash) FROM torrents WHERE ID = ".$TorrentID);
|
$DB->query("
|
||||||
|
SELECT GroupID, hex(info_hash)
|
||||||
|
FROM torrents
|
||||||
|
WHERE ID = $TorrentID");
|
||||||
list($GroupID, $InfoHash) = $DB->next_record();
|
list($GroupID, $InfoHash) = $DB->next_record();
|
||||||
Torrents::delete_torrent($TorrentID, 0, $ResolveType['reason']);
|
Torrents::delete_torrent($TorrentID, 0, $ResolveType['reason']);
|
||||||
|
|
||||||
//$InfoHash = unpack("H*", $InfoHash);
|
//$InfoHash = unpack("H*", $InfoHash);
|
||||||
$Log .= " (".strtoupper($InfoHash).")";
|
$Log .= ' ('.strtoupper($InfoHash).')';
|
||||||
Misc::write_log($Log);
|
Misc::write_log($Log);
|
||||||
$Log = "deleted torrent for the reason: ".$ResolveType['title'].". ( ".$Escaped['log_message']." )";
|
$Log = 'deleted torrent for the reason: '.$ResolveType['title'].'. ( '.$Escaped['log_message'].' )';
|
||||||
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $Log, 0);
|
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], $Log, 0);
|
||||||
} else {
|
} else {
|
||||||
$Log = "No log message (Torrent wasn't deleted)";
|
$Log = "No log message (torrent wasn't deleted).";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Warnings / remove upload
|
//Warnings / remove upload
|
||||||
if ($Upload) {
|
if ($Upload) {
|
||||||
$Cache->begin_transaction('user_info_heavy_'.$UploaderID);
|
$Cache->begin_transaction("user_info_heavy_$UploaderID");
|
||||||
$Cache->update_row(false, array('DisableUpload' => '1'));
|
$Cache->update_row(false, array('DisableUpload' => '1'));
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
UPDATE users_info
|
UPDATE users_info
|
||||||
SET DisableUpload='1'
|
SET DisableUpload = '1'
|
||||||
WHERE UserID=".$UploaderID);
|
WHERE UserID = $UploaderID");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Warning > 0) {
|
if ($Warning > 0) {
|
||||||
$WarnLength = $Warning * (7 * 24 * 60 * 60);
|
$WarnLength = $Warning * (7 * 24 * 60 * 60);
|
||||||
$Reason = "Uploader of torrent (".$TorrentID.") ".$RawName." which was resolved with the preset: ".$ResolveType['title'].".";
|
$Reason = "Uploader of torrent ($TorrentID) $RawName which was resolved with the preset: ".$ResolveType['title'].'.';
|
||||||
if ($Escaped['admin_message']) {
|
if ($Escaped['admin_message']) {
|
||||||
$Reason .= " (".$Escaped['admin_message'].").";
|
$Reason .= ' ('.$Escaped['admin_message'].').';
|
||||||
}
|
}
|
||||||
if ($Upload) {
|
if ($Upload) {
|
||||||
$Reason .= " (Upload privileges Removed).";
|
$Reason .= ' (Upload privileges removed).';
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools::warn_user($UploaderID, $WarnLength, $Reason);
|
Tools::warn_user($UploaderID, $WarnLength, $Reason);
|
||||||
@ -230,66 +258,69 @@
|
|||||||
$AdminComment = '';
|
$AdminComment = '';
|
||||||
if ($Upload) {
|
if ($Upload) {
|
||||||
//They removed upload
|
//They removed upload
|
||||||
$AdminComment .= "Upload privileges removed by ".$LoggedUser['Username'];
|
$AdminComment .= 'Upload privileges removed by '.$LoggedUser['Username'];
|
||||||
$AdminComment .= "\nReason: Uploader of torrent (".$TorrentID.") ".db_string($RawName)." which was resolved with the preset: ".$ResolveType['title'].". (Report ID: $ReportID)";
|
$AdminComment .= "\nReason: Uploader of torrent ($TorrentID) ".db_string($RawName).' which was resolved with the preset: '.$ResolveType['title'].". (Report ID: $ReportID)";
|
||||||
}
|
}
|
||||||
if ($Escaped['admin_message']) {
|
if ($Escaped['admin_message']) {
|
||||||
//They did nothing of note, but still want to mark it (Or upload and mark)
|
//They did nothing of note, but still want to mark it (Or upload and mark)
|
||||||
$AdminComment .= " (".$Escaped['admin_message'].")";
|
$AdminComment .= ' ('.$Escaped['admin_message'].')';
|
||||||
}
|
}
|
||||||
if ($AdminComment) {
|
if ($AdminComment) {
|
||||||
$AdminComment = date("Y-m-d").' - '.$AdminComment."\n\n";
|
$AdminComment = date('Y-m-d') . " - $AdminComment\n\n";
|
||||||
|
|
||||||
$DB->query("UPDATE users_info SET
|
$DB->query("
|
||||||
AdminComment=CONCAT('".db_string($AdminComment)."',AdminComment)
|
UPDATE users_info
|
||||||
WHERE UserID='".db_string($UploaderID)."'");
|
SET AdminComment = CONCAT('".db_string($AdminComment)."', AdminComment)
|
||||||
|
WHERE UserID = '".db_string($UploaderID)."'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//PM
|
//PM
|
||||||
if ($Escaped['uploader_pm'] || $Warning > 0 || isset($Escaped['delete']) || $SendPM) {
|
if ($Escaped['uploader_pm'] || $Warning > 0 || isset($Escaped['delete']) || $SendPM) {
|
||||||
if (isset($Escaped['delete'])) {
|
if (isset($Escaped['delete'])) {
|
||||||
$PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported and has been deleted.\n\n";
|
$PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]Your above torrent[/url] was reported and has been deleted.\n\n";
|
||||||
} else {
|
} else {
|
||||||
$PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported but not deleted.\n\n";
|
$PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]Your above torrent[/url] was reported but not deleted.\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$Preset = $ResolveType['resolve_options']['pm'];
|
$Preset = $ResolveType['resolve_options']['pm'];
|
||||||
|
|
||||||
if ($Preset != '') {
|
if ($Preset != '') {
|
||||||
$PM .= "Reason: ".$Preset;
|
$PM .= "Reason: $Preset";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Warning > 0) {
|
if ($Warning > 0) {
|
||||||
$PM .= "\nThis has resulted in a [url=https://".SSL_SITE_URL."/wiki.php?action=article&id=218]".$Warning." week warning.[/url]\n";
|
$PM .= "\nThis has resulted in a [url=https://".SSL_SITE_URL."/wiki.php?action=article&id=218]$Warning week warning.[/url]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Upload) {
|
if ($Upload) {
|
||||||
$PM .= "This has ".($Warning > 0 ? 'also ' : '')."resulted in you losing your upload privileges.";
|
$PM .= 'This has '.($Warning > 0 ? 'also ' : '').'resulted in you losing your upload privileges.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Log) {
|
if ($Log) {
|
||||||
$PM = $PM."\nLog Message: ".$Log."\n";
|
$PM = "$PM\nLog Message: $Log\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Escaped['uploader_pm']) {
|
if ($Escaped['uploader_pm']) {
|
||||||
$PM .= "\nMessage from ".$LoggedUser['Username'].": ".$PMMessage;
|
$PM .= "\nMessage from ".$LoggedUser['Username'].": $PMMessage";
|
||||||
}
|
}
|
||||||
|
|
||||||
$PM .= "\n\nReport was handled by [user]".$LoggedUser['Username']."[/user].";
|
$PM .= "\n\nReport was handled by [user]".$LoggedUser['Username'].'[/user].';
|
||||||
|
|
||||||
Misc::send_pm($UploaderID, 0, $Escaped['raw_name'], $PM);
|
Misc::send_pm($UploaderID, 0, $Escaped['raw_name'], $PM);
|
||||||
}
|
}
|
||||||
|
|
||||||
$Cache->delete_value('reports_torrent_'.$TorrentID);
|
$Cache->delete_value("reports_torrent_$TorrentID");
|
||||||
|
|
||||||
//Now we've done everything, update the DB with values
|
//Now we've done everything, update the DB with values
|
||||||
if ($Report) {
|
if ($Report) {
|
||||||
$DB->query("UPDATE reportsv2 SET
|
$DB->query("
|
||||||
Type = '".$Escaped['resolve_type']."',
|
UPDATE reportsv2
|
||||||
LogMessage='".db_string($Log)."',
|
SET
|
||||||
ModComment='".$Escaped['comment']."'
|
Type = '".$Escaped['resolve_type']."',
|
||||||
WHERE ID=".$ReportID);
|
LogMessage = '".db_string($Log)."',
|
||||||
|
ModComment = '".$Escaped['comment']."'
|
||||||
|
WHERE ID = $ReportID");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Someone beat us to it. Inform the staffer.
|
//Someone beat us to it. Inform the staffer.
|
||||||
|
@ -62,20 +62,22 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT
|
SELECT
|
||||||
CEIL((
|
CEIL((
|
||||||
SELECT COUNT(ID)+1
|
SELECT COUNT(ID) + 1
|
||||||
FROM requests_comments AS rc
|
FROM requests_comments AS rc
|
||||||
WHERE rc.RequestID='".$RequestID."'
|
WHERE rc.RequestID = '$RequestID'
|
||||||
)/".TORRENT_COMMENTS_PER_PAGE."
|
) / ".TORRENT_COMMENTS_PER_PAGE."
|
||||||
) AS Pages");
|
) AS Pages");
|
||||||
list($Pages) = $DB->next_record();
|
list($Pages) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO requests_comments (RequestID,AuthorID,AddedTime,Body)
|
INSERT INTO requests_comments
|
||||||
VALUES ('$RequestID', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
|
(RequestID, AuthorID, AddedTime, Body)
|
||||||
|
VALUES
|
||||||
|
('$RequestID', '".db_string($LoggedUser['ID'])."', '".sqltime()."', '".db_string($_POST['body'])."')");
|
||||||
$PostID = $DB->inserted_id();
|
$PostID = $DB->inserted_id();
|
||||||
|
|
||||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
$Cache->begin_transaction('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
|
$Cache->begin_transaction("request_comments_$RequestID"."_catalogue_$CatalogueID");
|
||||||
$Post = array(
|
$Post = array(
|
||||||
'ID'=>$PostID,
|
'ID'=>$PostID,
|
||||||
'AuthorID'=>$LoggedUser['ID'],
|
'AuthorID'=>$LoggedUser['ID'],
|
||||||
@ -87,9 +89,9 @@
|
|||||||
);
|
);
|
||||||
$Cache->insert('', $Post);
|
$Cache->insert('', $Post);
|
||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
$Cache->increment('request_comments_'.$RequestID);
|
$Cache->increment("request_comments_$RequestID");
|
||||||
|
|
||||||
header('Location: requests.php?action=view&id='.$RequestID.'&page='.$Pages);
|
header("Location: requests.php?action=view&id=$RequestID&page=$Pages");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'get_post':
|
case 'get_post':
|
||||||
@ -97,7 +99,10 @@
|
|||||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||||
error(0);
|
error(0);
|
||||||
}
|
}
|
||||||
$DB->query("SELECT Body FROM requests_comments WHERE ID='".db_string($_GET['post'])."'");
|
$DB->query("
|
||||||
|
SELECT Body
|
||||||
|
FROM requests_comments
|
||||||
|
WHERE ID = '".db_string($_GET['post'])."'");
|
||||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||||
|
|
||||||
echo trim($Body);
|
echo trim($Body);
|
||||||
@ -123,8 +128,8 @@
|
|||||||
rc.RequestID,
|
rc.RequestID,
|
||||||
rc.AddedTime
|
rc.AddedTime
|
||||||
FROM requests_comments AS rc
|
FROM requests_comments AS rc
|
||||||
WHERE rc.ID='".db_string($_POST['post'])."'");
|
WHERE rc.ID = '".db_string($_POST['post'])."'");
|
||||||
list($OldBody, $AuthorID,$RequestID,$AddedTime)=$DB->next_record();
|
list($OldBody, $AuthorID, $RequestID, $AddedTime) = $DB->next_record();
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page
|
SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page
|
||||||
@ -136,7 +141,7 @@
|
|||||||
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
if ($DB->record_count() == 0) {
|
if (!$DB->has_results()) {
|
||||||
error(404);
|
error(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,11 +152,11 @@
|
|||||||
Body = '".db_string($_POST['body'])."',
|
Body = '".db_string($_POST['body'])."',
|
||||||
EditedUserID = '".db_string($LoggedUser['ID'])."',
|
EditedUserID = '".db_string($LoggedUser['ID'])."',
|
||||||
EditedTime = '".sqltime()."'
|
EditedTime = '".sqltime()."'
|
||||||
WHERE ID='".db_string($_POST['post'])."'");
|
WHERE ID = '".db_string($_POST['post'])."'");
|
||||||
|
|
||||||
// Update the cache
|
// Update the cache
|
||||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
$Cache->begin_transaction('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
|
$Cache->begin_transaction("request_comments_$RequestID"."_catalogue_$CatalogueID");
|
||||||
|
|
||||||
$Cache->update_row($_POST['key'], array(
|
$Cache->update_row($_POST['key'], array(
|
||||||
'ID'=>$_POST['post'],
|
'ID'=>$_POST['post'],
|
||||||
@ -165,8 +170,10 @@
|
|||||||
$Cache->commit_transaction(0);
|
$Cache->commit_transaction(0);
|
||||||
|
|
||||||
$DB->query("
|
$DB->query("
|
||||||
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
INSERT INTO comments_edits
|
||||||
VALUES ('requests', ".db_string($_POST['post']).", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')");
|
(Page, PostID, EditUser, EditTime, Body)
|
||||||
|
VALUES
|
||||||
|
('requests', ".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
|
// This gets sent to the browser, which echoes it in place of the old body
|
||||||
echo $Text->full_format($_POST['body']);
|
echo $Text->full_format($_POST['body']);
|
||||||
@ -190,36 +197,38 @@
|
|||||||
$DB->query("
|
$DB->query("
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
RequestID,
|
RequestID,
|
||||||
CEIL(COUNT(rc.ID)/".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
|
CEIL(COUNT(rc.ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
|
||||||
CEIL(SUM(IF(rc.ID<=".$_GET['postid'].",1,0))/".TORRENT_COMMENTS_PER_PAGE.") AS Page
|
CEIL(SUM(IF(rc.ID <= ".$_GET['postid'].", 1, 0)) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page
|
||||||
FROM requests_comments AS rc
|
FROM requests_comments AS rc
|
||||||
WHERE rc.RequestID=(
|
WHERE rc.RequestID = (
|
||||||
SELECT RequestID
|
SELECT RequestID
|
||||||
FROM requests_comments
|
FROM requests_comments
|
||||||
WHERE ID='".db_string($_GET['postid'])."'
|
WHERE ID = '".db_string($_GET['postid'])."'
|
||||||
)");
|
)");
|
||||||
list($RequestID,$Pages,$Page) = $DB->next_record();
|
list($RequestID, $Pages, $Page) = $DB->next_record();
|
||||||
|
|
||||||
// $Pages = number of pages in the thread
|
// $Pages = number of pages in the thread
|
||||||
// $Page = which page the post is on
|
// $Page = which page the post is on
|
||||||
// These are set for cache clearing.
|
// These are set for cache clearing.
|
||||||
|
|
||||||
$DB->query("DELETE FROM requests_comments WHERE ID='".db_string($_GET['postid'])."'");
|
$DB->query("
|
||||||
|
DELETE FROM requests_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
|
//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);
|
$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);
|
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||||
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
||||||
$Cache->delete_value('request_comments_'.$RequestID.'_catalogue_'.$i);
|
$Cache->delete_value("request_comments_$RequestID" . "_catalogue_$i");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete thread info cache (eg. number of pages)
|
// Delete thread info cache (eg. number of pages)
|
||||||
$Cache->delete_value('request_comments_'.$GroupID);
|
$Cache->delete_value("request_comments_$GroupID");
|
||||||
break;
|
break;
|
||||||
case 'warn' :
|
case 'warn':
|
||||||
include(SERVER_ROOT.'/sections/requests/warn.php');
|
include(SERVER_ROOT.'/sections/requests/warn.php');
|
||||||
break;
|
break;
|
||||||
case 'take_warn' :
|
case 'take_warn':
|
||||||
include(SERVER_ROOT.'/sections/requests/take_warn.php');
|
include(SERVER_ROOT.'/sections/requests/take_warn.php');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user