From 07990e7a7a9b63e49954f577690f368558d1884e Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 29 Apr 2013 19:36:30 -0700 Subject: [PATCH] Online-Menu template cleanup --- e107_plugins/online/languages/English.php | 2 +- e107_plugins/online/lastseen_menu.php | 6 +- e107_plugins/online/online_menu.php | 37 +++++++++-- e107_plugins/online/online_menu_template.php | 64 +++++++++++--------- e107_plugins/online/online_shortcodes.php | 8 ++- 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/e107_plugins/online/languages/English.php b/e107_plugins/online/languages/English.php index 33c6c9ae7..8fe9c5fc3 100644 --- a/e107_plugins/online/languages/English.php +++ b/e107_plugins/online/languages/English.php @@ -26,7 +26,7 @@ define("LAN_ONLINE_4", "Online"); define("LAN_ONLINE_5", ""); define("LAN_ONLINE_6", "Newest Member: "); define("LAN_ONLINE_7", "viewing"); -define("LAN_ONLINE_8", "most ever online: "); +define("LAN_ONLINE_8", "Most ever online: "); define("LAN_ONLINE_9", "on "); define("LAN_ONLINE_10", "Online Menu"); diff --git a/e107_plugins/online/lastseen_menu.php b/e107_plugins/online/lastseen_menu.php index f260bd17f..784e6360e 100644 --- a/e107_plugins/online/lastseen_menu.php +++ b/e107_plugins/online/lastseen_menu.php @@ -35,13 +35,13 @@ $num = intval(varsettrue($menu_pref['online_ls_amount'],10)); $sql -> db_Select('user', 'user_id, user_name, user_currentvisit', 'ORDER BY user_currentvisit DESC LIMIT 0,'.$num, 'nowhere'); $lslist = $sql -> db_getList(); -$text = $tp -> parseTemplate($TEMPLATE_LASTSEEN['START'], TRUE); +$text = $tp -> parseTemplate($LASTSEEN_TEMPLATE['start'], TRUE); foreach($lslist as $row) { setScVar('online_shortcodes', 'currentUser', $row); - $text .= $tp -> parseTemplate($TEMPLATE_LASTSEEN['ITEM'],TRUE); + $text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['item'],TRUE); } -$text .= $tp -> parseTemplate($TEMPLATE_LASTSEEN['END'], TRUE); +$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['end'], TRUE); $caption = varsettrue($menu_pref['online_ls_caption'],LAN_LASTSEEN_1); $ns->tablerender($caption, $text, 'lastseen'); diff --git a/e107_plugins/online/online_menu.php b/e107_plugins/online/online_menu.php index 953ca4631..2492225f4 100644 --- a/e107_plugins/online/online_menu.php +++ b/e107_plugins/online/online_menu.php @@ -42,10 +42,16 @@ if(!defined('e_TRACKING_DISABLED')) { if (MEMBERS_ONLINE) { - global $listuserson; + // global $listuserson; + + $listuserson = e107::getOnline()->userList(); + $ret=''; - foreach($listuserson as $uinfo => $pinfo) + foreach($listuserson as $uinfo => $row) { + + $pinfo = $row['user_location']; + $online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1)); if ($pinfo == 'log.php' || $pinfo == 'error.php') { @@ -73,20 +79,30 @@ if(!defined('e_TRACKING_DISABLED')) $online_location_page = 'comment'; } list($oid, $oname) = explode('.', $uinfo, 2); - setScVar('online_shortcodes', 'currentMember', array('oid' => $oid, 'oname' => $oname, 'page' => $online_location_page, 'pinfo' => $pinfo)); - $ret .= $tp->parseTemplate($TEMPLATE_ONLINE['ONLINE_MEMBERS_LIST_EXTENDED'], TRUE); + + + $data = array( + 'oid' => $row['user_id'], + 'oname' =>$row['user_name'], + 'page' => $online_location_page, + 'pinfo' => $pinfo, + 'oimage' => $row['user_image'] + ); + + setScVar('online_shortcodes', 'currentMember', $data); + $ret .= $tp->parseTemplate($ONLINE_TEMPLATE['online_members_list_extended'], TRUE); } setScVar('online_shortcodes', 'onlineMembersList', $ret); } } - $text = $tp->parseTemplate($TEMPLATE_ONLINE['ENABLED'], TRUE); + $text = $tp->parseTemplate($ONLINE_TEMPLATE['enabled'], TRUE); } else { if (ADMIN) { - $text = $tp->parseTemplate($TEMPLATE_ONLINE['DISABLED'], TRUE); + $text = $tp->parseTemplate($ONLINE_TEMPLATE['disabled'], TRUE); } else { @@ -95,7 +111,16 @@ else } $img = (is_readable(THEME.'images/online_menu.png') ? "" : ''); + $caption = $img.' '.varsettrue($menu_pref['online_caption'],LAN_ONLINE_10); + +if (getperms('1')) +{ + $path = e_PLUGIN_ABS."online/config.php"; + $caption .= ""; +} + + $ns->tablerender($caption, $text, 'online_extended'); ?> \ No newline at end of file diff --git a/e107_plugins/online/online_menu_template.php b/e107_plugins/online/online_menu_template.php index e9b2159e0..3b14cc3b0 100644 --- a/e107_plugins/online/online_menu_template.php +++ b/e107_plugins/online/online_menu_template.php @@ -17,35 +17,32 @@ global $sc_style; //##### LASTSEEN MENU --------------------------------------------------------- -$sc_style['LASTSEEN_DATE']['pre'] = "
[ "; -$sc_style['LASTSEEN_DATE']['post'] = " ]"; - -$TEMPLATE_LASTSEEN['START'] = ""; +$LASTSEEN_TEMPLATE['start'] = ""; //##### ONLINE MENU ----------------------------------------------------------- -$sc_style['ONLINE_GUESTS']['pre'] = LAN_ONLINE_1; -$sc_style['ONLINE_GUESTS']['post'] = "
"; +$sc_style['ONLINE_GUESTS']['pre'] = "
  • ".LAN_ONLINE_1; +$sc_style['ONLINE_GUESTS']['post'] = "
  • "; -$sc_style['ONLINE_MEMBERS']['pre'] = LAN_ONLINE_2; -$sc_style['ONLINE_MEMBERS']['post'] = ""; +$sc_style['ONLINE_MEMBERS']['pre'] = "
  • ".LAN_ONLINE_2; +$sc_style['ONLINE_MEMBERS']['post'] = "
  • "; -$sc_style['ONLINE_MEMBERS_LIST']['pre'] = ", "; -$sc_style['ONLINE_MEMBERS_LIST']['post'] = ""; +$sc_style['ONLINE_MEMBERS_LIST']['pre'] = ""; -$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['pre'] = "
    "; -$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['post'] = "
    "; +$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['pre'] = ""; -$sc_style['ONLINE_ONPAGE']['pre'] = LAN_ONLINE_3; -$sc_style['ONLINE_ONPAGE']['post'] = "
    "; +$sc_style['ONLINE_ONPAGE']['pre'] = "
  • ".LAN_ONLINE_3; +$sc_style['ONLINE_ONPAGE']['post'] = "
  • "; -$sc_style['ONLINE_MEMBER_TOTAL']['pre'] = LAN_ONLINE_2; -$sc_style['ONLINE_MEMBER_TOTAL']['post'] = "
    "; +$sc_style['ONLINE_MEMBER_TOTAL']['pre'] = "
  • ".LAN_ONLINE_2; +$sc_style['ONLINE_MEMBER_TOTAL']['post'] = "
  • "; -$sc_style['ONLINE_MEMBER_NEWEST']['pre'] = LAN_ONLINE_6; -$sc_style['ONLINE_MEMBER_NEWEST']['post'] = "
    "; +$sc_style['ONLINE_MEMBER_NEWEST']['pre'] = "
  • ".LAN_ONLINE_6; +$sc_style['ONLINE_MEMBER_NEWEST']['post'] = "
  • "; $sc_style['ONLINE_MOST']['pre'] = LAN_ONLINE_8; $sc_style['ONLINE_MOST']['post'] = "
    "; @@ -53,29 +50,36 @@ $sc_style['ONLINE_MOST']['post'] = "
    "; $sc_style['ONLINE_MOST_MEMBERS']['pre'] = LAN_ONLINE_2; $sc_style['ONLINE_MOST_MEMBERS']['post'] = ""; -$sc_style['ONLINE_MOST_GUESTS']['pre'] = LAN_ONLINE_1; -$sc_style['ONLINE_MOST_GUESTS']['post'] = ""; +$sc_style['ONLINE_MOST_GUESTS']['pre'] = "".LAN_ONLINE_1; +$sc_style['ONLINE_MOST_GUESTS']['post'] = ", "; -$sc_style['ONLINE_MOST_DATESTAMP']['pre'] = LAN_ONLINE_9; +$sc_style['ONLINE_MOST_DATESTAMP']['pre'] = "".LAN_ONLINE_9; $sc_style['ONLINE_MOST_DATESTAMP']['post'] = ""; -$TEMPLATE_ONLINE['ENABLED'] = " +$ONLINE_TEMPLATE['enabled'] = " + + "; //##### ONLINE TRACKING DISABLED ---------------------------------------------- -$TEMPLATE_ONLINE['DISABLED'] = "{ONLINE_TRACKING_DISABLED}"; +$ONLINE_TEMPLATE['disabled'] = "{ONLINE_TRACKING_DISABLED}"; //##### ONLINE MEMBER LIST EXTENDED ------------------------------------------- -$TEMPLATE_ONLINE['ONLINE_MEMBERS_LIST_EXTENDED'] = "{ONLINE_MEMBER_IMAGE} {ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}
    "; +$ONLINE_TEMPLATE['online_members_list_extended'] = "{SETIMAGE: w=40}
  • {ONLINE_MEMBER_IMAGE=avatar} {ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}
  • "; ?> \ No newline at end of file diff --git a/e107_plugins/online/online_shortcodes.php b/e107_plugins/online/online_shortcodes.php index cc8b32c43..bf82de805 100644 --- a/e107_plugins/online/online_shortcodes.php +++ b/e107_plugins/online/online_shortcodes.php @@ -41,6 +41,7 @@ class online_shortcodes function sc_lastseen_date() { $seen_ago = $this->gen->computeLapse($this->currentUser['user_currentvisit'], false, false, true, 'short'); + return $seen_ago; return ($seen_ago ? $seen_ago : '1 '.LANDT_09).' '.LANDT_AGO; } @@ -136,8 +137,13 @@ class online_shortcodes } - function sc_online_member_image() + function sc_online_member_image($parm='') { + if($parm == 'avatar') + { + return e107::getParser()->parseTemplate("{USER_AVATAR=".$this->currentMember['oimage']."}",true); + } + return ""; }