mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 20:21:37 +00:00
Empty commit
This commit is contained in:
parent
7421c55040
commit
7b567a5ceb
@ -2,18 +2,14 @@
|
||||
|
||||
$music_extensions = array("mp3","flac","mp4","m4a","m3u","m4b","pls","m3u8","log","txt",
|
||||
"cue","jpg","jpeg","png","gif","dts","ac3","nfo",
|
||||
"sfv","md5","accurip","ffp","pdf");
|
||||
|
||||
$ebooks_extensions = array("pdf", "nfo", "sfv", "mobi", "epub", "txt", "htm", "html", "lit",
|
||||
"chm", "rtf", "doc", "djv", "djvu", "jpg","jpeg","png","gif");
|
||||
"sfv","md5","accurip","ffp","pdf", "mobi", "epub", "htm", "html", "lit",
|
||||
"chm", "rtf", "doc", "djv", "djvu");
|
||||
|
||||
$comics_extensions = array("cbr", "cbz", "pdf", "jpg","jpeg","png","gif");
|
||||
|
||||
$keywords = array("scc.nfo", "torrentday", "demonoid.com", "demonoid.me", "djtunes.com", "mixesdb.com",
|
||||
"housexclusive.net", "plixid.com", "h33t", "reggaeme.com" ,"ThePirateBay.org",
|
||||
"Limetorrents.com", "AhaShare.com", "MixFiend.blogstop", "MixtapeTorrent.blogspot");
|
||||
|
||||
|
||||
function check_file($Type, $Name) {
|
||||
check_name(strtolower($Name));
|
||||
check_extensions($Type, strtolower($Name));
|
||||
@ -40,20 +36,14 @@ function check_name($Name) {
|
||||
|
||||
function check_extensions($Type, $Name) {
|
||||
|
||||
global $music_extensions, $ebooks_extensions, $comics_extensions;
|
||||
global $music_extensions, $comics_extensions;
|
||||
|
||||
if($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy') {
|
||||
if($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy' || $Type == 'E-Books') {
|
||||
if(!in_array(get_file_extension($Name), $music_extensions)) {
|
||||
invalid_error($Name);
|
||||
}
|
||||
}
|
||||
|
||||
if($Type == 'E-Books') {
|
||||
if(!in_array(get_file_extension($Name), $ebooks_extensions)) {
|
||||
invalid_error($Name);
|
||||
}
|
||||
}
|
||||
|
||||
if($Type == 'Comics') {
|
||||
if(!in_array(get_file_extension($Name), $comics_extensions)) {
|
||||
invalid_error($Name);
|
||||
|
@ -98,6 +98,9 @@
|
||||
case 'similar_artists':
|
||||
require(SERVER_ROOT.'/sections/ajax/similar_artists.php');
|
||||
break;
|
||||
case 'userhistory':
|
||||
require(SERVER_ROOT.'/sections/ajax/userhistory/index.php');
|
||||
break;
|
||||
default:
|
||||
// If they're screwing around with the query string
|
||||
print json_encode(array('status' => 'failure'));
|
||||
|
21
sections/ajax/userhistory/index.php
Normal file
21
sections/ajax/userhistory/index.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?
|
||||
|
||||
if ($_GET['type']) {
|
||||
switch ($_GET['type']) {
|
||||
case 'posts':
|
||||
// Load post history page
|
||||
include('post_history.php');
|
||||
break;
|
||||
default:
|
||||
print json_encode(
|
||||
array('status' => 'failure')
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print json_encode(
|
||||
array('status' => 'failure')
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
220
sections/ajax/userhistory/post_history.php
Normal file
220
sections/ajax/userhistory/post_history.php
Normal file
@ -0,0 +1,220 @@
|
||||
<?
|
||||
//TODO: replace 24-43 with user_info()
|
||||
/*
|
||||
User post history page
|
||||
*/
|
||||
|
||||
function error_out($reason = "") {
|
||||
$error = array('status' => 'failure');
|
||||
if ($reason != "")
|
||||
$error['reason'] = $reason;
|
||||
print $error;
|
||||
die();
|
||||
}
|
||||
|
||||
if(!empty($LoggedUser['DisableForums'])) {
|
||||
error_out("You do not have access to the forums!");
|
||||
}
|
||||
|
||||
|
||||
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
|
||||
$Text = new TEXT;
|
||||
|
||||
|
||||
$UserID = empty($_GET['userid']) ? $LoggedUser['ID'] : $_GET['userid'];
|
||||
if(!is_number($UserID)){
|
||||
error_out("User does not exist!");
|
||||
}
|
||||
|
||||
if (isset($LoggedUser['PostsPerPage'])) {
|
||||
$PerPage = $LoggedUser['PostsPerPage'];
|
||||
} else {
|
||||
$PerPage = POSTS_PER_PAGE;
|
||||
}
|
||||
|
||||
list($Page,$Limit) = page_limit($PerPage);
|
||||
|
||||
if(($UserInfo = $Cache->get_value('user_info_'.$UserID)) === FALSE) {
|
||||
$DB->query("SELECT
|
||||
m.Username,
|
||||
m.Enabled,
|
||||
m.Title,
|
||||
i.Avatar,
|
||||
i.Donor,
|
||||
i.Warned
|
||||
FROM users_main AS m
|
||||
JOIN users_info AS i ON i.UserID = m.ID
|
||||
WHERE m.ID = $UserID");
|
||||
|
||||
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();
|
||||
} else {
|
||||
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
|
||||
}
|
||||
|
||||
if(check_perms('site_proxy_images') && !empty($Avatar)) {
|
||||
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Avatar);
|
||||
}
|
||||
|
||||
if($LoggedUser['CustomForums']) {
|
||||
unset($LoggedUser['CustomForums']['']);
|
||||
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||
}
|
||||
$ViewingOwn = ($UserID == $LoggedUser['ID']);
|
||||
$ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread']));
|
||||
$ShowGrouped = ($ViewingOwn && (!isset($_GET['group']) || !!$_GET['group']));
|
||||
if($ShowGrouped) {
|
||||
$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';
|
||||
if($ShowUnread) {
|
||||
$sql.='
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.TopicID = t.ID AND l.UserID = '.$LoggedUser['ID'];
|
||||
}
|
||||
$sql .= '
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
WHERE p.AuthorID = '.$UserID.'
|
||||
AND ((f.MinClassRead <= '.$LoggedUser['EffectiveClass'];
|
||||
if(!empty($RestrictedForums)) {
|
||||
$sql.='
|
||||
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
if(!empty($PermittedForums)) {
|
||||
$sql.='
|
||||
OR f.ID IN (\''.$PermittedForums.'\')';
|
||||
}
|
||||
$sql .= ')';
|
||||
if($ShowUnread) {
|
||||
$sql .= '
|
||||
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\')
|
||||
AND (l.PostID<t.LastPostID OR l.PostID IS NULL))';
|
||||
}
|
||||
$sql .= '
|
||||
GROUP BY t.ID
|
||||
ORDER BY p.ID DESC LIMIT '.$Limit;
|
||||
$PostIDs = $DB->query($sql);
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($Results) = $DB->next_record();
|
||||
|
||||
if($Results > $PerPage*($Page-1)) {
|
||||
$DB->set_query_id($PostIDs);
|
||||
$PostIDs = $DB->collect('ID');
|
||||
$sql = 'SELECT
|
||||
p.ID,
|
||||
p.AddedTime,
|
||||
p.Body,
|
||||
p.EditedUserID,
|
||||
p.EditedTime,
|
||||
ed.Username,
|
||||
p.TopicID,
|
||||
t.Title,
|
||||
t.LastPostID,
|
||||
l.PostID AS LastRead,
|
||||
t.IsLocked,
|
||||
t.IsSticky
|
||||
FROM forums_posts as p
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID
|
||||
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
|
||||
JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID
|
||||
WHERE p.ID IN ('.implode(',',$PostIDs).')
|
||||
ORDER BY p.ID DESC';
|
||||
$Posts = $DB->query($sql);
|
||||
}
|
||||
} else {
|
||||
$sql = 'SELECT
|
||||
SQL_CALC_FOUND_ROWS';
|
||||
if($ShowGrouped) {
|
||||
$sql.=' * FROM (SELECT';
|
||||
}
|
||||
$sql .= '
|
||||
p.ID,
|
||||
p.AddedTime,
|
||||
p.Body,
|
||||
p.EditedUserID,
|
||||
p.EditedTime,
|
||||
ed.Username,
|
||||
p.TopicID,
|
||||
t.Title,
|
||||
t.LastPostID,';
|
||||
if($UserID == $LoggedUser['ID']) {
|
||||
$sql .= '
|
||||
l.PostID AS LastRead,';
|
||||
}
|
||||
$sql .= '
|
||||
t.IsLocked,
|
||||
t.IsSticky
|
||||
FROM forums_posts as p
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID
|
||||
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
|
||||
JOIN forums_topics AS t ON t.ID = p.TopicID
|
||||
JOIN forums AS f ON f.ID = t.ForumID
|
||||
LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID
|
||||
WHERE p.AuthorID = '.$UserID.'
|
||||
AND f.MinClassRead <= '.$LoggedUser['EffectiveClass'];
|
||||
|
||||
if(!empty($RestrictedForums)) {
|
||||
$sql.='
|
||||
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
|
||||
}
|
||||
|
||||
if($ShowUnread) {
|
||||
$sql.='
|
||||
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostID<t.LastPostID OR l.PostID IS NULL)) ';
|
||||
}
|
||||
|
||||
$sql .= '
|
||||
ORDER BY p.ID DESC';
|
||||
|
||||
if($ShowGrouped) {
|
||||
$sql.='
|
||||
) AS sub
|
||||
GROUP BY TopicID ORDER BY ID DESC';
|
||||
}
|
||||
|
||||
$sql.=' LIMIT '.$Limit;
|
||||
$Posts = $DB->query($sql);
|
||||
|
||||
$DB->query("SELECT FOUND_ROWS()");
|
||||
list($Results) = $DB->next_record();
|
||||
|
||||
$DB->set_query_id($Posts);
|
||||
}
|
||||
|
||||
$JsonResults = array();
|
||||
while(list($PostID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername, $TopicID, $ThreadTitle, $LastPostID, $LastRead, $Locked, $Sticky) = $DB->next_record()){
|
||||
$JsonResults[] = array(
|
||||
'postId' => (int) $PostID,
|
||||
'topicId' => (int) $TopicID,
|
||||
'threadTitle' => $ThreadTitle,
|
||||
'lastPostId' => (int) $LastPostID,
|
||||
'lastRead' => (int) $LastRead,
|
||||
'locked' => $Locked == 1,
|
||||
'sticky' => $Sticky == 1,
|
||||
'addedTime' => $AddedTime,
|
||||
'body' => $Text->full_format($Body),
|
||||
'bbbody' => $Body,
|
||||
'editedUserId' => (int) $EditedUserID,
|
||||
'editedTime' => $EditedTime,
|
||||
'editedUsername' => $EditedUsername
|
||||
);
|
||||
}
|
||||
|
||||
print json_encode(
|
||||
array(
|
||||
'status' => 'success',
|
||||
'response' => array(
|
||||
'currentPage' => (int) $Page,
|
||||
'pages' => ceil($Results/$PerPage),
|
||||
'threads' => $JsonResults
|
||||
)
|
||||
)
|
||||
);
|
@ -91,9 +91,9 @@
|
||||
d.Comment,
|
||||
d.Time
|
||||
FROM do_not_upload as d
|
||||
ORDER BY d.Time");
|
||||
ORDER BY d.Time DESC");
|
||||
$DNU = $DB->to_array();
|
||||
list($Name,$Comment,$Updated) = end($DNU);
|
||||
list($Name,$Comment,$Updated) = reset($DNU);
|
||||
reset($DNU);
|
||||
$DB->query("SELECT IF(MAX(t.Time) < '$Updated' OR MAX(t.Time) IS NULL,1,0) FROM torrents AS t
|
||||
WHERE UserID = ".$LoggedUser['ID']);
|
||||
@ -113,11 +113,16 @@
|
||||
<td width="50%"><strong>Name</strong></td>
|
||||
<td><strong>Comment</strong></td>
|
||||
</tr>
|
||||
<? foreach($DNU as $BadUpload) {
|
||||
<? $TimeDiff = strtotime('-1 month', strtotime('now'));
|
||||
foreach($DNU as $BadUpload) {
|
||||
list($Name, $Comment, $Updated) = $BadUpload;
|
||||
?>
|
||||
<tr>
|
||||
<td><?=$Text->full_format($Name)?></td>
|
||||
<td><?=$Text->full_format($Name)?>
|
||||
<? if($TimeDiff < strtotime($Updated)) { ?>
|
||||
<strong class="important_text">(New!)</strong>
|
||||
<? } ?>
|
||||
</td>
|
||||
<td><?=$Text->full_format($Comment)?></td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
|
Loading…
Reference in New Issue
Block a user