mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-12 18:36:29 +00:00
Empty commit
This commit is contained in:
parent
a0a084fe34
commit
8b04ca921c
@ -1,4 +1,3 @@
|
||||
<?
|
||||
define('ERROR_EXCEPTION', true);
|
||||
require ('classes/script_start.php');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?
|
||||
class GOOGLE_CHARTS {
|
||||
protected $URL = 'http://chart.apis.google.com/chart';
|
||||
protected $URL = 'https://chart.googleapis.com/chart';
|
||||
protected $Labels = array();
|
||||
protected $Data = array();
|
||||
protected $Options = array();
|
||||
|
@ -13,7 +13,7 @@ class DEBUG {
|
||||
private $LoggedVars = array();
|
||||
|
||||
public function profile($Automatic = '') {
|
||||
global $ScriptStartTime;
|
||||
global $ScriptStartTime, $DB;
|
||||
$Reason = array();
|
||||
|
||||
if (!empty($Automatic)) {
|
||||
@ -40,6 +40,18 @@ public function profile($Automatic = '') {
|
||||
$Reason[] = Format::get_size($Ram).' RAM used';
|
||||
}
|
||||
|
||||
$DB->warnings(); // see comment in MYSQL::query
|
||||
$Queries = $this->get_queries();
|
||||
$DBWarningCount = 0;
|
||||
foreach ($Queries as $Query) {
|
||||
if (!empty($Query[2])) {
|
||||
$DBWarningCount += count($Query[2]);
|
||||
}
|
||||
}
|
||||
if ($DBWarningCount) {
|
||||
$Reason[] = $DBWarningCount . ' DB warning(s)';
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['profile'])) {
|
||||
global $LoggedUser;
|
||||
$Reason[] = 'Requested by '.$LoggedUser['Username'];
|
||||
@ -477,6 +489,7 @@ public function cache_table($CacheKeys = false) {
|
||||
<tr>
|
||||
<td align="left" class="debug_info debug_cache_key">
|
||||
<a href="#" onclick="$('#debug_cache_<?=$Key?>').gtoggle(); return false;"><?=display_str($Key)?></a>
|
||||
<a href="tools.php?action=clear_cache&key=<?=$Key?>&type=clear" target="_blank" class="brackets">Clear this cache key</a>
|
||||
</td>
|
||||
<td align="left" class="debug_data debug_cache_data">
|
||||
<pre id="debug_cache_<?=$Key?>" class="hidden"><?=display_str(print_r($Cache->get_value($Key, true), true))?></pre>
|
||||
@ -542,11 +555,13 @@ public function query_table($Queries=false) {
|
||||
<table id="debug_database" class="debug_table hidden" width="100%">
|
||||
<?
|
||||
foreach ($Queries as $Query) {
|
||||
list($SQL, $Time) = $Query;
|
||||
list($SQL, $Time, $Warnings) = $Query;
|
||||
$Warnings = implode('<br />', $Warnings);
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td class="debug_data debug_query_data"><div><?=str_replace("\t", ' ', nl2br(display_str($SQL)))?></div></td>
|
||||
<td class="rowa debug_info debug_query_time" style="width: 130px;" align="left"><?=number_format($Time, 5)?> ms</td>
|
||||
<td class="rowa debug_info debug_query_warnings"><?=$Warnings?></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
|
@ -204,6 +204,19 @@ function connect() {
|
||||
|
||||
function query($Query, $AutoHandle = 1) {
|
||||
global $LoggedUser, $Debug;
|
||||
/*
|
||||
* If there was a previous query, we store the warnings. We cannot do
|
||||
* this immediately after mysqli_query because mysqli_insert_id will
|
||||
* break otherwise due to mysqli_get_warnings sending a SHOW WARNINGS;
|
||||
* query. When sending a query, however, we're sure that we won't call
|
||||
* mysqli_insert_id (or any similar function, for that matter) later on,
|
||||
* so we can safely get the warnings without breaking things.
|
||||
* Note that this means that we have to call $this->warnings manually
|
||||
* for the last query!
|
||||
*/
|
||||
if ($this->QueryID) {
|
||||
$this->warnings();
|
||||
}
|
||||
$QueryStartTime = microtime(true);
|
||||
$this->connect();
|
||||
// In the event of a MySQL deadlock, we sleep allowing MySQL time to unlock, then attempt again for a maximum of 5 tries
|
||||
@ -218,7 +231,7 @@ function query($Query, $AutoHandle = 1) {
|
||||
sleep($i * rand(2, 5)); // Wait longer as attempts increase
|
||||
}
|
||||
$QueryEndTime = microtime(true);
|
||||
$this->Queries[] = array(display_str($Query), ($QueryEndTime - $QueryStartTime) * 1000);
|
||||
$this->Queries[] = array(display_str($Query), ($QueryEndTime - $QueryStartTime) * 1000, null);
|
||||
$this->Time += ($QueryEndTime-$QueryStartTime) * 1000;
|
||||
|
||||
if (!$this->QueryID) {
|
||||
@ -232,8 +245,8 @@ function query($Query, $AutoHandle = 1) {
|
||||
}
|
||||
}
|
||||
|
||||
$QueryType = substr($Query,0, 6);
|
||||
/*
|
||||
$QueryType = substr($Query,0, 6);
|
||||
if ($QueryType == 'DELETE' || $QueryType == 'UPDATE') {
|
||||
if ($this->affected_rows() > 50) {
|
||||
$Debug->analysis($this->affected_rows().' rows altered:', $Query, 3600 * 24);
|
||||
@ -364,5 +377,24 @@ function beginning() {
|
||||
mysqli_data_seek($this->QueryID, 0);
|
||||
$this->Row = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function determines whether the last query caused warning messages
|
||||
* and stores them in $this->Queries.
|
||||
*/
|
||||
function warnings() {
|
||||
$Warnings = array();
|
||||
if (mysqli_warning_count($this->LinkID)) {
|
||||
$e = mysqli_get_warnings($this->LinkID);
|
||||
do {
|
||||
if ($e->errno == 1592) {
|
||||
// 1592: Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.
|
||||
continue;
|
||||
}
|
||||
$Warnings[] = 'Code ' . $e->errno . ': ' . display_str($e->message);
|
||||
} while ($e->next());
|
||||
}
|
||||
$this->Queries[count($this->Queries) - 1][2] = $Warnings;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -658,7 +658,7 @@ private function to_html ($Array) {
|
||||
$Str .= '<a href="wiki.php?action=article&name='.urlencode($Block['Val']).'">'.$Block['Val'].'</a>';
|
||||
break;
|
||||
case 'tex':
|
||||
$Str .= '<img style="vertical-align: middle;" src="'.STATIC_SERVER.'blank.gif" onload="if (this.src.substr(this.src.length-9,this.src.length) == \'blank.gif\') { this.src = \'http://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chl='.urlencode(mb_convert_encoding($Block['Val'], 'UTF-8', 'HTML-ENTITIES')).'&chco=\' + hexify(getComputedStyle(this.parentNode,null).color); }" alt="'.$Block['Val'].'" />';
|
||||
$Str .= '<img style="vertical-align: middle;" src="'.STATIC_SERVER.'blank.gif" onload="if (this.src.substr(this.src.length - 9, this.src.length) == \'blank.gif\') { this.src = \'https://chart.googleapis.com/chart?cht=tx&chf=bg,s,FFFFFF00&chl='.urlencode(mb_convert_encoding($Block['Val'], 'UTF-8', 'HTML-ENTITIES')).'&chco=\' + hexify(getComputedStyle(this.parentNode, null).color); }" alt="'.$Block['Val'].'" />';
|
||||
break;
|
||||
case 'plain':
|
||||
$Str .= $Block['Val'];
|
||||
|
@ -694,4 +694,4 @@ class="stat"
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="content">
|
||||
|
@ -1,5 +1,8 @@
|
||||
CHANGELOG
|
||||
|
||||
2013-07-01 by alderaan
|
||||
Serve Google Charts API images over HTTPS
|
||||
|
||||
2013-07-01 by Ajax
|
||||
Moved autocomplete logic to jquery plugin, introduced artist autocompletes on rest of site
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
// Caching anything beyond the first page of any given forum is just wasting ram
|
||||
// users are more likely to search then to browse to page 2
|
||||
if ($Page == 1) {
|
||||
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
|
||||
list($Forum,,,$Stickies) = $Cache->get_value("forums_$ForumID");
|
||||
}
|
||||
if (!isset($Forum) || !is_array($Forum)) {
|
||||
$DB->query("
|
||||
@ -57,10 +57,10 @@
|
||||
$DB->query("
|
||||
SELECT COUNT(ID)
|
||||
FROM forums_topics
|
||||
WHERE ForumID='$ForumID'
|
||||
AND IsSticky='1'");
|
||||
WHERE ForumID = '$ForumID'
|
||||
AND IsSticky = '1'");
|
||||
list($Stickies) = $DB->next_record();
|
||||
$Cache->cache_value('forums_'.$ForumID, array($Forum, '', 0, $Stickies), 0);
|
||||
$Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,14 +5,15 @@
|
||||
if (!empty($LoggedUser['DisableForums'])) {
|
||||
print json_encode(array('status' => 'failure'));
|
||||
die();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
include(SERVER_ROOT.'/sections/forums/functions.php');
|
||||
// Replace the old hard-coded forum categories
|
||||
unset($ForumCats);
|
||||
$ForumCats = $Cache->get_value('forums_categories');
|
||||
if ($ForumCats === false) {
|
||||
$DB->query("SELECT ID, Name FROM forums_categories");
|
||||
$DB->query("
|
||||
SELECT ID, Name
|
||||
FROM forums_categories");
|
||||
$ForumCats = array();
|
||||
while (list($ID, $Name) = $DB->next_record()) {
|
||||
$ForumCats[$ID] = $Name;
|
||||
@ -83,7 +84,7 @@
|
||||
// Uses class CACHE
|
||||
function get_forum_info($ForumID) {
|
||||
global $DB, $Cache;
|
||||
$Forum = $Cache->get_value('ForumInfo_'.$ForumID);
|
||||
$Forum = $Cache->get_value("ForumInfo_$ForumID");
|
||||
if (!$Forum) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
@ -93,8 +94,8 @@ function get_forum_info($ForumID) {
|
||||
MinClassCreate,
|
||||
COUNT(forums_topics.ID) AS Topics
|
||||
FROM forums
|
||||
LEFT JOIN forums_topics ON forums_topics.ForumID=forums.ID
|
||||
WHERE forums.ID='$ForumID'
|
||||
LEFT JOIN forums_topics ON forums_topics.ForumID = forums.ID
|
||||
WHERE forums.ID = '$ForumID'
|
||||
GROUP BY ForumID");
|
||||
if ($DB->record_count() == 0) {
|
||||
return false;
|
||||
@ -102,7 +103,7 @@ function get_forum_info($ForumID) {
|
||||
// Makes an array, with $Forum['Name'], etc.
|
||||
$Forum = $DB->next_record(MYSQLI_ASSOC);
|
||||
|
||||
$Cache->cache_value('ForumInfo_'.$ForumID, $Forum, 86400); // Cache for a day
|
||||
$Cache->cache_value("ForumInfo_$ForumID", $Forum, 86400); // Cache for a day
|
||||
}
|
||||
return $Forum;
|
||||
}
|
||||
|
@ -150,17 +150,17 @@
|
||||
|
||||
$JsonPoll = array();
|
||||
if ($ThreadInfo['NoPoll'] == 0) {
|
||||
if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value('polls_'.$ThreadID)) {
|
||||
if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value("polls_$ThreadID")) {
|
||||
$DB->query("
|
||||
SELECT Question, Answers, Featured, Closed
|
||||
FROM forums_polls
|
||||
WHERE TopicID='$ThreadID'");
|
||||
WHERE TopicID = '$ThreadID'");
|
||||
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='$ThreadID'
|
||||
WHERE TopicID = '$ThreadID'
|
||||
GROUP BY Vote");
|
||||
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
||||
|
||||
@ -175,7 +175,7 @@
|
||||
$Votes[$i] = 0;
|
||||
}
|
||||
}
|
||||
$Cache->cache_value('polls_'.$ThreadID, array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
||||
$Cache->cache_value("polls_$ThreadID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
||||
}
|
||||
|
||||
if (!empty($Votes)) {
|
||||
@ -191,8 +191,8 @@
|
||||
$DB->query("
|
||||
SELECT Vote
|
||||
FROM forums_polls_votes
|
||||
WHERE UserID='".$LoggedUser['ID']."'
|
||||
AND TopicID='$ThreadID'");
|
||||
WHERE UserID = '".$LoggedUser['ID']."'
|
||||
AND TopicID = '$ThreadID'");
|
||||
list($UserResponse) = $DB->next_record();
|
||||
if (!empty($UserResponse) && $UserResponse != 0) {
|
||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||
|
@ -939,7 +939,7 @@ function require(file, callback) {
|
||||
// --- Comments ---
|
||||
|
||||
// gets the amount of comments for this group
|
||||
$Results = $Cache->get_value('artist_comments_'.$ArtistID);
|
||||
$Results = $Cache->get_value("artist_comments_$ArtistID");
|
||||
if ($Results === false) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
@ -947,7 +947,7 @@ function require(file, callback) {
|
||||
FROM artist_comments as c
|
||||
WHERE c.ArtistID = '$ArtistID'");
|
||||
list($Results) = $DB->next_record();
|
||||
$Cache->cache_value('artist_comments_'.$ArtistID, $Results, 0);
|
||||
$Cache->cache_value("artist_comments_$ArtistID", $Results, 0);
|
||||
}
|
||||
|
||||
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
foreach ($AutoSuggest as $Suggestion) {
|
||||
list($ID, $Name) = $Suggestion;
|
||||
if (stripos($Name, $FullName) === 0) {
|
||||
$Response['suggestions'][] = array('value' => display_str($Name), 'data' => $ID);
|
||||
$Response['suggestions'][] = array('value' => $Name, 'data' => $ID);
|
||||
if (++$Matched > 9) {
|
||||
break;
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
$Sticky = (isset($_POST['sticky'])) ? 1 : 0;
|
||||
$Locked = (isset($_POST['locked'])) ? 1 : 0;
|
||||
$Ranking = (int) $_POST['ranking'];
|
||||
if(!$Sticky && $Ranking > 0) {
|
||||
if (!$Sticky && $Ranking > 0) {
|
||||
$Ranking = 0;
|
||||
} elseif(0 > $Ranking) {
|
||||
} elseif (0 > $Ranking) {
|
||||
error("Ranking cannot be a negative value");
|
||||
}
|
||||
$Title = db_string($_POST['title']);
|
||||
@ -44,7 +44,9 @@
|
||||
|
||||
if ($Locked == 1) {
|
||||
|
||||
$DB->query("DELETE FROM forums_last_read_topics WHERE TopicID='$TopicID'");
|
||||
$DB->query("
|
||||
DELETE FROM forums_last_read_topics
|
||||
WHERE TopicID = '$TopicID'");
|
||||
}
|
||||
|
||||
$DB->query("
|
||||
@ -53,9 +55,9 @@
|
||||
f.MinClassWrite,
|
||||
COUNT(p.ID) AS Posts
|
||||
FROM forums_topics AS t
|
||||
LEFT JOIN forums_posts AS p ON p.TopicID=t.ID
|
||||
LEFT JOIN forums AS f ON f.ID=.t.ForumID
|
||||
WHERE t.ID='$TopicID'
|
||||
LEFT JOIN forums_posts AS p ON p.TopicID = t.ID
|
||||
LEFT JOIN forums AS f ON f.ID = t.ForumID
|
||||
WHERE t.ID = '$TopicID'
|
||||
GROUP BY p.TopicID");
|
||||
list($OldForumID, $MinClassWrite, $Posts) = $DB->next_record();
|
||||
|
||||
@ -64,14 +66,18 @@
|
||||
}
|
||||
|
||||
// If we're moving
|
||||
$Cache->delete_value('forums_'.$ForumID);
|
||||
$Cache->delete_value('forums_'.$OldForumID);
|
||||
$Cache->delete_value("forums_$ForumID");
|
||||
$Cache->delete_value("forums_$OldForumID");
|
||||
|
||||
// If we're deleting a thread
|
||||
if (isset($_POST['delete'])) {
|
||||
if (check_perms('site_admin_forums')) {
|
||||
$DB->query("DELETE FROM forums_posts WHERE TopicID='$TopicID'");
|
||||
$DB->query("DELETE FROM forums_topics WHERE ID='$TopicID'");
|
||||
$DB->query("
|
||||
DELETE FROM forums_posts
|
||||
WHERE TopicID = '$TopicID'");
|
||||
$DB->query("
|
||||
DELETE FROM forums_topics
|
||||
WHERE ID = '$TopicID'");
|
||||
|
||||
$DB->query("
|
||||
SELECT
|
||||
@ -81,16 +87,18 @@
|
||||
p.AuthorID,
|
||||
um.Username,
|
||||
p.AddedTime,
|
||||
( SELECT COUNT(pp.ID)
|
||||
(
|
||||
SELECT COUNT(pp.ID)
|
||||
FROM forums_posts AS pp
|
||||
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
|
||||
WHERE tt.ForumID='$ForumID'),
|
||||
JOIN forums_topics AS tt ON pp.TopicID = tt.ID
|
||||
WHERE tt.ForumID = '$ForumID'
|
||||
),
|
||||
t.IsLocked,
|
||||
t.IsSticky
|
||||
FROM forums_topics AS t
|
||||
JOIN forums_posts AS p ON p.ID=t.LastPostID
|
||||
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
|
||||
WHERE t.ForumID='$ForumID'
|
||||
JOIN forums_posts AS p ON p.ID = t.LastPostID
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
WHERE t.ForumID = '$ForumID'
|
||||
GROUP BY t.ID
|
||||
ORDER BY t.LastPostID DESC
|
||||
LIMIT 1");
|
||||
@ -99,16 +107,15 @@
|
||||
$DB->query("
|
||||
UPDATE forums
|
||||
SET
|
||||
NumTopics=NumTopics-1,
|
||||
NumPosts=NumPosts-'$Posts',
|
||||
LastPostTopicID='$NewLastTopic',
|
||||
LastPostID='$NewLastPostID',
|
||||
LastPostAuthorID='$NewLastAuthorID',
|
||||
LastPostTime='$NewLastAddedTime'
|
||||
NumTopics = NumTopics - 1,
|
||||
NumPosts = NumPosts - '$Posts',
|
||||
LastPostTopicID = '$NewLastTopic',
|
||||
LastPostID = '$NewLastPostID',
|
||||
LastPostAuthorID = '$NewLastAuthorID',
|
||||
LastPostTime = '$NewLastAddedTime'
|
||||
WHERE ID='$ForumID'");
|
||||
|
||||
$Cache->delete_value('thread_'.$TopicID);
|
||||
|
||||
$Cache->delete_value("thread_$TopicID");
|
||||
|
||||
$Cache->begin_transaction('forums_list');
|
||||
$UpdateArray = array(
|
||||
@ -125,7 +132,7 @@
|
||||
|
||||
$Cache->update_row($ForumID, $UpdateArray);
|
||||
$Cache->commit_transaction(0);
|
||||
$Cache->delete_value('thread_'.$TopicID.'_info');
|
||||
$Cache->delete_value("thread_{$TopicID}_info");
|
||||
|
||||
header('Location: forums.php?action=viewforum&forumid='.$ForumID);
|
||||
} else {
|
||||
@ -134,7 +141,7 @@
|
||||
|
||||
} else { // If we're just editing it
|
||||
|
||||
$Cache->begin_transaction('thread_'.$TopicID.'_info');
|
||||
$Cache->begin_transaction("thread_{$TopicID}_info");
|
||||
$UpdateArray = array(
|
||||
'IsSticky' => $Sticky,
|
||||
'Ranking' => $Ranking,
|
||||
@ -152,15 +159,18 @@
|
||||
Ranking = '$Ranking',
|
||||
IsLocked = '$Locked',
|
||||
Title = '$Title',
|
||||
ForumID ='$ForumID'
|
||||
WHERE ID='$TopicID'");
|
||||
ForumID = '$ForumID'
|
||||
WHERE ID = '$TopicID'");
|
||||
|
||||
|
||||
if ($ForumID != $OldForumID) { // If we're moving a thread, change the forum stats
|
||||
|
||||
$DB->query("SELECT MinClassRead, MinClassWrite, Name FROM forums WHERE ID='$ForumID'");
|
||||
$DB->query("
|
||||
SELECT MinClassRead, MinClassWrite, Name
|
||||
FROM forums
|
||||
WHERE ID = '$ForumID'");
|
||||
list($MinClassRead, $MinClassWrite, $ForumName) = $DB->next_record(MYSQLI_NUM, false);
|
||||
$Cache->begin_transaction('thread_'.$TopicID.'_info');
|
||||
$Cache->begin_transaction("thread_{$TopicID}_info");
|
||||
$UpdateArray = array(
|
||||
'ForumName' => $ForumName,
|
||||
'MinClassRead' => $MinClassRead,
|
||||
@ -171,7 +181,6 @@
|
||||
|
||||
$Cache->begin_transaction('forums_list');
|
||||
|
||||
|
||||
// Forum we're moving from
|
||||
$DB->query("
|
||||
SELECT
|
||||
@ -181,17 +190,19 @@
|
||||
p.AuthorID,
|
||||
um.Username,
|
||||
p.AddedTime,
|
||||
( SELECT COUNT(pp.ID)
|
||||
(
|
||||
SELECT COUNT(pp.ID)
|
||||
FROM forums_posts AS pp
|
||||
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
|
||||
WHERE tt.ForumID='$OldForumID'),
|
||||
JOIN forums_topics AS tt ON pp.TopicID = tt.ID
|
||||
WHERE tt.ForumID = '$OldForumID'
|
||||
),
|
||||
t.IsLocked,
|
||||
t.IsSticky,
|
||||
t.Ranking
|
||||
FROM forums_topics AS t
|
||||
JOIN forums_posts AS p ON p.ID=t.LastPostID
|
||||
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
|
||||
WHERE t.ForumID='$OldForumID'
|
||||
JOIN forums_posts AS p ON p.ID = t.LastPostID
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
WHERE t.ForumID = '$OldForumID'
|
||||
ORDER BY t.LastPostID DESC
|
||||
LIMIT 1");
|
||||
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts, $NewLocked, $NewSticky, $NewRanking) = $DB->next_record(MYSQLI_NUM, false);
|
||||
@ -199,13 +210,13 @@
|
||||
$DB->query("
|
||||
UPDATE forums
|
||||
SET
|
||||
NumTopics=NumTopics-1,
|
||||
NumPosts=NumPosts-'$Posts',
|
||||
LastPostTopicID='$NewLastTopic',
|
||||
LastPostID='$NewLastPostID',
|
||||
LastPostAuthorID='$NewLastAuthorID',
|
||||
LastPostTime='$NewLastAddedTime'
|
||||
WHERE ID='$OldForumID'");
|
||||
NumTopics = NumTopics - 1,
|
||||
NumPosts = NumPosts - '$Posts',
|
||||
LastPostTopicID = '$NewLastTopic',
|
||||
LastPostID = '$NewLastPostID',
|
||||
LastPostAuthorID = '$NewLastAuthorID',
|
||||
LastPostTime = '$NewLastAddedTime'
|
||||
WHERE ID = '$OldForumID'");
|
||||
|
||||
|
||||
$UpdateArray = array(
|
||||
@ -234,14 +245,15 @@
|
||||
p.AuthorID,
|
||||
um.Username,
|
||||
p.AddedTime,
|
||||
( SELECT COUNT(pp.ID)
|
||||
(
|
||||
SELECT COUNT(pp.ID)
|
||||
FROM forums_posts AS pp
|
||||
JOIN forums_topics AS tt ON pp.TopicID=tt.ID
|
||||
WHERE tt.ForumID='$ForumID')
|
||||
JOIN forums_topics AS tt ON pp.TopicID = tt.ID
|
||||
WHERE tt.ForumID = '$ForumID')
|
||||
FROM forums_topics AS t
|
||||
JOIN forums_posts AS p ON p.ID=t.LastPostID
|
||||
LEFT JOIN users_main AS um ON um.ID=p.AuthorID
|
||||
WHERE t.ForumID='$ForumID'
|
||||
JOIN forums_posts AS p ON p.ID = t.LastPostID
|
||||
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
|
||||
WHERE t.ForumID = '$ForumID'
|
||||
ORDER BY t.LastPostID DESC
|
||||
LIMIT 1");
|
||||
list($NewLastTopic, $NewLastPostID, $NewLastTitle, $NewLastAuthorID, $NewLastAuthorName, $NewLastAddedTime, $NumPosts) = $DB->next_record(MYSQLI_NUM, false);
|
||||
@ -249,13 +261,13 @@
|
||||
$DB->query("
|
||||
UPDATE forums
|
||||
SET
|
||||
NumTopics=NumTopics+1,
|
||||
NumPosts=NumPosts+'$Posts',
|
||||
LastPostTopicID='$NewLastTopic',
|
||||
LastPostID='$NewLastPostID',
|
||||
LastPostAuthorID='$NewLastAuthorID',
|
||||
LastPostTime='$NewLastAddedTime'
|
||||
WHERE ID='$ForumID'");
|
||||
NumTopics = NumTopics + 1,
|
||||
NumPosts = NumPosts + '$Posts',
|
||||
LastPostTopicID = '$NewLastTopic',
|
||||
LastPostID = '$NewLastPostID',
|
||||
LastPostAuthorID = '$NewLastAuthorID',
|
||||
LastPostTime = '$NewLastAddedTime'
|
||||
WHERE ID = '$ForumID'");
|
||||
|
||||
|
||||
$UpdateArray = array(
|
||||
@ -272,7 +284,10 @@
|
||||
|
||||
$Cache->commit_transaction(0);
|
||||
} else { // Editing
|
||||
$DB->query("SELECT LastPostTopicID FROM forums WHERE ID='$ForumID'");
|
||||
$DB->query("
|
||||
SELECT LastPostTopicID
|
||||
FROM forums
|
||||
WHERE ID = '$ForumID'");
|
||||
list($LastTopicID) = $DB->next_record();
|
||||
if ($LastTopicID == $TopicID) {
|
||||
$UpdateArray = array(
|
||||
@ -289,12 +304,15 @@
|
||||
if ($Locked) {
|
||||
$CatalogueID = floor($NumPosts / THREAD_CATALOGUE);
|
||||
for ($i = 0; $i <= $CatalogueID; $i++) {
|
||||
$Cache->expire_value('thread_'.$TopicID.'_catalogue_'.$i, 3600 * 24 * 7); // 7 days
|
||||
$Cache->expire_value("thread_{$TopicID}_catalogue_$i", 3600 * 24 * 7); // 7 days
|
||||
}
|
||||
$Cache->expire_value('thread_'.$TopicID.'_info', 3600 * 24 * 7); // 7 days
|
||||
$Cache->expire_value("thread_{$TopicID}_info", 3600 * 24 * 7); // 7 days
|
||||
|
||||
$DB->query('UPDATE forums_polls SET Closed=\'0\' WHERE TopicID=\''.$TopicID.'\'');
|
||||
$Cache->delete_value('polls_'.$TopicID);
|
||||
$DB->query("
|
||||
UPDATE forums_polls
|
||||
SET Closed = '0'
|
||||
WHERE TopicID = '$TopicID'");
|
||||
$Cache->delete_value("polls_$TopicID");
|
||||
}
|
||||
header('Location: forums.php?action=viewthread&threadid='.$TopicID.'&page='.$Page);
|
||||
}
|
||||
|
@ -20,7 +20,10 @@
|
||||
if (isset($_GET['topicid']) && is_number($_GET['topicid'])) {
|
||||
$ThreadID = $_GET['topicid'];
|
||||
} elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
|
||||
$DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]");
|
||||
$DB->query("
|
||||
SELECT TopicID
|
||||
FROM forums_posts
|
||||
WHERE ID = $_GET[postid]");
|
||||
list($ThreadID) = $DB->next_record();
|
||||
if ($ThreadID) {
|
||||
header("Location: forums.php?action=viewthread&threadid=$ThreadID&postid=$_GET[postid]#post$_GET[postid]");
|
||||
@ -80,10 +83,10 @@
|
||||
if (($Page - 1) * $PerPage > $ThreadInfo['Posts']) {
|
||||
$Page = ceil($ThreadInfo['Posts'] / $PerPage);
|
||||
}
|
||||
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page,$PerPage,THREAD_CATALOGUE);
|
||||
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page, $PerPage, THREAD_CATALOGUE);
|
||||
|
||||
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
|
||||
if (!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
|
||||
if (!$Catalogue = $Cache->get_value("thread_{$ThreadID}_catalogue_$CatalogueID")) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
p.ID,
|
||||
@ -98,12 +101,12 @@
|
||||
WHERE p.TopicID = '$ThreadID'
|
||||
AND p.ID != '".$ThreadInfo['StickyPostID']."'
|
||||
LIMIT $CatalogueLimit");
|
||||
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
|
||||
$Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
|
||||
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
|
||||
$Cache->cache_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
|
||||
$Cache->cache_value("thread_{$ThreadID}_catalogue_$CatalogueID", $Catalogue, 0);
|
||||
}
|
||||
}
|
||||
$Thread = Format::catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
|
||||
$Thread = Format::catalogue_select($Catalogue, $Page, $PerPage, THREAD_CATALOGUE);
|
||||
if ($_GET['updatelastread'] != '0') {
|
||||
$LastPost = end($Thread);
|
||||
$LastPost = $LastPost['ID'];
|
||||
@ -119,23 +122,26 @@
|
||||
$DB->query("
|
||||
SELECT PostID
|
||||
FROM forums_last_read_topics
|
||||
WHERE UserID='$LoggedUser[ID]'
|
||||
AND TopicID='$ThreadID'");
|
||||
WHERE UserID = '$LoggedUser[ID]'
|
||||
AND TopicID = '$ThreadID'");
|
||||
list($LastRead) = $DB->next_record();
|
||||
if ($LastRead < $LastPost) {
|
||||
$DB->query("
|
||||
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
|
||||
VALUES ('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
|
||||
ON DUPLICATE KEY UPDATE PostID='$LastPost'");
|
||||
ON DUPLICATE KEY UPDATE PostID = '$LastPost'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Handle subscriptions
|
||||
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
|
||||
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
|
||||
$DB->query("
|
||||
SELECT TopicID
|
||||
FROM users_subscriptions
|
||||
WHERE UserID = '$LoggedUser[ID]'");
|
||||
$UserSubscriptions = $DB->collect(0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
|
||||
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'], $UserSubscriptions,0);
|
||||
}
|
||||
|
||||
if (empty($UserSubscriptions)) {
|
||||
@ -210,17 +216,17 @@
|
||||
</div>
|
||||
<?
|
||||
if ($ThreadInfo['NoPoll'] == 0) {
|
||||
if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->get_value('polls_'.$ThreadID)) {
|
||||
if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value("polls_$ThreadID")) {
|
||||
$DB->query("
|
||||
SELECT Question, Answers, Featured, Closed
|
||||
FROM forums_polls
|
||||
WHERE TopicID='$ThreadID'");
|
||||
WHERE TopicID = '$ThreadID'");
|
||||
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='$ThreadID'
|
||||
WHERE TopicID = '$ThreadID'
|
||||
GROUP BY Vote");
|
||||
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
|
||||
|
||||
@ -235,7 +241,7 @@
|
||||
$Votes[$i] = 0;
|
||||
}
|
||||
}
|
||||
$Cache->cache_value('polls_'.$ThreadID, array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
||||
$Cache->cache_value("polls_$ThreadID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
|
||||
}
|
||||
|
||||
if (!empty($Votes)) {
|
||||
@ -251,8 +257,8 @@
|
||||
$DB->query("
|
||||
SELECT Vote
|
||||
FROM forums_polls_votes
|
||||
WHERE UserID='".$LoggedUser['ID']."'
|
||||
AND TopicID='$ThreadID'");
|
||||
WHERE UserID = '".$LoggedUser['ID']."'
|
||||
AND TopicID = '$ThreadID'");
|
||||
list($UserResponse) = $DB->next_record();
|
||||
if (!empty($UserResponse) && $UserResponse != 0) {
|
||||
$Answers[$UserResponse] = '» '.$Answers[$UserResponse];
|
||||
@ -280,7 +286,7 @@
|
||||
$Percent = 0;
|
||||
}
|
||||
?>
|
||||
<li><?=display_str($Answer)?> (<?=number_format($Percent * 100,2)?>%)</li>
|
||||
<li><?=display_str($Answer)?> (<?=number_format($Percent * 100, 2)?>%)</li>
|
||||
<li class="graph">
|
||||
<span class="left_poll"></span>
|
||||
<span class="center_poll" style="width: <?=round($Ratio * 750)?>px;"></span>
|
||||
@ -316,7 +322,7 @@
|
||||
GROUP_CONCAT(um.Username SEPARATOR ', ')
|
||||
FROM users_main AS um
|
||||
LEFT JOIN forums_polls_votes AS fpv ON um.ID = fpv.UserID
|
||||
WHERE TopicID = ".$ThreadID."
|
||||
WHERE TopicID = $ThreadID
|
||||
GROUP BY fpv.Vote");
|
||||
|
||||
$StaffVotesTmp = $DB->to_array();
|
||||
@ -553,7 +559,7 @@
|
||||
<input type="checkbox" onclick="$('#ranking_row').gtoggle();" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="ranking_row" <?=!$ThreadInfo['IsSticky'] ? 'class="hidden"' : ''?>>
|
||||
<tr id="ranking_row"<?=!$ThreadInfo['IsSticky'] ? ' class="hidden"' : ''?>>
|
||||
<td class="label">Ranking</td>
|
||||
<td>
|
||||
<input type="text" name="ranking" value="<?=$ThreadInfo['Ranking']?>" tabindex="2" />
|
||||
|
@ -109,7 +109,7 @@
|
||||
<br />
|
||||
|
||||
<div style="text-align: center;"><img style="vertical-align: middle;" src="static/blank.gif"
|
||||
onload="if (this.src.substr(this.src.length-9,this.src.length) == 'blank.gif') { this.src = 'http://chart.apis.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&chco=' + hexify(getComputedStyle(this.parentNode,null).color); }" />
|
||||
onload="if (this.src.substr(this.src.length - 9, this.src.length) == 'blank.gif') { this.src = 'https://chart.googleapis.com/chart?cht=tx&chf=bg,s,FFFFFF00&chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&chco=' + hexify(getComputedStyle(this.parentNode, null).color); }" />
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
|
@ -19,11 +19,13 @@
|
||||
}
|
||||
|
||||
if ($ID = (int)$_POST['id']) {
|
||||
$DB->query("DELETE FROM staff_pm_responses WHERE ID=$ID");
|
||||
$DB->query("
|
||||
DELETE FROM staff_pm_responses
|
||||
WHERE ID = $ID");
|
||||
echo '1';
|
||||
|
||||
} else {
|
||||
// No id
|
||||
// No ID
|
||||
echo '-1';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?
|
||||
enforce_login();
|
||||
// Get user level
|
||||
$DB->query("
|
||||
$DB->query('
|
||||
SELECT
|
||||
i.SupportFor,
|
||||
p.DisplayStaff
|
||||
FROM users_info as i
|
||||
JOIN users_main as m ON m.ID = i.UserID
|
||||
JOIN permissions as p ON p.ID = m.PermissionID
|
||||
WHERE i.UserID = ".$LoggedUser['ID']
|
||||
WHERE i.UserID = '.$LoggedUser['ID']
|
||||
);
|
||||
list($SupportFor, $DisplayStaff) = $DB->next_record();
|
||||
|
||||
@ -22,22 +22,32 @@
|
||||
if (is_numeric($ID)) {
|
||||
if ($ID == 0) {
|
||||
// Create new response
|
||||
$DB->query("INSERT INTO staff_pm_responses (Message, Name) VALUES ('$Message', '$Name')");
|
||||
$DB->query("
|
||||
INSERT INTO staff_pm_responses (Message, Name)
|
||||
VALUES ('$Message', '$Name')");
|
||||
echo '1';
|
||||
} else {
|
||||
$DB->query("SELECT * FROM staff_pm_responses WHERE ID=$ID");
|
||||
$DB->query("
|
||||
SELECT *
|
||||
FROM staff_pm_responses
|
||||
WHERE ID = $ID");
|
||||
if ($DB->record_count() != 0) {
|
||||
// Edit response
|
||||
$DB->query("UPDATE staff_pm_responses SET Message='$Message', Name='$Name' WHERE ID=$ID");
|
||||
$DB->query("
|
||||
UPDATE staff_pm_responses
|
||||
SET Message = '$Message', Name = '$Name'
|
||||
WHERE ID = $ID");
|
||||
echo '2';
|
||||
} else {
|
||||
// Create new response
|
||||
$DB->query("INSERT INTO staff_pm_responses (Message, Name) VALUES ('$Message', '$Name')");
|
||||
$DB->query("
|
||||
INSERT INTO staff_pm_responses (Message, Name)
|
||||
VALUES ('$Message', '$Name')");
|
||||
echo '1';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// No id
|
||||
// No ID
|
||||
echo '-2';
|
||||
}
|
||||
|
||||
@ -45,4 +55,4 @@
|
||||
// No message/name
|
||||
echo '-1';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -19,7 +19,10 @@
|
||||
}
|
||||
|
||||
if ($ID = (int)$_GET['id']) {
|
||||
$DB->query("SELECT Message FROM staff_pm_responses WHERE ID=$ID");
|
||||
$DB->query("
|
||||
SELECT Message
|
||||
FROM staff_pm_responses
|
||||
WHERE ID = $ID");
|
||||
list($Message) = $DB->next_record();
|
||||
if ($_GET['plain'] == 1) {
|
||||
echo $Message;
|
||||
@ -30,7 +33,7 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
// No id
|
||||
// No ID
|
||||
echo '-1';
|
||||
}
|
||||
?>
|
||||
|
@ -6,7 +6,10 @@
|
||||
|
||||
if ($ConvID = (int)$_GET['convid']) {
|
||||
// FLS, check level of conversation
|
||||
$DB->query("SELECT Level FROM staff_pm_conversations WHERE ID=$ConvID");
|
||||
$DB->query("
|
||||
SELECT Level
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID = $ConvID");
|
||||
list($Level) = $DB->next_record;
|
||||
|
||||
if ($Level == 0) {
|
||||
@ -27,9 +30,9 @@
|
||||
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Status='Unanswered',
|
||||
Level=$Level
|
||||
WHERE ID=$ConvID");
|
||||
SET Status = 'Unanswered',
|
||||
Level = $Level
|
||||
WHERE ID = $ConvID");
|
||||
header('Location: staffpm.php');
|
||||
} else {
|
||||
error(404);
|
||||
@ -40,22 +43,25 @@
|
||||
}
|
||||
|
||||
} elseif ($ConvID = (int)$_POST['convid']) {
|
||||
// Staff (via ajax), get current assign of conversation
|
||||
$DB->query("SELECT Level, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID");
|
||||
// Staff (via AJAX), get current assign of conversation
|
||||
$DB->query("
|
||||
SELECT Level, AssignedToUser
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID = $ConvID");
|
||||
list($Level, $AssignedToUser) = $DB->next_record;
|
||||
|
||||
if ($LoggedUser['EffectiveClass'] >= $Level || $AssignedToUser == $LoggedUser['ID']) {
|
||||
// Staff member is allowed to assign conversation, assign
|
||||
list($LevelType, $NewLevel) = explode("_", db_string($_POST['assign']));
|
||||
list($LevelType, $NewLevel) = explode('_', db_string($_POST['assign']));
|
||||
|
||||
if ($LevelType == 'class') {
|
||||
// Assign to class
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Status='Unanswered',
|
||||
Level=$NewLevel,
|
||||
AssignedToUser=NULL
|
||||
WHERE ID=$ConvID");
|
||||
SET Status = 'Unanswered',
|
||||
Level = $NewLevel,
|
||||
AssignedToUser = NULL
|
||||
WHERE ID = $ConvID");
|
||||
} else {
|
||||
$UserInfo = Users::user_info($NewLevel);
|
||||
$Level = $Classes[$UserInfo['PermissionID']]['Level'];
|
||||
@ -66,10 +72,10 @@
|
||||
// Assign to user
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Status='Unanswered',
|
||||
AssignedToUser=$NewLevel,
|
||||
Level=$Level
|
||||
WHERE ID=$ConvID");
|
||||
SET Status = 'Unanswered',
|
||||
AssignedToUser = $NewLevel,
|
||||
Level = $Level
|
||||
WHERE ID = $ConvID");
|
||||
|
||||
}
|
||||
echo '1';
|
||||
|
@ -61,7 +61,10 @@
|
||||
<?
|
||||
|
||||
// List common responses
|
||||
$DB->query("SELECT ID, Message, Name FROM staff_pm_responses ORDER BY ID DESC");
|
||||
$DB->query("
|
||||
SELECT ID, Message, Name
|
||||
FROM staff_pm_responses
|
||||
ORDER BY ID DESC");
|
||||
while (list($ID, $Message, $Name) = $DB->next_record()) {
|
||||
|
||||
?>
|
||||
@ -88,9 +91,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,10 +21,11 @@
|
||||
|
||||
// Message is selected providing the user quoting is the guy who opened the PM or has
|
||||
// the right level
|
||||
$DB->query("SELECT m.Message, c.Level, c.UserID
|
||||
FROM staff_pm_messages as m
|
||||
JOIN staff_pm_conversations AS c ON m.ConvID=c.ID
|
||||
WHERE m.ID='$PostID'");
|
||||
$DB->query("
|
||||
SELECT m.Message, c.Level, c.UserID
|
||||
FROM staff_pm_messages as m
|
||||
JOIN staff_pm_conversations AS c ON m.ConvID = c.ID
|
||||
WHERE m.ID = '$PostID'");
|
||||
list($Message, $Level, $UserID) = $DB->next_record(MYSQLI_NUM);
|
||||
|
||||
if (($LoggedUser['ID'] == $UserID) || ($IsFLS && $LoggedUser['Class'] >= $Level)) {
|
||||
|
@ -8,40 +8,47 @@
|
||||
}
|
||||
|
||||
$ConvID = (int)$_GET['id'];
|
||||
$DB->query("SELECT c.Subject, c.UserID, c.Level, c.AssignedToUser, c.Unread, c.Status, u.Donor
|
||||
FROM staff_pm_conversations AS c
|
||||
JOIN users_info AS u ON u.UserID = c.UserID
|
||||
WHERE ID=$ConvID");
|
||||
$DB->query("
|
||||
SELECT c.Subject, c.UserID, c.Level, c.AssignedToUser, c.Unread, c.Status, u.Donor
|
||||
FROM staff_pm_conversations AS c
|
||||
JOIN users_info AS u ON u.UserID = c.UserID
|
||||
WHERE ID = $ConvID");
|
||||
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status, $Donor) = $DB->next_record();
|
||||
if ($DB->record_count() == 0) {
|
||||
error(404);
|
||||
}
|
||||
|
||||
$Message = "Thank for for helping to support the site. It's users like you who make all of this possible.";
|
||||
$Message = "Thanks for helping to support the site. It's users like you who make all of this possible.";
|
||||
|
||||
if ((int)$Donor === 0) {
|
||||
$Msg = db_string(sqltime() . ' - Donated: https://'.SSL_SITE_URL."/staffpm.php?action=viewconv&id=$ConvID\n\n");
|
||||
$DB->query("UPDATE users_info
|
||||
SET Donor='1',
|
||||
AdminComment = CONCAT('$Msg',AdminComment)
|
||||
WHERE UserID = $UserID");
|
||||
$DB->query("UPDATE users_main
|
||||
SET Invites=Invites+2
|
||||
WHERE ID = $UserID");
|
||||
$DB->query("
|
||||
UPDATE users_info
|
||||
SET Donor = '1',
|
||||
AdminComment = CONCAT('$Msg', AdminComment)
|
||||
WHERE UserID = $UserID");
|
||||
$DB->query("
|
||||
UPDATE users_main
|
||||
SET Invites = Invites + 2
|
||||
WHERE ID = $UserID");
|
||||
|
||||
$Cache->delete_value('user_info_'.$UserID);
|
||||
$Cache->delete_value('user_info_heavy_'.$UserID);
|
||||
$Cache->delete_value("user_info_$UserID");
|
||||
$Cache->delete_value("user_info_heavy_$UserID");
|
||||
$Message .= ' Enjoy your new love from us!';
|
||||
} else {
|
||||
$Message .= ' ';
|
||||
}
|
||||
$DB->query("INSERT INTO staff_pm_messages (UserID, SentDate, Message, ConvID)
|
||||
VALUES (".$LoggedUser['ID'].", '".sqltime()."', '".db_string($Message)."', $ConvID)");
|
||||
$DB->query("UPDATE staff_pm_conversations
|
||||
SET Date='".sqltime()."',
|
||||
Unread=true,
|
||||
Status='Resolved',
|
||||
ResolverID=".$LoggedUser['ID']."
|
||||
WHERE ID=$ConvID");
|
||||
$DB->query("
|
||||
INSERT INTO staff_pm_messages
|
||||
(UserID, SentDate, Message, ConvID)
|
||||
VALUES
|
||||
(".$LoggedUser['ID'].", '".sqltime()."', '".db_string($Message)."', $ConvID)");
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Date = '".sqltime()."',
|
||||
Unread = true,
|
||||
Status = 'Resolved',
|
||||
ResolverID = ".$LoggedUser['ID']."
|
||||
WHERE ID = $ConvID");
|
||||
header('Location: staffpm.php');
|
||||
?>
|
||||
|
@ -5,12 +5,18 @@
|
||||
$ID = (int)$ID;
|
||||
|
||||
// Check if conversation belongs to user
|
||||
$DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ID");
|
||||
$DB->query("
|
||||
SELECT UserID, AssignedToUser
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID = $ID");
|
||||
list($UserID, $AssignedToUser) = $DB->next_record();
|
||||
|
||||
if ($UserID == $LoggedUser['ID'] || $DisplayStaff == '1' || $UserID == $AssignedToUser) {
|
||||
// Conversation belongs to user or user is staff, queue query
|
||||
$Queries[] = "UPDATE staff_pm_conversations SET Status='Resolved', ResolverID=".$LoggedUser['ID']." WHERE ID=$ID";
|
||||
$Queries[] = "
|
||||
UPDATE staff_pm_conversations
|
||||
SET Status = 'Resolved', ResolverID = ".$LoggedUser['ID']."
|
||||
WHERE ID = $ID";
|
||||
} else {
|
||||
// Trying to run disallowed query
|
||||
error(403);
|
||||
@ -29,7 +35,7 @@
|
||||
header("Location: staffpm.php");
|
||||
|
||||
} else {
|
||||
// No id
|
||||
// No ID
|
||||
header("Location: staffpm.php");
|
||||
}
|
||||
?>
|
||||
|
@ -1,12 +1,18 @@
|
||||
<?
|
||||
if ($ID = (int)($_GET['id'])) {
|
||||
// Check if conversation belongs to user
|
||||
$DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ID");
|
||||
$DB->query("
|
||||
SELECT UserID, AssignedToUser
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID = $ID");
|
||||
list($UserID, $AssignedToUser) = $DB->next_record();
|
||||
|
||||
if ($UserID == $LoggedUser['ID'] || $IsFLS || $AssignedToUser == $LoggedUser['ID']) {
|
||||
// Conversation belongs to user or user is staff, resolve it
|
||||
$DB->query("UPDATE staff_pm_conversations SET Status='Resolved', ResolverID=".$LoggedUser['ID']." WHERE ID=$ID");
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Status = 'Resolved', ResolverID = ".$LoggedUser['ID']."
|
||||
WHERE ID = $ID");
|
||||
$Cache->delete_value('staff_pm_new_'.$LoggedUser['ID']);
|
||||
$Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
|
||||
|
||||
@ -16,7 +22,7 @@
|
||||
error(403);
|
||||
}
|
||||
} else {
|
||||
// No id
|
||||
// No ID
|
||||
header('Location: staffpm.php');
|
||||
}
|
||||
?>
|
||||
|
@ -6,38 +6,55 @@
|
||||
$UserLevel = $LoggedUser['EffectiveClass'];
|
||||
|
||||
// Setup for current view mode
|
||||
$SortStr = 'IF(AssignedToUser = '.$LoggedUser['ID'].',0,1) ASC, ';
|
||||
$SortStr = 'IF(AssignedToUser = '.$LoggedUser['ID'].', 0, 1) ASC, ';
|
||||
switch ($View) {
|
||||
case 'unanswered':
|
||||
$ViewString = 'Unanswered';
|
||||
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
|
||||
$WhereCondition = "
|
||||
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
AND Status = 'Unanswered'";
|
||||
break;
|
||||
case 'open':
|
||||
$ViewString = 'All open';
|
||||
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status IN ('Open', 'Unanswered')";
|
||||
$WhereCondition = "
|
||||
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
AND Status IN ('Open', 'Unanswered')";
|
||||
$SortStr = '';
|
||||
break;
|
||||
case 'resolved':
|
||||
$ViewString = 'Resolved';
|
||||
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Resolved'";
|
||||
$WhereCondition = "
|
||||
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
AND Status = 'Resolved'";
|
||||
$SortStr = '';
|
||||
break;
|
||||
case 'my':
|
||||
$ViewString = 'My unanswered';
|
||||
$WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
|
||||
$WhereCondition = "
|
||||
WHERE (Level = $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
AND Status = 'Unanswered'";
|
||||
break;
|
||||
default:
|
||||
if ($UserLevel >= 700) {
|
||||
$ViewString = 'My unanswered';
|
||||
$WhereCondition = "WHERE ((Level >= ".max($Classes[MOD]['Level'],700)." AND Level <= $UserLevel) OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
|
||||
$WhereCondition = "
|
||||
WHERE (
|
||||
(Level >= ".max($Classes[MOD]['Level'], 700)." AND Level <= $UserLevel)
|
||||
OR AssignedToUser = '".$LoggedUser['ID']."'
|
||||
)
|
||||
AND Status = 'Unanswered'";
|
||||
} elseif ($UserLevel == 650) {
|
||||
// Forum Mods
|
||||
$ViewString = 'My unanswered';
|
||||
$WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
|
||||
$WhereCondition = "
|
||||
WHERE (Level = $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
AND Status = 'Unanswered'";
|
||||
} else {
|
||||
// FLS
|
||||
$ViewString = 'Unanswered';
|
||||
$WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'";
|
||||
$WhereCondition = "
|
||||
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
AND Status = 'Unanswered'";
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -148,7 +165,9 @@
|
||||
// Assigned to class
|
||||
$Assigned = ($Level == 0) ? 'First Line Support' : $ClassLevels[$Level]['Name'];
|
||||
// No + on Sysops
|
||||
if ($Assigned != 'Sysop') { $Assigned .= "+"; }
|
||||
if ($Assigned != 'Sysop') {
|
||||
$Assigned .= '+';
|
||||
}
|
||||
|
||||
} else {
|
||||
// Assigned to user
|
||||
|
@ -23,7 +23,10 @@
|
||||
|
||||
} elseif ($ConvID = (int)$_POST['convid']) {
|
||||
// Check if conversation belongs to user
|
||||
$DB->query("SELECT UserID, AssignedToUser FROM staff_pm_conversations WHERE ID=$ConvID");
|
||||
$DB->query("
|
||||
SELECT UserID, AssignedToUser
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID = $ConvID");
|
||||
list($UserID, $AssignedToUser) = $DB->next_record();
|
||||
|
||||
if ($UserID == $LoggedUser['ID'] || $IsFLS || $UserID == $AssignedToUser) {
|
||||
@ -40,19 +43,19 @@
|
||||
// FLS/Staff
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Date='".sqltime()."', Unread=true, Status='Open'
|
||||
WHERE ID=$ConvID");
|
||||
SET Date = '".sqltime()."', Unread = true, Status = 'Open'
|
||||
WHERE ID = $ConvID");
|
||||
$Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
|
||||
} else {
|
||||
// User
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Date='".sqltime()."', Unread=true, Status='Unanswered'
|
||||
WHERE ID=$ConvID");
|
||||
SET Date = '".sqltime()."', Unread = true, Status = 'Unanswered'
|
||||
WHERE ID = $ConvID");
|
||||
}
|
||||
|
||||
// Clear cache for user
|
||||
$Cache->delete_value('staff_pm_new_'.$UserID);
|
||||
$Cache->delete_value("staff_pm_new_$UserID");
|
||||
$Cache->delete_value('staff_pm_new_'.$LoggedUser['ID']);
|
||||
|
||||
header("Location: staffpm.php?action=viewconv&id=$ConvID");
|
||||
|
@ -4,7 +4,7 @@
|
||||
$DB->query("
|
||||
SELECT UserID, Level, AssignedToUser
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID=$ID");
|
||||
WHERE ID = $ID");
|
||||
list($UserID, $Level, $AssignedToUser) = $DB->next_record();
|
||||
|
||||
if ($UserID == $LoggedUser['ID'] || ($IsFLS && $Level == 0) ||
|
||||
@ -16,8 +16,8 @@
|
||||
// Conversation belongs to user or user is staff, unresolve it
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Status='Unanswered'
|
||||
WHERE ID=$ID");
|
||||
SET Status = 'Unanswered'
|
||||
WHERE ID = $ID");
|
||||
// Clear cache for user
|
||||
$Cache->delete_value('num_staff_pms_'.$LoggedUser['ID']);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
Date,
|
||||
Unread
|
||||
FROM staff_pm_conversations
|
||||
WHERE UserID=".$LoggedUser['ID']."
|
||||
WHERE UserID = ".$LoggedUser['ID']."
|
||||
ORDER BY Status, Date DESC"
|
||||
);
|
||||
|
||||
|
@ -4,9 +4,10 @@
|
||||
|
||||
if ($ConvID = (int)$_GET['id']) {
|
||||
// Get conversation info
|
||||
$DB->query("SELECT Subject, UserID, Level, AssignedToUser, Unread, Status FROM staff_pm_conversations WHERE ID=$ConvID");
|
||||
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record();
|
||||
$DB->query("SELECT Subject, UserID, Level, AssignedToUser, Unread, Status FROM staff_pm_conversations WHERE ID=$ConvID");
|
||||
$DB->query("
|
||||
SELECT Subject, UserID, Level, AssignedToUser, Unread, Status
|
||||
FROM staff_pm_conversations
|
||||
WHERE ID = $ConvID");
|
||||
list($Subject, $UserID, $Level, $AssignedToUser, $Unread, $Status) = $DB->next_record();
|
||||
|
||||
if (!(($UserID == $LoggedUser['ID']) || ($AssignedToUser == $LoggedUser['ID']) || (($Level > 0 && $Level <= $LoggedUser['EffectiveClass']) || ($Level == 0 && $IsFLS)))) {
|
||||
@ -15,7 +16,10 @@
|
||||
}
|
||||
// User is trying to view their own unread conversation, set it to read
|
||||
if ($UserID == $LoggedUser['ID'] && $Unread) {
|
||||
$DB->query("UPDATE staff_pm_conversations SET Unread=false WHERE ID=$ConvID");
|
||||
$DB->query("
|
||||
UPDATE staff_pm_conversations
|
||||
SET Unread = false
|
||||
WHERE ID = $ConvID");
|
||||
// Clear cache for user
|
||||
$Cache->delete_value('staff_pm_new_'.$LoggedUser['ID']);
|
||||
}
|
||||
@ -65,7 +69,7 @@
|
||||
$StaffPMs = $DB->query("
|
||||
SELECT UserID, SentDate, Message, ID
|
||||
FROM staff_pm_messages
|
||||
WHERE ConvID=$ConvID");
|
||||
WHERE ConvID = $ConvID");
|
||||
|
||||
while (list($UserID, $SentDate, $Message, $MessageID) = $DB->next_record()) {
|
||||
// Set user string
|
||||
@ -115,7 +119,9 @@
|
||||
<option id="first_common_response">Select a message</option>
|
||||
<?
|
||||
// List common responses
|
||||
$DB->query("SELECT ID, Name FROM staff_pm_responses");
|
||||
$DB->query("
|
||||
SELECT ID, Name
|
||||
FROM staff_pm_responses");
|
||||
while (list($ID, $Name) = $DB->next_record()) {
|
||||
?>
|
||||
<option value="<?=$ID?>"><?=$Name?></option>
|
||||
@ -172,8 +178,8 @@
|
||||
m.ID,
|
||||
m.Username
|
||||
FROM permissions as p
|
||||
JOIN users_main as m ON m.PermissionID=p.ID
|
||||
WHERE p.DisplayStaff='1'
|
||||
JOIN users_main as m ON m.PermissionID = p.ID
|
||||
WHERE p.DisplayStaff = '1'
|
||||
ORDER BY p.Level DESC, m.Username ASC"
|
||||
);
|
||||
while (list($ID, $Name) = $DB->next_record()) {
|
||||
@ -191,9 +197,10 @@
|
||||
m.ID,
|
||||
m.Username
|
||||
FROM users_info as i
|
||||
JOIN users_main as m ON m.ID=i.UserID
|
||||
JOIN permissions as p ON p.ID=m.PermissionID
|
||||
WHERE p.DisplayStaff!='1' AND i.SupportFor!=''
|
||||
JOIN users_main as m ON m.ID = i.UserID
|
||||
JOIN permissions as p ON p.ID = m.PermissionID
|
||||
WHERE p.DisplayStaff != '1'
|
||||
AND i.SupportFor != ''
|
||||
ORDER BY m.Username ASC
|
||||
");
|
||||
while (list($ID, $Name) = $DB->next_record()) {
|
||||
|
@ -25,34 +25,34 @@
|
||||
$TimelineNet = array_reverse($DB->to_array());
|
||||
|
||||
foreach ($TimelineIn as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
if ($Amount > $Max) {
|
||||
$Max = $Amount;
|
||||
}
|
||||
}
|
||||
foreach ($TimelineOut as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
if ($Amount > $Max) {
|
||||
$Max = $Amount;
|
||||
}
|
||||
}
|
||||
foreach ($TimelineNet as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
if ($Amount > $Max) {
|
||||
$Max = $Amount;
|
||||
}
|
||||
}
|
||||
foreach ($TimelineIn as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
$Labels[] = $Label;
|
||||
$InFlow[] = number_format(($Amount / $Max) * 100, 4);
|
||||
}
|
||||
foreach ($TimelineOut as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
$OutFlow[] = number_format(($Amount / $Max) * 100, 4);
|
||||
}
|
||||
foreach ($TimelineNet as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
$NetFlow[] = number_format(($Amount / $Max) * 100, 4);
|
||||
}
|
||||
$Cache->cache_value('torrents_timeline', array($Labels, $InFlow, $OutFlow, $NetFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2)); //Tested: fine for dec -> jan
|
||||
@ -62,11 +62,11 @@
|
||||
$DB->query("
|
||||
SELECT tg.CategoryID, COUNT(t.ID) AS Torrents
|
||||
FROM torrents AS t
|
||||
JOIN torrents_group AS tg ON tg.ID=t.GroupID
|
||||
JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
||||
GROUP BY tg.CategoryID
|
||||
ORDER BY Torrents DESC");
|
||||
$Groups = $DB->to_array();
|
||||
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
|
||||
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
|
||||
foreach ($Groups as $Group) {
|
||||
list($CategoryID, $Torrents) = $Group;
|
||||
$CategoryName = $Categories[$CategoryID - 1];
|
||||
@ -82,7 +82,7 @@
|
||||
|
||||
<div class="box pad center">
|
||||
<h1>Uploads by month</h1>
|
||||
<img src="http://chart.apis.google.com/chart?cht=lc&chs=880x160&chco=000D99,99000D,00990D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|',$Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',',$InFlow)?>|<?=implode(',',$OutFlow)?>|<?=implode(',',$NetFlow)?>&chls=2,4,0&chdl=Uploads|Deletions|Remaining&chf=bg,s,FFFFFF00" alt="User Flow Chart" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=lc&chs=880x160&chco=000D99,99000D,00990D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|', $Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',', $InFlow)?>|<?=implode(',', $OutFlow)?>|<?=implode(',', $NetFlow)?>&chls=2,4,0&chdl=Uploads|Deletions|Remaining&chf=bg,s,FFFFFF00" alt="User Flow Chart" />
|
||||
</div>
|
||||
<div class="box pad center">
|
||||
<h1>Torrents by category</h1>
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?
|
||||
if (!list($Countries,$Rank,$CountryUsers,$CountryMax,$CountryMin,$LogIncrements) = $Cache->get_value('geodistribution')) {
|
||||
if (!list($Countries, $Rank, $CountryUsers, $CountryMax, $CountryMin, $LogIncrements) = $Cache->get_value('geodistribution')) {
|
||||
include_once(SERVER_ROOT.'/classes/charts.class.php');
|
||||
$DB->query('SELECT Code, Users FROM users_geodistribution');
|
||||
$DB->query('
|
||||
SELECT Code, Users
|
||||
FROM users_geodistribution');
|
||||
$Data = $DB->to_array();
|
||||
$Count = $DB->record_count() - 1;
|
||||
|
||||
@ -16,7 +18,7 @@
|
||||
|
||||
$CountryRegions = array('RS' => array('RS-KM')); // Count Kosovo as Serbia as it doesn't have a TLD
|
||||
foreach ($Data as $Key => $Item) {
|
||||
list($Country,$UserCount) = $Item;
|
||||
list($Country, $UserCount) = $Item;
|
||||
$Countries[] = $Country;
|
||||
$CountryUsers[] = number_format((((log($UserCount) / log(2)) - $CountryMin) / ($CountryMax - $CountryMin)) * 100, 2);
|
||||
$Rank[] = round((1 - ($Key / $Count)) * 100);
|
||||
@ -33,7 +35,7 @@
|
||||
for ($i = $CountryMin; $i <= $CountryMax; $i++) {
|
||||
$LogIncrements[] = Format::human_format(pow(2, $i));
|
||||
}
|
||||
$Cache->cache_value('geodistribution',array($Countries, $Rank, $CountryUsers, $CountryMax, $CountryMin, $LogIncrements), 0);
|
||||
$Cache->cache_value('geodistribution', array($Countries, $Rank, $CountryUsers, $CountryMax, $CountryMin, $LogIncrements), 0);
|
||||
}
|
||||
|
||||
if (!$ClassDistribution = $Cache->get_value('class_distribution')) {
|
||||
@ -41,12 +43,12 @@
|
||||
$DB->query("
|
||||
SELECT p.Name, COUNT(m.ID) AS Users
|
||||
FROM users_main AS m
|
||||
JOIN permissions AS p ON m.PermissionID=p.ID
|
||||
WHERE m.Enabled='1'
|
||||
JOIN permissions AS p ON m.PermissionID = p.ID
|
||||
WHERE m.Enabled = '1'
|
||||
GROUP BY p.Name
|
||||
ORDER BY Users DESC");
|
||||
$ClassSizes = $DB->to_array();
|
||||
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
|
||||
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
|
||||
foreach ($ClassSizes as $ClassSize) {
|
||||
list($Label, $Users) = $ClassSize;
|
||||
$Pie->add($Label, $Users);
|
||||
@ -67,10 +69,10 @@
|
||||
ORDER BY Users DESC");
|
||||
|
||||
$Platforms = $DB->to_array();
|
||||
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
|
||||
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
|
||||
foreach ($Platforms as $Platform) {
|
||||
list($Label,$Users) = $Platform;
|
||||
$Pie->add($Label,$Users);
|
||||
list($Label, $Users) = $Platform;
|
||||
$Pie->add($Label, $Users);
|
||||
}
|
||||
$Pie->transparent();
|
||||
$Pie->color('8A00B8');
|
||||
@ -87,12 +89,12 @@
|
||||
FROM users_sessions
|
||||
GROUP BY Browser
|
||||
ORDER BY Users DESC");
|
||||
|
||||
|
||||
$Browsers = $DB->to_array();
|
||||
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
|
||||
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
|
||||
foreach ($Browsers as $Browser) {
|
||||
list($Label,$Users) = $Browser;
|
||||
$Pie->add($Label,$Users);
|
||||
list($Label, $Users) = $Browser;
|
||||
$Pie->add($Label, $Users);
|
||||
}
|
||||
$Pie->transparent();
|
||||
$Pie->color('008AB8');
|
||||
@ -103,7 +105,7 @@
|
||||
|
||||
|
||||
//Timeline generation
|
||||
if (!list($Labels,$InFlow,$OutFlow,$Max) = $Cache->get_value('users_timeline')) {
|
||||
if (!list($Labels, $InFlow, $OutFlow, $Max) = $Cache->get_value('users_timeline')) {
|
||||
$DB->query("
|
||||
SELECT DATE_FORMAT(JoinDate,'%b \\'%y') AS Month, COUNT(UserID)
|
||||
FROM users_info
|
||||
@ -119,13 +121,13 @@
|
||||
LIMIT 1, 12");
|
||||
$TimelineOut = array_reverse($DB->to_array());
|
||||
foreach ($TimelineIn as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
if ($Amount > $Max) {
|
||||
$Max = $Amount;
|
||||
}
|
||||
}
|
||||
foreach ($TimelineOut as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
if ($Amount > $Max) {
|
||||
$Max = $Amount;
|
||||
}
|
||||
@ -133,15 +135,15 @@
|
||||
|
||||
$Labels = array();
|
||||
foreach ($TimelineIn as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
$Labels[] = $Label;
|
||||
$InFlow[] = number_format(($Amount / $Max) * 100, 4);
|
||||
}
|
||||
foreach ($TimelineOut as $Month) {
|
||||
list($Label,$Amount) = $Month;
|
||||
list($Label, $Amount) = $Month;
|
||||
$OutFlow[] = number_format(($Amount / $Max) * 100, 4);
|
||||
}
|
||||
$Cache->cache_value('users_timeline',array($Labels,$InFlow,$OutFlow,$Max),mktime(0,0,0,date('n') + 1, 2)); //Tested: fine for dec -> jan
|
||||
$Cache->cache_value('users_timeline', array($Labels, $InFlow, $OutFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2)); //Tested: fine for Dec -> Jan
|
||||
}
|
||||
//End timeline generation
|
||||
|
||||
@ -149,7 +151,7 @@
|
||||
?>
|
||||
<h3 id="User_Flow"><a href="#User_Flow">User Flow</a></h3>
|
||||
<div class="box pad center">
|
||||
<img src="http://chart.apis.google.com/chart?cht=lc&chs=880x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|',$Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',',$InFlow)?>|<?=implode(',',$OutFlow)?>&chls=2,4,0&chdl=New+Registrations|Disabled+Users&chf=bg,s,FFFFFF00" alt="User Flow Chart" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=lc&chs=880x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|', $Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',', $InFlow)?>|<?=implode(',', $OutFlow)?>&chls=2,4,0&chdl=New+Registrations|Disabled+Users&chf=bg,s,FFFFFF00" alt="User Flow Chart" />
|
||||
</div>
|
||||
<br />
|
||||
<h3 id="User_Classes"><a href="#User_Classes">User Classes</a></h3>
|
||||
@ -169,16 +171,16 @@
|
||||
<br />
|
||||
<h3 id="Geo_Dist_Map"><a href="#Geo_Dist_Map">Geographical Distribution Map</a></h3>
|
||||
<div class="box center">
|
||||
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-55,-180,73,180&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Worldwide" />
|
||||
<img src="http://chart.apis.google.com/chart?cht=map:fixed=37,-26,65,67&chs=440x220&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Europe" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=map:fixed=-55,-180,73,180&chs=440x220&chd=t:<?=implode(',', $Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|', $Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Worldwide" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=map:fixed=37,-26,65,67&chs=440x220&chs=440x220&chd=t:<?=implode(',', $Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|', $Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Europe" />
|
||||
<br />
|
||||
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-46,-132,24,21.5&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - South America" />
|
||||
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-11,22,50,160&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Asia" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=map:fixed=-46,-132,24,21.5&chs=440x220&chd=t:<?=implode(',', $Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|', $Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - South America" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=map:fixed=-11,22,50,160&chs=440x220&chd=t:<?=implode(',', $Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|', $Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Asia" />
|
||||
<br />
|
||||
<img src="http://chart.apis.google.com/chart?cht=map:fixed=-36,-57,37,100&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Africa" />
|
||||
<img src="http://chart.apis.google.com/chart?cht=map:fixed=14.8,15,45,86&chs=440x220&chd=t:<?=implode(',',$Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|',$Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Middle East" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=map:fixed=-36,-57,37,100&chs=440x220&chd=t:<?=implode(',', $Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|', $Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Africa" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=map:fixed=14.8,15,45,86&chs=440x220&chd=t:<?=implode(',', $Rank)?>&chco=FFFFFF,EDEDED,1F0066&chld=<?=implode('|', $Countries)?>&chf=bg,s,CCD6FF" alt="Geographical Distribution Map - Middle East" />
|
||||
<br />
|
||||
<img src="http://chart.apis.google.com/chart?chxt=y,x&chg=0,-1,1,1&chxs=0,h&cht=bvs&chco=76A4FB&chs=880x300&chd=t:<?=implode(',',array_slice($CountryUsers,0,31))?>&chxl=1:|<?=implode('|',array_slice($Countries,0,31))?>|0:|<?=implode('|',$LogIncrements)?>&chf=bg,s,FFFFFF00" alt="Number of users by country" />
|
||||
<img src="https://chart.googleapis.com/chart?chxt=y,x&chg=0,-1,1,1&chxs=0,h&cht=bvs&chco=76A4FB&chs=880x300&chd=t:<?=implode(',', array_slice($CountryUsers, 0, 31))?>&chxl=1:|<?=implode('|', array_slice($Countries, 0, 31))?>|0:|<?=implode('|', $LogIncrements)?>&chf=bg,s,FFFFFF00" alt="Number of users by country" />
|
||||
</div>
|
||||
<?
|
||||
View::show_footer();
|
||||
|
@ -115,11 +115,11 @@
|
||||
$DB->set_query_id($RS);
|
||||
?>
|
||||
<div class="thin">
|
||||
<? if (!isset($_GET['page'])) { ?>
|
||||
<? if (!isset($_GET['page'])) { ?>
|
||||
<div class="box pad">
|
||||
<img src="http://chart.apis.google.com/chart?cht=lc&chs=820x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|',$Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',',$InFlow)?>|<?=implode(',',$OutFlow)?>&chls=2,4,0&chdl=New+Registrations|Disabled+Users&chf=bg,s,FFFFFF00" alt="User Flow vs. Time" />
|
||||
<img src="https://chart.googleapis.com/chart?cht=lc&chs=820x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?=implode('|', $Labels)?>&chxr=0,0,<?=$Max?>&chd=t:<?=implode(',', $InFlow)?>|<?=implode(',', $OutFlow)?>&chls=2,4,0&chdl=New+Registrations|Disabled+Users&chf=bg,s,FFFFFF00" alt="User Flow vs. Time" />
|
||||
</div>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<div class="linkbox">
|
||||
<?
|
||||
$Pages = Format::get_pages($Page, $Results, DAYS_PER_PAGE, 11);
|
||||
|
@ -4,29 +4,23 @@
|
||||
$FullName = rawurldecode($_GET['query']);
|
||||
|
||||
$MaxKeySize = 4;
|
||||
$KeySize = min($MaxKeySize,max(1,strlen($FullName)));
|
||||
$KeySize = min($MaxKeySize, max(1, strlen($FullName)));
|
||||
|
||||
$Letters = strtolower(substr($FullName,0,$KeySize));
|
||||
$AutoSuggest = $Cache->get('autocomplete_tags_'.$KeySize.'_'.$Letters);
|
||||
$Letters = strtolower(substr($FullName, 0, $KeySize));
|
||||
$AutoSuggest = $Cache->get("autocomplete_tags_{$KeySize}_$Letters");
|
||||
|
||||
if (!$AutoSuggest) {
|
||||
$Limit = (($KeySize === $MaxKeySize) ? 250 : 10);
|
||||
$DB->query("
|
||||
SELECT
|
||||
Name
|
||||
SELECT Name
|
||||
FROM tags
|
||||
WHERE
|
||||
Name != ''
|
||||
AND
|
||||
Name LIKE '".db_string(str_replace('\\','\\\\',$Letters),true)."%'
|
||||
AND
|
||||
(Uses > 700 OR TagType = 'genre')
|
||||
ORDER BY
|
||||
TagType = 'genre' DESC,
|
||||
Uses DESC
|
||||
WHERE Name != ''
|
||||
AND Name LIKE '".db_string(str_replace('\\', '\\\\', $Letters), true)."%'
|
||||
AND (Uses > 700 OR TagType = 'genre')
|
||||
ORDER BY TagType = 'genre' DESC, Uses DESC
|
||||
LIMIT $Limit");
|
||||
$AutoSuggest = $DB->to_array(false,MYSQLI_NUM,false);
|
||||
$Cache->cache_value('autocomplete_tags_'.$KeySize.'_'.$Letters,$AutoSuggest,1800 + 7200 * ($MaxKeySize - $KeySize)); // Can't cache things for too long in case names are edited
|
||||
$AutoSuggest = $DB->to_array(false, MYSQLI_NUM, false);
|
||||
$Cache->cache_value("autocomplete_tags_{$KeySize}_$Letters", $AutoSuggest, 1800 + 7200 * ($MaxKeySize - $KeySize)); // Can't cache things for too long in case names are edited
|
||||
}
|
||||
|
||||
$Matched = 0;
|
||||
@ -37,7 +31,7 @@
|
||||
foreach ($AutoSuggest as $Suggestion) {
|
||||
list($Name) = $Suggestion;
|
||||
if (stripos($Name, $FullName) === 0) {
|
||||
$Response['suggestions'][] = array('value' => display_str($Name));
|
||||
$Response['suggestions'][] = array('value' => $Name);
|
||||
if (++$Matched > 9) {
|
||||
break;
|
||||
}
|
||||
|
@ -28,5 +28,5 @@ $(document).ready(function() {
|
||||
serviceUrl : TAGS_AUTOCOMPLETE_URL,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
$(document).ready(function() {
|
||||
var url = new URL();
|
||||
var query = url.query;
|
||||
switch (url.path ) {
|
||||
switch (url.path) {
|
||||
case "forums":
|
||||
if (query['action'] == "new") {
|
||||
$("#newthreadform").validate();
|
||||
|
@ -727,4 +727,4 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
}));
|
||||
}));
|
||||
|
@ -203,7 +203,7 @@ function URL() {
|
||||
var q = splitted[i].split("=");
|
||||
query[q[0]] = q[1];
|
||||
};
|
||||
|
||||
|
||||
var response = new Array();
|
||||
response['path'] = path;
|
||||
response['query'] = query;
|
||||
|
@ -828,4 +828,7 @@ ul .invitetree {
|
||||
.edit_changelog textarea {
|
||||
width: 600px;
|
||||
}
|
||||
.autocomplete-suggestions { background: #F1E6CC; }
|
||||
|
||||
.autocomplete-suggestions {
|
||||
background: #F1E6CC;
|
||||
}
|
||||
|
@ -2012,7 +2012,14 @@ tr.torrent .bookmark > a:after { content:""; }
|
||||
.edit_changelog textarea {
|
||||
width: 600px;
|
||||
}
|
||||
.autocomplete-suggestions { background: #3f3f3f; }
|
||||
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; cursor: pointer; color: #ffffff; }
|
||||
|
||||
|
||||
.autocomplete-suggestions {
|
||||
background: #3f3f3f;
|
||||
}
|
||||
.autocomplete-suggestion {
|
||||
padding: 2px 5px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
@ -501,7 +501,22 @@ tr.torrent .bookmark>a:after {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.autocomplete-suggestions { margin-top: 5px; border: 1px solid #999; background: #FFF; overflow: auto; }
|
||||
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; cursor: pointer; }
|
||||
.autocomplete-selected { background: #F0F0F0; }
|
||||
.autocomplete-suggestions strong { font-weight: normal; color: #3399FF; }
|
||||
.autocomplete-suggestions {
|
||||
margin-top: 5px;
|
||||
border: 1px solid #999;
|
||||
background: #FFF;
|
||||
overflow: auto;
|
||||
}
|
||||
.autocomplete-suggestion {
|
||||
padding: 2px 5px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
.autocomplete-selected {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
.autocomplete-suggestions strong {
|
||||
font-weight: normal;
|
||||
color: #3399FF;
|
||||
}
|
||||
|
@ -922,4 +922,7 @@ tr.torrent .bookmark > a:after { color:#999; }
|
||||
.edit_changelog textarea {
|
||||
width: 600px;
|
||||
}
|
||||
.autocomplete-suggestions { background: #222; }
|
||||
|
||||
.autocomplete-suggestions {
|
||||
background: #222;
|
||||
}
|
||||
|
@ -562,5 +562,10 @@ tr.torrent .bookmark > a:after { content: ""; }
|
||||
.edit_changelog textarea {
|
||||
width: 600px;
|
||||
}
|
||||
.autocomplete-suggestions { background: #3f3f3f; }
|
||||
.autocomplete-selected { background: #666; }
|
||||
|
||||
.autocomplete-suggestions {
|
||||
background: #3f3f3f;
|
||||
}
|
||||
.autocomplete-selected {
|
||||
background: #666;
|
||||
}
|
||||
|
@ -1083,6 +1083,10 @@ tr.torrent .bookmark > a:after {
|
||||
.edit_changelog textarea {
|
||||
width: 600px;
|
||||
}
|
||||
.autocomplete-suggestions { background: #111; }
|
||||
.autocomplete-selected { background: #444; }
|
||||
|
||||
.autocomplete-suggestions {
|
||||
background: #111;
|
||||
}
|
||||
.autocomplete-selected {
|
||||
background: #444;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user