1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-27 01:40:22 +02:00

Start sorting online menu shortcodes etc

This commit is contained in:
e107steved
2009-09-21 21:43:45 +00:00
parent c5ae938501
commit e8db0ef354
5 changed files with 245 additions and 174 deletions

View File

@@ -1,20 +1,17 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * e107 Main
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $
| * $Revision: 1.5 $
| $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $ * $Date: 2009-09-21 21:43:44 $
| $Revision: 1.4 $ * $Author: e107steved $
| $Date: 2009-02-03 21:16:15 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/ */
class e_online class e_online
@@ -24,6 +21,7 @@ class e_online
global $sql, $pref, $e107, $e_event, $tp, $online_timeout, $online_warncount, $online_bancount; global $sql, $pref, $e107, $e_event, $tp, $online_timeout, $online_warncount, $online_bancount;
global $members_online, $total_online, $member_list, $listuserson; global $members_online, $total_online, $member_list, $listuserson;
if($online_tracking == true || $flood_control == true) if($online_tracking == true || $flood_control == true)
{ {
if(!isset($online_timeout)) $online_timeout = 300; if(!isset($online_timeout)) $online_timeout = 300;

View File

@@ -1,27 +1,24 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * e107 Main
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/online/languages/English.php,v $
| * $Revision: 1.2 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/online/languages/English.php,v $ * $Date: 2009-09-21 21:43:44 $
| $Revision: 1.1 $ * $Author: e107steved $
| $Date: 2007-05-01 19:50:56 $
| $Author: lisa_ $
+----------------------------------------------------------------------------+
*/ */
//lastseen //lastseen
define("LAN_LASTSEEN_1", "Last Seen Menu"); define("LAN_LASTSEEN_1", "Last Seen Menu");
//online //online
define("LAN_ONLINE_TRACKING_MESSAGE", "Online user tracking is currently disabled, please enable it [link=".e_ADMIN."users.php?options]here[/link][br]"); define('LAN_ONLINE_TRACKING_MESSAGE', "Online user tracking is currently disabled, please enable it [link=".e_ADMIN."users.php?options]here[/link][br]");
define("LAN_ONLINE_1", "Guests: "); define("LAN_ONLINE_1", "Guests: ");
define("LAN_ONLINE_2", "Members: "); define("LAN_ONLINE_2", "Members: ");
define("LAN_ONLINE_3", "On this page: "); define("LAN_ONLINE_3", "On this page: ");

View File

@@ -1,42 +1,43 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * e107 Main
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_menu.php,v $
| * $Revision: 1.4 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_menu.php,v $ * $Date: 2009-09-21 21:43:44 $
| $Revision: 1.3 $ * $Author: e107steved $
| $Date: 2009-07-08 07:01:31 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
global $tp, $sc_style, $gen, $menu_pref; global $tp, $sc_style, $gen, $menu_pref, $pref;
include_lan(e_PLUGIN."online/languages/".e_LANGUAGE.".php"); include_lan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
require_once(e_PLUGIN.'online/online_shortcodes.php'); require_once(e_PLUGIN.'online/online_shortcodes.php');
if (is_readable(THEME.'online_menu_template.php')) { if (is_readable(THEME.'online_menu_template.php'))
{
require_once(THEME.'online_menu_template.php'); require_once(THEME.'online_menu_template.php');
} else { }
else
{
require_once(e_PLUGIN.'online/online_menu_template.php'); require_once(e_PLUGIN.'online/online_menu_template.php');
} }
if(!defined("e_TRACKING_DISABLED") && varsettrue($pref['track_online'])){ if(!defined("e_TRACKING_DISABLED") && varsettrue($pref['track_online']))
{
if (!is_object($gen)) { $gen = new convert; } if (!is_object($gen)) { $gen = new convert; }
//update most ever online //update most ever 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']))
{
$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;
$menu_pref['most_online_datestamp'] = time(); $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' //display list of 'member viewing page'
if($menu_pref['online_show_memberlist_extended']){ if($menu_pref['online_show_memberlist_extended'])
if (MEMBERS_ONLINE) { {
if (MEMBERS_ONLINE)
{
global $listuserson, $pinfo, $ADMIN_DIRECTORY, $online_location_page, $oid, $oname, $online_location_page; global $listuserson, $pinfo, $ADMIN_DIRECTORY, $online_location_page, $oid, $oname, $online_location_page;
$ret=''; $ret='';
foreach($listuserson as $uinfo => $pinfo) { foreach($listuserson as $uinfo => $pinfo)
{
list($oid, $oname) = explode(".", $uinfo, 2); list($oid, $oname) = explode(".", $uinfo, 2);
$online_location_page = substr(strrchr($pinfo, "/"), 1); $online_location_page = substr(strrchr($pinfo, "/"), 1);
if ($pinfo == "log.php" || $pinfo == "error.php") { if ($pinfo == "log.php" || $pinfo == "error.php") {
$pinfo = "news.php"; $pinfo = "news.php";
$online_location_page = "news.php"; $online_location_page = "news.php";
} }
if ($online_location_page == "request.php") { if ($online_location_page == "request.php")
{
$pinfo = "download.php"; $pinfo = "download.php";
} }
if (strstr($online_location_page, "forum")) { if (strstr($online_location_page, "forum"))
{
$pinfo = e_PLUGIN."forum/forum.php"; $pinfo = e_PLUGIN."forum/forum.php";
$online_location_page = "forum.php"; $online_location_page = "forum.php";
} }
if (strstr($online_location_page, "content")) { if (strstr($online_location_page, "content"))
{
$pinfo = "content.php"; $pinfo = "content.php";
$online_location_page = "content.php"; $online_location_page = "content.php";
} }
if (strstr($online_location_page, "comment")) { if (strstr($online_location_page, "comment"))
{
$pinfo = "comment.php"; $pinfo = "comment.php";
$online_location_page = "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); $text = $e107->tp->parseTemplate($TEMPLATE_ONLINE['ENABLED'], TRUE);
}else{ }
if(ADMIN){ else
$text = $TEMPLATE_ONLINE['DISABLED']; {
}else{ if (ADMIN)
{
$text = $e107->tp -> parseTemplate($TEMPLATE_ONLINE['DISABLED'], TRUE);
}
else
{
return; return;
} }
} }

View File

@@ -1,4 +1,18 @@
<?php <?php
/*
* 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_menu_template.php,v $
* $Revision: 1.2 $
* $Date: 2009-09-21 21:43:44 $
* $Author: e107steved $
*/
//##### LASTSEEN MENU --------------------------------------------------------- //##### LASTSEEN MENU ---------------------------------------------------------

View File

@@ -1,112 +1,162 @@
<?php <?php
if (!defined('e107_INIT')) { exit; }
include_once(e_HANDLER.'shortcode_handler.php');
$online_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
/* /*
* 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; }
//##### LASTSEEN MENU ---------------------------------------------------------
SC_BEGIN LASTSEEN_USERLINK 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; global $row;
return "<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>"; return "<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>";
SC_END }
SC_BEGIN LASTSEEN_DATE function sc_lastseen_date()
{
global $gen, $row; global $gen, $row;
$seen_ago = $gen->computeLapse($row['user_currentvisit'], false, false, true, 'short'); $seen_ago = $gen->computeLapse($row['user_currentvisit'], false, false, true, 'short');
return ($seen_ago ? $seen_ago : "1 ".LANDT_09)." ".LANDT_AGO; return ($seen_ago ? $seen_ago : "1 ".LANDT_09)." ".LANDT_AGO;
SC_END }
//##### ONLINE TRACKING DISABLED ----------------------------------------------
SC_BEGIN ONLINE_TRACKING_DISABLED function sc_online_tracking_disabled()
global $tp; {
return $tp->toHTML(LAN_ONLINE_TRACKING_MESSAGE,TRUE); return $this->e107->tp->toHTML(LAN_ONLINE_TRACKING_MESSAGE,TRUE);
SC_END }
//##### ONLINE MENU -----------------------------------------------------------
SC_BEGIN ONLINE_GUESTS // Online Menu
function sc_online_guests()
{
return GUESTS_ONLINE; return GUESTS_ONLINE;
SC_END }
SC_BEGIN ONLINE_MEMBERS function sc_online_members()
{
return MEMBERS_ONLINE; return MEMBERS_ONLINE;
SC_END }
SC_BEGIN ONLINE_MEMBERS_LIST function sc_online_members_list()
{
global $menu_pref; global $menu_pref;
if($menu_pref['online_show_memberlist']){ if($menu_pref['online_show_memberlist'])
{
return (MEMBERS_ONLINE ? MEMBER_LIST : ''); return (MEMBERS_ONLINE ? MEMBER_LIST : '');
} }
SC_END }
SC_BEGIN ONLINE_ONPAGE
function sc_online_page()
{
return ON_PAGE; return ON_PAGE;
SC_END }
SC_BEGIN ONLINE_MEMBER_TOTAL
global $sql, $e107cache; function sc_online_members_total()
$total_members = $e107cache->retrieve("online_menu_member_total", 120); {
if($total_members == false) { $total_members = $this->e107->ecache->retrieve("online_menu_member_total", 120);
$total_members = $sql->db_Count("user","(*)","where user_ban='0'"); if($total_members == false)
$e107cache->set("online_menu_member_total", $total_members); {
$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; return $total_members;
SC_END }
SC_BEGIN ONLINE_MEMBER_NEWEST
global $sql, $e107cache; function sc_online_member_newest()
$ret = $e107cache->retrieve("online_menu_member_newest", 120); {
if($ret == false) { $ret = $this->e107->ecache->retrieve('online_menu_member_newest', 120);
$newest_member_sql = $sql->db_Select("user", "user_id, user_name", "user_ban='0' ORDER BY user_join DESC LIMIT 1"); if($ret == false)
$row = $sql->db_Fetch(); {
$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 = "<a href='".e_HTTP."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>"; $ret = "<a href='".e_HTTP."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>";
$e107cache->set("online_menu_member_newest", $ret); $this->e107->ecache->set("online_menu_member_newest", $ret);
} }
return $ret; return $ret;
SC_END }
SC_BEGIN ONLINE_MOST
function sc_online_most()
{
global $menu_pref; global $menu_pref;
return intval($menu_pref['most_members_online'] + $menu_pref['most_guests_online']); return intval($menu_pref['most_members_online'] + $menu_pref['most_guests_online']);
SC_END }
SC_BEGIN ONLINE_MOST_MEMBERS
function sc_online_most_members()
{
global $menu_pref; global $menu_pref;
return $menu_pref['most_members_online']; return $menu_pref['most_members_online'];
SC_END }
SC_BEGIN ONLINE_MOST_GUESTS
function sc_online_most_guests()
{
global $menu_pref; global $menu_pref;
return $menu_pref['most_guests_online']; return $menu_pref['most_guests_online'];
SC_END }
SC_BEGIN ONLINE_MOST_DATESTAMP
function sc_online_most_datestamp()
{
global $menu_pref, $gen; global $menu_pref, $gen;
return $gen->convert_date($menu_pref['most_online_datestamp'], "short"); return $gen->convert_date($menu_pref['most_online_datestamp'], "short");
SC_END }
//##### ONLINE MEMBER LIST EXTENDED --------------------------------------------------
SC_BEGIN ONLINE_MEMBERS_LIST_EXTENDED
//##### ONLINE MEMBER LIST EXTENDED
function sc_online_member_list_extended()
{
global $ONLINE_MEMBERS_LIST_EXTENDED; global $ONLINE_MEMBERS_LIST_EXTENDED;
return $ONLINE_MEMBERS_LIST_EXTENDED; return $ONLINE_MEMBERS_LIST_EXTENDED;
SC_END }
SC_BEGIN ONLINE_MEMBER_IMAGE
function sc_online_member_image()
{
return "<img src='".e_IMAGE."admin_images/users_16.png' alt='' style='vertical-align:middle' />"; return "<img src='".e_IMAGE."admin_images/users_16.png' alt='' style='vertical-align:middle' />";
SC_END }
SC_BEGIN ONLINE_MEMBER_USER
function sc_online_member_user()
{
global $oid, $oname; global $oid, $oname;
return "<a href='".e_BASE."user.php?id.$oid'>$oname</a>"; return "<a href='".e_BASE."user.php?id.$oid'>$oname</a>";
SC_END }
SC_BEGIN ONLINE_MEMBER_PAGE
function sc_online_member_page()
{
global $pinfo, $ADMIN_DIRECTORY, $online_location_page; global $pinfo, $ADMIN_DIRECTORY, $online_location_page;
return (!strstr($pinfo, $ADMIN_DIRECTORY) ? "<a href='".$pinfo."'>".$online_location_page."</a>" : $online_location_page); return (!strstr($pinfo, $ADMIN_DIRECTORY) ? "<a href='".$pinfo."'>".$online_location_page."</a>" : $online_location_page);
SC_END }
}
*/
?> ?>