From e8db0ef354ce2ee488bf15caa31bb2017ffba3d8 Mon Sep 17 00:00:00 2001 From: e107steved Date: Mon, 21 Sep 2009 21:43:45 +0000 Subject: [PATCH] Start sorting online menu shortcodes etc --- e107_handlers/online_class.php | 28 +- e107_plugins/online/languages/English.php | 29 +- e107_plugins/online/online_menu.php | 82 +++--- e107_plugins/online/online_menu_template.php | 14 + e107_plugins/online/online_shortcodes.php | 266 +++++++++++-------- 5 files changed, 245 insertions(+), 174 deletions(-) diff --git a/e107_handlers/online_class.php b/e107_handlers/online_class.php index 841c357ac..78c955b41 100755 --- a/e107_handlers/online_class.php +++ b/e107_handlers/online_class.php @@ -1,20 +1,17 @@ ($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'])) + { $menu_pref['most_members_online'] = MEMBERS_ONLINE; $menu_pref['most_guests_online'] = GUESTS_ONLINE; $menu_pref['most_online_datestamp'] = time(); @@ -45,30 +46,36 @@ if(!defined("e_TRACKING_DISABLED") && varsettrue($pref['track_online'])){ } //display list of 'member viewing page' - if($menu_pref['online_show_memberlist_extended']){ - if (MEMBERS_ONLINE) { + if($menu_pref['online_show_memberlist_extended']) + { + if (MEMBERS_ONLINE) + { global $listuserson, $pinfo, $ADMIN_DIRECTORY, $online_location_page, $oid, $oname, $online_location_page; $ret=''; - foreach($listuserson as $uinfo => $pinfo) { - + foreach($listuserson as $uinfo => $pinfo) + { list($oid, $oname) = explode(".", $uinfo, 2); $online_location_page = substr(strrchr($pinfo, "/"), 1); if ($pinfo == "log.php" || $pinfo == "error.php") { $pinfo = "news.php"; $online_location_page = "news.php"; } - if ($online_location_page == "request.php") { + if ($online_location_page == "request.php") + { $pinfo = "download.php"; } - if (strstr($online_location_page, "forum")) { + if (strstr($online_location_page, "forum")) + { $pinfo = e_PLUGIN."forum/forum.php"; $online_location_page = "forum.php"; } - if (strstr($online_location_page, "content")) { + if (strstr($online_location_page, "content")) + { $pinfo = "content.php"; $online_location_page = "content.php"; } - if (strstr($online_location_page, "comment")) { + if (strstr($online_location_page, "comment")) + { $pinfo = "comment.php"; $online_location_page = "comment.php"; } @@ -79,11 +86,16 @@ if(!defined("e_TRACKING_DISABLED") && varsettrue($pref['track_online'])){ } } - $text = $tp -> parseTemplate($TEMPLATE_ONLINE['ENABLED'], FALSE, $online_shortcodes); -}else{ - if(ADMIN){ - $text = $TEMPLATE_ONLINE['DISABLED']; - }else{ + $text = $e107->tp->parseTemplate($TEMPLATE_ONLINE['ENABLED'], TRUE); +} +else +{ + if (ADMIN) + { + $text = $e107->tp -> parseTemplate($TEMPLATE_ONLINE['DISABLED'], TRUE); + } + else + { return; } } diff --git a/e107_plugins/online/online_menu_template.php b/e107_plugins/online/online_menu_template.php index dcb86a5fa..504609e74 100644 --- a/e107_plugins/online/online_menu_template.php +++ b/e107_plugins/online/online_menu_template.php @@ -1,4 +1,18 @@ e_sc -> parse_scbatch(__FILE__); /* - -//##### LASTSEEN MENU --------------------------------------------------------- - -SC_BEGIN LASTSEEN_USERLINK -global $row; -return "".$row['user_name'].""; -SC_END - -SC_BEGIN LASTSEEN_DATE -global $gen, $row; -$seen_ago = $gen->computeLapse($row['user_currentvisit'], false, false, true, 'short'); -return ($seen_ago ? $seen_ago : "1 ".LANDT_09)." ".LANDT_AGO; -SC_END - -//##### ONLINE TRACKING DISABLED ---------------------------------------------- - -SC_BEGIN ONLINE_TRACKING_DISABLED -global $tp; -return $tp->toHTML(LAN_ONLINE_TRACKING_MESSAGE,TRUE); -SC_END - -//##### ONLINE MENU ----------------------------------------------------------- - -SC_BEGIN ONLINE_GUESTS -return GUESTS_ONLINE; -SC_END - -SC_BEGIN ONLINE_MEMBERS -return MEMBERS_ONLINE; -SC_END - -SC_BEGIN ONLINE_MEMBERS_LIST -global $menu_pref; -if($menu_pref['online_show_memberlist']){ - return (MEMBERS_ONLINE ? MEMBER_LIST : ''); -} -SC_END - -SC_BEGIN ONLINE_ONPAGE -return ON_PAGE; -SC_END - -SC_BEGIN ONLINE_MEMBER_TOTAL -global $sql, $e107cache; -$total_members = $e107cache->retrieve("online_menu_member_total", 120); -if($total_members == false) { - $total_members = $sql->db_Count("user","(*)","where user_ban='0'"); - $e107cache->set("online_menu_member_total", $total_members); -} -return $total_members; -SC_END - -SC_BEGIN ONLINE_MEMBER_NEWEST -global $sql, $e107cache; -$ret = $e107cache->retrieve("online_menu_member_newest", 120); -if($ret == false) { - $newest_member_sql = $sql->db_Select("user", "user_id, user_name", "user_ban='0' ORDER BY user_join DESC LIMIT 1"); - $row = $sql->db_Fetch(); - $ret = "".$row['user_name'].""; - $e107cache->set("online_menu_member_newest", $ret); -} -return $ret; -SC_END - -SC_BEGIN ONLINE_MOST -global $menu_pref; -return intval($menu_pref['most_members_online'] + $menu_pref['most_guests_online']); -SC_END - -SC_BEGIN ONLINE_MOST_MEMBERS -global $menu_pref; -return $menu_pref['most_members_online']; -SC_END - -SC_BEGIN ONLINE_MOST_GUESTS -global $menu_pref; -return $menu_pref['most_guests_online']; -SC_END - -SC_BEGIN ONLINE_MOST_DATESTAMP -global $menu_pref, $gen; -return $gen->convert_date($menu_pref['most_online_datestamp'], "short"); -SC_END - -//##### ONLINE MEMBER LIST EXTENDED -------------------------------------------------- - -SC_BEGIN ONLINE_MEMBERS_LIST_EXTENDED -global $ONLINE_MEMBERS_LIST_EXTENDED; -return $ONLINE_MEMBERS_LIST_EXTENDED; -SC_END - -SC_BEGIN ONLINE_MEMBER_IMAGE -return ""; -SC_END - -SC_BEGIN ONLINE_MEMBER_USER -global $oid, $oname; -return "$oname"; -SC_END - -SC_BEGIN ONLINE_MEMBER_PAGE -global $pinfo, $ADMIN_DIRECTORY, $online_location_page; -return (!strstr($pinfo, $ADMIN_DIRECTORY) ? "".$online_location_page."" : $online_location_page); -SC_END - + * e107 website system + * + * Copyright (C) 2001-2008 e107 Inc (e107.org) + * Released under the terms and conditions of the + * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) + * + * e107 Main + * + * $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_shortcodes.php,v $ + * $Revision: 1.3 $ + * $Date: 2009-09-21 21:43:45 $ + * $Author: e107steved $ */ +if (!defined('e107_INIT')) { exit; } + + +register_shortcode('online_shortcodes', true); +initShortcodeClass('online_shortcodes'); + +class online_shortcodes +{ + var $e107; + + function online_shortcodes() + { + $this->e107 = e107::getInstance(); + } + + // Last Seen Menu + function sc_lastseen_userlink() + { + global $row; + return "".$row['user_name'].""; + } + + function sc_lastseen_date() + { + global $gen, $row; + $seen_ago = $gen->computeLapse($row['user_currentvisit'], false, false, true, 'short'); + return ($seen_ago ? $seen_ago : "1 ".LANDT_09)." ".LANDT_AGO; + } + + + function sc_online_tracking_disabled() + { + return $this->e107->tp->toHTML(LAN_ONLINE_TRACKING_MESSAGE,TRUE); + } + + + // Online Menu + function sc_online_guests() + { + return GUESTS_ONLINE; + } + + function sc_online_members() + { + return MEMBERS_ONLINE; + } + + function sc_online_members_list() + { + global $menu_pref; + if($menu_pref['online_show_memberlist']) + { + return (MEMBERS_ONLINE ? MEMBER_LIST : ''); + } + } + + + function sc_online_page() + { + return ON_PAGE; + } + + + function sc_online_members_total() + { + $total_members = $this->e107->ecache->retrieve("online_menu_member_total", 120); + if($total_members == false) + { + $total_members = $this->e107->sql->db_Count('user','(*)',"where user_ban='0'"); + $this->e107->ecache->set("online_menu_member_total", $total_members); + } + return $total_members; + } + + + function sc_online_member_newest() + { + $ret = $this->e107->ecache->retrieve('online_menu_member_newest', 120); + if($ret == false) + { + $newest_member_sql = $this->e107->sql->db_Select('user', 'user_id, user_name', "user_ban='0' ORDER BY user_join DESC LIMIT 1"); + $row = $this->e107->sql->db_Fetch(); + $ret = "".$row['user_name'].""; + $this->e107->ecache->set("online_menu_member_newest", $ret); + } + return $ret; + } + + + function sc_online_most() + { + global $menu_pref; + return intval($menu_pref['most_members_online'] + $menu_pref['most_guests_online']); + } + + + function sc_online_most_members() + { + global $menu_pref; + return $menu_pref['most_members_online']; + } + + + function sc_online_most_guests() + { + global $menu_pref; + return $menu_pref['most_guests_online']; + } + + + function sc_online_most_datestamp() + { + global $menu_pref, $gen; + return $gen->convert_date($menu_pref['most_online_datestamp'], "short"); + } + + + + //##### ONLINE MEMBER LIST EXTENDED + function sc_online_member_list_extended() + { + global $ONLINE_MEMBERS_LIST_EXTENDED; + return $ONLINE_MEMBERS_LIST_EXTENDED; + } + + + function sc_online_member_image() + { + return ""; + } + + + function sc_online_member_user() + { + global $oid, $oname; + return "$oname"; + } + + + function sc_online_member_page() + { + global $pinfo, $ADMIN_DIRECTORY, $online_location_page; + return (!strstr($pinfo, $ADMIN_DIRECTORY) ? "".$online_location_page."" : $online_location_page); + } +} + ?> \ No newline at end of file