diff --git a/online.php b/online.php
index b30476223..508aea310 100644
--- a/online.php
+++ b/online.php
@@ -1,331 +1,365 @@
tablerender(ONLINE_EL4, ONLINE_EL16);
- require_once(FOOTERF);
- exit;
-}
-
-if (file_exists(THEME."online_template.php"))
-{
- require_once(THEME."online_template.php");
-}
-else
-{
- require_once(e_CORE."templates/online_template.php");
-}
-
-global $listuserson;
-
-foreach($listuserson as $uinfo => $pinfo)
-{
- $class_check = TRUE;
- list($oid, $oname) = explode(".", $uinfo, 2);
- $online_location = $pinfo;
- $online_location_page = substr(strrchr($online_location, "/"), 1);
- if (!strstr($online_location, "forum_") || !strstr($online_location, "content.php") || !strstr($online_location, "comment.php"))
- {
- $online_location_page = str_replace(".php", "", substr(strrchr($online_location, "/"), 1));
- }
-
- switch ($online_location_page)
- {
- case 'log' :
- case 'error' :
- $online_location = "news.php";
- $online_location_page = NEWS;
- break;
- case 'request' :
- $online_location = "download.php";
- break;
- case 'chat' :
- $online_location_page = CHAT;
- break;
- case 'content' :
- $online_location_page = CONTENT;
- break;
- case 'download' :
- $online_location_page = DOWNLOAD;
- break;
- case 'email' :
- $online_location_page = EMAIL;
- break;
- case 'forum' :
- $online_location_page = FORUM;
- break;
- case 'links' :
- $online_location_page = LINKS;
- break;
- case 'news' :
- $online_location_page = NEWS;
- break;
- case 'login' :
- $online_location_page = LOGIN;
- break;
- case 'search' :
- $online_location_page = SEARCH;
- break;
- case 'submitnews' :
- $online_location_page = SUBMITNEWS;
- break;
- case 'upload' :
- $online_location_page = UPLOAD;
- break;
- case 'user' :
- $online_location_page = USERPAGE;
- break;
- case 'usersettings' :
- $online_location_page = USERSETTINGS;
- break;
- case 'new' :
- $online_location_page = LISTNEW;
- break;
- case 'online' :
- $online_location_page = ONLINE;
- break;
- case 'userposts' :
- $online_location_page = USERPOSTS;
- break;
- case 'subcontent' :
- $online_location_page = SUBCONTENT;
- break;
- case 'top' :
- $online_location_page = TOP;
- break;
- case 'oldpolls' :
- $online_location_page = OLDPOLLS;
- break;
- //commonly used plugin pages
- case 'bugtracker' :
- $online_location_page = BUGTRACKER;
- break;
- case 'event' :
- $online_location_page = EVENT;
- break;
- case 'calendar' :
- $online_location_page = CALENDAR;
- break;
- case 'pm' :
- $online_location_page = PM;
- break;
- case 'survey' :
- $online_location_page = SURVEY;
- break;
- case 'faq' :
- $online_location_page = FAQ;
- break;
- default :
- $online_location_page = OTHER.$online_location_page;
- }
-
-/*
-Think these are no longer used
- case 'article' :
- $online_location_page = ARTICLEPAGE;
- break;
- if ($online_location_page == "oldpolls") {
- $online_location_page = OLDPOLLS;
+ if(!$pref['track_online'])
+ {
+ $ns->tablerender(ONLINE_EL4, ONLINE_EL16);
+ require_once(FOOTERF);
+ exit;
}
- if ($online_location_page == "print") {
- $online_location_page = PRINTPAGE;
+
+ $ONLINE_TABLE = '';
+ $ONLINE_TABLE_START = '';
+ $ONLINE_TABLE_END = '';
+ $ONLINE_TABLE_MISC = '';
+
+ if(!defined('COMMENT'))
+ {
+ define('COMMENT', '');
}
- if ($online_location_page == "stats") {
- $online_location_page = STATS;
+
+
+ if(file_exists(THEME . "online_template.php"))
+ {
+ require_once(THEME . "online_template.php");
}
-*/
- 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();
- $online_location_page = ARTICLE.": ".$content['content_heading'];
- $online_location = str_replace("php.", "php?", $online_location);
- if (!check_class($content['content_class'])) {
- $class_check = FALSE;
- $online_location_page = ARTICLE.": \"".CLASSRESTRICTED."\"";
+ else
+ {
+ require_once(e_CORE . "templates/online_template.php");
+ }
+
+ global $listuserson;
+
+ foreach($listuserson as $uinfo => $pinfo)
+ {
+ $class_check = true;
+ list($oid, $oname) = explode(".", $uinfo, 2);
+ $online_location = $pinfo;
+ $online_location_page = substr(strrchr($online_location, "/"), 1);
+ if(!strstr($online_location, "forum_") || !strstr($online_location, "content.php") || !strstr($online_location, "comment.php"))
+ {
+ $online_location_page = str_replace(".php", "", substr(strrchr($online_location, "/"), 1));
+ }
+
+ switch($online_location_page)
+ {
+ case 'log' :
+ case 'error' :
+ $online_location = "news.php";
+ $online_location_page = NEWS;
+ break;
+ case 'request' :
+ $online_location = "download.php";
+ break;
+ case 'chat' :
+ $online_location_page = CHAT;
+ break;
+ case 'content' :
+ $online_location_page = CONTENT;
+ break;
+ case 'download' :
+ $online_location_page = DOWNLOAD;
+ break;
+ case 'email' :
+ $online_location_page = EMAIL;
+ break;
+ case 'forum' :
+ $online_location_page = FORUM;
+ break;
+ case 'links' :
+ $online_location_page = LINKS;
+ break;
+ case 'news' :
+ $online_location_page = NEWS;
+ break;
+ case 'login' :
+ $online_location_page = LOGIN;
+ break;
+ case 'search' :
+ $online_location_page = SEARCH;
+ break;
+ case 'submitnews' :
+ $online_location_page = SUBMITNEWS;
+ break;
+ case 'upload' :
+ $online_location_page = UPLOAD;
+ break;
+ case 'user' :
+ $online_location_page = USERPAGE;
+ break;
+ case 'usersettings' :
+ $online_location_page = USERSETTINGS;
+ break;
+ case 'new' :
+ $online_location_page = LISTNEW;
+ break;
+ case 'online' :
+ $online_location_page = ONLINE;
+ break;
+ case 'userposts' :
+ $online_location_page = USERPOSTS;
+ break;
+ case 'subcontent' :
+ $online_location_page = SUBCONTENT;
+ break;
+ case 'top' :
+ $online_location_page = TOP;
+ break;
+ case 'oldpolls' :
+ $online_location_page = OLDPOLLS;
+ break;
+ //commonly used plugin pages
+ case 'bugtracker' :
+ $online_location_page = BUGTRACKER;
+ break;
+ case 'event' :
+ $online_location_page = EVENT;
+ break;
+ case 'calendar' :
+ $online_location_page = CALENDAR;
+ break;
+ case 'pm' :
+ $online_location_page = PM;
+ break;
+ case 'survey' :
+ $online_location_page = SURVEY;
+ break;
+ case 'faq' :
+ $online_location_page = FAQ;
+ break;
+ default :
+ $online_location_page = OTHER . $online_location_page;
+ }
+
+ /*
+ Think these are no longer used
+ case 'article' :
+ $online_location_page = ARTICLEPAGE;
+ break;
+ if ($online_location_page == "oldpolls") {
+ $online_location_page = OLDPOLLS;
}
- } elseif($tmp[0] == "review") {
- $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
- $content = $sql->db_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;
- $online_location_page = REVIEW.": \"".CLASSRESTRICTED."\"";
+ if ($online_location_page == "print") {
+ $online_location_page = PRINTPAGE;
}
- } elseif($tmp[0] == "content") {
- $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
- $content = $sql->db_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;
- $online_location_page = CONTENT.": \"".CLASSRESTRICTED."\"";
+ if ($online_location_page == "stats") {
+ $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->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;
+ $online_location_page = ARTICLE . ": \"" . CLASSRESTRICTED . "\"";
+ }
+ }
+ 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;
+ $online_location_page = REVIEW . ": \"" . CLASSRESTRICTED . "\"";
+ }
+ }
+ 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;
+ $online_location_page = CONTENT . ": \"" . CLASSRESTRICTED . "\"";
+ }
}
}
- }
- if (strstr($online_location, "comment.php"))
- {
- $tmp = explode(".php.", $online_location);
- $tmp = explode(".", $tmp[1]);
- 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();
- $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;
- $online_location_page = COMMENT.": \"".CLASSRESTRICTED."\"";
+ if(strstr($online_location, "comment.php"))
+ {
+ $tmp = explode(".php.", $online_location);
+ $tmp = explode(".", $tmp[1]);
+ if($tmp[1] == "news")
+ {
+ $id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
+ $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;
+ $online_location_page = COMMENT . ": \"" . CLASSRESTRICTED . "\"";
+ }
+ }
+ elseif($tmp[1] == "poll")
+ {
+ $id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
+ $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
+ {
+ $online_location_page = COMMENT;
+ $class_check = false;
}
- } 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();
- $online_location_page = POLLCOMMENT.": ".$poll['poll_title'];
- $online_location = "comment.php?comment.poll.$id";
- } else {
- $online_location_page = COMMENT;
- $class_check = FALSE;
}
- }
- if (strstr($online_location, "forum"))
- {
- $tmp = explode(".", substr(strrchr($online_location, "php."), 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 {
- $t_page = 1;
- }
- $qry = "
+ if(strstr($online_location, "forum"))
+ {
+ $tmp = explode(".", substr(strrchr($online_location, "php."), 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
+ {
+ $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();
- $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;
- $online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\"";
+ 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;
+ $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();
- $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;
- $online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\"";
+ 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;
+ $online_location_page = ONLINE_EL13 . ": \"" . CLASSRESTRICTED . "\"";
+ }
+ }
+ 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]";
}
- } 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();
- $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]";
}
- }
- if (strstr($online_location, "admin"))
- {
- $class_check = FALSE;
- $online_location_page = ADMINAREA;
- }
-
-// $ONLINE_TABLE_ICON = (vartrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "
");
-
- //$ONLINE_TABLE_USERNAME = "{$oname}";
- $uparams = array('id' => $oid, 'name' => $oname);
- $link = e107::getUrl()->create('user/profile/view', $uparams);
-// $ONLINE_TABLE_USERNAME = "".$oname."";
-// $ONLINE_TABLE_LOCATION = ($class_check ? "{$online_location_page}" : $online_location_page);
+ if(strstr($online_location, "admin"))
+ {
+ $class_check = false;
+ $online_location_page = ADMINAREA;
+ }
- $scArray = array(
- 'ONLINE_TABLE_ICON' => (vartrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "
"),
- 'ONLINE_TABLE_USERNAME' => "".$oname."",
- 'ONLINE_TABLE_LOCATION' => ($class_check ? "{$online_location_page}" : $online_location_page)
- );
+ $uparams = array('id' => $oid, 'name' => $oname);
+ $link = e107::getUrl()->create('user/profile/view', $uparams);
- $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;
-
-if (!isset($gen) || !is_object($gen))
-{
- $gen = new convert;
-}
+ $scArray['ONLINE_TABLE_ICON'] = (vartrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "
");
+ $scArray['ONLINE_TABLE_USERNAME'] = "" . $oname . "";
+ $scArray['ONLINE_TABLE_LOCATION'] = ($class_check ? "{$online_location_page}" : $online_location_page);
-$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;
-
-$total_members = $sql->db_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();
-
- $ONLINE_TABLE_MEMBERS_TOTAL = "
".ONLINE_EL5.": ".$total_members;
- $ONLINE_TABLE_MEMBERS_NEWEST = "
".ONLINE_EL6.": ".(USER ? "".$row['user_name']."" : $row['user_name']);
-}
-
-$text = '';
-if (count($listuserson))
-{
- $textstart = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_START);
- $textend = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_END);
- $text = $textstart.$textstring.$textend;
-}
-$text .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_MISC);
-
-$ns->tablerender(ONLINE_EL4, $text);
-
-require_once(FOOTERF);
+ $textstring .= $tp->parseTemplate($ONLINE_TABLE, true, $scArray); // preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE);
+ }
+
+
+ $scArray['ONLINE_TABLE_MEMBERS_ONLINE'] = ONLINE_EL1 . GUESTS_ONLINE;
+ $scArray['ONLINE_TABLE_GUESTS_ONLINE'] = ONLINE_EL2 . MEMBERS_ONLINE;
+
+ if(!isset($gen) || !is_object($gen))
+ {
+ $gen = new convert;
+ }
+
+ $siteHistory = e107::getConfig('history')->getPref('');
+
+ $datestamp = $gen->convert_date($siteHistory['most_online_datestamp'], "short");
+
+ $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->count("user", "(*)", "where user_ban = 0");
+
+ if($total_members > 1)
+ {
+ $newest_member = $sql->select("user", "user_id, user_name", "user_ban=0 ORDER BY user_join DESC LIMIT 0,1");
+ $row = $sql->fetch();
+
+ $scArray['ONLINE_TABLE_MEMBERS_TOTAL'] = "
" . ONLINE_EL5 . ": " . $total_members;
+ $scArray['ONLINE_TABLE_MEMBERS_NEWEST'] = "
" . ONLINE_EL6 . ": " . (USER ? "" . $row['user_name'] . "" : $row['user_name']);
+ }
+
+
+ $text = '';
+ if(count($listuserson))
+ {
+ $textstart = $tp->parseTemplate($ONLINE_TABLE_START, true, $scArray);
+ $textend = $tp->parseTemplate($ONLINE_TABLE_END, true, $scArray);
+ $text = $textstart . $textstring . $textend;
+ }
+ $text .= $tp->parseTemplate($ONLINE_TABLE_MISC, true, $scArray);
+
+ $ns->tablerender(ONLINE_EL4, $text);
+
+ require_once(FOOTERF);