1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

Bugtracker #4284 - handle case of no members online, plus a tidy up

This commit is contained in:
e107steved
2008-01-06 09:38:39 +00:00
parent 1fbb22866f
commit 50554746c7
3 changed files with 176 additions and 138 deletions

View File

@@ -4,9 +4,9 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_online.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_online.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:34:39 $ | $Date: 2008-01-06 09:38:33 $
| $Author: mcfly_e107 $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -26,8 +26,10 @@ define("ONLINE_EL12", "Replying to");
define("ONLINE_EL13", "Forum"); define("ONLINE_EL13", "Forum");
define("ONLINE_EL14", "Thread"); define("ONLINE_EL14", "Thread");
define("ONLINE_EL15", "Page"); define("ONLINE_EL15", "Page");
define("ONLINE_EL16", "Information not available");
define("CLASSRESTRICTED", "Class Restricted Page"); define("CLASSRESTRICTED", "Class Restricted Page");
define("ARTICLEPAGE", "Article/Review"); //define("ARTICLEPAGE", "Article/Review");
define("CHAT", "Chat"); define("CHAT", "Chat");
define("COMMENT", "Comments"); define("COMMENT", "Comments");
define("DOWNLOAD", "Downloads"); define("DOWNLOAD", "Downloads");
@@ -48,7 +50,7 @@ define("USERSETTINGS", "User Settings");
define("ONLINE", "Online Users"); define("ONLINE", "Online Users");
define("LISTNEW", "List New Items"); define("LISTNEW", "List New Items");
define("USERPOSTS", "User Posts"); define("USERPOSTS", "User Posts");
define("SUBCONTENT", "Submit Article/Review"); define("SUBCONTENT", "Submit Content");
define("TOP", "Top Posters/Most Active Threads"); define("TOP", "Top Posters/Most Active Threads");
define("ADMINAREA", "Admin Area"); define("ADMINAREA", "Admin Area");
define("BUGTRACKER", "Bugtracker"); define("BUGTRACKER", "Bugtracker");
@@ -60,5 +62,6 @@ define("SURVEY", "Survey");
define("ARTICLE", "Article"); define("ARTICLE", "Article");
define("CONTENT", "Content Page"); define("CONTENT", "Content Page");
define("REVIEW", "Review"); define("REVIEW", "Review");
define('OTHER', 'Other page: ');
?> ?>

View File

