mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Bugtracker #4284 - handle case of no members online, plus a tidy up
This commit is contained in:
parent
1fbb22866f
commit
50554746c7
@ -4,9 +4,9 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_online.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:34:39 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-01-06 09:38:33 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -26,8 +26,10 @@ define("ONLINE_EL12", "Replying to");
|
||||
define("ONLINE_EL13", "Forum");
|
||||
define("ONLINE_EL14", "Thread");
|
||||
define("ONLINE_EL15", "Page");
|
||||
define("ONLINE_EL16", "Information not available");
|
||||
|
||||
define("CLASSRESTRICTED", "Class Restricted Page");
|
||||
define("ARTICLEPAGE", "Article/Review");
|
||||
//define("ARTICLEPAGE", "Article/Review");
|
||||
define("CHAT", "Chat");
|
||||
define("COMMENT", "Comments");
|
||||
define("DOWNLOAD", "Downloads");
|
||||
@ -48,7 +50,7 @@ define("USERSETTINGS", "User Settings");
|
||||
define("ONLINE", "Online Users");
|
||||
define("LISTNEW", "List New Items");
|
||||
define("USERPOSTS", "User Posts");
|
||||
define("SUBCONTENT", "Submit Article/Review");
|
||||
define("SUBCONTENT", "Submit Content");
|
||||
define("TOP", "Top Posters/Most Active Threads");
|
||||
define("ADMINAREA", "Admin Area");
|
||||
define("BUGTRACKER", "Bugtracker");
|
||||
@ -60,5 +62,6 @@ define("SURVEY", "Survey");
|
||||
define("ARTICLE", "Article");
|
||||
define("CONTENT", "Content Page");
|
||||
define("REVIEW", "Review");
|
||||
define('OTHER', 'Other page: ');
|
||||
|
||||
?>
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
// $Id: online_template.php,v 1.2 2007-12-06 21:35:55 e107steved Exp $
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:96%"); }
|
||||
@ -7,7 +6,7 @@ if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:96%"); }
|
||||
// ##### ONLINE TABLE -----------------------------------------------------------------------------
|
||||
if(!isset($ONLINE_TABLE_START))
|
||||
{
|
||||
$ONLINE_TABLE_START = "
|
||||
$ONLINE_TABLE_START = "
|
||||
<div style='text-align:center'>
|
||||
<table class='fborder' style='".USER_WIDTH."'>
|
||||
<tr>
|
||||
@ -18,7 +17,7 @@ if(!isset($ONLINE_TABLE_START))
|
||||
}
|
||||
if(!isset($ONLINE_TABLE))
|
||||
{
|
||||
$ONLINE_TABLE = "
|
||||
$ONLINE_TABLE = "
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:3%;text-align:center'>{ONLINE_TABLE_ICON}</td>
|
||||
<td class='forumheader3' style='width:45%'>{ONLINE_TABLE_USERNAME}</td>
|
||||
@ -27,11 +26,14 @@ if(!isset($ONLINE_TABLE))
|
||||
}
|
||||
if(!isset($ONLINE_TABLE_END))
|
||||
{
|
||||
$ONLINE_TABLE_END = "
|
||||
$ONLINE_TABLE_END = "
|
||||
</table>
|
||||
</div>
|
||||
<br />
|
||||
".ONLINE_EL1.GUESTS_ONLINE.",
|
||||
<br />";
|
||||
}
|
||||
if (!isset($ONLINE_TABLE_MISC))
|
||||
{
|
||||
$ONLINE_TABLE_MISC = ONLINE_EL1.GUESTS_ONLINE.",
|
||||
".ONLINE_EL2.MEMBERS_ONLINE." ...<br />
|
||||
<br />{ONLINE_TABLE_MOST_EVER_ONLINE}
|
||||
<br />({ONLINE_TABLE_MOST_MEMBERS_ONLINE}, {ONLINE_TABLE_MOST_GUESTS_ONLINE}) ".ONLINE_EL9." {ONLINE_TABLE_DATESTAMP}<br />
|
||||
|
287
online.php
287
online.php
@ -11,121 +11,147 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/online.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-10-06 17:36:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-01-06 09:38:33 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
require_once("class2.php");
|
||||
require_once(HEADERF);
|
||||
|
||||
if (!$pref['track_online'])
|
||||
{
|
||||
$ns->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_THEME."templates/online_template.php");
|
||||
}
|
||||
|
||||
global $listuserson;
|
||||
|
||||
foreach($listuserson as $uinfo => $pinfo) {
|
||||
$class_check = TRUE;
|
||||
list($oid, $oname) = explode(".", $uinfo, 2);
|
||||
$sql2 = new db;
|
||||
$sql2->db_Select("user", "user_id", "user_admin > 0 ");
|
||||
$row_2 = $sql2->db_Fetch();
|
||||
$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));
|
||||
}
|
||||
if ($online_location_page == "log" || $online_location_page == "error") {
|
||||
$online_location = "news.php";
|
||||
$online_location_page = NEWS;
|
||||
}
|
||||
if ($online_location_page == "request") {
|
||||
$online_location = "download.php";
|
||||
}
|
||||
if ($online_location_page == "article") {
|
||||
$online_location_page = ARTICLEPAGE;
|
||||
}
|
||||
if ($online_location_page == "chat") {
|
||||
$online_location_page = CHAT;
|
||||
}
|
||||
//if($online_location_page == "comment"){$online_location_page = COMMENT;}
|
||||
if ($online_location_page == "content") {
|
||||
$online_location_page = CONTENT;
|
||||
}
|
||||
if ($online_location_page == "download") {
|
||||
$online_location_page = DOWNLOAD;
|
||||
}
|
||||
if ($online_location_page == "email") {
|
||||
$online_location_page = EMAIL;
|
||||
}
|
||||
if ($online_location_page == "forum") {
|
||||
$online_location_page = FORUM;
|
||||
}
|
||||
if ($online_location_page == "links") {
|
||||
$online_location_page = LINKS;
|
||||
}
|
||||
if ($online_location_page == "news") {
|
||||
$online_location_page = NEWS;
|
||||
}
|
||||
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;
|
||||
//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 ($online_location_page == "print") {
|
||||
$online_location_page = PRINTPAGE;
|
||||
}
|
||||
if ($online_location_page == "login") {
|
||||
$online_location_page = LOGIN;
|
||||
}
|
||||
if ($online_location_page == "search") {
|
||||
$online_location_page = SEARCH;
|
||||
}
|
||||
if ($online_location_page == "stats") {
|
||||
$online_location_page = STATS;
|
||||
}
|
||||
if ($online_location_page == "submitnews") {
|
||||
$online_location_page = SUBMITNEWS;
|
||||
}
|
||||
if ($online_location_page == "upload") {
|
||||
$online_location_page = UPLOAD;
|
||||
}
|
||||
if ($online_location_page == "user") {
|
||||
$online_location_page = USERPAGE;
|
||||
}
|
||||
if ($online_location_page == "usersettings") {
|
||||
$online_location_page = USERSETTINGS;
|
||||
}
|
||||
if ($online_location_page == "new") {
|
||||
$online_location_page = LISTNEW;
|
||||
}
|
||||
if ($online_location_page == "online") {
|
||||
$online_location_page = ONLINE;
|
||||
}
|
||||
if ($online_location_page == "userposts") {
|
||||
$online_location_page = USERPOSTS;
|
||||
}
|
||||
if ($online_location_page == "subcontent") {
|
||||
$online_location_page = SUBCONTENT;
|
||||
}
|
||||
if ($online_location_page == "top") {
|
||||
$online_location_page = TOP;
|
||||
}
|
||||
//commonly used plugin pages
|
||||
if ($online_location_page == "bugtracker") {
|
||||
$online_location_page = BUGTRACKER;
|
||||
}
|
||||
if ($online_location_page == "event") {
|
||||
$online_location_page = EVENT;
|
||||
}
|
||||
if ($online_location_page == "calendar") {
|
||||
$online_location_page = CALENDAR;
|
||||
}
|
||||
if ($online_location_page == "faq") {
|
||||
$online_location_page = FAQ;
|
||||
}
|
||||
if ($online_location_page == "pm") {
|
||||
$online_location_page = PM;
|
||||
}
|
||||
if ($online_location_page == "survey") {
|
||||
$online_location_page = SURVEY;
|
||||
}
|
||||
if (strstr($online_location, "content.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])."'");
|
||||
@ -155,8 +181,10 @@ foreach($listuserson as $uinfo => $pinfo) {
|
||||
$online_location_page = CONTENT.": \"".CLASSRESTRICTED."\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strstr($online_location, "comment.php")) {
|
||||
}
|
||||
|
||||
if (strstr($online_location, "comment.php"))
|
||||
{
|
||||
$tmp = explode(".php.", $online_location);
|
||||
$tmp = explode(".", $tmp[1]);
|
||||
if ($tmp[1] == "news") {
|
||||
@ -179,8 +207,10 @@ foreach($listuserson as $uinfo => $pinfo) {
|
||||
$online_location_page = COMMENT;
|
||||
$class_check = FALSE;
|
||||
}
|
||||
}
|
||||
if (strstr($online_location, "forum")) {
|
||||
}
|
||||
|
||||
if (strstr($online_location, "forum"))
|
||||
{
|
||||
$tmp = explode(".", substr(strrchr($online_location, "php."), 2));
|
||||
if (strstr($online_location, "_viewtopic")) {
|
||||
if ($tmp[2]) {
|
||||
@ -219,30 +249,26 @@ foreach($listuserson as $uinfo => $pinfo) {
|
||||
$online_location_page = ONLINE_EL12.": ".ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum_t['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;
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr($online_location, "admin"))
|
||||
{
|
||||
$class_check = FALSE;
|
||||
$online_location_page = ADMINAREA;
|
||||
}
|
||||
|
||||
$ONLINE_TABLE_ICON = (varsettrue($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>";
|
||||
$ONLINE_TABLE_LOCATION = ($class_check ? "<a href='$online_location'>$online_location_page</a>" : $online_location_page);
|
||||
|
||||
if (!$ONLINE_TABLE) {
|
||||
if (file_exists(THEME."online_template.php")) {
|
||||
require_once(THEME."online_template.php");
|
||||
} else {
|
||||
require_once(e_BASE.$THEMES_DIRECTORY."templates/online_template.php");
|
||||
}
|
||||
}
|
||||
$textstring .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE);
|
||||
$ONLINE_TABLE_ICON = (varsettrue($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>";
|
||||
$ONLINE_TABLE_LOCATION = ($class_check ? "<a href='{$online_location}'>{$online_location_page}</a>" : $online_location_page);
|
||||
|
||||
$textstring .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE);
|
||||
}
|
||||
|
||||
$ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1.GUESTS_ONLINE;
|
||||
$ONLINE_TABLE_GUESTS_ONLINE = ONLINE_EL2.MEMBERS_ONLINE;
|
||||
if ((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $menu_pref['most_guests_online'])) {
|
||||
if ((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $menu_pref['most_guests_online']))
|
||||
{
|
||||
global $sysprefs;
|
||||
$menu_pref['most_members_online'] = MEMBERS_ONLINE;
|
||||
$menu_pref['most_guests_online'] = GUESTS_ONLINE;
|
||||
@ -250,8 +276,9 @@ if ((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $men
|
||||
$sysprefs->setArray('menu_pref');
|
||||
}
|
||||
|
||||
if (!isset($gen) || !is_object($gen)) {
|
||||
$gen = new convert;
|
||||
if (!isset($gen) || !is_object($gen))
|
||||
{
|
||||
$gen = new convert;
|
||||
}
|
||||
|
||||
$datestamp = $gen->convert_date($menu_pref['most_online_datestamp'], "short");
|
||||
@ -271,10 +298,16 @@ if ($total_members > 1)
|
||||
$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']);
|
||||
}
|
||||
|
||||
|
||||
$textstart = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_START);
|
||||
$textend = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_END);
|
||||
$text = $textstart.$textstring.$textend;
|
||||
$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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user