1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00
This commit is contained in:
Cameron
2019-01-17 12:59:20 -08:00
parent bce677757c
commit 68a4aaea16

View File

@@ -37,6 +37,17 @@ if (!$pref['track_online'])
exit;
}
$ONLINE_TABLE = '';
$ONLINE_TABLE_START = '';
$ONLINE_TABLE_END = '';
$ONLINE_TABLE_MISC = '';
if(!defined('COMMENT'))
{
define('COMMENT', '');
}
if(file_exists(THEME . "online_template.php"))
{
require_once(THEME . "online_template.php");
@@ -50,7 +61,7 @@ global $listuserson;
foreach($listuserson as $uinfo => $pinfo)
{
$class_check = TRUE;
$class_check = true;
list($oid, $oname) = explode(".", $uinfo, 2);
$online_location = $pinfo;
$online_location_page = substr(strrchr($online_location, "/"), 1);
@@ -164,34 +175,47 @@ Think these are no longer used
$online_location_page = STATS;
}
*/
$scArray = array();
if(strstr($online_location, "content.php"))
{
$tmp = explode(".", substr(strrchr($online_location, "php."), 2));
if ($tmp[0] == "article") {
$sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
$content = $sql->db_Fetch();
if($tmp[0] == "article")
{
$sql->select("content", "content_heading, content_class", "content_id='" . intval($tmp[1]) . "'");
$content = $sql->fetch();
$online_location_page = ARTICLE . ": " . $content['content_heading'];
$online_location = str_replace("php.", "php?", $online_location);
if (!check_class($content['content_class'])) {
$class_check = FALSE;
if(!check_class($content['content_class']))
{
$class_check = false;
$online_location_page = ARTICLE . ": \"" . CLASSRESTRICTED . "\"";
}
} elseif($tmp[0] == "review") {
$sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
$content = $sql->db_Fetch();
}
elseif($tmp[0] == "review")
{
$sql->select("content", "content_heading, content_class", "content_id='" . intval($tmp[1]) . "'");
$content = $sql->fetch();
$online_location_page = REVIEW . ": " . $content['content_heading'];
$online_location = str_replace("php.", "php?", $online_location);
if (!check_class($content['content_class'])) {
$class_check = FALSE;
if(!check_class($content['content_class']))
{
$class_check = false;
$online_location_page = REVIEW . ": \"" . CLASSRESTRICTED . "\"";
}
} elseif($tmp[0] == "content") {
$sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
$content = $sql->db_Fetch();
}
elseif($tmp[0] == "content")
{
$sql->select("content", "content_heading, content_class", "content_id='" . intval($tmp[1]) . "'");
$content = $sql->fetch();
$online_location_page = CONTENT . ": " . $content['content_heading'];
$online_location = str_replace("php.", "php?", $online_location);
if (!check_class($content['content_class'])) {
$class_check = FALSE;
if(!check_class($content['content_class']))
{
$class_check = false;
$online_location_page = CONTENT . ": \"" . CLASSRESTRICTED . "\"";
}
}
@@ -201,65 +225,80 @@ Think these are no longer used
{
$tmp = explode(".php.", $online_location);
$tmp = explode(".", $tmp[1]);
if ($tmp[1] == "news") {
if($tmp[1] == "news")
{
$id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
$sql->db_Select("news", "news_title, news_class", "news_id=".intval($id));
$news = $sql->db_Fetch();
$sql->select("news", "news_title, news_class", "news_id=" . intval($id));
$news = $sql->fetch();
$online_location_page = ($tmp[0] == "reply" ? COMMENT . ": " . ONLINE_EL12 . " > " . $news['news_title'] : COMMENT . ": " . $news['news_title']);
$online_location = "comment.php?comment.news.$id";
if (!check_class($news['news_class'])) {
$class_check = FALSE;
if(!check_class($news['news_class']))
{
$class_check = false;
$online_location_page = COMMENT . ": \"" . CLASSRESTRICTED . "\"";
}
} elseif($tmp[1] == "poll") {
}
elseif($tmp[1] == "poll")
{
$id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
$sql->db_Select("poll", "poll_title", "poll_id=".intval($id));
$poll = $sql->db_Fetch();
$sql->select("poll", "poll_title", "poll_id=" . intval($id));
$poll = $sql->fetch();
$online_location_page = POLLCOMMENT . ": " . $poll['poll_title'];
$online_location = "comment.php?comment.poll.$id";
} else {
}
else
{
$online_location_page = COMMENT;
$class_check = FALSE;
$class_check = false;
}
}
if(strstr($online_location, "forum"))
{
$tmp = explode(".", substr(strrchr($online_location, "php."), 2));
if (strstr($online_location, "_viewtopic")) {
if ($tmp[2]) {
if(strstr($online_location, "_viewtopic"))
{
if($tmp[2])
{
$pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
$t_page = $tmp[2] / $pref['forum_postspage'] + 1;
} else {
}
else
{
$t_page = 1;
}
$qry = "
SELECT t.thread_name, f.forum_name, f.forum_class from #forum_thread AS t
LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
WHERE t.thread_id = ".intval($tmp[0])
;
$sql->db_Select_gen($qry);
$forum = $sql->db_Fetch();
WHERE t.thread_id = " . intval($tmp[0]);
$sql->gen($qry);
$forum = $sql->fetch();
$online_location_page = ONLINE_EL13 . " .:. " . $forum['forum_name'] . "->" . ONLINE_EL14 . " .:. " . $forum['thread_name'] . "->" . ONLINE_EL15 . ": " . $t_page;
$online_location = str_replace("php.", "php?", $online_location);
if (!check_class($forum['forum_class'])) {
$class_check = FALSE;
if(!check_class($forum['forum_class']))
{
$class_check = false;
$online_location_page = ONLINE_EL13 . ": \"" . CLASSRESTRICTED . "\"";
}
} elseif(strstr($online_location, "_viewforum")) {
$sql->db_Select("forum", "forum_name, forum_class", "forum_id=".intval($tmp[0]));
$forum = $sql->db_Fetch();
}
elseif(strstr($online_location, "_viewforum"))
{
$sql->select("forum", "forum_name, forum_class", "forum_id=" . intval($tmp[0]));
$forum = $sql->fetch();
$online_location_page = ONLINE_EL13 . " .:. " . $forum['forum_name'];
$online_location = str_replace("php.", "php?", $online_location);
if (!check_class($forum['forum_class'])) {
$class_check = FALSE;
if(!check_class($forum['forum_class']))
{
$class_check = false;
$online_location_page = ONLINE_EL13 . ": \"" . CLASSRESTRICTED . "\"";
}
} elseif(strstr($online_location, "_post")) {
$sql->db_Select("forum_thread", "thread_name, thread_forum_id", "thread_forum_id=".intval($tmp[0])." AND thread_parent=0");
$forum_thread = $sql->db_Fetch();
$sql->db_Select("forum", "forum_name", "forum_id=".$forum_thread['thread_forum_id']);
$forum = $sql->db_Fetch();
}
elseif(strstr($online_location, "_post"))
{
$sql->select("forum_thread", "thread_name, thread_forum_id", "thread_forum_id=" . intval($tmp[0]) . " AND thread_parent=0");
$forum_thread = $sql->fetch();
$sql->select("forum", "forum_name", "forum_id=" . $forum_thread['thread_forum_id']);
$forum = $sql->fetch();
$online_location_page = ONLINE_EL12 . ": " . ONLINE_EL13 . " .:. " . $forum['forum_name'] . "->" . ONLINE_EL14 . " .:. " . $forum_thread['thread_name'];
$online_location = e_PLUGIN . "forum/forum_viewtopic.php?$tmp[0].$tmp[1]";
}
@@ -267,29 +306,24 @@ Think these are no longer used
if(strstr($online_location, "admin"))
{
$class_check = FALSE;
$class_check = false;
$online_location_page = ADMINAREA;
}
// $ONLINE_TABLE_ICON = (vartrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "<img src='".e_PLUGIN."online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />");
//$ONLINE_TABLE_USERNAME = "<a href='".e_BASE."user.php?id.$oid'>{$oname}</a>";
$uparams = array('id' => $oid, 'name' => $oname);
$link = e107::getUrl()->create('user/profile/view', $uparams);
// $ONLINE_TABLE_USERNAME = "<a href='".$link."'>".$oname."</a>";
// $ONLINE_TABLE_LOCATION = ($class_check ? "<a href='{$online_location}'>{$online_location_page}</a>" : $online_location_page);
$scArray = array(
'ONLINE_TABLE_ICON' => (vartrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "<img src='".e_PLUGIN."online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />"),
'ONLINE_TABLE_USERNAME' => "<a href='".$link."'>".$oname."</a>",
'ONLINE_TABLE_LOCATION' => ($class_check ? "<a href='{$online_location}'>{$online_location_page}</a>" : $online_location_page)
);
$scArray['ONLINE_TABLE_ICON'] = (vartrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "<img src='" . e_PLUGIN . "online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />");
$scArray['ONLINE_TABLE_USERNAME'] = "<a href='" . $link . "'>" . $oname . "</a>";
$scArray['ONLINE_TABLE_LOCATION'] = ($class_check ? "<a href='{$online_location}'>{$online_location_page}</a>" : $online_location_page);
$textstring .= $tp->parseTemplate($ONLINE_TABLE, true, $scArray); // preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE);
}
$ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1.GUESTS_ONLINE;
$ONLINE_TABLE_GUESTS_ONLINE = ONLINE_EL2.MEMBERS_ONLINE;
$scArray['ONLINE_TABLE_MEMBERS_ONLINE'] = ONLINE_EL1 . GUESTS_ONLINE;
$scArray['ONLINE_TABLE_GUESTS_ONLINE'] = ONLINE_EL2 . MEMBERS_ONLINE;
if(!isset($gen) || !is_object($gen))
{
@@ -300,31 +334,31 @@ $siteHistory = e107::getConfig('history')->getPref('');
$datestamp = $gen->convert_date($siteHistory['most_online_datestamp'], "short");
$ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8.($siteHistory['most_members_online'] + $siteHistory['most_guests_online']);
$ONLINE_TABLE_MOST_MEMBERS_ONLINE = ONLINE_EL2.$siteHistory['most_members_online'];
$ONLINE_TABLE_MOST_GUESTS_ONLINE = ONLINE_EL1.$siteHistory['most_guests_online'];
$ONLINE_TABLE_DATESTAMP = $datestamp;
$scArray['ONLINE_TABLE_MOST_EVER_ONLINE'] = ONLINE_EL8 . ($siteHistory['most_members_online'] + $siteHistory['most_guests_online']);
$scArray['ONLINE_TABLE_MOST_MEMBERS_ONLINE'] = ONLINE_EL2 . $siteHistory['most_members_online'];
$scArray['ONLINE_TABLE_MOST_GUESTS_ONLINE'] = ONLINE_EL1 . $siteHistory['most_guests_online'];
$scArray['ONLINE_TABLE_DATESTAMP'] = $datestamp;
$total_members = $sql->db_Count("user","(*)","where user_ban = 0");
$total_members = $sql->count("user", "(*)", "where user_ban = 0");
if($total_members > 1)
{
$newest_member = $sql->db_Select("user", "user_id, user_name", "user_ban=0 ORDER BY user_join DESC LIMIT 0,1");
$row = $sql->db_Fetch();
$newest_member = $sql->select("user", "user_id, user_name", "user_ban=0 ORDER BY user_join DESC LIMIT 0,1");
$row = $sql->fetch();
$ONLINE_TABLE_MEMBERS_TOTAL = "<br />".ONLINE_EL5.": ".$total_members;
$ONLINE_TABLE_MEMBERS_NEWEST = "<br />".ONLINE_EL6.": ".(USER ? "<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>" : $row['user_name']);
$scArray['ONLINE_TABLE_MEMBERS_TOTAL'] = "<br />" . ONLINE_EL5 . ": " . $total_members;
$scArray['ONLINE_TABLE_MEMBERS_NEWEST'] = "<br />" . ONLINE_EL6 . ": " . (USER ? "<a href='" . e_BASE . "user.php?id." . $row['user_id'] . "'>" . $row['user_name'] . "</a>" : $row['user_name']);
}
$text = '';
if(count($listuserson))
{
$textstart = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_START);
$textend = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_END);
$textstart = $tp->parseTemplate($ONLINE_TABLE_START, true, $scArray);
$textend = $tp->parseTemplate($ONLINE_TABLE_END, true, $scArray);
$text = $textstart . $textstring . $textend;
}
$text .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_MISC);
$text .= $tp->parseTemplate($ONLINE_TABLE_MISC, true, $scArray);
$ns->tablerender(ONLINE_EL4, $text);