mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
de02cdd53e
commit
68fa26b2db
@ -1,6 +1,6 @@
|
||||
<?
|
||||
//For sorting tags
|
||||
function compare($X, $Y){
|
||||
function compare($X, $Y) {
|
||||
return($Y['count'] - $X['count']);
|
||||
}
|
||||
|
||||
|
@ -4,16 +4,18 @@
|
||||
//~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
|
||||
function compare($X, $Y){
|
||||
function compare($X, $Y) {
|
||||
return($Y['count'] - $X['count']);
|
||||
}
|
||||
|
||||
if(!empty($_GET['userid'])) {
|
||||
if(!check_perms('users_override_paranoia')) {
|
||||
if (!empty($_GET['userid'])) {
|
||||
if (!check_perms('users_override_paranoia')) {
|
||||
error(403);
|
||||
}
|
||||
$UserID = $_GET['userid'];
|
||||
if(!is_number($UserID)) { error(404); }
|
||||
if (!is_number($UserID)) {
|
||||
error(404);
|
||||
}
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
|
||||
list($Username) = $DB->next_record();
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@
|
||||
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
|
||||
|
||||
$JsonRequestComments = array();
|
||||
foreach ($Thread as $Key => $Post){
|
||||
foreach ($Thread as $Key => $Post) {
|
||||
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||
$JsonRequestComments[] = array(
|
||||
|
@ -87,7 +87,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_GET['tags'])){
|
||||
if (!empty($_GET['tags'])) {
|
||||
$Tags = explode(',', $_GET['tags']);
|
||||
$TagNames = array();
|
||||
foreach ($Tags as $Tag) {
|
||||
@ -114,7 +114,7 @@
|
||||
$CategoryArray = array_keys($_GET['filter_cat']);
|
||||
if (count($CategoryArray) != count($Categories)) {
|
||||
foreach ($CategoryArray as $Key => $Index) {
|
||||
if (!isset($Categories[$Index-1])) {
|
||||
if (!isset($Categories[$Index - 1])) {
|
||||
unset($CategoryArray[$Key]);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(empty($_GET['id']) || !is_number($_GET['id']) || empty($_GET['limit']) || !is_number($_GET['limit'])) {
|
||||
if (empty($_GET['id']) || !is_number($_GET['id']) || empty($_GET['limit']) || !is_number($_GET['limit'])) {
|
||||
print
|
||||
json_encode(
|
||||
array(
|
||||
@ -14,21 +14,21 @@
|
||||
$artist_limit = $_GET["limit"];
|
||||
|
||||
$DB->query("
|
||||
SELECT
|
||||
SELECT
|
||||
s2.ArtistID,
|
||||
ag.Name,
|
||||
ass.Score
|
||||
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_scores AS ass ON ass.SimilarID=s1.SimilarID
|
||||
JOIN artists_group AS ag ON ag.ArtistID=s2.ArtistID
|
||||
WHERE s1.ArtistID=".$artist_id."
|
||||
ORDER BY ass.Score DESC
|
||||
LIMIT $artist_limit");
|
||||
WHERE s1.ArtistID=$artist_id
|
||||
ORDER BY ass.Score DESC
|
||||
LIMIT $artist_limit");
|
||||
|
||||
|
||||
while(list($ArtistID, $Name, $Score) = $DB->next_record(MYSQLI_NUM, false)){
|
||||
if($Score<0){
|
||||
while (list($ArtistID, $Name, $Score) = $DB->next_record(MYSQLI_NUM, false)) {
|
||||
if ($Score < 0) {
|
||||
continue;
|
||||
}
|
||||
$results[] = array('id' => (int) $ArtistID, 'name' => $Name, 'score' => (int) $Score);
|
||||
|
@ -1,12 +1,10 @@
|
||||
<?
|
||||
|
||||
|
||||
/*
|
||||
User topic subscription page
|
||||
*/
|
||||
|
||||
if(!empty($LoggedUser['DisableForums'])) {
|
||||
json_die("failure");
|
||||
if (!empty($LoggedUser['DisableForums'])) {
|
||||
json_die('failure');
|
||||
}
|
||||
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
@ -19,7 +17,7 @@
|
||||
}
|
||||
list($Page,$Limit) = Format::page_limit($PerPage);
|
||||
|
||||
if($LoggedUser['CustomForums']) {
|
||||
if ($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
|
||||
@ -27,28 +25,29 @@
|
||||
|
||||
$ShowUnread = (!isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread']);
|
||||
$ShowCollapsed = (!isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse']);
|
||||
$sql = 'SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
MAX(p.ID) AS ID
|
||||
$sql = '
|
||||
SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
MAX(p.ID) AS ID
|
||||
FROM forums_posts AS p
|
||||
LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
JOIN users_subscriptions AS s ON s.TopicID = t.ID
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN forums_last_read_topics AS l ON p.TopicID = l.TopicID AND l.UserID = s.UserID
|
||||
LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
JOIN users_subscriptions AS s ON s.TopicID = t.ID
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN forums_last_read_topics AS l ON p.TopicID = l.TopicID AND l.UserID = s.UserID
|
||||
WHERE s.UserID = '.$LoggedUser['ID'].'
|
||||
AND p.ID <= IFNULL(l.PostID,t.LastPostID)
|
||||
AND ((f.MinClassRead <= '.$LoggedUser['Class'];
|
||||
if(!empty($RestrictedForums)) {
|
||||
$sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
AND p.ID <= IFNULL(l.PostID,t.LastPostID)
|
||||
AND ((f.MinClassRead <= '.$LoggedUser['Class'];
|
||||
if (!empty($RestrictedForums)) {
|
||||
$sql.=" AND f.ID NOT IN ('$RestrictedForums')";
|
||||
}
|
||||
$sql .= ')';
|
||||
if(!empty($PermittedForums)) {
|
||||
$sql.=' OR f.ID IN (\''.$PermittedForums.'\')';
|
||||
if (!empty($PermittedForums)) {
|
||||
$sql.=" OR f.ID IN ('$PermittedForums')";
|
||||
}
|
||||
$sql .= ')';
|
||||
if($ShowUnread) {
|
||||
if ($ShowUnread) {
|
||||
$sql .= '
|
||||
AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID';
|
||||
AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID';
|
||||
}
|
||||
$sql .= '
|
||||
GROUP BY t.ID
|
||||
@ -58,38 +57,39 @@
|
||||
$DB->query('SELECT FOUND_ROWS()');
|
||||
list($NumResults) = $DB->next_record();
|
||||
|
||||
if($NumResults > $PerPage*($Page-1)) {
|
||||
if ($NumResults > $PerPage * ($Page - 1)) {
|
||||
$DB->set_query_id($PostIDs);
|
||||
$PostIDs = $DB->collect('ID');
|
||||
$sql = 'SELECT
|
||||
f.ID AS ForumID,
|
||||
f.Name AS ForumName,
|
||||
p.TopicID,
|
||||
t.Title,
|
||||
p.Body,
|
||||
t.LastPostID,
|
||||
t.IsLocked,
|
||||
t.IsSticky,
|
||||
p.ID,
|
||||
um.ID,
|
||||
um.Username,
|
||||
ui.Avatar,
|
||||
p.EditedUserID,
|
||||
p.EditedTime,
|
||||
ed.Username AS EditedUsername
|
||||
$sql = '
|
||||
SELECT
|
||||
f.ID AS ForumID,
|
||||
f.Name AS ForumName,
|
||||
p.TopicID,
|
||||
t.Title,
|
||||
p.Body,
|
||||
t.LastPostID,
|
||||
t.IsLocked,
|
||||
t.IsSticky,
|
||||
p.ID,
|
||||
um.ID,
|
||||
um.Username,
|
||||
ui.Avatar,
|
||||
p.EditedUserID,
|
||||
p.EditedTime,
|
||||
ed.Username AS EditedUsername
|
||||
FROM forums_posts AS p
|
||||
LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
LEFT JOIN users_info AS ui ON ui.UserID = um.ID
|
||||
LEFT JOIN users_main AS ed ON ed.ID = um.ID
|
||||
LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
LEFT JOIN users_info AS ui ON ui.UserID = um.ID
|
||||
LEFT JOIN users_main AS ed ON ed.ID = um.ID
|
||||
WHERE p.ID IN ('.implode(',',$PostIDs).')
|
||||
ORDER BY f.Name ASC, t.LastPostID DESC';
|
||||
$DB->query($sql);
|
||||
}
|
||||
|
||||
$JsonPosts = array();
|
||||
while(list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()){
|
||||
while (list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()) {
|
||||
$JsonPost = array(
|
||||
'forumId' => (int) $ForumID,
|
||||
'forumName' => $ForumName,
|
||||
@ -103,7 +103,7 @@
|
||||
$JsonPosts[] = $JsonPost;
|
||||
}
|
||||
|
||||
json_die("success", array(
|
||||
json_die('success', array(
|
||||
'threads' => $JsonPosts
|
||||
));
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Already done in /sections/ajax/index.php
|
||||
//enforce_login();
|
||||
|
||||
if (!check_perms('site_top10')){
|
||||
if (!check_perms('site_top10')) {
|
||||
print json_encode(array('status' => 'failure'));
|
||||
die();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
json_die("failure", "bad hash parameter");
|
||||
} else {
|
||||
$TorrentID = (int)torrenthash_to_torrentid($TorrentHash);
|
||||
if (!$TorrentID){
|
||||
if (!$TorrentID) {
|
||||
json_die("failure", "bad hash parameter");
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,7 @@
|
||||
list($TorrentDetails, $TorrentList) = $TorrentCache;
|
||||
|
||||
$ArtistForm = Artists::get_artist($GroupID);
|
||||
if($TorrentDetails['CategoryID'] == 0) {
|
||||
if ($TorrentDetails['CategoryID'] == 0) {
|
||||
$CategoryName = "Unknown";
|
||||
} else {
|
||||
$CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
|
||||
|
@ -20,7 +20,7 @@
|
||||
json_die("failure", "bad hash parameter");
|
||||
} else {
|
||||
$GroupID = (int)torrenthash_to_groupid($TorrentHash);
|
||||
if (!$GroupID){
|
||||
if (!$GroupID) {
|
||||
json_die("failure", "bad hash parameter");
|
||||
}
|
||||
}
|
||||
|
@ -11,44 +11,46 @@
|
||||
$UserID = $_GET['id'];
|
||||
|
||||
|
||||
if($UserID == $LoggedUser['ID']) {
|
||||
if ($UserID == $LoggedUser['ID']) {
|
||||
$OwnProfile = true;
|
||||
} else {
|
||||
$OwnProfile = false;
|
||||
}
|
||||
|
||||
// Always view as a normal user.
|
||||
$DB->query("SELECT
|
||||
m.Username,
|
||||
m.Email,
|
||||
m.LastAccess,
|
||||
m.IP,
|
||||
p.Level AS Class,
|
||||
m.Uploaded,
|
||||
m.Downloaded,
|
||||
m.RequiredRatio,
|
||||
m.Enabled,
|
||||
m.Paranoia,
|
||||
m.Invites,
|
||||
m.Title,
|
||||
m.torrent_pass,
|
||||
m.can_leech,
|
||||
i.JoinDate,
|
||||
i.Info,
|
||||
i.Avatar,
|
||||
i.Country,
|
||||
i.Donor,
|
||||
i.Warned,
|
||||
COUNT(posts.id) AS ForumPosts,
|
||||
i.Inviter,
|
||||
i.DisableInvites,
|
||||
inviter.username
|
||||
$DB->query("
|
||||
SELECT
|
||||
m.Username,
|
||||
m.Email,
|
||||
m.LastAccess,
|
||||
m.IP,
|
||||
p.Level AS Class,
|
||||
m.Uploaded,
|
||||
m.Downloaded,
|
||||
m.RequiredRatio,
|
||||
m.Enabled,
|
||||
m.Paranoia,
|
||||
m.Invites,
|
||||
m.Title,
|
||||
m.torrent_pass,
|
||||
m.can_leech,
|
||||
i.JoinDate,
|
||||
i.Info,
|
||||
i.Avatar,
|
||||
i.Country,
|
||||
i.Donor,
|
||||
i.Warned,
|
||||
COUNT(posts.id) AS ForumPosts,
|
||||
i.Inviter,
|
||||
i.DisableInvites,
|
||||
inviter.username
|
||||
FROM users_main AS m
|
||||
JOIN users_info AS i ON i.UserID = m.ID
|
||||
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
|
||||
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
|
||||
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
|
||||
WHERE m.ID = $UserID GROUP BY AuthorID");
|
||||
JOIN users_info AS i ON i.UserID = m.ID
|
||||
LEFT JOIN permissions AS p ON p.ID=m.PermissionID
|
||||
LEFT JOIN users_main AS inviter ON i.Inviter = inviter.ID
|
||||
LEFT JOIN forums_posts AS posts ON posts.AuthorID = m.ID
|
||||
WHERE m.ID = $UserID
|
||||
GROUP BY AuthorID");
|
||||
|
||||
if ($DB->record_count() == 0) { // If user doesn't exist
|
||||
json_die("failure", "no such user");
|
||||
@ -57,13 +59,13 @@
|
||||
list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11));
|
||||
|
||||
$Paranoia = unserialize($Paranoia);
|
||||
if(!is_array($Paranoia)) {
|
||||
if (!is_array($Paranoia)) {
|
||||
$Paranoia = array();
|
||||
}
|
||||
$ParanoiaLevel = 0;
|
||||
foreach($Paranoia as $P) {
|
||||
foreach ($Paranoia as $P) {
|
||||
$ParanoiaLevel++;
|
||||
if(strpos($P, '+')) {
|
||||
if (strpos($P, '+')) {
|
||||
$ParanoiaLevel++;
|
||||
}
|
||||
}
|
||||
@ -79,7 +81,7 @@ function check_paranoia_here($Setting) {
|
||||
|
||||
$Friend = false;
|
||||
$DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
|
||||
if($DB->record_count() != 0) {
|
||||
if ($DB->record_count() != 0) {
|
||||
$Friend = true;
|
||||
}
|
||||
|
||||
@ -95,7 +97,7 @@ function check_paranoia_here($Setting) {
|
||||
$RequestsVoted = 0;
|
||||
$TotalSpent = 0;
|
||||
}
|
||||
if(check_paranoia_here('uploads+')) {
|
||||
if (check_paranoia_here('uploads+')) {
|
||||
$DB->query("SELECT COUNT(ID) FROM torrents WHERE UserID='$UserID'");
|
||||
list($Uploads) = $DB->next_record();
|
||||
} else {
|
||||
@ -145,9 +147,9 @@ function check_paranoia_here($Setting) {
|
||||
$ArtistsRank = null;
|
||||
}
|
||||
|
||||
if($Downloaded == 0) {
|
||||
if ($Downloaded == 0) {
|
||||
$Ratio = 1;
|
||||
} elseif($Uploaded == 0) {
|
||||
} elseif ($Uploaded == 0) {
|
||||
$Ratio = 0.5;
|
||||
} else {
|
||||
$Ratio = round($Uploaded/$Downloaded, 2);
|
||||
@ -159,7 +161,7 @@ function check_paranoia_here($Setting) {
|
||||
}
|
||||
|
||||
// Community section
|
||||
if(check_paranoia_here(array('snatched', 'snatched+'))) {
|
||||
if (check_paranoia_here(array('snatched', 'snatched+'))) {
|
||||
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) FROM xbt_snatched AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID'");
|
||||
list($Snatched, $UniqueSnatched) = $DB->next_record();
|
||||
}
|
||||
@ -185,7 +187,21 @@ function check_paranoia_here($Setting) {
|
||||
}
|
||||
|
||||
if (check_paranoia_here(array('perfectflacs', 'perfectflacs+'))) {
|
||||
$DB->query("SELECT COUNT(ID) FROM torrents WHERE ((LogScore = 100 AND Format = 'FLAC') OR (Media = 'Vinyl' AND Format = 'FLAC') OR (Media = 'WEB' AND Format = 'FLAC') OR (Media = 'DVD' AND Format = 'FLAC') OR (Media = 'Soundboard' AND Format = 'FLAC') OR (Media = 'Cassette' AND Format = 'FLAC') OR (Media = 'SACD' AND Format = 'FLAC') OR (Media = 'Blu-ray' AND Format = 'FLAC') OR (Media = 'DAT' AND Format = 'FLAC')) AND UserID = '$UserID'");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM torrents
|
||||
WHERE (
|
||||
(LogScore = 100 AND Format = 'FLAC')
|
||||
OR (Media = 'Vinyl' AND Format = 'FLAC')
|
||||
OR (Media = 'WEB' AND Format = 'FLAC')
|
||||
OR (Media = 'DVD' AND Format = 'FLAC')
|
||||
OR (Media = 'Soundboard' AND Format = 'FLAC')
|
||||
OR (Media = 'Cassette' AND Format = 'FLAC')
|
||||
OR (Media = 'SACD' AND Format = 'FLAC')
|
||||
OR (Media = 'Blu-ray' AND Format = 'FLAC')
|
||||
OR (Media = 'DAT' AND Format = 'FLAC')
|
||||
)
|
||||
AND UserID = '$UserID'");
|
||||
list($PerfectFLACs) = $DB->next_record();
|
||||
}
|
||||
|
||||
@ -199,18 +215,18 @@ function check_paranoia_here($Setting) {
|
||||
list($Leeching) = $DB->next_record();
|
||||
}
|
||||
|
||||
if(check_paranoia_here('invitedcount')) {
|
||||
if (check_paranoia_here('invitedcount')) {
|
||||
$DB->query("SELECT COUNT(UserID) FROM users_info WHERE Inviter='$UserID'");
|
||||
list($Invited) = $DB->next_record();
|
||||
}
|
||||
|
||||
if (!$OwnProfile) {
|
||||
$torrent_pass = "";
|
||||
$torrent_pass = '';
|
||||
}
|
||||
|
||||
// Run through some paranoia stuff to decide what we can send out.
|
||||
if (!check_paranoia_here('lastseen')) {
|
||||
$LastAccess = "";
|
||||
$LastAccess = '';
|
||||
}
|
||||
if (!check_paranoia_here('uploaded')) {
|
||||
$Uploaded = null;
|
||||
@ -221,21 +237,21 @@ function check_paranoia_here($Setting) {
|
||||
if (isset($RequiredRatio) && !check_paranoia_here('requiredratio')) {
|
||||
$RequiredRatio = null;
|
||||
}
|
||||
if($ParanoiaLevel == 0) {
|
||||
if ($ParanoiaLevel == 0) {
|
||||
$ParanoiaLevelText = 'Off';
|
||||
} elseif($ParanoiaLevel == 1) {
|
||||
} elseif ($ParanoiaLevel == 1) {
|
||||
$ParanoiaLevelText = 'Very Low';
|
||||
} elseif($ParanoiaLevel <= 5) {
|
||||
} elseif ($ParanoiaLevel <= 5) {
|
||||
$ParanoiaLevelText = 'Low';
|
||||
} elseif($ParanoiaLevel <= 20) {
|
||||
} elseif ($ParanoiaLevel <= 20) {
|
||||
$ParanoiaLevelText = 'High';
|
||||
} else {
|
||||
$ParanoiaLevelText = 'Very high';
|
||||
}
|
||||
|
||||
//Bugfix for no access time available
|
||||
if ($LastAccess == "0000-00-00 00:00:00"){
|
||||
$LastAccess = "";
|
||||
if ($LastAccess == '0000-00-00 00:00:00') {
|
||||
$LastAccess = '';
|
||||
}
|
||||
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
|
@ -46,7 +46,7 @@ function error_out($reason = '') {
|
||||
JOIN users_info AS i ON i.UserID = m.ID
|
||||
WHERE m.ID = $UserID");
|
||||
|
||||
if ($DB->record_count() == 0){ // If user doesn't exist
|
||||
if ($DB->record_count() == 0) { // If user doesn't exist
|
||||
error_out('User does not exist!');
|
||||
}
|
||||
list($Username, $Enabled, $Title, $Avatar, $Donor, $Warned) = $DB->next_record();
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
define('USERS_PER_PAGE', 30);
|
||||
|
||||
if(isset($_GET['username'])){
|
||||
if (isset($_GET['username'])) {
|
||||
$_GET['username'] = trim($_GET['username']);
|
||||
|
||||
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
|
||||
|
@ -5,18 +5,18 @@
|
||||
$Artist1ID = db_string($_POST['artistid']);
|
||||
$Artist2Name = db_string($_POST['artistname']);
|
||||
|
||||
if(!is_number($Artist1ID)) {
|
||||
if (!is_number($Artist1ID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if(empty($Artist2Name)) {
|
||||
if (empty($Artist2Name)) {
|
||||
error('Blank artist name.');
|
||||
}
|
||||
|
||||
$DB->query("SELECT ag.ArtistID FROM artists_group AS ag WHERE ag.Name LIKE '$Artist2Name'");
|
||||
list($Artist2ID) = $DB->next_record();
|
||||
|
||||
if(!empty($Artist2ID)) { // artist was found in the database
|
||||
if (!empty($Artist2ID)) { // artist was found in the database
|
||||
|
||||
// Let's see if there's already a similar artists field for these two
|
||||
$DB->query("SELECT
|
||||
@ -26,7 +26,7 @@
|
||||
WHERE s1.ArtistID='$Artist1ID' AND s2.ArtistID='$Artist2ID'");
|
||||
list($SimilarID) = $DB->next_record();
|
||||
|
||||
if($SimilarID){ // The similar artists field already exists, just update the score
|
||||
if ($SimilarID) { // The similar artists field already exists, just update the score
|
||||
$DB->query("UPDATE artists_similar_scores SET Score=Score+200 WHERE SimilarID='$SimilarID'");
|
||||
} else { // No, it doesn't exist - create it
|
||||
$DB->query("INSERT INTO artists_similar_scores (Score) VALUES ('200')");
|
||||
@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='up'");
|
||||
if($DB->record_count() == 0) {
|
||||
if ($DB->record_count() == 0) {
|
||||
$DB->query("INSERT INTO artists_similar_votes (SimilarID, UserID, way) VALUES ('$SimilarID', '$UserID', 'up')");
|
||||
}
|
||||
|
||||
|
@ -41,23 +41,25 @@ function compare($X, $Y) {
|
||||
list($K, list($Name, $Image, $Body, $NumSimilar, $SimilarArray, , , $VanityHouseArtist)) = each($Data);
|
||||
} else {
|
||||
if ($RevisionID) {
|
||||
$sql = "SELECT
|
||||
a.Name,
|
||||
wiki.Image,
|
||||
wiki.body,
|
||||
a.VanityHouse
|
||||
FROM wiki_artists AS wiki
|
||||
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
||||
WHERE wiki.RevisionID='$RevisionID' ";
|
||||
$sql = "
|
||||
SELECT
|
||||
a.Name,
|
||||
wiki.Image,
|
||||
wiki.body,
|
||||
a.VanityHouse
|
||||
FROM wiki_artists AS wiki
|
||||
LEFT JOIN artists_group AS a ON wiki.RevisionID=a.RevisionID
|
||||
WHERE wiki.RevisionID='$RevisionID' ";
|
||||
} else {
|
||||
$sql = "SELECT
|
||||
a.Name,
|
||||
wiki.Image,
|
||||
wiki.body,
|
||||
a.VanityHouse
|
||||
FROM artists_group AS a
|
||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID=a.RevisionID
|
||||
WHERE a.ArtistID='$ArtistID' ";
|
||||
$sql = "
|
||||
SELECT
|
||||
a.Name,
|
||||
wiki.Image,
|
||||
wiki.body,
|
||||
a.VanityHouse
|
||||
FROM artists_group AS a
|
||||
LEFT JOIN wiki_artists AS wiki ON wiki.RevisionID=a.RevisionID
|
||||
WHERE a.ArtistID='$ArtistID' ";
|
||||
}
|
||||
$sql .= " GROUP BY a.ArtistID";
|
||||
$DB->query($sql);
|
||||
@ -77,21 +79,22 @@ function compare($X, $Y) {
|
||||
// Requests
|
||||
$Requests = $Cache->get_value('artists_requests_'.$ArtistID);
|
||||
if (!is_array($Requests)) {
|
||||
$DB->query("SELECT
|
||||
r.ID,
|
||||
r.CategoryID,
|
||||
r.Title,
|
||||
r.Year,
|
||||
r.TimeAdded,
|
||||
COUNT(rv.UserID) AS Votes,
|
||||
SUM(rv.Bounty) AS Bounty
|
||||
FROM requests AS r
|
||||
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
||||
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
||||
WHERE ra.ArtistID = ".$ArtistID."
|
||||
AND r.TorrentID = 0
|
||||
GROUP BY r.ID
|
||||
ORDER BY Votes DESC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
r.ID,
|
||||
r.CategoryID,
|
||||
r.Title,
|
||||
r.Year,
|
||||
r.TimeAdded,
|
||||
COUNT(rv.UserID) AS Votes,
|
||||
SUM(rv.Bounty) AS Bounty
|
||||
FROM requests AS r
|
||||
LEFT JOIN requests_votes AS rv ON rv.RequestID=r.ID
|
||||
LEFT JOIN requests_artists AS ra ON r.ID=ra.RequestID
|
||||
WHERE ra.ArtistID = ".$ArtistID."
|
||||
AND r.TorrentID = 0
|
||||
GROUP BY r.ID
|
||||
ORDER BY Votes DESC");
|
||||
|
||||
if ($DB->record_count() > 0) {
|
||||
$Requests = $DB->to_array();
|
||||
@ -104,12 +107,13 @@ function compare($X, $Y) {
|
||||
|
||||
|
||||
if (($Importances = $Cache->get_value('artist_groups_'.$ArtistID)) === false) {
|
||||
$DB->query("SELECT
|
||||
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
|
||||
FROM torrents_artists AS ta
|
||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||
WHERE ta.ArtistID='$ArtistID'
|
||||
ORDER BY tg.Year DESC, tg.Name DESC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
DISTINCTROW ta.GroupID, ta.Importance, tg.VanityHouse, tg.Year
|
||||
FROM torrents_artists AS ta
|
||||
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
|
||||
WHERE ta.ArtistID='$ArtistID'
|
||||
ORDER BY tg.Year DESC, tg.Name DESC");
|
||||
$GroupIDs = $DB->collect('GroupID');
|
||||
$Importances = $DB->to_array(false, MYSQLI_BOTH, false);
|
||||
$Cache->cache_value('artist_groups_'.$ArtistID, $Importances, 0);
|
||||
@ -339,7 +343,7 @@ function compare($X, $Y) {
|
||||
}
|
||||
|
||||
|
||||
switch ($ReleaseType){
|
||||
switch ($ReleaseType) {
|
||||
case 1023: // Remixes, DJ Mixes, Guest artists, and Producers need the artist name
|
||||
case 1024:
|
||||
case 1021:
|
||||
@ -594,17 +598,17 @@ function compare($X, $Y) {
|
||||
<? $OpenGroup = true;
|
||||
}
|
||||
?>
|
||||
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
|
||||
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<button type="button" onclick="add_selection()">+</button>
|
||||
<select name="preference" style="width: 210px">
|
||||
<option value="0"<? if ($ZIPPrefs == 0){ echo ' selected="selected"'; } ?>>Prefer Original</option>
|
||||
<option value="1"<? if ($ZIPPrefs == 1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||
<option value="2"<? if ($ZIPPrefs == 2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||
<select name="preference" style="width: 210px;">
|
||||
<option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
|
||||
<option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||
<option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||
</select>
|
||||
<input type="submit" style="width:210px" value="Download" />
|
||||
</form>
|
||||
@ -683,7 +687,7 @@ function compare($X, $Y) {
|
||||
<span class="remove remove_artist"><a href="artist.php?action=delete_similar&similarid=<?=$SimilarID?>&auth=<?=$LoggedUser['AuthKey']?>" title="Remove this similar artist" class="brackets">X</a></span>
|
||||
<? } ?>
|
||||
</div>
|
||||
<br style="clear:both" />
|
||||
<br style="clear: both;" />
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
@ -713,7 +717,7 @@ function compare($X, $Y) {
|
||||
?>
|
||||
<table cellpadding="6" cellspacing="1" border="0" class="request_table border" width="100%" id="requests">
|
||||
<tr class="colhead_dark">
|
||||
<td style="width:48%;">
|
||||
<td style="width: 48%;">
|
||||
<a href="#">↑</a>
|
||||
<strong>Request name</strong>
|
||||
</td>
|
||||
@ -733,14 +737,14 @@ function compare($X, $Y) {
|
||||
|
||||
$CategoryName = $Categories[$CategoryID - 1];
|
||||
|
||||
if ($CategoryName == "Music") {
|
||||
if ($CategoryName == 'Music') {
|
||||
$ArtistForm = get_request_artists($RequestID);
|
||||
$ArtistLink = Artists::display_artists($ArtistForm, true, true);
|
||||
$FullName = $ArtistLink."<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||
} elseif ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
|
||||
$FullName = "<a href='requests.php?action=view&id=".$RequestID."'>".$Title." [".$Year."]</a>";
|
||||
$FullName = $ArtistLink."<a href=\"requests.php?action=view&id=".$RequestID."\">$Title [$Year]</a>";
|
||||
} elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
|
||||
$FullName = "<a href=\"requests.php?action=view&id=".$RequestID."\">$Title [$Year]</a>";
|
||||
} else {
|
||||
$FullName ="<a href='requests.php?action=view&id=".$RequestID."'>".$Title."</a>";
|
||||
$FullName ="<a href=\"requests.php?action=view&id=".$RequestID."\">$Title</a>";
|
||||
}
|
||||
|
||||
$Row = ($Row == 'a') ? 'b' : 'a';
|
||||
@ -748,7 +752,7 @@ function compare($X, $Y) {
|
||||
$Tags = get_request_tags($RequestID);
|
||||
$ReqTagList = array();
|
||||
foreach ($Tags as $TagID => $TagName) {
|
||||
$ReqTagList[] = "<a href='requests.php?tags=".$TagName."'>".display_str($TagName)."</a>";
|
||||
$ReqTagList[] = "<a href=\"requests.php?tags=".$TagName.'">'.display_str($TagName).'</a>';
|
||||
}
|
||||
$ReqTagList = implode(', ', $ReqTagList);
|
||||
?>
|
||||
@ -759,7 +763,7 @@ function compare($X, $Y) {
|
||||
</td>
|
||||
<td>
|
||||
<span id="vote_count_<?=$RequestID?>"><?=$Votes?></span>
|
||||
<? if (check_perms('site_vote')){ ?>
|
||||
<? if (check_perms('site_vote')) { ?>
|
||||
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
|
||||
<? } ?>
|
||||
@ -799,7 +803,7 @@ function compare($X, $Y) {
|
||||
|
||||
$SimilarData = $Similar->dump_data();
|
||||
|
||||
$Cache->cache_value('similar_positions_'.$ArtistID, $SimilarData, 3600*24);
|
||||
$Cache->cache_value('similar_positions_'.$ArtistID, $SimilarData, 3600 * 24);
|
||||
}
|
||||
?>
|
||||
<div id="similar_artist_map" class="box">
|
||||
@ -808,17 +812,17 @@ function compare($X, $Y) {
|
||||
<strong id="flipper_title">Similar artist map</strong>
|
||||
<a id="flip_to" class="brackets" href="#null" onclick="flipView();">Switch to cloud</a>
|
||||
</div>
|
||||
<div id="flip_view_1" style="display:block;width:<?=WIDTH?>px;height:<?=HEIGHT?>px;position:relative;background-image:url(static/similar/<?=$ArtistID?>.png?t=<?=time()?>)">
|
||||
<div id="flip_view_1" style="display: block; width: <?=(WIDTH)?>px; height: <?=(HEIGHT)?>px; position: relative; background-image: url(static/similar/<?=($ArtistID)?>.png?t=<?=(time())?>)">
|
||||
<?
|
||||
$Similar->write_artists();
|
||||
?>
|
||||
</div>
|
||||
<div id="flip_view_2" style="display:none;width:<?=WIDTH?>px;height:<?=HEIGHT?>px;">
|
||||
<canvas width="<?=WIDTH?>px" height="<?=HEIGHT-20?>px" id="similarArtistsCanvas"></canvas>
|
||||
<div id="artistTags" style="display:none;">
|
||||
<div id="flip_view_2" style="display: none; width: <?=WIDTH?>px; height: <?=HEIGHT?>px;">
|
||||
<canvas width="<?=(WIDTH)?>px" height="<?=(HEIGHT - 20)?>px" id="similarArtistsCanvas"></canvas>
|
||||
<div id="artistTags" style="display: none;">
|
||||
<ul><li></li></ul>
|
||||
</div>
|
||||
<strong style="margin-left:10px;"><a id="currentArtist" href="#null">Loading...</a></strong>
|
||||
<strong style="margin-left: 10px;"><a id="currentArtist" href="#null">Loading...</a></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -875,7 +879,7 @@ function require(file, callback) {
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<? } // if $NumSimilar>0 ?>
|
||||
<? } // if $NumSimilar > 0 ?>
|
||||
<div class="box">
|
||||
<div id="info" class="head">
|
||||
<a href="#">↑</a>
|
||||
@ -891,16 +895,21 @@ function require(file, callback) {
|
||||
// gets the amount of comments for this group
|
||||
$Results = $Cache->get_value('artist_comments_'.$ArtistID);
|
||||
if ($Results === false) {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
COUNT(c.ID)
|
||||
FROM artist_comments as c
|
||||
WHERE c.ArtistID = '$ArtistID'");
|
||||
FROM artist_comments as c
|
||||
WHERE c.ArtistID = '$ArtistID'");
|
||||
list($Results) = $DB->next_record();
|
||||
$Cache->cache_value('artist_comments_'.$ArtistID, $Results, 0);
|
||||
}
|
||||
|
||||
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
|
||||
$DB->query("SELECT COUNT(ID) FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $_GET[postid]");
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM artist_comments
|
||||
WHERE ArtistID = $ArtistID
|
||||
AND ID <= $_GET[postid]");
|
||||
list($PostNum) = $DB->next_record();
|
||||
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
|
||||
} else {
|
||||
@ -908,15 +917,16 @@ function require(file, callback) {
|
||||
}
|
||||
|
||||
//Get the cache catalogue
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
|
||||
$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
|
||||
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
||||
$CatalogueLimit = $CatalogueID * THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
|
||||
|
||||
//---------- Get some data to start processing
|
||||
|
||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||
$Catalogue = $Cache->get_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID);
|
||||
if ($Catalogue === false) {
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
c.ID,
|
||||
c.AuthorID,
|
||||
c.AddedTime,
|
||||
@ -924,17 +934,17 @@ function require(file, callback) {
|
||||
c.EditedUserID,
|
||||
c.EditedTime,
|
||||
u.Username
|
||||
FROM artist_comments as c
|
||||
FROM artist_comments as c
|
||||
LEFT JOIN users_main AS u ON u.ID=c.EditedUserID
|
||||
WHERE c.ArtistID = '$ArtistID'
|
||||
ORDER BY c.ID
|
||||
LIMIT $CatalogueLimit");
|
||||
WHERE c.ArtistID = '$ArtistID'
|
||||
ORDER BY c.ID
|
||||
LIMIT $CatalogueLimit");
|
||||
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
|
||||
$Cache->cache_value('artist_comments_'.$ArtistID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
||||
}
|
||||
|
||||
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
|
||||
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)%THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
|
||||
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
|
||||
?>
|
||||
<div id="artistcomments" class="linkbox">
|
||||
<a name="comments"></a>
|
||||
@ -950,7 +960,7 @@ function require(file, callback) {
|
||||
list($PostID, $AuthorID, $AddedTime, $CommentBody, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
|
||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||
?>
|
||||
<table class="forum_post box vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||
<table class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>" id="post<?=$PostID?>">
|
||||
<colgroup>
|
||||
<? if (Users::has_avatars_enabled()) { ?>
|
||||
<col class="col_avatar" />
|
||||
@ -958,7 +968,7 @@ function require(file, callback) {
|
||||
<col class="col_post_body" />
|
||||
</colgroup>
|
||||
<tr class="colhead_dark">
|
||||
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>">
|
||||
<td colspan="<?=(Users::has_avatars_enabled() ? 2 : 1)?>">
|
||||
<div style="float:left;"><a class="post_id" href='artist.php?id=<?=$ArtistID?>&postid=<?=$PostID?>#post<?=$PostID?>'>#<?=$PostID?></a>
|
||||
<strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?>
|
||||
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a>
|
||||
@ -1015,7 +1025,7 @@ function require(file, callback) {
|
||||
</table>
|
||||
<? } ?>
|
||||
<div class="linkbox">
|
||||
<?=$Pages?>
|
||||
<?=($Pages)?>
|
||||
</div>
|
||||
<?
|
||||
View::parse('generic/reply/quickreply.php', array(
|
||||
@ -1031,9 +1041,9 @@ function require(file, callback) {
|
||||
// Cache page for later use
|
||||
|
||||
if ($RevisionID) {
|
||||
$Key = "artist_$ArtistID"."_revision_$RevisionID";
|
||||
$Key = "artist_$ArtistID" . "_revision_$RevisionID";
|
||||
} else {
|
||||
$Key = 'artist_'.$ArtistID;
|
||||
$Key = 'artist_' . $ArtistID;
|
||||
}
|
||||
|
||||
$Data = array(array($Name, $Image, $Body, $NumSimilar, $SimilarArray, array(), array(), $VanityHouseArtist));
|
||||
|
@ -4,16 +4,16 @@
|
||||
$ArtistID = db_string($_GET['artistid']);
|
||||
$Way = db_string($_GET['way']);
|
||||
|
||||
if(!is_number($SimilarID) || !is_number($ArtistID)) {
|
||||
if (!is_number($SimilarID) || !is_number($ArtistID)) {
|
||||
error(404);
|
||||
}
|
||||
if(!in_array($Way, array('up', 'down'))){
|
||||
if (!in_array($Way, array('up', 'down'))) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='$Way'");
|
||||
if($DB->record_count() == 0) {
|
||||
if($Way == 'down') {
|
||||
if ($DB->record_count() == 0) {
|
||||
if ($Way == 'down') {
|
||||
$Score = 'Score-100';
|
||||
} elseif($Way == 'up') {
|
||||
$Score = 'Score+100';
|
||||
|
@ -4,16 +4,18 @@
|
||||
|
||||
//~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
function compare($X, $Y){
|
||||
function compare($X, $Y) {
|
||||
return($Y['count'] - $X['count']);
|
||||
}
|
||||
|
||||
if(!empty($_GET['userid'])) {
|
||||
if(!check_perms('users_override_paranoia')) {
|
||||
if (!empty($_GET['userid'])) {
|
||||
if (!check_perms('users_override_paranoia')) {
|
||||
error(403);
|
||||
}
|
||||
$UserID = $_GET['userid'];
|
||||
if(!is_number($UserID)) { error(404); }
|
||||
if (!is_number($UserID)) {
|
||||
error(404);
|
||||
}
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
|
||||
list($Username) = $DB->next_record();
|
||||
} else {
|
||||
@ -39,9 +41,9 @@ function compare($X, $Y){
|
||||
// Handle stats and stuff
|
||||
$NumGroups++;
|
||||
|
||||
if($Artists) {
|
||||
foreach($Artists as $Artist) {
|
||||
if(!isset($ArtistCount[$Artist['id']])) {
|
||||
if ($Artists) {
|
||||
foreach ($Artists as $Artist) {
|
||||
if (!isset($ArtistCount[$Artist['id']])) {
|
||||
$ArtistCount[$Artist['id']] = array('name'=>$Artist['name'], 'count'=>1);
|
||||
} else {
|
||||
$ArtistCount[$Artist['id']]['count']++;
|
||||
@ -55,19 +57,21 @@ function compare($X, $Y){
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName = Artists::display_artists($ExtendedArtists);
|
||||
} elseif(count($Artists)>0) {
|
||||
} elseif (count($Artists) > 0) {
|
||||
$DisplayName = Artists::display_artists(array('1'=>$Artists));
|
||||
} else {
|
||||
$DisplayName = '';
|
||||
}
|
||||
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
|
||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName = $DisplayName . " [$GroupYear]";
|
||||
}
|
||||
if ($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
|
||||
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
|
||||
|
||||
// Start an output buffer, so we can store this output in $TorrentTable
|
||||
ob_start();
|
||||
if(count($Torrents)>1 || $GroupCategoryID==1) {
|
||||
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
|
||||
// Grouped torrents
|
||||
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
|
||||
?>
|
||||
@ -82,8 +86,8 @@ function compare($X, $Y){
|
||||
</td>
|
||||
<td colspan="5">
|
||||
<strong><?=$DisplayName?></strong>
|
||||
<span style="text-align:right" class="float_right">
|
||||
<? if(!$Sneaky){ ?>
|
||||
<span style="text-align: right;" class="float_right">
|
||||
<? if (!$Sneaky) { ?>
|
||||
<a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a>
|
||||
<br />
|
||||
<? } ?>
|
||||
@ -109,7 +113,7 @@ function compare($X, $Y){
|
||||
}
|
||||
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
|
||||
|
||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
|
||||
$EditionID++;
|
||||
@ -177,7 +181,7 @@ function compare($X, $Y){
|
||||
</span>
|
||||
<strong><?=$DisplayName?></strong>
|
||||
<div class="tags"><?=$TorrentTags->format()?></div>
|
||||
<? if(!$Sneaky){ ?>
|
||||
<? if (!$Sneaky) { ?>
|
||||
<span class="float_right float_clear"><a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, '');return false;">Unbookmark</a></span>
|
||||
<? } ?>
|
||||
<span class="float_right float_clear"><?=time_diff($AddedTime);?></span>
|
||||
@ -185,7 +189,7 @@ function compare($X, $Y){
|
||||
</td>
|
||||
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
|
||||
<td><?=number_format($Torrent['Snatched'])?></td>
|
||||
<td<?=($Torrent['Seeders']==0)?' class="r00"':''?>><?=number_format($Torrent['Seeders'])?></td>
|
||||
<td<?=(($Torrent['Seeders'] == 0) ? ' class="r00"' : '')?>><?=number_format($Torrent['Seeders'])?></td>
|
||||
<td><?=number_format($Torrent['Leechers'])?></td>
|
||||
</tr>
|
||||
<?
|
||||
@ -201,15 +205,17 @@ function compare($X, $Y){
|
||||
unset($ExtendedArtists[2]);
|
||||
unset($ExtendedArtists[3]);
|
||||
$DisplayName .= Artists::display_artists($ExtendedArtists, false);
|
||||
} elseif(count($Artists)>0) {
|
||||
} elseif (count($Artists) > 0) {
|
||||
$DisplayName .= Artists::display_artists(array('1'=>$Artists), false);
|
||||
}
|
||||
$DisplayName .= $GroupName;
|
||||
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
|
||||
if ($GroupYear > 0) {
|
||||
$DisplayName = $DisplayName . " [$GroupYear]";
|
||||
}
|
||||
?>
|
||||
<li class="image_group_<?=$GroupID?>">
|
||||
<a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
|
||||
<? if($WikiImage) {
|
||||
<? if ($WikiImage) {
|
||||
?>
|
||||
<img src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
|
||||
<? } else { ?>
|
||||
@ -264,13 +270,13 @@ function compare($X, $Y){
|
||||
<div class="head"><strong>Stats</strong></div>
|
||||
<ul class="stats nobullet">
|
||||
<li>Torrents: <?=$NumGroups?></li>
|
||||
<? if(count($ArtistCount) >0) { ?> <li>Artists: <?=count($ArtistCount)?></li> <? } ?>
|
||||
<? if (count($ArtistCount) > 0) { ?> <li>Artists: <?=count($ArtistCount)?></li> <? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box box_tags">
|
||||
<div class="head"><strong>Top tags</strong></div>
|
||||
<div class="pad">
|
||||
<ol style="padding-left:5px;">
|
||||
<ol style="padding-left: 5px;">
|
||||
<? Tags::format_top(5) ?>
|
||||
</ol>
|
||||
</div>
|
||||
@ -278,13 +284,15 @@ function compare($X, $Y){
|
||||
<div class="box box_artists">
|
||||
<div class="head"><strong>Top artists</strong></div>
|
||||
<div class="pad">
|
||||
<ol style="padding-left:5px;">
|
||||
<ol style="padding-left: 5px;">
|
||||
<?
|
||||
uasort($ArtistCount, 'compare');
|
||||
$i = 0;
|
||||
foreach ($ArtistCount as $ID => $Artist) {
|
||||
$i++;
|
||||
if($i>10) { break; }
|
||||
if ($i > 10) {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<li><a href="artist.php?id=<?=$ID?>"><?=display_str($Artist['name'])?></a> (<?=$Artist['count']?>)</li>
|
||||
<?
|
||||
@ -296,13 +304,13 @@ function compare($X, $Y){
|
||||
</div>
|
||||
<div class="main_column">
|
||||
<?
|
||||
if($CollageCovers != 0) { ?>
|
||||
if ($CollageCovers != 0) { ?>
|
||||
<div id="coverart" class="box">
|
||||
<div class="head" id="coverhead"><strong>Cover art</strong></div>
|
||||
<ul class="collage_images" id="collage_page0">
|
||||
<?
|
||||
$Page1 = array_slice($Collage, 0, $CollageCovers);
|
||||
foreach($Page1 as $Group) {
|
||||
foreach ($Page1 as $Group) {
|
||||
echo $Group;
|
||||
}?>
|
||||
</ul>
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
// Check for lame SQL injection attempts
|
||||
$CollageID = $_GET['collageid'];
|
||||
if(!is_number($CollageID)) {
|
||||
if (!is_number($CollageID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
@ -28,12 +28,13 @@
|
||||
//---------- Get some data to start processing
|
||||
|
||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||
if(!list($Catalogue,$Posts) = $Cache->get_value('collage_'.$CollageID.'_catalogue_'.$CatalogueID)) {
|
||||
$DB->query("SELECT SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
UserID,
|
||||
Time,
|
||||
Body
|
||||
if (!list($Catalogue,$Posts) = $Cache->get_value('collage_'.$CollageID.'_catalogue_'.$CatalogueID)) {
|
||||
$DB->query("
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
UserID,
|
||||
Time,
|
||||
Body
|
||||
FROM collages_comments
|
||||
WHERE CollageID = '$CollageID'
|
||||
LIMIT $CatalogueLimit");
|
||||
@ -44,7 +45,7 @@
|
||||
}
|
||||
|
||||
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
|
||||
$Thread = array_slice($Catalogue,((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)%THREAD_CATALOGUE),POSTS_PER_PAGE,true);
|
||||
$Thread = array_slice($Catalogue, ((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) % THREAD_CATALOGUE), POSTS_PER_PAGE, true);
|
||||
|
||||
$DB->query("SELECT Name FROM collages WHERE ID='$CollageID'");
|
||||
list($Name) = $DB->next_record();
|
||||
@ -60,7 +61,7 @@
|
||||
</h2>
|
||||
<div class="linkbox">
|
||||
<?
|
||||
$Pages=Format::get_pages($Page,$Posts,POSTS_PER_PAGE,9);
|
||||
$Pages = Format::get_pages($Page, $Posts, POSTS_PER_PAGE, 9);
|
||||
echo $Pages;
|
||||
?>
|
||||
</div>
|
||||
@ -68,24 +69,24 @@
|
||||
<?
|
||||
|
||||
//---------- Begin printing
|
||||
foreach($Thread as $Post){
|
||||
foreach ($Thread as $Post) {
|
||||
list($PostID, $AuthorID, $AddedTime, $Body) = $Post;
|
||||
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
|
||||
?>
|
||||
<table class="forum_post box vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : ''?>" id="post<?=$PostID?>">
|
||||
<table class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>" id="post<?=$PostID?>">
|
||||
<colgroup>
|
||||
<? if(Users::has_avatars_enabled()) { ?>
|
||||
<? if (Users::has_avatars_enabled()) { ?>
|
||||
<col class="col_avatar" />
|
||||
<? } ?>
|
||||
<col class="col_post_body" />
|
||||
</colgroup>
|
||||
<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="#post<?=$PostID?>">#<?=$PostID?></a>
|
||||
<?=Users::format_username($AuthorID, true, true, true, true, true)?> <?=time_diff($AddedTime)?>
|
||||
<? if (!$ThreadInfo['IsLocked']){ ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a><? }
|
||||
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');" class="brackets">Edit</a><? }
|
||||
if (check_perms('site_moderate_forums')){ ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a> <? } ?>
|
||||
<? if (!$ThreadInfo['IsLocked']) { ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a><? }
|
||||
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');" class="brackets">Edit</a><? }
|
||||
if (check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a> <? } ?>
|
||||
</span>
|
||||
<span id="bar<?=$PostID?>" style="float: right;">
|
||||
<a href="reports.php?action=report&type=collages_comment&id=<?=$PostID?>" class="brackets">Report</a>
|
||||
@ -107,8 +108,8 @@
|
||||
</tr>
|
||||
</table>
|
||||
<? }
|
||||
if(!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
||||
if($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
|
||||
if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
||||
if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
|
||||
|
||||
View::parse('generic/reply/quickreply.php', array(
|
||||
'InputName' => 'collageid',
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
//~~~~~~~~~~~ Main collage page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
function compare($X, $Y){
|
||||
function compare($X, $Y) {
|
||||
return($Y['count'] - $X['count']);
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ function compare($X, $Y){
|
||||
<div class="pad"><?=$Text->full_format($Description)?></div>
|
||||
</div>
|
||||
<?
|
||||
if (check_perms('zip_downloader')){
|
||||
if (check_perms('zip_downloader')) {
|
||||
if (isset($LoggedUser['Collector'])) {
|
||||
list($ZIPList,$ZIPPrefs) = $LoggedUser['Collector'];
|
||||
$ZIPList = explode(':',$ZIPList);
|
||||
@ -412,19 +412,19 @@ function compare($X, $Y){
|
||||
<? $OpenGroup = true;
|
||||
}
|
||||
?>
|
||||
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)){ echo ' disabled="disabled"'; }?>><?=$OptName?></option>
|
||||
<option id="opt<?=$GroupID.$OptionID?>" value="<?=$GroupID.$OptionID?>"<? if (in_array($GroupID.$OptionID,$ZIPList)) { echo ' disabled="disabled"'; }?>><?=$OptName?></option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<button type="button" onclick="add_selection()">+</button>
|
||||
<select name="preference" style="width:210px">
|
||||
<option value="0"<? if ($ZIPPrefs == 0){ echo ' selected="selected"'; } ?>>Prefer Original</option>
|
||||
<option value="1"<? if ($ZIPPrefs == 1){ echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||
<option value="2"<? if ($ZIPPrefs == 2){ echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||
<select name="preference" style="width: 210px;">
|
||||
<option value="0"<? if ($ZIPPrefs == 0) { echo ' selected="selected"'; } ?>>Prefer Original</option>
|
||||
<option value="1"<? if ($ZIPPrefs == 1) { echo ' selected="selected"'; } ?>>Prefer Best Seeded</option>
|
||||
<option value="2"<? if ($ZIPPrefs == 2) { echo ' selected="selected"'; } ?>>Prefer Bonus Tracks</option>
|
||||
</select>
|
||||
<input type="submit" style="width:210px" value="Download" />
|
||||
<input type="submit" style="width: 210px;" value="Download" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -474,7 +474,7 @@ function compare($X, $Y){
|
||||
<div class="box box_contributors">
|
||||
<div class="head"><strong>Top contributors</strong></div>
|
||||
<div class="pad">
|
||||
<ol style="padding-left:5px;">
|
||||
<ol style="padding-left: 5px;">
|
||||
<?
|
||||
uasort($Users, 'compare');
|
||||
$i = 0;
|
||||
@ -493,7 +493,7 @@ function compare($X, $Y){
|
||||
</div>
|
||||
<? if (check_perms('site_collages_manage') && !$PreventAdditions) { ?>
|
||||
<div class="box box_addtorrent">
|
||||
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add'?'Individual add':'Batch add'); return false;" class="brackets">Batch add</a></span></div>
|
||||
<div class="head"><strong>Add torrent</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
|
||||
<div class="pad add_torrent_container">
|
||||
<form class="add_form" name="torrent" action="collages.php" method="post">
|
||||
<input type="hidden" name="action" value="add_torrent" />
|
||||
@ -521,16 +521,18 @@ function compare($X, $Y){
|
||||
<h3>Comments</h3>
|
||||
<?
|
||||
if (empty($CommentList)) {
|
||||
$DB->query("SELECT
|
||||
cc.ID,
|
||||
cc.Body,
|
||||
cc.UserID,
|
||||
um.Username,
|
||||
cc.Time
|
||||
$DB->query("
|
||||
SELECT
|
||||
cc.ID,
|
||||
cc.Body,
|
||||
cc.UserID,
|
||||
um.Username,
|
||||
cc.Time
|
||||
FROM collages_comments AS cc
|
||||
LEFT JOIN users_main AS um ON um.ID=cc.UserID
|
||||
WHERE CollageID='$CollageID'
|
||||
ORDER BY ID DESC LIMIT 15");
|
||||
ORDER BY ID DESC
|
||||
LIMIT 15");
|
||||
$CommentList = $DB->to_array(false, MYSQLI_NUM);
|
||||
}
|
||||
foreach ($CommentList as $Comment) {
|
||||
@ -588,11 +590,11 @@ function compare($X, $Y){
|
||||
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong><< First</strong></a> | </span>
|
||||
<span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>< Prev</strong></a> | </span>
|
||||
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
|
||||
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></strong></a><?=($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : ''?></span>
|
||||
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups,$CollageCovers * ($i + 1))?></strong></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
|
||||
<? } ?>
|
||||
<span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
|
||||
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next ></strong></a></span>
|
||||
<span id="lastpage" class="<?=ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : ''?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last >></strong></a></span>
|
||||
<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last >></strong></a></span>
|
||||
</div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
collageShow.init(<?=json_encode($CollagePages)?>);
|
||||
|
@ -11,7 +11,7 @@
|
||||
\*********************************************************************/
|
||||
|
||||
// Quick SQL injection check
|
||||
if(!$_GET['post'] || !is_number($_GET['post'])){
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
|
@ -1,49 +1,57 @@
|
||||
<?php
|
||||
|
||||
authorize();
|
||||
authorize();
|
||||
|
||||
$CollageID = $_POST['collageid'];
|
||||
if(!is_number($CollageID)) { error(404); }
|
||||
$CollageID = $_POST['collageid'];
|
||||
if (!is_number($CollageID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
|
||||
list($UserID, $CategoryID) = $DB->next_record();
|
||||
if($CategoryID == 0 && $UserID!=$LoggedUser['ID'] && !check_perms('site_collages_delete')) { error(403); }
|
||||
$DB->query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
|
||||
list($UserID, $CategoryID) = $DB->next_record();
|
||||
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$GroupID = $_POST['groupid'];
|
||||
if(!is_number($GroupID)) { error(404); }
|
||||
$GroupID = $_POST['groupid'];
|
||||
if (!is_number($GroupID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
if($_POST['submit'] == 'Remove') {
|
||||
$DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
||||
$Rows = $DB->affected_rows();
|
||||
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('torrent_collages_'.$GroupID);
|
||||
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
|
||||
} elseif(isset($_POST['drag_drop_collage_sort_order'])) {
|
||||
if ($_POST['submit'] == 'Remove') {
|
||||
$DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
||||
$Rows = $DB->affected_rows();
|
||||
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$Cache->delete_value('torrent_collages_'.$GroupID);
|
||||
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
|
||||
} elseif (isset($_POST['drag_drop_collage_sort_order'])) {
|
||||
|
||||
@parse_str($_POST['drag_drop_collage_sort_order'], $Series);
|
||||
$Series = @array_shift($Series);
|
||||
if(is_array($Series)){
|
||||
$SQL = array();
|
||||
foreach($Series as $Sort => $GroupID){
|
||||
if(is_number($Sort) && is_number($GroupID)){
|
||||
$Sort = ($Sort+1) * 10;
|
||||
$SQL[] = sprintf('(%d, %d, %d)', $GroupID, $Sort, $CollageID);
|
||||
}
|
||||
@parse_str($_POST['drag_drop_collage_sort_order'], $Series);
|
||||
$Series = @array_shift($Series);
|
||||
if (is_array($Series)) {
|
||||
$SQL = array();
|
||||
foreach ($Series as $Sort => $GroupID) {
|
||||
if (is_number($Sort) && is_number($GroupID)) {
|
||||
$Sort = ($Sort + 1) * 10;
|
||||
$SQL[] = sprintf('(%d, %d, %d)', $GroupID, $Sort, $CollageID);
|
||||
}
|
||||
|
||||
$SQL = 'INSERT INTO collages_torrents (GroupID, Sort, CollageID) VALUES '
|
||||
. implode(', ', $SQL)
|
||||
. ' ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
|
||||
|
||||
$DB->query($SQL);
|
||||
}
|
||||
|
||||
} else {
|
||||
$Sort = $_POST['sort'];
|
||||
if(!is_number($Sort)) { error(404); }
|
||||
$DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
||||
$SQL = 'INSERT INTO collages_torrents (GroupID, Sort, CollageID) VALUES '
|
||||
. implode(', ', $SQL)
|
||||
. ' ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
|
||||
|
||||
$DB->query($SQL);
|
||||
}
|
||||
|
||||
$Cache->delete_value('collage_'.$CollageID);
|
||||
header('Location: collages.php?action=manage&collageid='.$CollageID);
|
||||
} else {
|
||||
$Sort = $_POST['sort'];
|
||||
if (!is_number($Sort)) {
|
||||
error(404);
|
||||
}
|
||||
$DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
|
||||
}
|
||||
|
||||
$Cache->delete_value('collage_'.$CollageID);
|
||||
header('Location: collages.php?action=manage&collageid='.$CollageID);
|
||||
|
@ -2,7 +2,9 @@
|
||||
// Paypal hits this page once a donation has gone through.
|
||||
// This may appear to be light on the input validation, but the vast majority of that is handled through paypal confirmation
|
||||
// $_POST['txn_id'] centains the unique identifier if anyone ever needs it
|
||||
if(!is_number($_POST['custom'])) { die(); } //Seems too stupid a mistake to bother banning
|
||||
if (!is_number($_POST['custom'])) {
|
||||
die(); //Seems too stupid a mistake to bother banning
|
||||
}
|
||||
|
||||
// Create request to return to paypal
|
||||
$Request = 'cmd=_notify-validate';
|
||||
@ -35,7 +37,7 @@
|
||||
if (($_POST['payment_status'] == "Completed") || ($_POST['payment_status'] == "Pending")) {
|
||||
$DB->query('SELECT Donor FROM users_info WHERE UserID=\''.$_POST['custom'].'\'');
|
||||
list($Donor) = $DB->next_record();
|
||||
if($Donor == 0){
|
||||
if ($Donor == 0) {
|
||||
//First time donor
|
||||
$DB->query('UPDATE users_main SET Invites = Invites + \''.DONOR_INVITES.'\' WHERE ID=\''.$_POST['custom'].'\'');
|
||||
$DB->query('UPDATE users_info SET Donor = \'1\' WHERE UserID=\''.$_POST['custom'].'\'');
|
||||
@ -69,7 +71,7 @@
|
||||
if ($TotalDonated+$_POST['mc_gross'] == 0) {
|
||||
$DB->query("SELECT Invites FROM users_main WHERE ID='".$_POST['custom']."'");
|
||||
list($Invites) = $DB->next_record();
|
||||
if(($Invites - DONOR_INVITES) >= 0) {
|
||||
if (($Invites - DONOR_INVITES) >= 0) {
|
||||
$NewInvites = $Invites - DONOR_INVITES;
|
||||
} else {
|
||||
$NewInvites = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<h1>Error: 404</h1> Not Found.
|
||||
<?
|
||||
//Hide alerts for missing images and static requests
|
||||
if(!preg_match("/\.(ico|jpg|jpeg|gif|png)$/", $_SERVER['REQUEST_URI']) && substr($_SERVER['REQUEST_URI'],0,9) !== '/static/') {
|
||||
if (!preg_match("/\.(ico|jpg|jpeg|gif|png)$/", $_SERVER['REQUEST_URI']) && substr($_SERVER['REQUEST_URI'],0,9) !== '/static/') {
|
||||
notify(STATUS_CHAN,'404');
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ function notify ($Channel, $Message) {
|
||||
|
||||
$Errors = array('403','404','413','504');
|
||||
|
||||
if(!empty($_GET['e']) && in_array($_GET['e'],$Errors)) {
|
||||
//Webserver error i.e. http://sitename/madeupdocument.php
|
||||
if (!empty($_GET['e']) && in_array($_GET['e'],$Errors)) {
|
||||
// Web server error i.e. http://sitename/madeupdocument.php
|
||||
include($_GET['e'].'.php');
|
||||
} else {
|
||||
//Gazelle error (Come from the error() function)
|
||||
// Gazelle error (Come from the error() function)
|
||||
switch ($Error) {
|
||||
|
||||
case '403':
|
||||
@ -33,7 +33,7 @@ function notify ($Channel, $Message) {
|
||||
$Description = "Something was wrong with your request, and the server is refusing to fulfill it.";
|
||||
break;
|
||||
default:
|
||||
if(!empty($Error)) {
|
||||
if (!empty($Error)) {
|
||||
$Title = 'Error';
|
||||
$Description = $Error;
|
||||
} else {
|
||||
@ -42,11 +42,11 @@ function notify ($Channel, $Message) {
|
||||
}
|
||||
}
|
||||
|
||||
if($Log) {
|
||||
if ($Log) {
|
||||
$Description .= ' <a href="log.php?search='.$Log.'">Search Log</a>';
|
||||
}
|
||||
|
||||
if(empty($Ajax) && $Error != -1) {
|
||||
if (empty($Ajax) && $Error != -1) {
|
||||
View::show_header($Title);
|
||||
?>
|
||||
<div class="thin">
|
||||
|
@ -77,15 +77,17 @@
|
||||
$Feed->channel('Blog', 'RSS feed for site blog.');
|
||||
if (!$Blog = $Cache->get_value('blog')) {
|
||||
require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper
|
||||
$DB=NEW DB_MYSQL; //Load the database wrapper
|
||||
$DB->query("SELECT
|
||||
b.ID,
|
||||
um.Username,
|
||||
b.Title,
|
||||
b.Body,
|
||||
b.Time,
|
||||
b.ThreadID
|
||||
FROM blog AS b LEFT JOIN users_main AS um ON b.UserID=um.ID
|
||||
$DB = NEW DB_MYSQL; //Load the database wrapper
|
||||
$DB->query("
|
||||
SELECT
|
||||
b.ID,
|
||||
um.Username,
|
||||
b.Title,
|
||||
b.Body,
|
||||
b.Time,
|
||||
b.ThreadID
|
||||
FROM blog AS b
|
||||
LEFT JOIN users_main AS um ON b.UserID=um.ID
|
||||
ORDER BY Time DESC
|
||||
LIMIT 20");
|
||||
$Blog = $DB->to_array();
|
||||
@ -93,7 +95,7 @@
|
||||
}
|
||||
foreach ($Blog as $BlogItem) {
|
||||
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
|
||||
if($ThreadID) {
|
||||
if ($ThreadID) {
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), 'forums.php?action=viewthread&threadid='.$ThreadID, SITE_NAME.' Staff','','',$BlogTime);
|
||||
} else {
|
||||
echo $Feed->item($Title, $Text->strip_bbcode($Body), 'blog.php#blog'.$BlogID, SITE_NAME.' Staff','','',$BlogTime);
|
||||
@ -154,15 +156,15 @@
|
||||
break;
|
||||
default:
|
||||
// Personalized torrents
|
||||
if(empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
|
||||
if (empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_') {
|
||||
// All personalized torrent notifications
|
||||
$Feed->channel('Personalized torrent notifications', 'RSS feed for personalized torrent notifications.');
|
||||
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
|
||||
} elseif(!empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_'){
|
||||
} elseif (!empty($_GET['name']) && substr($_GET['feed'], 0, 16) == 'torrents_notify_') {
|
||||
// Specific personalized torrent notification channel
|
||||
$Feed->channel(display_str($_GET['name']), 'Personal RSS feed: '.display_str($_GET['name']));
|
||||
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
|
||||
} elseif(!empty($_GET['name']) && substr($_GET['feed'], 0, 21) == 'torrents_bookmarks_t_') {
|
||||
} elseif (!empty($_GET['name']) && substr($_GET['feed'], 0, 21) == 'torrents_bookmarks_t_') {
|
||||
// Bookmarks
|
||||
$Feed->channel('Bookmarked torrent notifications', 'RSS feed for bookmarked torrents.');
|
||||
$Feed->retrieve($_GET['feed'],$_GET['authkey'],$_GET['passkey']);
|
||||
|
@ -12,7 +12,7 @@
|
||||
\*********************************************************************/
|
||||
|
||||
// Quick SQL injection check
|
||||
if(!$_GET['post'] || !is_number($_GET['post'])){
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
@ -20,14 +20,17 @@
|
||||
$PostID = $_GET['post'];
|
||||
|
||||
// Mainly
|
||||
$DB->query("SELECT
|
||||
p.Body, t.ForumID
|
||||
FROM forums_posts as p JOIN forums_topics as t on p.TopicID = t.ID
|
||||
WHERE p.ID='$PostID'");
|
||||
$DB->query("
|
||||
SELECT
|
||||
p.Body,
|
||||
t.ForumID
|
||||
FROM forums_posts as p
|
||||
JOIN forums_topics as t on p.TopicID = t.ID
|
||||
WHERE p.ID='$PostID'");
|
||||
list($Body, $ForumID) = $DB->next_record(MYSQLI_NUM);
|
||||
|
||||
// Is the user allowed to view the post?
|
||||
if(!check_forumperm($ForumID)) {
|
||||
if (!check_forumperm($ForumID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
@ -35,4 +38,4 @@
|
||||
|
||||
echo trim($Body);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -15,7 +15,7 @@
|
||||
if (!is_number($_POST['threadid'])) {
|
||||
error(404);
|
||||
}
|
||||
if ($_POST['title'] == ''){
|
||||
if ($_POST['title'] == '') {
|
||||
error(0);
|
||||
}
|
||||
// End injection check
|
||||
|
@ -12,17 +12,18 @@
|
||||
}
|
||||
|
||||
if (!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) {
|
||||
$DB->query("SELECT
|
||||
t.Title,
|
||||
t.ForumID,
|
||||
t.IsLocked,
|
||||
t.IsSticky,
|
||||
COUNT(fp.id) AS Posts,
|
||||
t.LastPostAuthorID,
|
||||
ISNULL(p.TopicID) AS NoPoll
|
||||
$DB->query("
|
||||
SELECT
|
||||
t.Title,
|
||||
t.ForumID,
|
||||
t.IsLocked,
|
||||
t.IsSticky,
|
||||
COUNT(fp.id) AS Posts,
|
||||
t.LastPostAuthorID,
|
||||
ISNULL(p.TopicID) AS NoPoll
|
||||
FROM forums_topics AS t
|
||||
JOIN forums_posts AS fp ON fp.TopicID = t.ID
|
||||
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
||||
JOIN forums_posts AS fp ON fp.TopicID = t.ID
|
||||
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
|
||||
WHERE t.ID = '$TopicID'
|
||||
GROUP BY fp.TopicID");
|
||||
if ($DB->record_count() == 0) {
|
||||
@ -36,10 +37,22 @@
|
||||
$ForumID = $ThreadInfo['ForumID'];
|
||||
|
||||
if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->get_value('polls_'.$TopicID)) {
|
||||
$DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$TopicID."'");
|
||||
$DB->query("
|
||||
SELECT
|
||||
Question,
|
||||
Answers,
|
||||
Featured,
|
||||
Closed
|
||||
FROM forums_polls
|
||||
WHERE TopicID='$TopicID'");
|
||||
list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
|
||||
$Answers = unserialize($Answers);
|
||||
$DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$TopicID' AND Vote <> '0' GROUP BY Vote");
|
||||
$DB->query("
|
||||
SELECT Vote, COUNT(UserID)
|
||||
FROM forums_polls_votes
|
||||
WHERE TopicID='$TopicID'
|
||||
AND Vote <> '0'
|
||||
GROUP BY Vote");
|
||||
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
||||
|
||||
$Votes = array();
|
||||
@ -82,13 +95,15 @@
|
||||
<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 />
|
||||
<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>
|
||||
<?
|
||||
} else {
|
||||
authorize();
|
||||
$Vote = $_POST['vote'];
|
||||
if (!isset($Answers[$Vote]) && $Vote != 0) { error(0,true); }
|
||||
if (!isset($Answers[$Vote]) && $Vote != 0) {
|
||||
error(0,true);
|
||||
}
|
||||
|
||||
//Add our vote
|
||||
$DB->query('INSERT IGNORE INTO forums_polls_votes (TopicID, UserID, Vote) VALUES ('.$TopicID.','.$LoggedUser['ID'].','.$Vote.')');
|
||||
@ -127,12 +142,13 @@
|
||||
<? }
|
||||
} else {
|
||||
//Staff forum, output voters, not percentages
|
||||
$DB->query("SELECT GROUP_CONCAT(um.Username SEPARATOR ', '),
|
||||
fpv.Vote
|
||||
FROM users_main AS um
|
||||
JOIN forums_polls_votes AS fpv ON um.ID = fpv.UserID
|
||||
WHERE TopicID = ".$TopicID."
|
||||
GROUP BY fpv.Vote");
|
||||
$DB->query("
|
||||
SELECT GROUP_CONCAT(um.Username SEPARATOR ', '),
|
||||
fpv.Vote
|
||||
FROM users_main AS um
|
||||
JOIN forums_polls_votes AS fpv ON um.ID = fpv.UserID
|
||||
WHERE TopicID = $TopicID
|
||||
GROUP BY fpv.Vote");
|
||||
|
||||
$StaffVotes = $DB->to_array();
|
||||
foreach ($StaffVotes as $StaffVote) {
|
||||
|
@ -341,7 +341,7 @@
|
||||
<input type="hidden" name="large" value="1" />
|
||||
<input type="hidden" name="topicid" value="<?=$ThreadID?>" />
|
||||
<ul style="list-style: none;" id="poll_options">
|
||||
<? foreach($Answers as $i => $Answer) { //for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
|
||||
<? foreach ($Answers as $i => $Answer) { //for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
|
||||
<li>
|
||||
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
|
||||
<label for="answer_<?=$i?>"><?=display_str($Answer)?></label>
|
||||
@ -352,16 +352,16 @@
|
||||
<input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br />
|
||||
</li>
|
||||
</ul>
|
||||
<? if($ForumID == STAFF_FORUM) { ?>
|
||||
<? if ($ForumID == STAFF_FORUM) { ?>
|
||||
<a href="#" onclick="AddPollOption(<?=$ThreadID?>); return false;" class="brackets">+</a>
|
||||
<br />
|
||||
<br />
|
||||
<? } ?>
|
||||
<input type="button" style="float: left;" onclick="ajax.post('index.php','poll',function(response){$('#poll_container').raw().innerHTML = response});" value="Vote" />
|
||||
<input type="button" style="float: left;" onclick="ajax.post('index.php','poll',function(response) { $('#poll_container').raw().innerHTML = response});" value="Vote" />
|
||||
</form>
|
||||
</div>
|
||||
<? } ?>
|
||||
<? if(check_perms('forums_polls_moderate') && !$RevealVoters) {
|
||||
<? }
|
||||
if (check_perms('forums_polls_moderate') && !$RevealVoters) {
|
||||
if (!$Featured || $Featured == '0000-00-00 00:00:00') {
|
||||
?>
|
||||
<form class="manage_form" name="poll" action="forums.php" method="post">
|
||||
@ -386,11 +386,11 @@
|
||||
} //End Polls
|
||||
|
||||
//Sqeeze in stickypost
|
||||
if($ThreadInfo['StickyPostID']) {
|
||||
if($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
|
||||
if ($ThreadInfo['StickyPostID']) {
|
||||
if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
|
||||
array_unshift($Thread, $ThreadInfo['StickyPost']);
|
||||
}
|
||||
if($ThreadInfo['StickyPostID'] != $Thread[count($Thread)-1]['ID']) {
|
||||
if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread) - 1]['ID']) {
|
||||
$Thread[] = $ThreadInfo['StickyPost'];
|
||||
}
|
||||
}
|
||||
@ -429,16 +429,16 @@
|
||||
if ((!$ThreadInfo['IsLocked'] && check_forumperm($ForumID, 'Write') && $AuthorID == $LoggedUser['ID']) || check_perms('site_moderate_forums')) { ?>
|
||||
- <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>','<?=$Key?>');" class="brackets">Edit</a>
|
||||
<? }
|
||||
if(check_perms('site_admin_forums') && $ThreadInfo['Posts'] > 1) { ?>
|
||||
if (check_perms('site_admin_forums') && $ThreadInfo['Posts'] > 1) { ?>
|
||||
- <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a>
|
||||
<? }
|
||||
if($PostID == $ThreadInfo['StickyPostID']) { ?>
|
||||
if ($PostID == $ThreadInfo['StickyPostID']) { ?>
|
||||
<strong><span class="sticky_post_label" class="brackets">Sticky</span></strong>
|
||||
<? if(check_perms('site_moderate_forums')) { ?>
|
||||
<? if (check_perms('site_moderate_forums')) { ?>
|
||||
- <a href="forums.php?action=sticky_post&threadid=<?=$ThreadID?>&postid=<?=$PostID?>&remove=true&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">X</a>
|
||||
<? }
|
||||
} else {
|
||||
if(check_perms('site_moderate_forums')) { ?>
|
||||
if (check_perms('site_moderate_forums')) { ?>
|
||||
- <a href="forums.php?action=sticky_post&threadid=<?=$ThreadID?>&postid=<?=$PostID?>&auth=<?=$LoggedUser['AuthKey']?>" class="brackets">⇕</a>
|
||||
<? }
|
||||
}
|
||||
@ -448,7 +448,7 @@
|
||||
<a href="reports.php?action=report&type=post&id=<?=$PostID?>" class="brackets">Report</a>
|
||||
<? if (check_perms('users_warn') && $AuthorID != $LoggedUser['ID']) {
|
||||
$AuthorInfo = Users::user_info($AuthorID);
|
||||
if($LoggedUser['Class'] >= $AuthorInfo['Class']) {
|
||||
if ($LoggedUser['Class'] >= $AuthorInfo['Class']) {
|
||||
?>
|
||||
<form class="manage_form hidden" name="user" id="warn<?=$PostID?>" action="" method="post">
|
||||
<input type="hidden" name="action" value="warn" />
|
||||
@ -471,7 +471,7 @@
|
||||
<?=Users::show_avatar($Avatar, $Username, $HeavyInfo['DisableAvatars'])?>
|
||||
</td>
|
||||
<? } ?>
|
||||
<td class="body" valign="top"<? if(!Users::has_avatars_enabled()) { echo ' colspan="2"'; } ?>>
|
||||
<td class="body" valign="top"<? if (!Users::has_avatars_enabled()) { echo ' colspan="2"'; } ?>>
|
||||
<div id="content<?=$PostID?>">
|
||||
<?=$Text->full_format($Body) ?>
|
||||
<? if ($EditedUserID) { ?>
|
||||
@ -498,7 +498,7 @@
|
||||
</div>
|
||||
<?
|
||||
if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
|
||||
if(check_forumperm($ForumID, 'Write') && !$LoggedUser['DisablePosting']) {
|
||||
if (check_forumperm($ForumID, 'Write') && !$LoggedUser['DisablePosting']) {
|
||||
View::parse('generic/reply/quickreply.php', array(
|
||||
'InputTitle' => 'Post reply',
|
||||
'InputName' => 'thread',
|
||||
@ -508,7 +508,7 @@
|
||||
));
|
||||
}
|
||||
}
|
||||
if(check_perms('site_moderate_forums')) {
|
||||
if (check_perms('site_moderate_forums')) {
|
||||
?>
|
||||
<br />
|
||||
<h3>Edit thread</h3>
|
||||
@ -554,20 +554,20 @@
|
||||
|
||||
if ($Forum['CategoryID'] != $LastCategoryID) {
|
||||
$LastCategoryID = $Forum['CategoryID'];
|
||||
if($OpenGroup) { ?>
|
||||
if ($OpenGroup) { ?>
|
||||
</optgroup>
|
||||
<? } ?>
|
||||
<optgroup label="<?=$ForumCats[$Forum['CategoryID']]?>">
|
||||
<? $OpenGroup = true;
|
||||
}
|
||||
?>
|
||||
<option value="<?=$Forum['ID']?>"<? if($ThreadInfo['ForumID'] == $Forum['ID']) { echo ' selected="selected"';} ?>><?=display_str($Forum['Name'])?></option>
|
||||
<option value="<?=$Forum['ID']?>"<? if ($ThreadInfo['ForumID'] == $Forum['ID']) { echo ' selected="selected"';} ?>><?=display_str($Forum['Name'])?></option>
|
||||
<? } ?>
|
||||
</optgroup>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<? if(check_perms('site_admin_forums')) { ?>
|
||||
<? if (check_perms('site_admin_forums')) { ?>
|
||||
<tr>
|
||||
<td class="label">Delete thread</td>
|
||||
<td>
|
||||
|
@ -3,32 +3,36 @@
|
||||
// The image proxy does not use script_start.php, its code instead resides entirely in image.php in the document root
|
||||
// Bear this in mind when you try to use script_start functions.
|
||||
|
||||
if(!check_perms('site_proxy_images')) { error('forbidden'); }
|
||||
if (!check_perms('site_proxy_images')) {
|
||||
error('forbidden');
|
||||
}
|
||||
$URL = isset($_GET['i']) ? htmlspecialchars_decode($_GET['i']) : null;
|
||||
|
||||
if(!extension_loaded('openssl') && strtoupper($URL[4]) == 'S') { error('badprotocol'); }
|
||||
if (!extension_loaded('openssl') && strtoupper($URL[4]) == 'S') {
|
||||
error('badprotocol');
|
||||
}
|
||||
|
||||
if(!preg_match('/^'.IMAGE_REGEX.'/is',$URL,$Matches)) {
|
||||
if (!preg_match('/^'.IMAGE_REGEX.'/is',$URL,$Matches)) {
|
||||
error('invalid');
|
||||
}
|
||||
|
||||
if(isset($_GET['c'])) {
|
||||
if (isset($_GET['c'])) {
|
||||
list($Data,$Type) = $Cache->get_value('image_cache_'.md5($URL));
|
||||
$Cached = true;
|
||||
}
|
||||
if(!isset($Data) || !$Data) {
|
||||
if (!isset($Data) || !$Data) {
|
||||
$Cached = false;
|
||||
$Data = @file_get_contents($URL,0,stream_context_create(array('http'=>array('timeout'=>15))));
|
||||
if(!$Data || empty($Data)) {
|
||||
if (!$Data || empty($Data)) {
|
||||
error('timeout');
|
||||
}
|
||||
$Type = image_type($Data);
|
||||
if($Type && function_exists('imagecreatefrom'.$Type)) {
|
||||
if ($Type && function_exists('imagecreatefrom'.$Type)) {
|
||||
$Image = imagecreatefromstring($Data);
|
||||
if(invisible($Image)) {
|
||||
if (invisible($Image)) {
|
||||
error('invisible');
|
||||
}
|
||||
if(verysmall($Image)) {
|
||||
if (verysmall($Image)) {
|
||||
error('small');
|
||||
}
|
||||
}
|
||||
@ -39,19 +43,21 @@
|
||||
}
|
||||
|
||||
// Enforce avatar rules
|
||||
if(isset($_GET['avatar'])) {
|
||||
if(!is_number($_GET['avatar'])) { die(); }
|
||||
if (isset($_GET['avatar'])) {
|
||||
if (!is_number($_GET['avatar'])) {
|
||||
die();
|
||||
}
|
||||
$UserID = $_GET['avatar'];
|
||||
|
||||
$Height = image_height($Type, $Data);
|
||||
if(strlen($Data)>256*1024 || $Height>400) {
|
||||
if (strlen($Data) > 256 * 1024 || $Height > 400) {
|
||||
// Sometimes the cached image we have isn't the actual image
|
||||
if($Cached) {
|
||||
if ($Cached) {
|
||||
$Data2 = @file_get_contents($URL,0,stream_context_create(array('http'=>array('timeout'=>15))));
|
||||
} else {
|
||||
$Data2 = $Data;
|
||||
}
|
||||
if(strlen($Data2)>256*1024 || image_height($Type, $Data2)>400) {
|
||||
if (strlen($Data2) > 256 * 1024 || image_height($Type, $Data2) > 400) {
|
||||
require_once(SERVER_ROOT.'/classes/class_mysql.php');
|
||||
require_once(SERVER_ROOT.'/classes/class_time.php'); //Require the time class
|
||||
|
||||
@ -63,7 +69,10 @@
|
||||
$UserInfo['Avatar'] = '';
|
||||
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
|
||||
|
||||
$DB->query("UPDATE users_info SET Avatar='', AdminComment=CONCAT('".sqltime()." - Avatar reset automatically (Size: ".number_format((strlen($Data)) / 1024)." kB, Height: ".$Height."px). Used to be $DBURL\n\n', AdminComment) WHERE UserID='$UserID'");
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET Avatar='', AdminComment=CONCAT('".sqltime()." - Avatar reset automatically (Size: ".number_format((strlen($Data)) / 1024)." kB, Height: ".$Height."px). Used to be $DBURL\n\n', AdminComment)
|
||||
WHERE UserID='$UserID'");
|
||||
|
||||
// Send PM
|
||||
|
||||
@ -79,12 +88,12 @@
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: solve this properl for photoshop output images which prepend shit to the image file. skip it or strip it
|
||||
TODO: solve this properly for photoshop output images which prepend shit to the image file. skip it or strip it
|
||||
if (!isset($Type)) {
|
||||
error('timeout');
|
||||
}
|
||||
*/
|
||||
if(isset($Type)) {
|
||||
if (isset($Type)) {
|
||||
header('Content-type: image/'.$Type);
|
||||
}
|
||||
echo $Data;
|
||||
|
@ -1,22 +1,26 @@
|
||||
<?
|
||||
|
||||
if(empty($Return)) {
|
||||
if (empty($Return)) {
|
||||
$ToID = $_GET['to'];
|
||||
if($ToID == $LoggedUser['ID']) {
|
||||
if ($ToID == $LoggedUser['ID']) {
|
||||
error("You cannot start a conversation with yourself!");
|
||||
header('Location: inbox.php');
|
||||
}
|
||||
}
|
||||
|
||||
if(!$ToID || !is_number($ToID)) { error(404); }
|
||||
if (!$ToID || !is_number($ToID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
if(!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$ToID])) {
|
||||
if (!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$ToID])) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("SELECT Username FROM users_main WHERE ID='$ToID'");
|
||||
list($Username) = $DB->next_record();
|
||||
if(!$Username) { error(404); }
|
||||
if (!$Username) {
|
||||
error(404);
|
||||
}
|
||||
View::show_header('Compose', 'inbox,bbcode');
|
||||
?>
|
||||
<div class="thin">
|
||||
|
@ -3,13 +3,15 @@
|
||||
$Text = new TEXT;
|
||||
|
||||
$ConvID = $_GET['id'];
|
||||
if(!$ConvID || !is_number($ConvID)) { error(404); }
|
||||
if (!$ConvID || !is_number($ConvID)) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$UserID = $LoggedUser['ID'];
|
||||
$DB->query("SELECT InInbox, InSentbox FROM pm_conversations_users WHERE UserID='$UserID' AND ConvID='$ConvID'");
|
||||
if($DB->record_count() == 0) {
|
||||
if ($DB->record_count() == 0) {
|
||||
error(403);
|
||||
}
|
||||
list($InInbox, $InSentbox) = $DB->next_record();
|
||||
@ -23,23 +25,26 @@
|
||||
}
|
||||
|
||||
// Get information on the conversation
|
||||
$DB->query("SELECT
|
||||
c.Subject,
|
||||
cu.Sticky,
|
||||
cu.UnRead,
|
||||
cu.ForwardedTo
|
||||
$DB->query("
|
||||
SELECT
|
||||
c.Subject,
|
||||
cu.Sticky,
|
||||
cu.UnRead,
|
||||
cu.ForwardedTo
|
||||
FROM pm_conversations AS c
|
||||
JOIN pm_conversations_users AS cu ON c.ID=cu.ConvID
|
||||
WHERE c.ID='$ConvID' AND UserID='$UserID'");
|
||||
JOIN pm_conversations_users AS cu ON c.ID=cu.ConvID
|
||||
WHERE c.ID='$ConvID'
|
||||
AND UserID='$UserID'");
|
||||
list($Subject, $Sticky, $UnRead, $ForwardedID) = $DB->next_record();
|
||||
|
||||
|
||||
$DB->query("SELECT um.ID, Username
|
||||
$DB->query("
|
||||
SELECT um.ID, Username
|
||||
FROM pm_messages AS pm
|
||||
JOIN users_main AS um ON um.ID=pm.SenderID
|
||||
JOIN users_main AS um ON um.ID=pm.SenderID
|
||||
WHERE pm.ConvID='$ConvID'");
|
||||
|
||||
while(list($PMUserID, $Username) = $DB->next_record()) {
|
||||
while (list($PMUserID, $Username) = $DB->next_record()) {
|
||||
$PMUserID = (int)$PMUserID;
|
||||
$Users[$PMUserID]['UserStr'] = Users::format_username($PMUserID, true, true, true, true);
|
||||
$Users[$PMUserID]['Username'] = $Username;
|
||||
@ -49,7 +54,7 @@
|
||||
|
||||
|
||||
|
||||
if($UnRead=='1') {
|
||||
if ($UnRead == '1') {
|
||||
|
||||
$DB->query("UPDATE pm_conversations_users SET UnRead='0' WHERE ConvID='$ConvID' AND UserID='$UserID'");
|
||||
// Clear the caches of the inbox and sentbox
|
||||
@ -62,7 +67,7 @@
|
||||
$DB->query("SELECT SentDate, SenderID, Body, ID FROM pm_messages AS m WHERE ConvID='$ConvID' ORDER BY ID");
|
||||
?>
|
||||
<div class="thin">
|
||||
<h2><?=$Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')':'')?></h2>
|
||||
<h2><?=$Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')' : '')?></h2>
|
||||
<div class="linkbox">
|
||||
<a href="inbox.php" class="brackets">Back to inbox</a>
|
||||
</div>
|
||||
@ -83,7 +88,7 @@
|
||||
$ReceiverIDs = $DB->collect('UserID');
|
||||
|
||||
|
||||
if(!empty($ReceiverIDs) && (empty($LoggedUser['DisablePM']) || array_intersect($ReceiverIDs, array_keys($StaffIDs)))) {
|
||||
if (!empty($ReceiverIDs) && (empty($LoggedUser['DisablePM']) || array_intersect($ReceiverIDs, array_keys($StaffIDs)))) {
|
||||
?>
|
||||
<h3>Reply</h3>
|
||||
<form class="send_form" name="reply" action="inbox.php" method="post" id="messageform">
|
||||
@ -114,7 +119,7 @@
|
||||
<tr>
|
||||
<td class="label"><label for="sticky">Sticky</label></td>
|
||||
<td>
|
||||
<input type="checkbox" id="sticky" name="sticky"<? if($Sticky) { echo ' checked="checked"'; } ?> />
|
||||
<input type="checkbox" id="sticky" name="sticky"<? if ($Sticky) { echo ' checked="checked"'; } ?> />
|
||||
</td>
|
||||
<td class="label"><label for="mark_unread">Mark as unread</label></td>
|
||||
<td>
|
||||
@ -135,7 +140,7 @@
|
||||
<?
|
||||
$DB->query("SELECT SupportFor FROM users_info WHERE UserID = ".$LoggedUser['ID']);
|
||||
list($FLS) = $DB->next_record();
|
||||
if((check_perms('users_mod') || $FLS != "") && (!$ForwardedID || $ForwardedID == $LoggedUser['ID'])) {
|
||||
if ((check_perms('users_mod') || $FLS != '') && (!$ForwardedID || $ForwardedID == $LoggedUser['ID'])) {
|
||||
?>
|
||||
<h3>Forward conversation</h3>
|
||||
<form class="send_form" name="forward" action="inbox.php" method="post">
|
||||
@ -146,8 +151,8 @@
|
||||
<label for="receiverid">Forward to</label>
|
||||
<select id="receiverid" name="receiverid">
|
||||
<?
|
||||
foreach($StaffIDs as $StaffID => $StaffName) {
|
||||
if($StaffID == $LoggedUser['ID'] || in_array($StaffID, $ReceiverIDs)) {
|
||||
foreach ($StaffIDs as $StaffID => $StaffName) {
|
||||
if ($StaffID == $LoggedUser['ID'] || in_array($StaffID, $ReceiverIDs)) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
|
@ -4,15 +4,34 @@
|
||||
$UserID = $LoggedUser['ID'];
|
||||
$ConvID = $_POST['convid'];
|
||||
$ReceiverID = $_POST['receiverid'];
|
||||
if(!is_number($ConvID) || !is_number($ReceiverID)) { error(404); }
|
||||
if(!check_perms('users_mod') && !isset($StaffIDs[$ReceiverID])) { error(403); }
|
||||
$DB->query("SELECT ConvID FROM pm_conversations_users WHERE UserID='$UserID' AND InInbox='1' AND (ForwardedTo=0 OR ForwardedTo=UserID) AND ConvID='$ConvID'");
|
||||
if($DB->record_count() == 0) { error(403); }
|
||||
if (!is_number($ConvID) || !is_number($ReceiverID)) {
|
||||
error(404);
|
||||
}
|
||||
if (!check_perms('users_mod') && !isset($StaffIDs[$ReceiverID])) {
|
||||
error(403);
|
||||
}
|
||||
$DB->query("
|
||||
SELECT ConvID
|
||||
FROM pm_conversations_users
|
||||
WHERE UserID='$UserID'
|
||||
AND InInbox='1'
|
||||
AND (ForwardedTo=0 OR ForwardedTo=UserID)
|
||||
AND ConvID='$ConvID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$DB->query("SELECT ConvID FROM pm_conversations_users WHERE UserID='$ReceiverID' AND (ForwardedTo = 0 OR ForwardedTo = UserID) AND InInbox='1' AND ConvID='$ConvID'");
|
||||
if($DB->record_count() == 0) {
|
||||
$DB->query("INSERT IGNORE INTO pm_conversations_users
|
||||
(UserID, ConvID, InInbox, InSentbox, ReceivedDate)
|
||||
$DB->query("
|
||||
SELECT ConvID
|
||||
FROM pm_conversations_users
|
||||
WHERE UserID='$ReceiverID'
|
||||
AND (ForwardedTo = 0 OR ForwardedTo = UserID)
|
||||
AND InInbox='1'
|
||||
AND ConvID='$ConvID'");
|
||||
if ($DB->record_count() == 0) {
|
||||
$DB->query("
|
||||
INSERT IGNORE INTO pm_conversations_users
|
||||
(UserID, ConvID, InInbox, InSentbox, ReceivedDate)
|
||||
VALUES ('$ReceiverID', '$ConvID', '1', '0', NOW())
|
||||
ON DUPLICATE KEY UPDATE ForwardedTo = 0, UnRead = 1");
|
||||
$DB->query("UPDATE pm_conversations_users SET ForwardedTo='$ReceiverID' WHERE ConvID='$ConvID' AND UserID='$UserID'");
|
||||
|
@ -12,7 +12,7 @@
|
||||
\*********************************************************************/
|
||||
|
||||
// Quick SQL injection check
|
||||
if(!$_GET['post'] || !is_number($_GET['post'])){
|
||||
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
@ -20,11 +20,12 @@
|
||||
$PostID = $_GET['post'];
|
||||
|
||||
// Message is selected providing the user quoting is one of the two people in the thread
|
||||
$DB->query("SELECT
|
||||
$DB->query("
|
||||
SELECT
|
||||
m.Body
|
||||
FROM pm_messages as m
|
||||
FROM pm_messages as m
|
||||
JOIN pm_conversations_users AS u ON m.ConvID=u.ConvID
|
||||
WHERE m.ID='$PostID'
|
||||
WHERE m.ID='$PostID'
|
||||
AND u.UserID=".$LoggedUser['ID']);
|
||||
list($Body) = $DB->next_record(MYSQLI_NUM);
|
||||
|
||||
@ -32,4 +33,4 @@
|
||||
|
||||
echo trim($Body);
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -4,11 +4,14 @@
|
||||
$UserID = $LoggedUser['ID'];
|
||||
|
||||
|
||||
if(empty($_GET['action'])) { $Section = 'inbox'; }
|
||||
else {
|
||||
if (empty($_GET['action'])) {
|
||||
$Section = 'inbox';
|
||||
} else {
|
||||
$Section = $_GET['action']; // either 'inbox' or 'sentbox'
|
||||
}
|
||||
if(!in_array($Section, array('inbox', 'sentbox'))) { error(404); }
|
||||
if (!in_array($Section, array('inbox', 'sentbox'))) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
list($Page,$Limit) = Format::page_limit(MESSAGES_PER_PAGE);
|
||||
|
||||
@ -19,9 +22,9 @@
|
||||
<div class="linkbox">
|
||||
<?
|
||||
|
||||
if($Section == 'inbox') { ?>
|
||||
if ($Section == 'inbox') { ?>
|
||||
<a href="inbox.php?action=sentbox" class="brackets">Sentbox</a>
|
||||
<? } elseif($Section == 'sentbox') { ?>
|
||||
<? } elseif ($Section == 'sentbox') { ?>
|
||||
<a href="inbox.php" class="brackets">Inbox</a>
|
||||
<? }
|
||||
|
||||
@ -31,33 +34,33 @@
|
||||
|
||||
$Sort = empty($_GET['sort']) || $_GET['sort'] != "unread" ? "Date DESC" : "cu.Unread = '1' DESC, DATE DESC";
|
||||
|
||||
$sql = "SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
c.ID,
|
||||
c.Subject,
|
||||
cu.Unread,
|
||||
cu.Sticky,
|
||||
cu.ForwardedTo,
|
||||
cu2.UserID,";
|
||||
$sql = "
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
c.ID,
|
||||
c.Subject,
|
||||
cu.Unread,
|
||||
cu.Sticky,
|
||||
cu.ForwardedTo,
|
||||
cu2.UserID,";
|
||||
$sql .= ($Section == 'sentbox')? ' cu.SentDate ' : ' cu.ReceivedDate ';
|
||||
$sql .= "AS Date
|
||||
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 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 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 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 .= " WHERE ";
|
||||
if(!empty($_GET['search'])) {
|
||||
if (!empty($_GET['search'])) {
|
||||
$Search = db_string($_GET['search']);
|
||||
if($_GET['searchtype'] == "user") {
|
||||
if ($_GET['searchtype'] == "user") {
|
||||
$sql .= "um.Username LIKE '".$Search."' AND ";
|
||||
} elseif($_GET['searchtype'] == "subject") {
|
||||
} elseif ($_GET['searchtype'] == "subject") {
|
||||
$Words = explode(' ', $Search);
|
||||
$sql .= "c.Subject LIKE '%".implode("%' AND c.Subject LIKE '%", $Words)."%' AND ";
|
||||
} elseif($_GET['searchtype'] == "message") {
|
||||
} elseif ($_GET['searchtype'] == "message") {
|
||||
$Words = explode(' ', $Search);
|
||||
$sql .= "m.Body LIKE '%".implode("%' AND m.Body LIKE '%", $Words)."%' AND ";
|
||||
}
|
||||
@ -74,7 +77,7 @@
|
||||
$Count = $DB->record_count();
|
||||
|
||||
$CurURL = Format::get_url(array('sort'));
|
||||
if(empty($CurURL)) {
|
||||
if (empty($CurURL)) {
|
||||
$CurURL = "inbox.php?";
|
||||
} else {
|
||||
$CurURL = "inbox.php?".$CurURL."&";
|
||||
@ -86,17 +89,17 @@
|
||||
</div>
|
||||
|
||||
<div class="box pad">
|
||||
<? if($Count == 0 && empty($_GET['search'])) { ?>
|
||||
<? if ($Count == 0 && empty($_GET['search'])) { ?>
|
||||
<h2>Your <?= ($Section == 'sentbox') ? 'sentbox' : 'inbox' ?> is currently empty</h2>
|
||||
<? } else { ?>
|
||||
<form class="search_form" name="<?= ($Section == 'sentbox')?'sentbox':'inbox'?>" action="inbox.php" method="get" id="searchbox">
|
||||
<form class="search_form" name="<?=(($Section == 'sentbox') ? 'sentbox' : 'inbox')?>" action="inbox.php" method="get" id="searchbox">
|
||||
<div>
|
||||
<input type="hidden" name="action" value="<?=$Section?>" />
|
||||
<input type="radio" name="searchtype" value="user"<?=(empty($_GET['searchtype']) || $_GET['searchtype'] == 'user' ? ' checked="checked"' : '')?> /> User
|
||||
<input type="radio" name="searchtype" value="subject"<?=(!empty($_GET['searchtype']) && $_GET['searchtype'] == 'subject' ? ' checked="checked"' : '')?> /> Subject
|
||||
<input type="radio" name="searchtype" value="message"<?=(!empty($_GET['searchtype']) && $_GET['searchtype'] == 'message' ? ' checked="checked"' : '')?> /> Message
|
||||
<span style="float: right;">
|
||||
<? if(empty($_GET['sort']) || $_GET['sort'] != "unread") { ?>
|
||||
<? if (empty($_GET['sort']) || $_GET['sort'] != "unread") { ?>
|
||||
<a href="<?=$CurURL?>sort=unread" class="brackets">List unread first</a>
|
||||
<? } else { ?>
|
||||
<a href="<?=$CurURL?>" class="brackets">List latest first</a>
|
||||
@ -120,21 +123,21 @@
|
||||
<tr class="colhead">
|
||||
<td width="10"><input type="checkbox" onclick="toggleChecks('messageform',this)" /></td>
|
||||
<td width="50%">Subject</td>
|
||||
<td><?=($Section == 'sentbox')? 'Receiver' : 'Sender' ?></td>
|
||||
<td><?=(($Section == 'sentbox')? 'Receiver' : 'Sender')?></td>
|
||||
<td>Date</td>
|
||||
<? if(check_perms('users_mod')) {?>
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<td>Forwarded to</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
<?
|
||||
if($Count == 0) {?>
|
||||
if ($Count == 0) { ?>
|
||||
<tr class="a">
|
||||
<td colspan="5">No results.</td>
|
||||
</tr>
|
||||
<? } else {
|
||||
$Row = 'a';
|
||||
while(list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $SenderID, $Date) = $DB->next_record()) {
|
||||
if($Unread === '1') {
|
||||
while (list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $SenderID, $Date) = $DB->next_record()) {
|
||||
if ($Unread === '1') {
|
||||
$RowClass = 'unreadpm';
|
||||
} else {
|
||||
$Row = ($Row === 'a') ? 'b' : 'a';
|
||||
@ -144,16 +147,22 @@
|
||||
<tr class="<?=$RowClass?>">
|
||||
<td class="center"><input type="checkbox" name="messages[]=" value="<?=$ConvID?>" /></td>
|
||||
<td>
|
||||
<? if($Unread) { echo '<strong>'; }
|
||||
if($Sticky) { echo 'Sticky: '; }
|
||||
<? if ($Unread) {
|
||||
echo '<strong>';
|
||||
}
|
||||
if ($Sticky) {
|
||||
echo 'Sticky: ';
|
||||
}
|
||||
?>
|
||||
<a href="inbox.php?action=viewconv&id=<?=$ConvID?>"><?=$Subject?></a>
|
||||
<?
|
||||
if($Unread) { echo '</strong>';} ?>
|
||||
if ($Unread) {
|
||||
echo '</strong>';
|
||||
} ?>
|
||||
</td>
|
||||
<td><?=Users::format_username($SenderID, true, true, true, true)?></td>
|
||||
<td><?=time_diff($Date)?></td>
|
||||
<? if(check_perms('users_mod')) { ?>
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<td><?=($ForwardedID && $ForwardedID != $LoggedUser['ID'] ? Users::format_username($ForwardedID, false, false, false):'')?></td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
|
@ -5,33 +5,40 @@
|
||||
authorize();
|
||||
replace */
|
||||
|
||||
if(!isset($_POST['messages']) || !is_array($_POST['messages'])){
|
||||
if (!isset($_POST['messages']) || !is_array($_POST['messages'])) {
|
||||
error('You forgot to select messages to delete.');
|
||||
header('Location: inbox.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$Messages = $_POST['messages'];
|
||||
foreach($Messages AS $ConvID) {
|
||||
foreach ($Messages AS $ConvID) {
|
||||
$ConvID = trim($ConvID);
|
||||
if(!is_number($ConvID)) {
|
||||
if (!is_number($ConvID)) {
|
||||
error(0);
|
||||
}
|
||||
}
|
||||
$ConvIDs = implode(',', $Messages);
|
||||
$DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE ConvID IN ($ConvIDs) AND UserID=$UserID");
|
||||
$DB->query("
|
||||
SELECT COUNT(ConvID)
|
||||
FROM pm_conversations_users
|
||||
WHERE ConvID IN ($ConvIDs)
|
||||
AND UserID=$UserID");
|
||||
list($MessageCount) = $DB->next_record();
|
||||
if($MessageCount != count($Messages)){
|
||||
if ($MessageCount != count($Messages)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
if (isset($_POST['delete'])) {
|
||||
$DB->query("UPDATE pm_conversations_users SET
|
||||
InInbox='0',
|
||||
InSentbox='0',
|
||||
Sticky='0',
|
||||
UnRead='0'
|
||||
WHERE ConvID IN($ConvIDs) AND UserID=$UserID");
|
||||
$DB->query("
|
||||
UPDATE pm_conversations_users
|
||||
SET
|
||||
InInbox='0',
|
||||
InSentbox='0',
|
||||
Sticky='0',
|
||||
UnRead='0'
|
||||
WHERE ConvID IN($ConvIDs)
|
||||
AND UserID=$UserID");
|
||||
} elseif (isset($_POST['unread'])) {
|
||||
$DB->query("UPDATE pm_conversations_users SET Unread='1'
|
||||
WHERE ConvID IN($ConvIDs) AND UserID=$UserID");
|
||||
|
@ -26,7 +26,7 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<? if($TotalMatches > LOG_ENTRIES_PER_PAGE) { ?>
|
||||
<? if ($TotalMatches > LOG_ENTRIES_PER_PAGE) { ?>
|
||||
<div class="linkbox">
|
||||
<?
|
||||
$Pages = Format::get_pages($Page,$TotalMatches,LOG_ENTRIES_PER_PAGE,9);
|
||||
@ -38,9 +38,9 @@
|
||||
<td style="width: 180px;"><strong>Time</strong></td>
|
||||
<td><strong>Message</strong></td>
|
||||
</tr>
|
||||
<? if($QueryStatus) { ?>
|
||||
<? if ($QueryStatus) { ?>
|
||||
<tr class="nobr"><td colspan="2">Search request failed (<?=$QueryError?>).</td></tr>
|
||||
<? } elseif($DB->record_count() == 0) { ?>
|
||||
<? } elseif ($DB->record_count() == 0) { ?>
|
||||
<tr class="nobr"><td colspan="2">Nothing found!</td></tr>
|
||||
<? }
|
||||
$Row = 'a';
|
||||
@ -96,21 +96,21 @@
|
||||
break;
|
||||
case "by":
|
||||
$UserID = 0;
|
||||
$User = "";
|
||||
$URL = "";
|
||||
$User = '';
|
||||
$URL = '';
|
||||
if ($MessageParts[$i + 1] == "user") {
|
||||
$i++;
|
||||
if (is_numeric($MessageParts[$i + 1])) {
|
||||
$UserID = $MessageParts[++$i];
|
||||
}
|
||||
$URL = "user ".$UserID." ".'(<a href="user.php?id='.$UserID.'">'.substr($MessageParts[++$i],1,-1)."</a>)";
|
||||
$URL = "user $UserID ".'(<a href="user.php?id='.$UserID.'">'.substr($MessageParts[++$i],1,-1)."</a>)";
|
||||
} elseif (in_array($MessageParts[$i - 1], array('deleted','uploaded','edited','created','recovered'))) {
|
||||
$User = $MessageParts[++$i];
|
||||
if(substr($User,-1) == ':') {
|
||||
if (substr($User,-1) == ':') {
|
||||
$User = substr($User, 0, -1);
|
||||
$Colon = true;
|
||||
}
|
||||
if(!isset($Usernames[$User])) {
|
||||
if (!isset($Usernames[$User])) {
|
||||
$DB->query("SELECT ID FROM users_main WHERE Username = _utf8 '".$User."' COLLATE utf8_bin");
|
||||
list($UserID) = $DB->next_record();
|
||||
$Usernames[$User] = $UserID ? $UserID : '';
|
||||
@ -118,7 +118,7 @@
|
||||
$UserID = $Usernames[$User];
|
||||
}
|
||||
$DB->set_query_id($Log);
|
||||
$URL = $Usernames[$User] ? '<a href="user.php?id='.$UserID.'">'.$User."</a>".($Colon?':':'') : $User;
|
||||
$URL = $Usernames[$User] ? '<a href="user.php?id='.$UserID.'">'.$User."</a>".($Colon ? ':' : '') : $User;
|
||||
}
|
||||
$Message = $Message." by ".$URL;
|
||||
break;
|
||||
@ -149,7 +149,7 @@
|
||||
case "marked":
|
||||
if ($i == 1) {
|
||||
$User = $MessageParts[$i - 1];
|
||||
if(!isset($Usernames[$User])) {
|
||||
if (!isset($Usernames[$User])) {
|
||||
$DB->query("SELECT ID FROM users_main WHERE Username = _utf8 '".$User."' COLLATE utf8_bin");
|
||||
list($UserID) = $DB->next_record();
|
||||
$Usernames[$User] = $UserID ? $UserID : '';
|
||||
@ -183,7 +183,7 @@
|
||||
<?=time_diff($LogTime)?>
|
||||
</td>
|
||||
<td>
|
||||
<span<? if($Color) { ?> style="color: <?=$Color?>;"<? } ?>><?=$Message?></span>
|
||||
<span<? if ($Color) { ?> style="color: <?=$Color?>;"<? } ?>><?=$Message?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?
|
||||
if(!empty($_GET['page']) && is_number($_GET['page'])) {
|
||||
$Page = min(SPHINX_MAX_MATCHES/LOG_ENTRIES_PER_PAGE, $_GET['page']);
|
||||
$Offset = ($Page-1)*LOG_ENTRIES_PER_PAGE;
|
||||
if (!empty($_GET['page']) && is_number($_GET['page'])) {
|
||||
$Page = min(SPHINX_MAX_MATCHES / LOG_ENTRIES_PER_PAGE, $_GET['page']);
|
||||
$Offset = ($Page - 1) * LOG_ENTRIES_PER_PAGE;
|
||||
} else {
|
||||
$Page = 1;
|
||||
$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);
|
||||
$NumResults = $DB->record_count();
|
||||
if(!$NumResults) {
|
||||
if (!$NumResults) {
|
||||
$TotalMatches = 0;
|
||||
} elseif($NumResults == LOG_ENTRIES_PER_PAGE) {
|
||||
} elseif ($NumResults == LOG_ENTRIES_PER_PAGE) {
|
||||
// This is a lot faster than SQL_CALC_FOUND_ROWS
|
||||
$SphQL = new SphinxqlQuery();
|
||||
$Result = $SphQL->select('id')->from('log, log_delta')->limit(0, 1, 1)->query();
|
||||
@ -22,23 +22,23 @@
|
||||
}
|
||||
$QueryStatus = 0;
|
||||
} else {
|
||||
$Page = min(SPHINX_MAX_MATCHES/TORRENTS_PER_PAGE, $Page);
|
||||
$Page = min(SPHINX_MAX_MATCHES / TORRENTS_PER_PAGE, $Page);
|
||||
$SphQL = new SphinxqlQuery();
|
||||
$SphQL->select('id')
|
||||
->from('log, log_delta')
|
||||
->where_match($_GET['search'], 'message')
|
||||
->order_by('id', 'DESC')
|
||||
->limit($Offset, LOG_ENTRIES_PER_PAGE, $Offset+LOG_ENTRIES_PER_PAGE);
|
||||
->limit($Offset, LOG_ENTRIES_PER_PAGE, $Offset + LOG_ENTRIES_PER_PAGE);
|
||||
|
||||
$Result = $SphQL->query();
|
||||
$Debug->log_var($Result, '$Result');
|
||||
$Debug->set_flag('Finished SphQL query');
|
||||
if($QueryStatus = $Result->Errno) {
|
||||
if ($QueryStatus = $Result->Errno) {
|
||||
$QueryError = $Result->Error;
|
||||
}
|
||||
$NumResults = $Result->get_result_info('num_rows');
|
||||
$TotalMatches = min(SPHINX_MAX_MATCHES, $Result->get_meta('total_found'));
|
||||
if($NumResults > 0) {
|
||||
if ($NumResults > 0) {
|
||||
$LogIDs = $Result->collect('id');
|
||||
$Log = $DB->query("SELECT ID, Message, Time FROM log WHERE ID IN (".implode(',', $LogIDs).") ORDER BY ID DESC");
|
||||
} else {
|
||||
|
@ -1,33 +1,35 @@
|
||||
<?
|
||||
list($Page,$Limit) = Format::page_limit(LOG_ENTRIES_PER_PAGE);
|
||||
|
||||
if(!empty($_GET['search'])) {
|
||||
if (!empty($_GET['search'])) {
|
||||
$Search = db_string($_GET['search']);
|
||||
} else {
|
||||
$Search = false;
|
||||
}
|
||||
$Words = explode(' ', $Search);
|
||||
$sql = "SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
Message,
|
||||
Time
|
||||
FROM log ";
|
||||
if($Search) {
|
||||
$sql = '
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
Message,
|
||||
Time
|
||||
FROM log ';
|
||||
if ($Search) {
|
||||
$sql .= "WHERE Message LIKE '%";
|
||||
$sql .= implode("%' AND Message LIKE '%", $Words);
|
||||
$sql .= "%' ";
|
||||
}
|
||||
if(!check_perms('site_view_full_log')) {
|
||||
if($Search) {
|
||||
$sql.=" AND ";
|
||||
if (!check_perms('site_view_full_log')) {
|
||||
if ($Search) {
|
||||
$sql.=' AND ';
|
||||
} else {
|
||||
$sql.=" WHERE ";
|
||||
$sql.=' WHERE ';
|
||||
}
|
||||
$sql .= " Time>'".time_minus(3600*24*28)."' ";
|
||||
$sql .= " Time>'".time_minus(3600 * 24 * 28)."' ";
|
||||
}
|
||||
|
||||
$sql .= "ORDER BY ID DESC LIMIT $Limit";
|
||||
$sql .= "
|
||||
ORDER BY ID DESC
|
||||
LIMIT $Limit";
|
||||
|
||||
$Log = $DB->query($sql);
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?
|
||||
|
||||
/*-- TODO ---------------------------//
|
||||
Add the javascript validation into the display page using the class
|
||||
Add the JavaScript validation into the display page using the class
|
||||
//-----------------------------------*/
|
||||
|
||||
if(!empty($LoggedUser['ID'])) {
|
||||
if (!empty($LoggedUser['ID'])) {
|
||||
header('Location: index.php');
|
||||
die();
|
||||
}
|
||||
@ -14,14 +14,14 @@
|
||||
}
|
||||
|
||||
// Check if IP is banned
|
||||
if(Tools::site_ban_ip($_SERVER['REMOTE_ADDR'])) {
|
||||
if (Tools::site_ban_ip($_SERVER['REMOTE_ADDR'])) {
|
||||
error('Your IP has been banned.');
|
||||
}
|
||||
|
||||
require(SERVER_ROOT."/classes/class_validate.php");
|
||||
$Validate=NEW VALIDATE;
|
||||
|
||||
if(array_key_exists('action', $_GET) && $_GET['action'] == 'disabled') {
|
||||
if (array_key_exists('action', $_GET) && $_GET['action'] == 'disabled') {
|
||||
require('disabled.php');
|
||||
die();
|
||||
}
|
||||
@ -30,16 +30,17 @@
|
||||
// Recover password
|
||||
if (!empty($_REQUEST['key'])) {
|
||||
// User has entered a new password, use step 2
|
||||
$DB->query("SELECT
|
||||
m.ID,
|
||||
m.Email,
|
||||
m.ipcc,
|
||||
i.ResetExpires
|
||||
$DB->query("
|
||||
SELECT
|
||||
m.ID,
|
||||
m.Email,
|
||||
m.ipcc,
|
||||
i.ResetExpires
|
||||
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'])."'
|
||||
AND i.ResetKey<>''
|
||||
AND m.Enabled='1'");
|
||||
AND i.ResetKey<>''
|
||||
AND m.Enabled='1'");
|
||||
list($UserID,$Email,$Country,$Expires)=$DB->next_record();
|
||||
|
||||
if ($UserID && strtotime($Expires)>time()) {
|
||||
@ -53,14 +54,16 @@
|
||||
$Err=$Validate->ValidateForm($_REQUEST);
|
||||
if ($Err=='') {
|
||||
// Form validates without error, set new secret and password.
|
||||
$DB->query("UPDATE
|
||||
users_main AS m,
|
||||
users_info AS i
|
||||
SET m.PassHash='".db_string(Users::make_crypt_hash($_REQUEST['password']))."',
|
||||
i.ResetKey='',
|
||||
i.ResetExpires='0000-00-00 00:00:00'
|
||||
$DB->query("
|
||||
UPDATE
|
||||
users_main AS m,
|
||||
users_info AS i
|
||||
SET
|
||||
m.PassHash='".db_string(Users::make_crypt_hash($_REQUEST['password']))."',
|
||||
i.ResetKey='',
|
||||
i.ResetExpires='0000-00-00 00:00:00'
|
||||
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
|
||||
|
||||
|
||||
@ -76,12 +79,12 @@
|
||||
|
||||
if (strtotime($Expires) < time() && $UserID) {
|
||||
// If his key has expired, clear all the reset information
|
||||
$DB->query("UPDATE
|
||||
users_info
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET ResetKey='',
|
||||
ResetExpires='0000-00-00 00:00:00'
|
||||
ResetExpires='0000-00-00 00:00:00'
|
||||
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)
|
||||
header('Location: login.php?act=recover');
|
||||
@ -95,17 +98,18 @@
|
||||
|
||||
if (!empty($_REQUEST['email'])) {
|
||||
// User has entered email and submitted form
|
||||
$Err=$Validate->ValidateForm($_REQUEST);
|
||||
$Err = $Validate->ValidateForm($_REQUEST);
|
||||
|
||||
if (!$Err) {
|
||||
// Form validates correctly
|
||||
$DB->query("SELECT
|
||||
ID,
|
||||
Username,
|
||||
Email
|
||||
$DB->query("
|
||||
SELECT
|
||||
ID,
|
||||
Username,
|
||||
Email
|
||||
FROM users_main
|
||||
WHERE Email='".db_string($_REQUEST['email'])."'
|
||||
AND Enabled='1'");
|
||||
AND Enabled='1'");
|
||||
list($UserID,$Username,$Email)=$DB->next_record();
|
||||
|
||||
if ($UserID) {
|
||||
@ -137,7 +141,7 @@
|
||||
$Cache->delete_value('enabled_'.$UserID);
|
||||
|
||||
$DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID'");
|
||||
while(list($SessionID) = $DB->next_record()) {
|
||||
while (list($SessionID) = $DB->next_record()) {
|
||||
$Cache->delete_value('session_'.$UserID.'_'.$SessionID);
|
||||
}
|
||||
$DB->query("UPDATE users_sessions SET Active = 0 WHERE UserID='$UserID' AND Active = 1");
|
||||
@ -152,7 +156,7 @@
|
||||
// User has not entered email address, and there is an error set in session data
|
||||
// This is typically because their key has expired.
|
||||
// Stick the error into $Err so recover_step1.php can take care of it
|
||||
$Err=$_SESSION['reseterr'];
|
||||
$Err = $_SESSION['reseterr'];
|
||||
unset($_SESSION['reseterr']);
|
||||
}
|
||||
|
||||
@ -176,7 +180,7 @@ function log_attempt($UserID) {
|
||||
$IPStr = $_SERVER['REMOTE_ADDR'];
|
||||
$IPA = substr($IPStr, 0, strcspn($IPStr, '.'));
|
||||
$IP = Tools::ip_to_unsigned($IPStr);
|
||||
if($AttemptID) { // User has attempted to log in recently
|
||||
if ($AttemptID) { // User has attempted to log in recently
|
||||
$Attempts++;
|
||||
if ($Attempts>5) { // Only 6 allowed login attempts, ban user's IP
|
||||
$BannedUntil=time_plus(60*60*6);
|
||||
@ -187,12 +191,12 @@ function log_attempt($UserID) {
|
||||
Bans=Bans+1
|
||||
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");
|
||||
if($DB->record_count() > 0) {
|
||||
if ($DB->record_count() > 0) {
|
||||
//Ban exists already, only add new entry if not for same reason
|
||||
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("UPDATE ip_bans
|
||||
SET Reason = CONCAT('Automated ban per >60 failed login attempts AND ', Reason)
|
||||
WHERE FromIP = ".$IP." AND ToIP = ".$IP);
|
||||
@ -222,25 +226,27 @@ function log_attempt($UserID) {
|
||||
} // end log_attempt function
|
||||
|
||||
// If user has submitted form
|
||||
if(isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
|
||||
if (isset($_POST['username']) && !empty($_POST['username']) && isset($_POST['password']) && !empty($_POST['password'])) {
|
||||
if (strtotime($BannedUntil) > time()) {
|
||||
header("Location: login.php");
|
||||
die();
|
||||
}
|
||||
$Err=$Validate->ValidateForm($_POST);
|
||||
|
||||
if(!$Err) {
|
||||
if (!$Err) {
|
||||
// Passes preliminary validation (username and password "look right")
|
||||
$DB->query("SELECT
|
||||
ID,
|
||||
PermissionID,
|
||||
CustomPermissions,
|
||||
PassHash,
|
||||
Secret,
|
||||
Enabled
|
||||
FROM users_main WHERE Username='".db_string($_POST['username'])."'
|
||||
AND Username<>''");
|
||||
list($UserID,$PermissionID,$CustomPermissions,$PassHash,$Secret,$Enabled)=$DB->next_record(MYSQLI_NUM, array(2));
|
||||
$DB->query("
|
||||
SELECT
|
||||
ID,
|
||||
PermissionID,
|
||||
CustomPermissions,
|
||||
PassHash,
|
||||
Secret,
|
||||
Enabled
|
||||
FROM users_main
|
||||
WHERE Username='".db_string($_POST['username'])."'
|
||||
AND Username<>''");
|
||||
list($UserID,$PermissionID,$CustomPermissions,$PassHash,$Secret,$Enabled) = $DB->next_record(MYSQLI_NUM, array(2));
|
||||
if (strtotime($BannedUntil)<time()) {
|
||||
if ($UserID && Users::check_password($_POST['password'], $PassHash, $Secret)) {
|
||||
if (!Users::is_crypt_hash($PassHash)) {
|
||||
@ -251,7 +257,7 @@ function log_attempt($UserID) {
|
||||
$SessionID = Users::make_secret();
|
||||
$Cookie = $Enc->encrypt($Enc->encrypt($SessionID.'|~|'.$UserID));
|
||||
|
||||
if(isset($_POST['keeplogged']) && $_POST['keeplogged']) {
|
||||
if (isset($_POST['keeplogged']) && $_POST['keeplogged']) {
|
||||
$KeepLogged = 1;
|
||||
setcookie('session', $Cookie, time()+60*60*24*365, '/', '', $SSL, true);
|
||||
} else {
|
||||
@ -295,7 +301,7 @@ function log_attempt($UserID) {
|
||||
|
||||
if (!empty($_COOKIE['redirect'])) {
|
||||
$URL = $_COOKIE['redirect'];
|
||||
setcookie('redirect','',time()-60*60*24,'/','',false);
|
||||
setcookie('redirect','',time() - 60 * 60 * 24,'/','',false);
|
||||
header('Location: '.$URL);
|
||||
die();
|
||||
} else {
|
||||
@ -304,29 +310,29 @@ function log_attempt($UserID) {
|
||||
}
|
||||
} else {
|
||||
log_attempt($UserID);
|
||||
if ($Enabled==2) {
|
||||
if ($Enabled == 2) {
|
||||
|
||||
header('location:login.php?action=disabled');
|
||||
} elseif ($Enabled==0) {
|
||||
$Err="Your account has not been confirmed.<br />Please check your email.";
|
||||
} elseif ($Enabled == 0) {
|
||||
$Err = "Your account has not been confirmed.<br />Please check your email.";
|
||||
}
|
||||
setcookie('keeplogged','',time()+60*60*24*365,'/','',false);
|
||||
setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false);
|
||||
}
|
||||
} else {
|
||||
log_attempt($UserID);
|
||||
|
||||
$Err="Your username or password was incorrect.";
|
||||
setcookie('keeplogged','',time()+60*60*24*365,'/','',false);
|
||||
$Err = "Your username or password was incorrect.";
|
||||
setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false);
|
||||
}
|
||||
|
||||
} else {
|
||||
log_attempt($UserID);
|
||||
setcookie('keeplogged','',time()+60*60*24*365,'/','',false);
|
||||
setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false);
|
||||
}
|
||||
|
||||
} else {
|
||||
log_attempt('0');
|
||||
setcookie('keeplogged','',time()+60*60*24*365,'/','',false);
|
||||
setcookie('keeplogged','',time() + 60 * 60 * 24 * 365,'/','',false);
|
||||
}
|
||||
}
|
||||
require("sections/login/login.php");
|
||||
|
@ -6,11 +6,11 @@
|
||||
<script src="<?=STATIC_SERVER?>functions/password_validate.js" type="text/javascript"></script>
|
||||
<form class="auth_form" name="recovery" id="recoverform" method="post" action="" onsubmit="return formVal();">
|
||||
<input type="hidden" name="key" value="<?=display_str($_REQUEST['key'])?>" />
|
||||
<div style="width:500px;">
|
||||
<div style="width: 500px;">
|
||||
<span class="titletext">Reset your password - Final Step</span><br /><br />
|
||||
<?
|
||||
if(empty($Reset)) {
|
||||
if(!empty($Err)) {
|
||||
if (empty($Reset)) {
|
||||
if (!empty($Err)) {
|
||||
?>
|
||||
<strong class="important_text"><?=display_str($Err)?></strong><br /><br />
|
||||
<? } ?> A strong password is between 8 and 40 characters long, contains at least 1 lowercase and uppercase letter, and contains at least a number or symbol.<br /><br />
|
||||
|
@ -33,11 +33,11 @@
|
||||
$LastGroupID = 0;
|
||||
$UpdatedKeys = $UncachedGroups = 0;
|
||||
list($TorrentID, $GroupID, $Seeders, $Leechers, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
||||
while($TorrentID) {
|
||||
if($LastGroupID != $GroupID) {
|
||||
while ($TorrentID) {
|
||||
if ($LastGroupID != $GroupID) {
|
||||
$CachedData = $Cache->get_value('torrent_group_'.$GroupID);
|
||||
if($CachedData !== false) {
|
||||
if(isset($CachedData['ver']) && $CachedData['ver'] == CACHE::GROUP_VERSION) {
|
||||
if ($CachedData !== false) {
|
||||
if (isset($CachedData['ver']) && $CachedData['ver'] == CACHE::GROUP_VERSION) {
|
||||
$CachedStats = &$CachedData['d']['Torrents'];
|
||||
}
|
||||
} else {
|
||||
@ -45,9 +45,9 @@
|
||||
}
|
||||
$LastGroupID = $GroupID;
|
||||
}
|
||||
while($LastGroupID == $GroupID) {
|
||||
while ($LastGroupID == $GroupID) {
|
||||
$RowNum++;
|
||||
if(isset($CachedStats) && is_array($CachedStats[$TorrentID])) {
|
||||
if (isset($CachedStats) && is_array($CachedStats[$TorrentID])) {
|
||||
$OldValues = &$CachedStats[$TorrentID];
|
||||
$OldValues['Seeders'] = $Seeders;
|
||||
$OldValues['Leechers'] = $Leechers;
|
||||
@ -55,14 +55,14 @@
|
||||
$Changed = true;
|
||||
unset($OldValues);
|
||||
}
|
||||
if(!($RowNum % $StepSize)) {
|
||||
if (!($RowNum % $StepSize)) {
|
||||
$DB->query("SELECT * FROM tpc_temp WHERE GroupID > $GroupID OR (GroupID = $GroupID AND TorrentID > $TorrentID)
|
||||
ORDER BY GroupID ASC, TorrentID ASC LIMIT $StepSize");
|
||||
}
|
||||
$LastGroupID = $GroupID;
|
||||
list($TorrentID, $GroupID, $Seeders, $Leechers, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
||||
}
|
||||
if($Changed) {
|
||||
if ($Changed) {
|
||||
$Cache->cache_value('torrent_group_'.$LastGroupID, $CachedData, 0);
|
||||
unset($CachedStats);
|
||||
$UpdatedKeys++;
|
||||
|
@ -5,7 +5,7 @@
|
||||
$_REQUEST['action'] = '';
|
||||
}
|
||||
|
||||
switch ($_REQUEST['action']){
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'report':
|
||||
include('report.php');
|
||||
break;
|
||||
|
@ -81,11 +81,11 @@
|
||||
|
||||
$Channels = array();
|
||||
|
||||
if($Short == "request_update") {
|
||||
if ($Short == "request_update") {
|
||||
$Channels[] = "#requestedits";
|
||||
$Cache->increment('num_update_reports');
|
||||
}
|
||||
if(in_array($Short, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
|
||||
if (in_array($Short, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) {
|
||||
$Channels[] = "#forumreports";
|
||||
|
||||
}
|
||||
|
@ -4,29 +4,29 @@
|
||||
* every time you change the resolve type on one of the two reports pages.
|
||||
*/
|
||||
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if(is_number($_GET['id'])) {
|
||||
if (is_number($_GET['id'])) {
|
||||
$ReportID = $_GET['id'];
|
||||
} else {
|
||||
echo 'HAX on report ID';
|
||||
die();
|
||||
}
|
||||
|
||||
if(!isset($_GET['categoryid'])) {
|
||||
if (!isset($_GET['categoryid'])) {
|
||||
echo 'HAX on categoryid';
|
||||
die();
|
||||
} else {
|
||||
$CategoryID = $_GET['categoryid'];
|
||||
}
|
||||
|
||||
if(!isset($_GET['type'])) {
|
||||
if (!isset($_GET['type'])) {
|
||||
error(404);
|
||||
} else if (array_key_exists($_GET['type'], $Types[$CategoryID])) {
|
||||
$ReportType = $Types[$CategoryID][$_GET['type']];
|
||||
} else if(array_key_exists($_GET['type'],$Types['master'])) {
|
||||
} else if (array_key_exists($_GET['type'],$Types['master'])) {
|
||||
$ReportType = $Types['master'][$_GET['type']];
|
||||
} else {
|
||||
//There was a type but it wasn't an option!
|
||||
|
@ -10,13 +10,13 @@
|
||||
* It should not be used on site as is, except in its current use (Switch) as it is lacking for any purpose but this.
|
||||
*/
|
||||
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
authorize();
|
||||
|
||||
if(!is_number($_POST['torrentid'])) {
|
||||
if (!is_number($_POST['torrentid'])) {
|
||||
echo 'No Torrent ID';
|
||||
die();
|
||||
} else {
|
||||
@ -24,19 +24,19 @@
|
||||
}
|
||||
|
||||
$DB->query("SELECT tg.CategoryID FROM torrents_group AS tg JOIN torrents AS t ON t.GroupID=tg.ID WHERE t.ID = ".$TorrentID);
|
||||
if($DB->record_count() < 1) {
|
||||
$Err = "No torrent with that ID exists!";
|
||||
if ($DB->record_count() < 1) {
|
||||
$Err = 'No torrent with that ID exists!';
|
||||
} else {
|
||||
list($CategoryID) = $DB->next_record();
|
||||
}
|
||||
|
||||
if(!isset($_POST['type'])) {
|
||||
if (!isset($_POST['type'])) {
|
||||
echo 'Missing Type';
|
||||
die();
|
||||
} else if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
||||
$Type = $_POST['type'];
|
||||
$ReportType = $Types[$CategoryID][$Type];
|
||||
} else if(array_key_exists($_POST['type'],$Types['master'])) {
|
||||
} else if (array_key_exists($_POST['type'],$Types['master'])) {
|
||||
$Type = $_POST['type'];
|
||||
$ReportType = $Types['master'][$Type];
|
||||
} else {
|
||||
@ -48,26 +48,31 @@
|
||||
|
||||
$ExtraID = $_POST['otherid'];
|
||||
|
||||
if(!empty($_POST['extra'])) {
|
||||
if (!empty($_POST['extra'])) {
|
||||
$Extra = db_string($_POST['extra']);
|
||||
} else {
|
||||
$Extra = "";
|
||||
$Extra = '';
|
||||
}
|
||||
|
||||
if(!empty($Err)) {
|
||||
if (!empty($Err)) {
|
||||
echo $Err;
|
||||
die();
|
||||
}
|
||||
|
||||
$DB->query("SELECT ID FROM reportsv2 WHERE TorrentID=".$TorrentID." AND ReporterID=".db_string($LoggedUser['ID'])." AND ReportedTime > '".time_minus(3)."'");
|
||||
if($DB->record_count() > 0) {
|
||||
$DB->query("
|
||||
SELECT ID
|
||||
FROM reportsv2
|
||||
WHERE TorrentID=$TorrentID
|
||||
AND ReporterID=".db_string($LoggedUser['ID'])."
|
||||
AND ReportedTime > '".time_minus(3)."'");
|
||||
if ($DB->record_count() > 0) {
|
||||
die();
|
||||
}
|
||||
|
||||
$DB->query("INSERT INTO reportsv2
|
||||
(ReporterID, TorrentID, Type, UserComment, Status, ReportedTime, ExtraID)
|
||||
VALUES
|
||||
(".db_string($LoggedUser['ID']).", $TorrentID, '".$Type."', '$Extra', 'New', '".sqltime()."', '$ExtraID')");
|
||||
(".db_string($LoggedUser['ID']).", $TorrentID, '$Type', '$Extra', 'New', '".sqltime()."', '$ExtraID')");
|
||||
|
||||
$ReportID = $DB->inserted_id();
|
||||
|
||||
|
@ -3,17 +3,17 @@
|
||||
* This page simply assings a report to the person clicking on
|
||||
* the Claim / Claim all button.
|
||||
*/
|
||||
if(!check_perms('admin_reports')){
|
||||
//error(403);
|
||||
echo '403';
|
||||
die();
|
||||
if (!check_perms('admin_reports')) {
|
||||
//error(403);
|
||||
echo '403';
|
||||
die();
|
||||
}
|
||||
|
||||
if(!is_number($_GET['id'])) {
|
||||
die();
|
||||
if (!is_number($_GET['id'])) {
|
||||
die();
|
||||
}
|
||||
$DB->query("UPDATE reportsv2 SET Status='InProgress', ResolverID=".$LoggedUser['ID']." WHERE ID=".$_GET['id']);
|
||||
if($DB->affected_rows() == 0) {
|
||||
if ($DB->affected_rows() == 0) {
|
||||
echo '0';
|
||||
} else {
|
||||
echo '1';
|
||||
|
@ -11,9 +11,9 @@
|
||||
<?
|
||||
$CategoryID = $_POST['categoryid'];
|
||||
|
||||
if(array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
||||
if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
||||
$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']];
|
||||
} else {
|
||||
echo 'HAX IN REPORT TYPE';
|
||||
@ -30,7 +30,7 @@
|
||||
<br />
|
||||
<table class="layout border" cellpadding="3" cellspacing="1" border="0" width="100%">
|
||||
<?
|
||||
if(array_key_exists('image', $ReportType['report_fields'])) {
|
||||
if (array_key_exists('image', $ReportType['report_fields'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="label">
|
||||
@ -42,7 +42,7 @@
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
if(array_key_exists('track', $ReportType['report_fields'])) {
|
||||
if (array_key_exists('track', $ReportType['report_fields'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="label">
|
||||
@ -54,7 +54,7 @@
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
if(array_key_exists('link', $ReportType['report_fields'])) {
|
||||
if (array_key_exists('link', $ReportType['report_fields'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="label">
|
||||
@ -66,7 +66,7 @@
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
if(array_key_exists('sitelink', $ReportType['report_fields'])) {
|
||||
if (array_key_exists('sitelink', $ReportType['report_fields'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="label">
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
authorize();
|
||||
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
echo 'HAX on premissions!';
|
||||
die();
|
||||
}
|
||||
@ -13,14 +13,14 @@
|
||||
$Recipient = $_POST['pm_type'];
|
||||
$TorrentID = $_POST['torrentid'];
|
||||
|
||||
if(isset($_POST['uploader_pm']) && $_POST['uploader_pm'] != "") {
|
||||
if (isset($_POST['uploader_pm']) && $_POST['uploader_pm'] != '') {
|
||||
$Message = $_POST['uploader_pm'];
|
||||
} else {
|
||||
//No message given
|
||||
die();
|
||||
}
|
||||
|
||||
if(!is_number($_POST['categoryid']) || !is_number($TorrentID)) {
|
||||
if (!is_number($_POST['categoryid']) || !is_number($TorrentID)) {
|
||||
echo 'HAX on categoryid!';
|
||||
die();
|
||||
} else {
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
|
||||
$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']];
|
||||
} else {
|
||||
//There was a type but it wasn't an option!
|
||||
@ -37,20 +37,20 @@
|
||||
die();
|
||||
}
|
||||
|
||||
if(!isset($_POST['from_delete'])) {
|
||||
if (!isset($_POST['from_delete'])) {
|
||||
$Report = true;
|
||||
} else if(!is_number($_POST['from_delete'])) {
|
||||
} else if (!is_number($_POST['from_delete'])) {
|
||||
echo 'Hax occured in from_delete';
|
||||
}
|
||||
|
||||
if($Recipient == 'Uploader') {
|
||||
if ($Recipient == 'Uploader') {
|
||||
$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;
|
||||
} 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;
|
||||
}
|
||||
} else if($Recipient == 'Reporter') {
|
||||
} else if ($Recipient == 'Reporter') {
|
||||
$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;
|
||||
} else {
|
||||
@ -59,15 +59,15 @@
|
||||
|
||||
$Subject = $_POST['raw_name'];
|
||||
|
||||
if(!is_number($ToID)) {
|
||||
if (!is_number($ToID)) {
|
||||
$Err = "Haxx occuring, non number present";
|
||||
}
|
||||
|
||||
if($ToID == $LoggedUser['ID']) {
|
||||
if ($ToID == $LoggedUser['ID']) {
|
||||
$Err = "That's you!";
|
||||
}
|
||||
|
||||
if(isset($Err)) {
|
||||
if (isset($Err)) {
|
||||
echo $Err;
|
||||
} else {
|
||||
Misc::send_pm($ToID, $LoggedUser['ID'], $Subject, $Message);
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
authorize();
|
||||
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if(empty($_POST['reportid']) || !is_number($_POST['reportid'])) {
|
||||
if (empty($_POST['reportid']) || !is_number($_POST['reportid'])) {
|
||||
echo 'HAX ATTEMPT!'.$_GET['reportid'];
|
||||
die();
|
||||
}
|
||||
@ -19,6 +19,6 @@
|
||||
|
||||
$DB->query("SELECT ModComment FROM reportsv2 WHERE ID=".$ReportID);
|
||||
list($ModComment) = $DB->next_record();
|
||||
if(isset($ModComment)) {
|
||||
if (isset($ModComment)) {
|
||||
$DB->query("Update reportsv2 SET ModComment='".$Message."' WHERE ID=".$ReportID);
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
<?
|
||||
// perform the back end of updating a resolve type
|
||||
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
if(empty($_GET['reportid']) || !is_number($_GET['reportid'])) {
|
||||
if (empty($_GET['reportid']) || !is_number($_GET['reportid'])) {
|
||||
echo 'HAX ATTEMPT!'.$_GET['reportid'];
|
||||
die();
|
||||
}
|
||||
|
||||
if(empty($_GET['categoryid']) || !is_number($_GET['categoryid'])) {
|
||||
if (empty($_GET['categoryid']) || !is_number($_GET['categoryid'])) {
|
||||
echo 'HAX ATTEMPT!!'.$_GET['categoryid'];
|
||||
die();
|
||||
}
|
||||
|
||||
if(empty($_GET['newresolve'])) {
|
||||
if (empty($_GET['newresolve'])) {
|
||||
echo "No new resolve";
|
||||
die();
|
||||
}
|
||||
@ -35,7 +35,7 @@
|
||||
$TypeList = $Types['master'];
|
||||
}
|
||||
|
||||
if(!array_key_exists($NewType, $TypeList)) {
|
||||
if (!array_key_exists($NewType, $TypeList)) {
|
||||
echo "No resolve from that category";
|
||||
die();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
include('array.php');
|
||||
|
||||
if (isset($_REQUEST['action'])) {
|
||||
switch ($_REQUEST['action']){
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'report':
|
||||
include('report.php');
|
||||
break;
|
||||
|
@ -10,8 +10,8 @@
|
||||
$Text = NEW TEXT;
|
||||
|
||||
//If we're not coming from torrents.php, check we're being returned because of an error.
|
||||
if(!isset($_GET['id']) || !is_number($_GET['id'])) {
|
||||
if(!isset($Err)) {
|
||||
if (!isset($_GET['id']) || !is_number($_GET['id'])) {
|
||||
if (!isset($Err)) {
|
||||
error(404);
|
||||
}
|
||||
} else {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* that actually populate the page and shows the proper header and footer.
|
||||
* The important function is AddMore().
|
||||
*/
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
| <span title="Unclaim all of the reports currently displayed"><input type="button" onclick="GiveBack();" value="Unclaim all" /></span>
|
||||
</div>
|
||||
<br />
|
||||
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto">
|
||||
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto;">
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* TODO: I'm not writing documentation for this page until I write this page >.>
|
||||
*/
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* replicated on the auto page (reports.php).
|
||||
*/
|
||||
|
||||
if (!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
@ -20,14 +20,14 @@
|
||||
list($Page,$Limit) = Format::page_limit(REPORTS_PER_PAGE);
|
||||
|
||||
|
||||
if (isset($_GET['view'])){
|
||||
if (isset($_GET['view'])) {
|
||||
$View = $_GET['view'];
|
||||
} else {
|
||||
error(404);
|
||||
}
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
if (!is_number($_GET['id']) && $View != "type") {
|
||||
if (!is_number($_GET['id']) && $View != 'type') {
|
||||
error(404);
|
||||
} else {
|
||||
$ID = db_string($_GET['id']);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* a collision occurs or a POST attack is detected.
|
||||
*/
|
||||
|
||||
if(!check_perms('admin_reports')) {
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
authorize();
|
||||
@ -16,9 +16,9 @@
|
||||
$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(!isset($Escaped['from_delete'])) {
|
||||
if (!isset($Escaped['from_delete'])) {
|
||||
$Report = true;
|
||||
} else if(!is_number($Escaped['from_delete'])) {
|
||||
} elseif (!is_number($Escaped['from_delete'])) {
|
||||
echo 'Hax occured in from_delete';
|
||||
} else {
|
||||
$Report = false;
|
||||
@ -26,31 +26,31 @@
|
||||
|
||||
$PMMessage = $_POST['uploader_pm'];
|
||||
|
||||
if(is_number($Escaped['reportid'])) {
|
||||
if (is_number($Escaped['reportid'])) {
|
||||
$ReportID = $Escaped['reportid'];
|
||||
} else {
|
||||
echo 'Hax occured in the reportid';
|
||||
die();
|
||||
}
|
||||
|
||||
if($Escaped['pm_type'] != 'Uploader') {
|
||||
if ($Escaped['pm_type'] != 'Uploader') {
|
||||
$Escaped['uploader_pm'] = '';
|
||||
}
|
||||
|
||||
$UploaderID = (int)$Escaped['uploaderid'];
|
||||
if(!is_number($UploaderID)) {
|
||||
if (!is_number($UploaderID)) {
|
||||
echo 'Hax occuring on the uploaderid';
|
||||
die();
|
||||
}
|
||||
|
||||
$Warning = (int)$Escaped['warning'];
|
||||
if(!is_number($Warning)) {
|
||||
if (!is_number($Warning)) {
|
||||
echo 'Hax occuring on the warning';
|
||||
die();
|
||||
}
|
||||
|
||||
$CategoryID = $Escaped['categoryid'];
|
||||
if(!isset($CategoryID)) {
|
||||
if (!isset($CategoryID)) {
|
||||
echo 'Hax occuring on the categoryid';
|
||||
die();
|
||||
}
|
||||
@ -58,26 +58,28 @@
|
||||
$TorrentID = $Escaped['torrentid'];
|
||||
$RawName = $Escaped['raw_name'];
|
||||
|
||||
if(($Escaped['resolve_type'] == "manual" || $Escaped['resolve_type'] == "dismiss" ) && $Report) {
|
||||
if($Escaped['comment']) {
|
||||
if (($Escaped['resolve_type'] == "manual" || $Escaped['resolve_type'] == "dismiss" ) && $Report) {
|
||||
if ($Escaped['comment']) {
|
||||
$Comment = $Escaped['comment'];
|
||||
} else {
|
||||
if($Escaped['resolve_type'] == "manual") {
|
||||
if ($Escaped['resolve_type'] == "manual") {
|
||||
$Comment = "Report was resolved manually";
|
||||
} elseif($Escaped['resolve_type'] == "dismiss") {
|
||||
} elseif ($Escaped['resolve_type'] == "dismiss") {
|
||||
$Comment = "Report was dismissed as invalid";
|
||||
}
|
||||
}
|
||||
|
||||
$DB->query("UPDATE reportsv2 SET
|
||||
Status='Resolved',
|
||||
LastChangeTime='".sqltime()."',
|
||||
ModComment = '".$Comment."',
|
||||
ResolverID='".$LoggedUser['ID']."'
|
||||
WHERE ID='".$ReportID."'
|
||||
AND Status <> 'Resolved'");
|
||||
$DB->query("
|
||||
UPDATE reportsv2
|
||||
SET
|
||||
Status='Resolved',
|
||||
LastChangeTime='".sqltime()."',
|
||||
ModComment = '".$Comment."',
|
||||
ResolverID='".$LoggedUser['ID']."'
|
||||
WHERE ID='".$ReportID."'
|
||||
AND Status <> 'Resolved'");
|
||||
|
||||
if($DB->affected_rows() > 0) {
|
||||
if ($DB->affected_rows() > 0) {
|
||||
$Cache->delete_value('num_torrent_reportsv2');
|
||||
$Cache->delete_value('reports_torrent_'.$TorrentID);
|
||||
} else {
|
||||
@ -96,12 +98,12 @@
|
||||
die();
|
||||
}
|
||||
|
||||
if(!isset($Escaped['resolve_type'])) {
|
||||
if (!isset($Escaped['resolve_type'])) {
|
||||
echo 'No resolve type';
|
||||
die();
|
||||
} else if (array_key_exists($_POST['resolve_type'], $Types[$CategoryID])) {
|
||||
} elseif (array_key_exists($_POST['resolve_type'], $Types[$CategoryID])) {
|
||||
$ResolveType = $Types[$CategoryID][$_POST['resolve_type']];
|
||||
} else if(array_key_exists($_POST['resolve_type'],$Types['master'])) {
|
||||
} elseif (array_key_exists($_POST['resolve_type'],$Types['master'])) {
|
||||
$ResolveType = $Types['master'][$_POST['resolve_type']];
|
||||
} else {
|
||||
//There was a type but it wasn't an option!
|
||||
@ -112,20 +114,22 @@
|
||||
|
||||
$DB->query("SELECT ID FROM torrents WHERE ID = ".$TorrentID);
|
||||
$TorrentExists = ($DB->record_count() > 0);
|
||||
if(!$TorrentExists) {
|
||||
$DB->query("UPDATE reportsv2
|
||||
if (!$TorrentExists) {
|
||||
$DB->query("
|
||||
UPDATE reportsv2
|
||||
SET Status='Resolved',
|
||||
LastChangeTime='".sqltime()."',
|
||||
ResolverID='".$LoggedUser['ID']."',
|
||||
ModComment='Report already dealt with (Torrent deleted)'
|
||||
WHERE ID=".$ReportID);
|
||||
LastChangeTime='".sqltime()."',
|
||||
ResolverID='".$LoggedUser['ID']."',
|
||||
ModComment='Report already dealt with (Torrent deleted)'
|
||||
WHERE ID=".$ReportID);
|
||||
|
||||
$Cache->decrement('num_torrent_reportsv2');
|
||||
}
|
||||
|
||||
if($Report) {
|
||||
if ($Report) {
|
||||
//Resolve with a parallel check
|
||||
$DB->query("UPDATE reportsv2
|
||||
$DB->query("
|
||||
UPDATE reportsv2
|
||||
SET Status='Resolved',
|
||||
LastChangeTime='".sqltime()."',
|
||||
ResolverID='".$LoggedUser['ID']."'
|
||||
@ -134,19 +138,21 @@
|
||||
}
|
||||
|
||||
//See if it we managed to resolve
|
||||
if($DB->affected_rows() > 0 || !$Report) {
|
||||
if ($DB->affected_rows() > 0 || !$Report) {
|
||||
//We did, lets do all our shit
|
||||
if($Report) { $Cache->decrement('num_torrent_reportsv2'); }
|
||||
if ($Report) {
|
||||
$Cache->decrement('num_torrent_reportsv2');
|
||||
}
|
||||
|
||||
|
||||
if(isset($Escaped['upload'])) {
|
||||
if (isset($Escaped['upload'])) {
|
||||
$Upload = true;
|
||||
} else {
|
||||
$Upload = false;
|
||||
}
|
||||
|
||||
|
||||
if($_POST['resolve_type'] == "tags_lots") {
|
||||
if ($_POST['resolve_type'] == "tags_lots") {
|
||||
$DB->query("INSERT IGNORE INTO torrents_bad_tags (TorrentID, UserID, TimeAdded) VALUES (".$TorrentID.", ".$LoggedUser['ID']." , '".sqltime()."')");
|
||||
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
|
||||
list($GroupID) = $DB->next_record();
|
||||
@ -154,14 +160,14 @@
|
||||
$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("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
|
||||
list($GroupID) = $DB->next_record();
|
||||
$Cache->delete_value('torrents_details_'.$GroupID);
|
||||
$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("SELECT GroupID FROM torrents WHERE ID = ".$TorrentID);
|
||||
list($GroupID) = $DB->next_record();
|
||||
@ -170,12 +176,12 @@
|
||||
}
|
||||
|
||||
//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);
|
||||
list($UpUsername) = $DB->next_record();
|
||||
$Log = "Torrent ".$TorrentID." (".$RawName.") uploaded by ".$UpUsername." was deleted by ".$LoggedUser['Username'];
|
||||
$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']." )";
|
||||
}
|
||||
$DB->query("SELECT GroupID, hex(info_hash) FROM torrents WHERE ID = ".$TorrentID);
|
||||
@ -192,23 +198,24 @@
|
||||
}
|
||||
|
||||
//Warnings / remove upload
|
||||
if($Upload) {
|
||||
if ($Upload) {
|
||||
$Cache->begin_transaction('user_info_heavy_'.$UploaderID);
|
||||
$Cache->update_row(false, array('DisableUpload' => '1'));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$DB->query("UPDATE users_info SET
|
||||
DisableUpload='1'
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET DisableUpload='1'
|
||||
WHERE UserID=".$UploaderID);
|
||||
}
|
||||
|
||||
if($Warning > 0) {
|
||||
$WarnLength = $Warning * (7*24*60*60);
|
||||
if ($Warning > 0) {
|
||||
$WarnLength = $Warning * (7 * 24 * 60 * 60);
|
||||
$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'].").";
|
||||
}
|
||||
if($Upload) {
|
||||
if ($Upload) {
|
||||
$Reason .= " (Upload privileges Removed).";
|
||||
}
|
||||
|
||||
@ -216,16 +223,16 @@
|
||||
} else {
|
||||
//This is a bitch for people that don't warn but do other things, it makes me sad.
|
||||
$AdminComment = '';
|
||||
if($Upload) {
|
||||
if ($Upload) {
|
||||
//They removed upload
|
||||
$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)";
|
||||
}
|
||||
if($Escaped['admin_message']) {
|
||||
if ($Escaped['admin_message']) {
|
||||
//They did nothing of note, but still want to mark it (Or upload and mark)
|
||||
$AdminComment .= " (".$Escaped['admin_message'].")";
|
||||
}
|
||||
if($AdminComment) {
|
||||
if ($AdminComment) {
|
||||
$AdminComment = date("Y-m-d").' - '.$AdminComment."\n\n";
|
||||
|
||||
$DB->query("UPDATE users_info SET
|
||||
@ -235,8 +242,8 @@
|
||||
}
|
||||
|
||||
//PM
|
||||
if($Escaped['uploader_pm'] || $Warning > 0 || isset($Escaped['delete']) || $SendPM) {
|
||||
if(isset($Escaped['delete'])) {
|
||||
if ($Escaped['uploader_pm'] || $Warning > 0 || isset($Escaped['delete']) || $SendPM) {
|
||||
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";
|
||||
} else {
|
||||
$PM = '[url=https://'.SSL_SITE_URL."/torrents.php?torrentid=".$TorrentID."]Your above torrent[/url] was reported but not deleted.\n\n";
|
||||
@ -244,23 +251,23 @@
|
||||
|
||||
$Preset = $ResolveType['resolve_options']['pm'];
|
||||
|
||||
if($Preset != "") {
|
||||
if ($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";
|
||||
}
|
||||
|
||||
if($Upload) {
|
||||
if ($Upload) {
|
||||
$PM .= "This has ".($Warning > 0 ? 'also ' : '')."resulted in you losing your upload privileges.";
|
||||
}
|
||||
|
||||
if($Log) {
|
||||
if ($Log) {
|
||||
$PM = $PM."\nLog Message: ".$Log."\n";
|
||||
}
|
||||
|
||||
if($Escaped['uploader_pm']) {
|
||||
if ($Escaped['uploader_pm']) {
|
||||
$PM .= "\nMessage from ".$LoggedUser['Username'].": ".$PMMessage;
|
||||
}
|
||||
|
||||
@ -272,7 +279,7 @@
|
||||
$Cache->delete_value('reports_torrent_'.$TorrentID);
|
||||
|
||||
//Now we've done everything, update the DB with values
|
||||
if($Report) {
|
||||
if ($Report) {
|
||||
$DB->query("UPDATE reportsv2 SET
|
||||
Type = '".$Escaped['resolve_type']."',
|
||||
LogMessage='".db_string($Log)."',
|
||||
|
@ -5,7 +5,7 @@
|
||||
* and the current in-progress reports by staff member.
|
||||
* All the different views are self explanatory by their names.
|
||||
*/
|
||||
if(!check_perms('admin_reports')){
|
||||
if (!check_perms('admin_reports')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
@ -23,10 +23,19 @@
|
||||
<? include('header.php'); ?>
|
||||
</div>
|
||||
<br />
|
||||
<div class="box pad thin" style="padding: 0px 0px 0px 20px; width: 70%; margin-left: auto; margin-right: auto">
|
||||
<div class="box pad thin" style="padding: 0px 0px 0px 20px; width: 70%; margin-left: auto; margin-right: auto;">
|
||||
<table class="layout"><tr><td style="width: 50%;">
|
||||
<?
|
||||
$DB->query("SELECT um.ID, um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.LastChangeTime > NOW() - INTERVAL 24 HOUR GROUP BY r.ResolverID ORDER BY Reports DESC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.ID,
|
||||
um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reportsv2 AS r
|
||||
JOIN users_main AS um ON um.ID=r.ResolverID
|
||||
WHERE r.LastChangeTime > NOW() - INTERVAL 24 HOUR
|
||||
GROUP BY r.ResolverID
|
||||
ORDER BY Reports DESC");
|
||||
$Results = $DB->to_array();
|
||||
?>
|
||||
<strong>Reports resolved in the last 24 hours</strong>
|
||||
@ -46,7 +55,16 @@
|
||||
</table>
|
||||
<br />
|
||||
<?
|
||||
$DB->query("SELECT um.ID, um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.LastChangeTime > NOW() - INTERVAL 1 WEEK GROUP BY r.ResolverID ORDER BY Reports DESC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.ID,
|
||||
um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reportsv2 AS r
|
||||
JOIN users_main AS um ON um.ID=r.ResolverID
|
||||
WHERE r.LastChangeTime > NOW() - INTERVAL 1 WEEK
|
||||
GROUP BY r.ResolverID
|
||||
ORDER BY Reports DESC");
|
||||
$Results = $DB->to_array();
|
||||
?>
|
||||
<strong>Reports resolved in the last week</strong>
|
||||
@ -55,7 +73,7 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach($Results as $Result) {
|
||||
<? foreach ($Results as $Result) {
|
||||
list($UserID, $Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -66,7 +84,16 @@
|
||||
</table>
|
||||
<br />
|
||||
<?
|
||||
$DB->query("SELECT um.ID, um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID WHERE r.LastChangeTime > NOW() - INTERVAL 1 MONTH GROUP BY r.ResolverID ORDER BY Reports DESC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.ID,
|
||||
um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reportsv2 AS r
|
||||
JOIN users_main AS um ON um.ID=r.ResolverID
|
||||
WHERE r.LastChangeTime > NOW() - INTERVAL 1 MONTH
|
||||
GROUP BY r.ResolverID
|
||||
ORDER BY Reports DESC");
|
||||
$Results = $DB->to_array();
|
||||
?>
|
||||
<strong>Reports resolved in the last month</strong>
|
||||
@ -75,7 +102,7 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach($Results as $Result) {
|
||||
<? foreach ($Results as $Result) {
|
||||
list($UserID, $Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -86,7 +113,14 @@
|
||||
</table>
|
||||
<br />
|
||||
<?
|
||||
$DB->query("SELECT um.Username, COUNT(r.ID) AS Reports FROM reportsv2 AS r JOIN users_main AS um ON um.ID=r.ResolverID GROUP BY r.ResolverID ORDER BY Reports DESC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
um.Username,
|
||||
COUNT(r.ID) AS Reports
|
||||
FROM reportsv2 AS r
|
||||
JOIN users_main AS um ON um.ID=r.ResolverID
|
||||
GROUP BY r.ResolverID
|
||||
ORDER BY Reports DESC");
|
||||
$Results = $DB->to_array();
|
||||
?>
|
||||
<strong>Reports resolved since Reports v2 (2009-07-27)</strong>
|
||||
@ -95,7 +129,7 @@
|
||||
<td class="head colhead_dark">Username</td>
|
||||
<td class="head colhead_dark">Reports</td>
|
||||
</tr>
|
||||
<? foreach($Results as $Result) {
|
||||
<? foreach ($Results as $Result) {
|
||||
list($Username, $Reports) = $Result;
|
||||
?>
|
||||
<tr>
|
||||
@ -171,15 +205,17 @@
|
||||
</td>
|
||||
<td style="vertical-align: top;">
|
||||
<?
|
||||
$DB->query("SELECT r.ResolverID,
|
||||
um.Username,
|
||||
COUNT(r.ID) AS Count,
|
||||
COUNT(tasted.Tasted) AS Tasted
|
||||
FROM reportsv2 AS r
|
||||
LEFT JOIN users_main AS um ON r.ResolverID=um.ID
|
||||
LEFT JOIN torrents AS tasted ON tasted.ID=r.TorrentID AND tasted.Tasted = '1'
|
||||
WHERE r.Status = 'InProgress'
|
||||
GROUP BY r.ResolverID");
|
||||
$DB->query("
|
||||
SELECT
|
||||
r.ResolverID,
|
||||
um.Username,
|
||||
COUNT(r.ID) AS Count,
|
||||
COUNT(tasted.Tasted) AS Tasted
|
||||
FROM reportsv2 AS r
|
||||
LEFT JOIN users_main AS um ON r.ResolverID=um.ID
|
||||
LEFT JOIN torrents AS tasted ON tasted.ID=r.TorrentID AND tasted.Tasted = '1'
|
||||
WHERE r.Status = 'InProgress'
|
||||
GROUP BY r.ResolverID");
|
||||
$Staff = $DB->to_array();
|
||||
?>
|
||||
<strong>Currently assigned reports by staff member</strong>
|
||||
@ -191,7 +227,7 @@
|
||||
</tr>
|
||||
|
||||
<?
|
||||
foreach($Staff as $Array) { ?>
|
||||
foreach ($Staff as $Array) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="reportsv2.php?view=staff&id=<?=$Array['ResolverID']?>"><?=display_str($Array['Username'])?>'s reports</a>
|
||||
@ -208,13 +244,15 @@
|
||||
<br />
|
||||
<h3>Different view modes by report type</h3>
|
||||
<?
|
||||
$DB->query("SELECT r.Type,
|
||||
COUNT(r.ID) AS Count
|
||||
FROM reportsv2 AS r
|
||||
WHERE r.Status='New'
|
||||
GROUP BY r.Type");
|
||||
$DB->query("
|
||||
SELECT
|
||||
r.Type,
|
||||
COUNT(r.ID) AS Count
|
||||
FROM reportsv2 AS r
|
||||
WHERE r.Status='New'
|
||||
GROUP BY r.Type");
|
||||
$Current = $DB->to_array();
|
||||
if(!empty($Current)) {
|
||||
if (!empty($Current)) {
|
||||
?>
|
||||
<table>
|
||||
<tr class="colhead">
|
||||
@ -222,10 +260,10 @@
|
||||
<td>Current count</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach($Current as $Array) {
|
||||
foreach ($Current as $Array) {
|
||||
//Ugliness
|
||||
foreach($Types as $Category) {
|
||||
if(!empty($Category[$Array['Type']])) {
|
||||
foreach ($Types as $Category) {
|
||||
if (!empty($Category[$Array['Type']])) {
|
||||
$Title = $Category[$Array['Type']]['title'];
|
||||
break;
|
||||
}
|
||||
|
@ -3,21 +3,22 @@
|
||||
function get_request_artists($RequestID) {
|
||||
global $Cache, $DB;
|
||||
$Artists = $Cache->get_value('request_artists_'.$RequestID);
|
||||
if(is_array($Artists)) {
|
||||
if (is_array($Artists)) {
|
||||
$Results = $Artists;
|
||||
} else {
|
||||
$Results = array();
|
||||
$DB->query("SELECT ra.ArtistID,
|
||||
aa.Name,
|
||||
ra.Importance
|
||||
FROM requests_artists AS ra
|
||||
JOIN artists_alias AS aa ON ra.AliasID = aa.AliasID
|
||||
WHERE ra.RequestID = ".$RequestID."
|
||||
ORDER BY ra.Importance ASC,
|
||||
aa.Name ASC;");
|
||||
$DB->query("
|
||||
SELECT
|
||||
ra.ArtistID,
|
||||
aa.Name,
|
||||
ra.Importance
|
||||
FROM requests_artists AS ra
|
||||
JOIN artists_alias AS aa ON ra.AliasID = aa.AliasID
|
||||
WHERE ra.RequestID = ".$RequestID."
|
||||
ORDER BY ra.Importance ASC, aa.Name ASC;");
|
||||
|
||||
$ArtistRaw = $DB->to_array();
|
||||
foreach($ArtistRaw as $ArtistRow) {
|
||||
foreach ($ArtistRaw as $ArtistRow) {
|
||||
list($ArtistID, $ArtistName, $ArtistImportance) = $ArtistRow;
|
||||
$Results[$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName);
|
||||
}
|
||||
@ -28,15 +29,17 @@ function get_request_artists($RequestID) {
|
||||
|
||||
function get_request_tags($RequestID) {
|
||||
global $DB;
|
||||
$DB->query("SELECT rt.TagID,
|
||||
t.Name
|
||||
FROM requests_tags AS rt
|
||||
JOIN tags AS t ON rt.TagID=t.ID
|
||||
WHERE rt.RequestID = ".$RequestID."
|
||||
ORDER BY rt.TagID ASC");
|
||||
$DB->query("
|
||||
SELECT
|
||||
rt.TagID,
|
||||
t.Name
|
||||
FROM requests_tags AS rt
|
||||
JOIN tags AS t ON rt.TagID=t.ID
|
||||
WHERE rt.RequestID = ".$RequestID."
|
||||
ORDER BY rt.TagID ASC");
|
||||
$Tags = $DB->to_array();
|
||||
$Results = array();
|
||||
foreach($Tags as $TagsRow) {
|
||||
foreach ($Tags as $TagsRow) {
|
||||
list($TagID, $TagName) = $TagsRow;
|
||||
$Results[$TagID]= $TagName;
|
||||
}
|
||||
@ -47,15 +50,17 @@ function get_votes_array($RequestID) {
|
||||
global $Cache, $DB;
|
||||
|
||||
$RequestVotes = $Cache->get_value('request_votes_'.$RequestID);
|
||||
if(!is_array($RequestVotes)) {
|
||||
$DB->query("SELECT rv.UserID,
|
||||
rv.Bounty,
|
||||
u.Username
|
||||
FROM requests_votes as rv
|
||||
LEFT JOIN users_main AS u ON u.ID=rv.UserID
|
||||
WHERE rv.RequestID = ".$RequestID."
|
||||
ORDER BY rv.Bounty DESC");
|
||||
if($DB->record_count() < 1) {
|
||||
if (!is_array($RequestVotes)) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
rv.UserID,
|
||||
rv.Bounty,
|
||||
u.Username
|
||||
FROM requests_votes as rv
|
||||
LEFT JOIN users_main AS u ON u.ID=rv.UserID
|
||||
WHERE rv.RequestID = ".$RequestID."
|
||||
ORDER BY rv.Bounty DESC");
|
||||
if ($DB->record_count() < 1) {
|
||||
error(0);
|
||||
} else {
|
||||
$Votes = $DB->to_array();
|
||||
@ -63,7 +68,7 @@ function get_votes_array($RequestID) {
|
||||
$RequestVotes = array();
|
||||
$RequestVotes['TotalBounty'] = array_sum($DB->collect('Bounty'));
|
||||
|
||||
foreach($Votes as $Vote) {
|
||||
foreach ($Votes as $Vote) {
|
||||
list($UserID, $Bounty, $Username) = $Vote;
|
||||
$VoteArray = array();
|
||||
$VotesArray[] = array('UserID' => $UserID,
|
||||
|
@ -1,39 +1,41 @@
|
||||
<?
|
||||
if(!isset($_GET['id']) || !is_number($_GET['id'])) { error(404); }
|
||||
if (!isset($_GET['id']) || !is_number($_GET['id'])) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$Action = $_GET['action'];
|
||||
if($Action != "unfill" && $Action != "delete") {
|
||||
if ($Action != 'unfill' && $Action != 'delete') {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$DB->query("SELECT UserID, FillerID FROM requests WHERE ID = ".$_GET['id']);
|
||||
list($RequestorID, $FillerID) = $DB->next_record();
|
||||
|
||||
if($Action == 'unfill') {
|
||||
if($LoggedUser['ID'] != $RequestorID && $LoggedUser['ID'] != $FillerID && !check_perms('site_moderate_requests')) {
|
||||
if ($Action == 'unfill') {
|
||||
if ($LoggedUser['ID'] != $RequestorID && $LoggedUser['ID'] != $FillerID && !check_perms('site_moderate_requests')) {
|
||||
error(403);
|
||||
}
|
||||
} elseif($Action == "delete") {
|
||||
if($LoggedUser['ID'] != $RequestorID && !check_perms('site_moderate_requests')) {
|
||||
} elseif ($Action == "delete") {
|
||||
if ($LoggedUser['ID'] != $RequestorID && !check_perms('site_moderate_requests')) {
|
||||
error(403);
|
||||
}
|
||||
}
|
||||
|
||||
View::show_header(ucwords($Action)." Request");
|
||||
View::show_header(ucwords($Action) . ' Request');
|
||||
?>
|
||||
<div class="thin center">
|
||||
<div class="box" style="width:600px; margin:0px auto;">
|
||||
<div class="box" style="width: 600px; margin: 0px auto;">
|
||||
<div class="head colhead">
|
||||
<?=ucwords($Action)?> Request
|
||||
</div>
|
||||
<div class="pad">
|
||||
<form class="<?=($Action == 'delete')?'delete_form':'edit_form'?>" name="request" action="requests.php" method="post">
|
||||
<form class="<?=(($Action == 'delete') ? 'delete_form' : 'edit_form')?>" name="request" action="requests.php" method="post">
|
||||
<input type="hidden" name="action" value="take<?=$Action?>" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="id" value="<?=$_GET['id']?>" />
|
||||
<? if($Action == 'delete') { ?>
|
||||
<? if ($Action == 'delete') { ?>
|
||||
<div class="warning">You will <strong>not</strong> get your bounty back if you delete this request.</div>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<strong>Reason:</strong>
|
||||
<input type="text" name="reason" size="30" />
|
||||
<input value="<?=ucwords($Action)?>" type="submit" />
|
||||
@ -43,4 +45,4 @@
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
?>
|
||||
?>
|
||||
|
@ -5,26 +5,28 @@
|
||||
authorize();
|
||||
|
||||
$RequestID = $_POST['id'];
|
||||
if(!is_number($RequestID)) {
|
||||
if (!is_number($RequestID)) {
|
||||
error(0);
|
||||
}
|
||||
|
||||
$DB->query("SELECT UserID,
|
||||
Title,
|
||||
CategoryID,
|
||||
GroupID
|
||||
FROM requests
|
||||
WHERE ID = ".$RequestID);
|
||||
$DB->query("
|
||||
SELECT
|
||||
UserID,
|
||||
Title,
|
||||
CategoryID,
|
||||
GroupID
|
||||
FROM requests
|
||||
WHERE ID = ".$RequestID);
|
||||
list($UserID, $Title, $CategoryID, $GroupID) = $DB->next_record();
|
||||
|
||||
if($LoggedUser['ID'] != $UserID && !check_perms('site_moderate_requests')) {
|
||||
if ($LoggedUser['ID'] != $UserID && !check_perms('site_moderate_requests')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
$CategoryName = $Categories[$CategoryID - 1];
|
||||
|
||||
//Do we need to get artists?
|
||||
if($CategoryName == "Music") {
|
||||
if ($CategoryName == 'Music') {
|
||||
$ArtistForm = get_request_artists($RequestID);
|
||||
$ArtistName = Artists::display_artists($ArtistForm, false, true);
|
||||
$FullName = $ArtistName.$Title;
|
||||
@ -45,11 +47,11 @@
|
||||
}
|
||||
$DB->query("DELETE FROM requests_artists WHERE RequestID='$RequestID'");
|
||||
|
||||
if($UserID != $LoggedUser['ID']) {
|
||||
Misc::send_pm($UserID, 0, "A request you created has been deleted", "The request '".$FullName."' was deleted by [url=https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID']."]".$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']);
|
||||
if ($UserID != $LoggedUser['ID']) {
|
||||
Misc::send_pm($UserID, 0, 'A request you created has been deleted', "The request '$FullName' was deleted by [url=https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID'].']'.$LoggedUser['Username']."[/url] for the reason: ".$_POST['reason']);
|
||||
}
|
||||
|
||||
Misc::write_log("Request $RequestID ($FullName) was deleted by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].") for the reason: ".$_POST['reason']);
|
||||
Misc::write_log("Request $RequestID ($FullName) was deleted by user ".$LoggedUser['ID'].' ('.$LoggedUser['Username'].') for the reason: '.$_POST['reason']);
|
||||
|
||||
$Cache->delete_value('request_'.$RequestID);
|
||||
$Cache->delete_value('request_votes_'.$RequestID);
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
if (!check_perms('users_warn')) { error(404);}
|
||||
if (!check_perms('users_warn')) {
|
||||
error(404);
|
||||
}
|
||||
Misc::assert_isset_request($_POST, array('groupid', 'postid', 'userid', 'key'));
|
||||
|
||||
$GroupID = (int) $_POST['groupid'];
|
||||
@ -7,13 +9,14 @@
|
||||
$UserID = (int) $_POST['userid'];
|
||||
$Key = (int) $_POST['key'];
|
||||
$UserInfo = Users::user_info($UserID);
|
||||
$DB->query("SELECT
|
||||
rc.Body,
|
||||
rc.AuthorID,
|
||||
rc.RequestID,
|
||||
rc.AddedTime
|
||||
FROM requests_comments AS rc
|
||||
WHERE rc.ID='$PostID'");
|
||||
$DB->query("
|
||||
SELECT
|
||||
rc.Body,
|
||||
rc.AuthorID,
|
||||
rc.RequestID,
|
||||
rc.AddedTime
|
||||
FROM requests_comments AS rc
|
||||
WHERE rc.ID='$PostID'");
|
||||
list($PostBody) = $DB -> next_record();
|
||||
|
||||
View::show_header('Warn User');
|
||||
@ -45,19 +48,19 @@
|
||||
<option value="1">1 week</option>
|
||||
<option value="2">2 weeks</option>
|
||||
<option value="4">4 weeks</option>
|
||||
<? if(check_perms("users_mod")) { ?>
|
||||
<? if (check_perms('users_mod')) { ?>
|
||||
<option value="8">8 weeks</option>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Private Message:</td>
|
||||
<td class="label">Private message:</td>
|
||||
<td>
|
||||
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Edit Post:</td>
|
||||
<td class="label">Edit post:</td>
|
||||
<td>
|
||||
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
|
||||
<br />
|
||||
|
@ -4,7 +4,7 @@
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
|
||||
if(!empty($_POST['message'])) {
|
||||
if (!empty($_POST['message'])) {
|
||||
echo $Text->full_format($_POST['message']);
|
||||
}
|
||||
?>
|
||||
|
@ -58,8 +58,8 @@
|
||||
// List messages
|
||||
$Row = 'a';
|
||||
$ShowBox = 1;
|
||||
while(list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $Resolved) = $DB->next_record()) {
|
||||
if($Unread === '1') {
|
||||
while (list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $Resolved) = $DB->next_record()) {
|
||||
if ($Unread === '1') {
|
||||
$RowClass = 'unreadpm';
|
||||
} else {
|
||||
$Row = ($Row === 'a') ? 'b' : 'a';
|
||||
@ -84,9 +84,9 @@
|
||||
}
|
||||
|
||||
// Get assigned
|
||||
$Assigned = ($Level == 0) ? "First Line Support" : $ClassLevels[$Level]['Name'];
|
||||
$Assigned = ($Level == 0) ? 'First Line Support' : $ClassLevels[$Level]['Name'];
|
||||
// No + on Sysops
|
||||
if ($Assigned != 'Sysop') { $Assigned .= "+"; }
|
||||
if ($Assigned != 'Sysop') { $Assigned .= '+'; }
|
||||
|
||||
// Table row
|
||||
?>
|
||||
@ -113,4 +113,4 @@
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<? View::show_footer(); ?>
|
||||
<? View::show_footer(); ?>
|
||||
|
@ -117,9 +117,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<span style="float: left;"><?=display_str($IP)?></span>
|
||||
<span style="float: right;"><?=display_str($Uses)?> <a href="userhistory.php?action=ips&userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&ip_history=on&ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a></span><br />
|
||||
<span style="float: right;"><?=display_str($Uses)?> <a href="userhistory.php?action=ips&userid=<?=$UserID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&ip_history=on&ip=<?=display_str($IP)?>" title="Search" class="brackets">S</a> <a href="http://whatismyipaddress.com/ip/<?=display_str($IP)?>" title="WI" class="brackets">WI</a></span><br />
|
||||
<span style="float: left;"><?=display_str($InviterIP)?></span>
|
||||
<span style="float: right;"><?=display_str($InviterUses)?> <a href="userhistory.php?action=ips&userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&ip_history=on&ip=<?=display_str($InviterIP)?>" title="Search" class="brackets">S</a></span><br />
|
||||
<span style="float: right;"><?=display_str($InviterUses)?> <a href="userhistory.php?action=ips&userid=<?=$InviterID?>" title="History" class="brackets">H</a> <a href="/user.php?action=search&ip_history=on&ip=<?=display_str($InviterIP)?>" title="Search" class="brackets">S</a> <a href="http://whatismyipaddress.com/ip/<?=display_str($InviterIP)?>" title="WI" class="brackets">WI</a></span><br />
|
||||
</td>
|
||||
<td>
|
||||
<?=$IPCC?> <br />
|
||||
|
@ -24,7 +24,7 @@
|
||||
$Client = db_string($_POST['client']);
|
||||
$PeerID = db_string($_POST['peer_id']);
|
||||
|
||||
if ($_POST['submit'] == 'Edit'){ //Edit
|
||||
if ($_POST['submit'] == 'Edit') { //Edit
|
||||
if (empty($_POST['id']) || !is_number($_POST['id'])) {
|
||||
error('3');
|
||||
} else {
|
||||
|
@ -16,7 +16,7 @@ var autocomp = {
|
||||
this.cache[id] = ["",[],[],[]];
|
||||
this.input = document.getElementById(id + "search");
|
||||
this.list = document.getElementById(id + "complete");
|
||||
listener.set(document.body,'click',function(){
|
||||
listener.set(document.body,'click',function() {
|
||||
autocomp.value = autocomp.input.value;
|
||||
autocomp.end();
|
||||
});
|
||||
@ -30,7 +30,7 @@ var autocomp = {
|
||||
},
|
||||
keyup: function (e) {
|
||||
clearTimeout(this.timer);
|
||||
var key = (window.event)?window.event.keyCode:e.keyCode;
|
||||
var key = (window.event) ? window.event.keyCode : e.keyCode;
|
||||
switch (key) {
|
||||
case 27: //esc
|
||||
break;
|
||||
@ -101,7 +101,7 @@ var autocomp = {
|
||||
if (this.pos >= this.list.children.length) {
|
||||
this.pos = -1;
|
||||
} else if (this.pos < -1) {
|
||||
this.pos = this.list.children.length-1;
|
||||
this.pos = this.list.children.length - 1;
|
||||
}
|
||||
|
||||
if (this.pos !== -1) {
|
||||
@ -115,29 +115,29 @@ var autocomp = {
|
||||
this.pos = -1;
|
||||
this.value = unescape(value);
|
||||
|
||||
if (typeof this.cache[this.id+value] === 'object') {
|
||||
this.display(this.cache[this.id+value]);
|
||||
if (typeof this.cache[this.id + value] === 'object') {
|
||||
this.display(this.cache[this.id + value]);
|
||||
return;
|
||||
}
|
||||
|
||||
ajax.get(this.id+'.php?action=autocomplete&name='+this.input.value,function(jstr){
|
||||
ajax.get(this.id+'.php?action=autocomplete&name='+this.input.value,function(jstr) {
|
||||
var data = json.decode(jstr);
|
||||
autocomp.cache[autocomp.id+data[0]] = data;
|
||||
autocomp.display(data);
|
||||
});
|
||||
},
|
||||
display: function (data) {
|
||||
var i,il,li;
|
||||
var i, il, li;
|
||||
this.list.innerHTML = '';
|
||||
for (i=0,il=data[1].length;i<il;++i) {
|
||||
for (i = 0, il = data[1].length; i < il; ++i) {
|
||||
li = document.createElement('li');
|
||||
li.innerHTML = data[1][i];
|
||||
li.i = i;
|
||||
li.artistid = data[3][i];
|
||||
listener.set(li,'mouseover',function(){
|
||||
listener.set(li,'mouseover',function() {
|
||||
autocomp.highlight(this.i);
|
||||
});
|
||||
listener.set(li,'click',function(){
|
||||
listener.set(li,'click',function() {
|
||||
window.location = autocomp.id + '.php?id='+this.artistid;
|
||||
});
|
||||
this.list.appendChild(li);
|
||||
|
@ -1,12 +1,12 @@
|
||||
function show_peers (TorrentID, Page) {
|
||||
if (Page > 0) {
|
||||
ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response) {
|
||||
$('#peers_' + TorrentID).show().raw().innerHTML=response;
|
||||
});
|
||||
} else {
|
||||
if ($('#peers_' + TorrentID).raw().innerHTML === '') {
|
||||
$('#peers_' + TorrentID).show().raw().innerHTML = '<h4>Loading...</h4>';
|
||||
ajax.get('torrents.php?action=peerlist&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('torrents.php?action=peerlist&torrentid=' + TorrentID,function(response) {
|
||||
$('#peers_' + TorrentID).show().raw().innerHTML=response;
|
||||
});
|
||||
} else {
|
||||
@ -19,15 +19,15 @@ function show_peers (TorrentID, Page) {
|
||||
$('#reported_' + TorrentID).hide();
|
||||
}
|
||||
|
||||
function show_snatches (TorrentID, Page){
|
||||
function show_snatches (TorrentID, Page) {
|
||||
if (Page > 0) {
|
||||
ajax.get('torrents.php?action=snatchlist&page='+Page+'&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('torrents.php?action=snatchlist&page='+Page+'&torrentid=' + TorrentID,function(response) {
|
||||
$('#snatches_' + TorrentID).show().raw().innerHTML=response;
|
||||
});
|
||||
} else {
|
||||
if ($('#snatches_' + TorrentID).raw().innerHTML === '') {
|
||||
$('#snatches_' + TorrentID).show().raw().innerHTML = '<h4>Loading...</h4>';
|
||||
ajax.get('torrents.php?action=snatchlist&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('torrents.php?action=snatchlist&torrentid=' + TorrentID,function(response) {
|
||||
$('#snatches_' + TorrentID).show().raw().innerHTML=response;
|
||||
});
|
||||
} else {
|
||||
@ -40,15 +40,15 @@ function show_snatches (TorrentID, Page){
|
||||
$('#reported_' + TorrentID).hide();
|
||||
}
|
||||
|
||||
function show_downloads (TorrentID, Page){
|
||||
function show_downloads (TorrentID, Page) {
|
||||
if (Page > 0) {
|
||||
ajax.get('torrents.php?action=downloadlist&page='+Page+'&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('torrents.php?action=downloadlist&page='+Page+'&torrentid=' + TorrentID,function(response) {
|
||||
$('#downloads_' + TorrentID).show().raw().innerHTML=response;
|
||||
});
|
||||
} else {
|
||||
if ($('#downloads_' + TorrentID).raw().innerHTML === '') {
|
||||
$('#downloads_' + TorrentID).show().raw().innerHTML = '<h4>Loading...</h4>';
|
||||
ajax.get('torrents.php?action=downloadlist&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('torrents.php?action=downloadlist&torrentid=' + TorrentID,function(response) {
|
||||
$('#downloads_' + TorrentID).raw().innerHTML=response;
|
||||
});
|
||||
} else {
|
||||
@ -61,7 +61,7 @@ function show_downloads (TorrentID, Page){
|
||||
$('#reported_' + TorrentID).hide();
|
||||
}
|
||||
|
||||
function show_files(TorrentID){
|
||||
function show_files(TorrentID) {
|
||||
$('#files_' + TorrentID).toggle();
|
||||
$('#peers_' + TorrentID).hide();
|
||||
$('#snatches_' + TorrentID).hide();
|
||||
@ -69,7 +69,7 @@ function show_files(TorrentID){
|
||||
$('#reported_' + TorrentID).hide();
|
||||
}
|
||||
|
||||
function show_reported(TorrentID){
|
||||
function show_reported(TorrentID) {
|
||||
$('#files_' + TorrentID).hide();
|
||||
$('#peers_' + TorrentID).hide();
|
||||
$('#snatches_' + TorrentID).hide();
|
||||
@ -95,8 +95,12 @@ function toggle_group(groupid, link, event) {
|
||||
var allGroups = event.ctrlKey;
|
||||
for (var i = 0; i < group_rows.length; i++) {
|
||||
var row = $(group_rows[i]);
|
||||
if (row.has_class('colhead_dark')) { continue; }
|
||||
if (row.has_class('colhead')) { continue; }
|
||||
if (row.has_class('colhead_dark')) {
|
||||
continue;
|
||||
}
|
||||
if (row.has_class('colhead')) {
|
||||
continue;
|
||||
}
|
||||
var relevantRow = row.has_class('group') ? $(group_rows[i+1]) : row;
|
||||
if (allGroups || relevantRow.has_class('groupid_' + groupid)) {
|
||||
row = $(group_rows[i]); // idk why we need this :S
|
||||
@ -122,7 +126,11 @@ function toggle_group(groupid, link, event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; }
|
||||
if (event.preventDefault) {
|
||||
event.preventDefault();
|
||||
} else {
|
||||
event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_edition(groupid, editionid, lnk, event) {
|
||||
@ -149,7 +157,11 @@ function toggle_edition(groupid, editionid, lnk, event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; }
|
||||
if (event.preventDefault) {
|
||||
event.preventDefault();
|
||||
} else {
|
||||
event.returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTorrentSearch(mode) {
|
||||
@ -194,7 +206,9 @@ function Bitrate() {
|
||||
var ArtistFieldCount = 1;
|
||||
|
||||
function AddArtistField() {
|
||||
if (ArtistFieldCount >= 100) { return; }
|
||||
if (ArtistFieldCount >= 100) {
|
||||
return;
|
||||
}
|
||||
var x = $('#AddArtists').raw();
|
||||
x.appendChild(document.createElement("br"));
|
||||
var ArtistField = document.createElement("input");
|
||||
@ -218,7 +232,7 @@ function ToggleEditionRows() {
|
||||
|
||||
function check_private(TorrentID) {
|
||||
$('#checkprivate-'+TorrentID).raw().innerHTML = "Checking...";
|
||||
ajax.get('ajax.php?action=checkprivate&torrentid=' + TorrentID,function(response){
|
||||
ajax.get('ajax.php?action=checkprivate&torrentid=' + TorrentID,function(response) {
|
||||
$('#checkprivate-'+TorrentID).raw().innerHTML = response;
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function Add(input) {
|
||||
if(input.checked == false) {
|
||||
if (input.checked == false) {
|
||||
Cancel();
|
||||
} else {
|
||||
if(document.getElementById("choices").raw().value == "") {
|
||||
@ -12,8 +12,8 @@ function Add(input) {
|
||||
|
||||
function Cancel() {
|
||||
var e=document.getElementsByTagName("input");
|
||||
for(i=0;i<e.length;i++){
|
||||
if(e[i].type=="checkbox"){
|
||||
for (i = 0; i < e.length; i++) {
|
||||
if (e[i].type == "checkbox") {
|
||||
e[i].checked=false;
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@ function Cancel() {
|
||||
function CollageSubscribe(collageid) {
|
||||
ajax.get("userhistory.php?action=collage_subscribe&collageid=" + collageid + "&auth=" + authkey, function() {
|
||||
var subscribeLink = $("#subscribelink" + collageid).raw();
|
||||
if(subscribeLink) {
|
||||
if (subscribeLink) {
|
||||
subscribeLink.firstChild.nodeValue = subscribeLink.firstChild.nodeValue.charAt(0) == 'U'
|
||||
? "Subscribe"
|
||||
: "Unsubscribe";
|
||||
@ -35,15 +35,15 @@ var collageShow = {
|
||||
pg:0,
|
||||
pages:false,
|
||||
wrap:false,
|
||||
init:function(collagePages){
|
||||
init:function(collagePages) {
|
||||
this.wrap = document.getElementById('coverart');
|
||||
this.pages = collagePages;
|
||||
this.max = this.pages.length-1;
|
||||
this.max = this.pages.length - 1;
|
||||
},
|
||||
selected:function(){
|
||||
selected:function() {
|
||||
return $('.linkbox .selected').raw();
|
||||
},
|
||||
createUL:function(data){
|
||||
createUL:function(data) {
|
||||
var ul = document.createElement('ul');
|
||||
$(ul).add_class('collage_images');
|
||||
ul.id = 'collage_page'+this.pg;
|
||||
@ -51,24 +51,30 @@ var collageShow = {
|
||||
this.wrap.appendChild(ul);
|
||||
return ul;
|
||||
},
|
||||
page:function(num,el){
|
||||
page:function(num,el) {
|
||||
var ul = $('#collage_page'+num).raw(), s = this.selected(), covers, lists, i;
|
||||
this.pg = num;
|
||||
|
||||
if(!ul){
|
||||
if (!ul) {
|
||||
covers = this.pages[num];
|
||||
if(covers){
|
||||
if (covers) {
|
||||
ul = this.createUL(covers);
|
||||
}
|
||||
}
|
||||
|
||||
lists = $('.collage_images').objects;
|
||||
i = lists.length;
|
||||
while(i--){ $(lists[i]).hide(); }
|
||||
while (i--) {
|
||||
$(lists[i]).hide();
|
||||
}
|
||||
|
||||
$(ul).show();
|
||||
if(s){ $(s).remove_class('selected'); }
|
||||
if(el){ $(el.parentNode).add_class('selected'); }
|
||||
if (s) {
|
||||
$(s).remove_class('selected');
|
||||
}
|
||||
if (el) {
|
||||
$(el.parentNode).add_class('selected');
|
||||
}
|
||||
|
||||
|
||||
// Toggle the page number links
|
||||
@ -116,15 +122,15 @@ var collageShow = {
|
||||
$('#nextbar').hide();
|
||||
}
|
||||
},
|
||||
nextPage:function(){
|
||||
this.pg = this.pg < this.max ? this.pg+1 : this.pg;
|
||||
nextPage:function() {
|
||||
this.pg = this.pg < this.max ? this.pg + 1 : this.pg;
|
||||
this.pager();
|
||||
},
|
||||
prevPage:function(){
|
||||
this.pg = this.pg > 0 ? this.pg-1 : this.pg;
|
||||
prevPage:function() {
|
||||
this.pg = this.pg > 0 ? this.pg - 1 : this.pg;
|
||||
this.pager();
|
||||
},
|
||||
pager:function(){
|
||||
pager:function() {
|
||||
this.page(this.pg,$('#pagelink'+this.pg).raw().firstChild);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ function Quote(post, user) {
|
||||
function Quote(post, user, link) {
|
||||
username = user;
|
||||
postid = post;
|
||||
ajax.get("?action=get_post&post=" + postid, function(response){
|
||||
ajax.get("?action=get_post&post=" + postid, function(response) {
|
||||
if ($('#quickpost').raw().value !== '') {
|
||||
$('#quickpost').raw().value = $('#quickpost').raw().value + "\n\n";
|
||||
}
|
||||
@ -65,7 +65,7 @@ function Edit_Form(post,key) {
|
||||
* If editing is already underway and edit is pressed again, reset the post
|
||||
* (keeps current functionality, move into brackets to stop from happening).
|
||||
*/
|
||||
ajax.get("?action=get_post&post=" + postid, function(response){
|
||||
ajax.get("?action=get_post&post=" + postid, function(response) {
|
||||
$('#editbox' + postid).raw().value = html_entity_decode(response);
|
||||
resize('editbox' + postid);
|
||||
});
|
||||
@ -82,7 +82,7 @@ function Cancel_Edit(postid) {
|
||||
|
||||
function Preview_Edit(postid) {
|
||||
$('#bar' + postid).raw().innerHTML = "<input type=\"button\" value=\"Editor\" onclick=\"Cancel_Preview(" + postid + ");\" /><input type=\"button\" value=\"Post\" onclick=\"Save_Edit(" + postid + ")\" /><input type=\"button\" value=\"Cancel\" onclick=\"Cancel_Edit(" + postid + ");\" />";
|
||||
ajax.post("ajax.php?action=preview","form" + postid, function(response){
|
||||
ajax.post("ajax.php?action=preview","form" + postid, function(response) {
|
||||
$('#preview' + postid).raw().innerHTML = response;
|
||||
$('#editbox' + postid).hide();
|
||||
});
|
||||
@ -146,7 +146,7 @@ function Delete(post) {
|
||||
$('#post' + postid).hide();
|
||||
});
|
||||
} else if (location.href.match(/artist\.php/)) {
|
||||
ajax.get("artist.php?action=delete_comment&auth="+authkey+ "&postid=" + postid, function (){
|
||||
ajax.get("artist.php?action=delete_comment&auth="+authkey+ "&postid=" + postid, function () {
|
||||
$('#post' + postid).hide();
|
||||
});
|
||||
} else {
|
||||
@ -161,7 +161,7 @@ function Quick_Preview() {
|
||||
var quickreplybuttons;
|
||||
$('#post_preview').raw().value = "Make changes";
|
||||
$('#post_preview').raw().preview = true;
|
||||
ajax.post("ajax.php?action=preview","quickpostform", function(response){
|
||||
ajax.post("ajax.php?action=preview","quickpostform", function(response) {
|
||||
$('#quickreplypreview').show();
|
||||
$('#contentpreview').raw().innerHTML = response;
|
||||
$('#quickreplytext').hide();
|
||||
@ -180,7 +180,7 @@ function Newthread_Preview(mode) {
|
||||
$('#newthreadpreviewbutton').toggle();
|
||||
$('#newthreadeditbutton').toggle();
|
||||
if (mode) { // Preview
|
||||
ajax.post("ajax.php?action=preview","newthreadform", function(response){
|
||||
ajax.post("ajax.php?action=preview","newthreadform", function(response) {
|
||||
$('#contentpreview').raw().innerHTML = response;
|
||||
});
|
||||
$('#newthreadtitle').raw().innerHTML = $('#title').raw().value;
|
||||
|
@ -1,8 +1,8 @@
|
||||
//Using this instead of comments as comments has pertty damn strict requirements on the variable names required
|
||||
|
||||
function Quick_Preview() {
|
||||
$('#buttons').raw().innerHTML = "<input type='button' value='Editor' onclick='Quick_Edit();' /><input type='submit' value='Send Message' />";
|
||||
ajax.post("ajax.php?action=preview","messageform", function(response){
|
||||
$('#buttons').raw().innerHTML = "<input type=\"button\" value=\"Editor\" onclick=\"Quick_Edit();\" /><input type=\"submit\" value=\"Send Message\" />";
|
||||
ajax.post("ajax.php?action=preview","messageform", function(response) {
|
||||
$('#quickpost').hide();
|
||||
$('#preview').raw().innerHTML = response;
|
||||
$('#preview').show();
|
||||
@ -10,7 +10,7 @@ function Quick_Preview() {
|
||||
}
|
||||
|
||||
function Quick_Edit() {
|
||||
$('#buttons').raw().innerHTML = "<input type='button' value='Preview' onclick='Quick_Preview();' /><input type='submit' value='Send Message' />";
|
||||
$('#buttons').raw().innerHTML = "<input type=\"button\" value=\"Preview\" onclick=\"Quick_Preview();\" /><input type=\"submit\" value=\"Send Message\" />";
|
||||
$('#preview').hide();
|
||||
$('#quickpost').show();
|
||||
}
|
||||
|
@ -62,7 +62,12 @@ function main () {
|
||||
});
|
||||
|
||||
// Hide the address bar
|
||||
setTimeout(function(){window.scrollTo(0, 1);setTimeout(function(){window.scrollTo(0, 0);},0);},500);
|
||||
setTimeout(function() {
|
||||
window.scrollTo(0, 1);
|
||||
setTimeout(function() {
|
||||
window.scrollTo(0, 0);
|
||||
},0);
|
||||
}, 500);
|
||||
};
|
||||
|
||||
// Tap header to swap for ratio
|
||||
@ -98,7 +103,7 @@ function load(url,forward,formid) {
|
||||
if (moved_after_touch) {
|
||||
return;
|
||||
}
|
||||
if (formid === undefined){
|
||||
if (formid === undefined) {
|
||||
ajax.get(url, function (response) {
|
||||
get_headers(response);
|
||||
transition_to_new_element(response, forward);
|
||||
|
@ -112,7 +112,7 @@ function calculateComplexity(password) {
|
||||
setStatus(CLEAR);
|
||||
}
|
||||
if (isUserPage()) {
|
||||
if (irckey.length > 0){
|
||||
if (irckey.length > 0) {
|
||||
if (password.toLowerCase() == irckey.toLowerCase()) {
|
||||
setStatus(MATCH_IRCKEY);
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ function PreviewMessage() {
|
||||
function Quote(post, user) {
|
||||
username = user;
|
||||
postid = post;
|
||||
ajax.get("?action=get_post&post=" + postid, function(response){
|
||||
ajax.get("?action=get_post&post=" + postid, function(response) {
|
||||
if ($('#quickpost').raw().value !== '') {
|
||||
$('#quickpost').raw().value = $('#quickpost').raw().value + "\n\n";
|
||||
}
|
||||
$('#quickpost').raw().value = $('#quickpost').raw().value + "[quote="+username+"]" +
|
||||
$('#quickpost').raw().value = $('#quickpost').raw().value + "[quote=" + username + "]" +
|
||||
//response.replace(/(img|aud)(\]|=)/ig,'url$2').replace(/\[url\=(https?:\/\/[^\s\[\]<>"\'()]+?)\]\[url\](.+?)\[\/url\]\[\/url\]/gi, "[url]$1[/url]")
|
||||
html_entity_decode(response)
|
||||
+ "[/quote]";
|
||||
resize('quickpost');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ function ChangeTo(to) {
|
||||
buttons[i].setAttribute('onclick',"ChangeTo('links'); return false;");
|
||||
}
|
||||
} else if (to == "links") {
|
||||
ajax.post("ajax.php?action=preview","form", function(response){
|
||||
ajax.post("ajax.php?action=preview","form", function(response) {
|
||||
$('#admincommentlinks').raw().innerHTML = response;
|
||||
$('#admincomment').hide();
|
||||
$('#admincommentlinks').show();
|
||||
|
@ -1,5 +1,5 @@
|
||||
function Remove_Alias(alias) {
|
||||
ajax.get("wiki.php?action=delete_alias&auth=" + authkey + "&alias=" + alias, function(response){
|
||||
ajax.get("wiki.php?action=delete_alias&auth=" + authkey + "&alias=" + alias, function(response) {
|
||||
$('#alias_' + alias).hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user