@@ -1,5 +1,4 @@
<?php <?php
// $Id: online_template.php,v 1.2 2007-12-06 21:35:55 e107steved Exp $
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:96%"); } if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:96%"); }
@@ -30,8 +29,11 @@ if(!isset($ONLINE_TABLE_END))
$ONLINE_TABLE_END = " $ONLINE_TABLE_END = "
</table> </table>
</div> </div>
<br /> <br />";
".ONLINE_EL1.GUESTS_ONLINE.", }
if (!isset($ONLINE_TABLE_MISC))
{
$ONLINE_TABLE_MISC = ONLINE_EL1.GUESTS_ONLINE.",
".ONLINE_EL2.MEMBERS_ONLINE." ...<br /> ".ONLINE_EL2.MEMBERS_ONLINE." ...<br />
<br />{ONLINE_TABLE_MOST_EVER_ONLINE} <br />{ONLINE_TABLE_MOST_EVER_ONLINE}
<br />({ONLINE_TABLE_MOST_MEMBERS_ONLINE}, {ONLINE_TABLE_MOST_GUESTS_ONLINE}) ".ONLINE_EL9." {ONLINE_TABLE_DATESTAMP}<br /> <br />({ONLINE_TABLE_MOST_MEMBERS_ONLINE}, {ONLINE_TABLE_MOST_GUESTS_ONLINE}) ".ONLINE_EL9." {ONLINE_TABLE_DATESTAMP}<br />

View File

@@ -11,121 +11,147 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/online.php,v $ | $Source: /cvs_backup/e107_0.8/online.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2007-10-06 17:36:10 $ | $Date: 2008-01-06 09:38:33 $
| $Author: mcfly_e107 $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("class2.php"); require_once("class2.php");
require_once(HEADERF); 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; global $listuserson;
foreach($listuserson as $uinfo => $pinfo) { foreach($listuserson as $uinfo => $pinfo)
{
$class_check = TRUE; $class_check = TRUE;
list($oid, $oname) = explode(".", $uinfo, 2); 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 = $pinfo;
$online_location_page = substr(strrchr($online_location, "/"), 1); $online_location_page = substr(strrchr($online_location, "/"), 1);
if (!strstr($online_location, "forum_") || !strstr($online_location, "content.php") || !strstr($online_location, "comment.php")) { 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)); $online_location_page = str_replace(".php", "", substr(strrchr($online_location, "/"), 1));
} }
if ($online_location_page == "log" || $online_location_page == "error") {
switch ($online_location_page)
{
case 'log' :
case 'error' :
$online_location = "news.php"; $online_location = "news.php";
$online_location_page = NEWS; $online_location_page = NEWS;
} break;
if ($online_location_page == "request") { case 'request' :
$online_location = "download.php"; $online_location = "download.php";
} break;
if ($online_location_page == "article") { case 'chat' :
$online_location_page = ARTICLEPAGE;
}
if ($online_location_page == "chat") {
$online_location_page = CHAT; $online_location_page = CHAT;
} break;
//if($online_location_page == "comment"){$online_location_page = COMMENT;} case 'content' :
if ($online_location_page == "content") {
$online_location_page = CONTENT; $online_location_page = CONTENT;
} break;
if ($online_location_page == "download") { case 'download' :
$online_location_page = DOWNLOAD; $online_location_page = DOWNLOAD;
} break;
if ($online_location_page == "email") { case 'email' :
$online_location_page = EMAIL; $online_location_page = EMAIL;
} break;
if ($online_location_page == "forum") { case 'forum' :
$online_location_page = FORUM; $online_location_page = FORUM;
} break;
if ($online_location_page == "links") { case 'links' :
$online_location_page = LINKS; $online_location_page = LINKS;
} break;
if ($online_location_page == "news") { case 'news' :
$online_location_page = 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") { if ($online_location_page == "oldpolls") {
$online_location_page = OLDPOLLS; $online_location_page = OLDPOLLS;
} }
if ($online_location_page == "print") { if ($online_location_page == "print") {
$online_location_page = PRINTPAGE; $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") { if ($online_location_page == "stats") {
$online_location_page = STATS; $online_location_page = STATS;
} }
if ($online_location_page == "submitnews") { */
$online_location_page = SUBMITNEWS; if (strstr($online_location, "content.php"))
} {
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")) {
$tmp = explode(".", substr(strrchr($online_location, "php."), 2)); $tmp = explode(".", substr(strrchr($online_location, "php."), 2));
if ($tmp[0] == "article") { if ($tmp[0] == "article") {
$sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'"); $sql->db_Select("content", "content_heading, content_class", "content_id='".intval($tmp[1])."'");
@@ -156,7 +182,9 @@ foreach($listuserson as $uinfo => $pinfo) {
} }
} }
} }
if (strstr($online_location, "comment.php")) {
if (strstr($online_location, "comment.php"))
{
$tmp = explode(".php.", $online_location); $tmp = explode(".php.", $online_location);
$tmp = explode(".", $tmp[1]); $tmp = explode(".", $tmp[1]);
if ($tmp[1] == "news") { if ($tmp[1] == "news") {
@@ -180,7 +208,9 @@ foreach($listuserson as $uinfo => $pinfo) {
$class_check = FALSE; $class_check = FALSE;
} }
} }
if (strstr($online_location, "forum")) {
if (strstr($online_location, "forum"))
{
$tmp = explode(".", substr(strrchr($online_location, "php."), 2)); $tmp = explode(".", substr(strrchr($online_location, "php."), 2));
if (strstr($online_location, "_viewtopic")) { if (strstr($online_location, "_viewtopic")) {
if ($tmp[2]) { if ($tmp[2]) {
@@ -220,29 +250,25 @@ foreach($listuserson as $uinfo => $pinfo) {
$online_location = e_PLUGIN."forum/forum_viewtopic.php?$tmp[0].$tmp[1]"; $online_location = e_PLUGIN."forum/forum_viewtopic.php?$tmp[0].$tmp[1]";
} }
} }
if (strstr($online_location, "admin")) {
if (strstr($online_location, "admin"))
{
$class_check = FALSE; $class_check = FALSE;
$online_location_page = ADMINAREA; $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_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_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); $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); $textstring .= preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE);
} }
$ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1.GUESTS_ONLINE; $ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1.GUESTS_ONLINE;
$ONLINE_TABLE_GUESTS_ONLINE = ONLINE_EL2.MEMBERS_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; global $sysprefs;
$menu_pref['most_members_online'] = MEMBERS_ONLINE; $menu_pref['most_members_online'] = MEMBERS_ONLINE;
$menu_pref['most_guests_online'] = GUESTS_ONLINE; $menu_pref['most_guests_online'] = GUESTS_ONLINE;
@@ -250,7 +276,8 @@ if ((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $men
$sysprefs->setArray('menu_pref'); $sysprefs->setArray('menu_pref');
} }
if (!isset($gen) || !is_object($gen)) { if (!isset($gen) || !is_object($gen))
{
$gen = new convert; $gen = new convert;
} }
@@ -272,9 +299,15 @@ if ($total_members > 1)
$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']); $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 = '';
$text = $textstart.$textstring.$textend; 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); $ns->tablerender(ONLINE_EL4, $text);