1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

All $menu_prefs now use non-serialised access, latest pref handler

This commit is contained in:
e107steved 2009-12-28 21:36:13 +00:00
parent 7ebf5afe91
commit 3dc8ec26eb
19 changed files with 498 additions and 259 deletions

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/comment_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/comment_class.php,v $
| $Revision: 1.33 $ | $Revision: 1.34 $
| $Date: 2009-11-18 01:04:43 $ | $Date: 2009-12-28 21:36:13 $
| $Author: e107coders $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) if (!defined('e107_INIT'))
@ -827,7 +827,7 @@ class comment
function getCommentData($amount = '', $from = '', $qry = '', $cdvalid = FALSE, $cdreta = FALSE) function getCommentData($amount = '', $from = '', $qry = '', $cdvalid = FALSE, $cdreta = FALSE)
{ {
global $pref,$menu_pref,$sql,$sql2,$tp; global $pref,$sql,$sql2,$tp;
$from1 = ($from ? $from : '0'); $from1 = ($from ? $from : '0');
$amount1 = ($amount ? $amount : '10'); $amount1 = ($amount ? $amount : '10');
$valid = ($cdvalid ? $cdvalid : '0'); $valid = ($cdvalid ? $cdvalid : '0');

View File

@ -9,18 +9,18 @@
* e107 Main * e107 Main
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/online_class.php,v $
* $Revision: 1.9 $ * $Revision: 1.10 $
* $Date: 2009-12-28 17:53:10 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107steved $ * $Author: e107steved $
*/ */
/** /**
*
* @package e107 * @package e107
* @subpackage e107_handlers * @subpackage e107_handlers
* @version $Id: online_class.php,v 1.9 2009-12-28 17:53:10 e107steved Exp $; * @version $Id: online_class.php,v 1.10 2009-12-28 21:36:13 e107steved Exp $;
* *
* Handler to keep track of online users
*/ */
/* /*

View File

@ -9,49 +9,64 @@
* Banner Administration * Banner Administration
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/banner/admin_banner.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/banner/admin_banner.php,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2009-11-18 01:05:22 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
require_once("../../class2.php"); /**
if (!getperms("D")) * e107 Banner management plugin
*
* Handles the display and sequencing of banners on web pages, including counting impressions
*
* @package e107_plugins
* @subpackage banner
* @version $Id: admin_banner.php,v 1.5 2009-12-28 21:36:13 e107steved Exp $;
*
* @todo language file issues to resolve
*/
require_once('../../class2.php');
if (!getperms('D'))
{ {
header("location:".e_BASE."index.php"); header('location:'.e_BASE.'index.php');
exit; exit;
} }
$e_sub_cat = 'banner'; $e_sub_cat = 'banner';
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER.'form_handler.php');
$frm = new e_form(); $frm = new e_form();
require_once(e_HANDLER."userclass_class.php"); require_once(e_HANDLER.'userclass_class.php');
require_once(e_HANDLER."file_class.php"); require_once(e_HANDLER.'file_class.php');
$fl = new e_file; $fl = new e_file;
require_once(e_HANDLER."message_handler.php"); require_once(e_HANDLER.'message_handler.php');
$emessage = eMessage::getInstance(); $emessage = eMessage::getInstance();
//@FIXME mix up in banner language files //@FIXME mix up in banner language files
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php"); //include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_menus.php');
include_lan(e_PLUGIN."banner/languages/".e_LANGUAGE.".php"); include_lan(e_PLUGIN.'banner/languages/'.e_LANGUAGE.'.php');
include_lan(e_PLUGIN.'banner/languages/'.e_LANGUAGE.'_menu_banner.php');
if(e_QUERY) if(e_QUERY)
{ {
list($action, $sub_action, $id) = explode(".", e_QUERY); list($action, $sub_action, $id) = explode('.', e_QUERY);
} }
$images = $fl->get_files(e_IMAGE."banners/","","standard"); $images = $fl->get_files(e_IMAGE.'banners/','','standard');
$menu_pref = e107::getConfig('menu')->getPref('');
if (isset($_POST['update_menu'])) if (isset($_POST['update_menu']))
{ {
$menu_pref['banner_caption'] = $e107->tp->toDB($_POST['banner_caption']); $temp['banner_caption'] = $e107->tp->toDB($_POST['banner_caption']);
$menu_pref['banner_amount'] = intval($_POST['banner_amount']); $temp['banner_amount'] = intval($_POST['banner_amount']);
$menu_pref['banner_rendertype'] = intval($_POST['banner_rendertype']); $temp['banner_rendertype'] = intval($_POST['banner_rendertype']);
if (isset($_POST['multiaction_cat_active'])) if (isset($_POST['multiaction_cat_active']))
{ {
@ -63,12 +78,22 @@ if (isset($_POST['update_menu']))
} }
$cat = substr($cat, 0, -1);*/ $cat = substr($cat, 0, -1);*/
$cat = implode('|', $e107->tp->toDB($_POST['multiaction_cat_active'])); $cat = implode('|', $e107->tp->toDB($_POST['multiaction_cat_active']));
$menu_pref['banner_campaign'] = $cat; $temp['banner_campaign'] = $cat;
} }
if ($admin_log->logArrayDiffs($temp,$menu_pref,'BANNER_01'))
{
$menuPref = e107::getConfig('menu');
//e107::getConfig('menu')->setPref('', $menu_pref);
//e107::getConfig('menu')->save(false, true, false);
foreach ($temp as $k => $v)
{
$menuPref->setPref($k, $v);
}
$menuPref->save(false, true, false);
$sysprefs->setArray('menu_pref'); //banners_adminlog('01', $menu_pref['banner_caption'].'[!br!]'.$menu_pref['banner_amount'].', '.$menu_pref['banner_rendertype'].'[!br!]'.$menu_pref['banner_campaign']);
banners_adminlog('01', $menu_pref['banner_caption'].'[!br!]'.$menu_pref['banner_amount'].', '.$menu_pref['banner_rendertype'].'[!br!]'.$menu_pref['banner_campaign']);
$emessage->add(BANNER_MENU_L2, E_MESSAGE_SUCCESS); $emessage->add(BANNER_MENU_L2, E_MESSAGE_SUCCESS);
}
} }

View File

@ -9,9 +9,19 @@
* *
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/banner/banner.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/banner/banner.php,v $
* $Revision: 1.3 $ * $Revision: 1.4 $
* $Date: 2009-11-19 13:46:29 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
*/
/**
* e107 Banner management plugin
*
* Handles the display and sequencing of banners on web pages, including counting impressions
*
* @package e107_plugins
* @subpackage banner
* @version $Id: banner.php,v 1.4 2009-12-28 21:36:13 e107steved Exp $;
*/ */
if (!defined('e107_INIT')) if (!defined('e107_INIT'))

View File

@ -9,9 +9,19 @@
* *
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/banner/banner_menu.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/banner/banner_menu.php,v $
* $Revision: 1.5 $ * $Revision: 1.6 $
* $Date: 2009-11-19 22:02:19 $ * $Date: 2009-12-28 21:36:13 $
* $Author: marj_nl_fr $ * $Author: e107steved $
*/
/**
* e107 Banner management plugin
*
* Handles the display and sequencing of banners on web pages, including counting impressions
*
* @package e107_plugins
* @subpackage banner
* @version $Id: banner_menu.php,v 1.6 2009-12-28 21:36:13 e107steved Exp $;
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@ -27,21 +37,22 @@ To define your own banner to use here ...
3. Save file 3. Save file
*/ */
include_lan(e_PLUGIN."banner/languages/".e_LANGUAGE."_menu_banner.php"); include_lan(e_PLUGIN.'banner/languages/'.e_LANGUAGE.'_menu_banner.php');
if(file_exists(THEME."banner_template.php")) if(file_exists(THEME.'banner_template.php'))
{ {
require_once (THEME."banner_template.php"); require_once (THEME.'banner_template.php');
} }
else else
{ {
require_once (e_THEME."templates/banner_template.php"); require_once (e_THEME.'templates/banner_template.php');
} }
$menu_pref = e107::getConfig('menu')->getPref('');
if(isset($campaign)) if(isset($campaign))
{ {
$parm = $campaign; $parm = $campaign;
$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc"); $bannersccode = file_get_contents(e_FILE.'shortcode/banner.sc');
$BANNER = eval($bannersccode); $BANNER = eval($bannersccode);
$txt = $BANNER_MENU_START; $txt = $BANNER_MENU_START;
$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU); $txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
@ -54,7 +65,7 @@ else
{ {
if(strstr($menu_pref['banner_campaign'], "|")) if(strstr($menu_pref['banner_campaign'], "|"))
{ {
$campaignlist = explode("|", $menu_pref['banner_campaign']); $campaignlist = explode('|', $menu_pref['banner_campaign']);
$amount = ($menu_pref['banner_amount'] < 1 ? '1' : $menu_pref['banner_amount']); $amount = ($menu_pref['banner_amount'] < 1 ? '1' : $menu_pref['banner_amount']);
$amount = ($amount > count($campaignlist) ? count($campaignlist) : $amount); $amount = ($amount > count($campaignlist) ? count($campaignlist) : $amount);
$keys = array_rand($campaignlist, $amount); $keys = array_rand($campaignlist, $amount);
@ -73,7 +84,7 @@ else
$txt = $BANNER_MENU_START; $txt = $BANNER_MENU_START;
foreach ($parms as $parm) foreach ($parms as $parm)
{ {
$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc"); $bannersccode = file_get_contents(e_FILE.'shortcode/banner.sc');
$BANNER = eval($bannersccode); $BANNER = eval($bannersccode);
$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU); $txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
} }

View File

@ -9,11 +9,24 @@
* Banner Menu Configuration (OLD - redirects to e107_admin/banner.php) * Banner Menu Configuration (OLD - redirects to e107_admin/banner.php)
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/banner/config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/banner/config.php,v $
* $Revision: 1.3 $ * $Revision: 1.4 $
* $Date: 2009-11-18 01:05:23 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
/**
* e107 Banner management plugin
*
* Handles the display and sequencing of banners on web pages, including counting impressions
*
* @package e107_plugins
* @subpackage banner
* @version $Id: config.php,v 1.4 2009-12-28 21:36:13 e107steved Exp $;
*
* @todo - try and access file for menu config without a redirect
*/
$eplug_admin = TRUE; $eplug_admin = TRUE;
require_once("../../class2.php"); require_once("../../class2.php");
@ -21,7 +34,7 @@ require_once("../../class2.php");
* The same, cleaned up code is already part of banner.php * The same, cleaned up code is already part of banner.php
* FIXME - we should be able to combine all core menus in a nice way... somehow * FIXME - we should be able to combine all core menus in a nice way... somehow
*/ */
header('Location:'.e_ADMIN_ABS.'banner.php?menu'); header('Location:'.e_PLUGIN_ABS.'banner/admin_banner.php?menu');
exit; exit;
if (!getperms("1")) // Access to those who can change prefs, theme etc if (!getperms("1")) // Access to those who can change prefs, theme etc

View File

@ -1,11 +1,21 @@
<?php <?php
/* /*
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: e_shortcode.php,v 1.2 2009-12-28 17:53:10 e107steved Exp $ * $Id: e_shortcode.php,v 1.3 2009-12-28 21:36:13 e107steved Exp $
* *
* Banner shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files. * Banner shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
*/ */
/**
* e107 Banner management plugin
*
* Handles the display and sequencing of banners on web pages, including counting impressions
*
* @package e107_plugins
* @subpackage banner
* @version $Id: e_shortcode.php,v 1.3 2009-12-28 21:36:13 e107steved Exp $;
*/
class banner_shortcodes // must match the plugin's folder name. ie. [PLUGIN_FOLDER]_shortcodes class banner_shortcodes // must match the plugin's folder name. ie. [PLUGIN_FOLDER]_shortcodes
{ {
function sc_banner($parm) function sc_banner($parm)

View File

@ -17,16 +17,27 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/clock_menu/clock_menu.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/clock_menu/clock_menu.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2009-11-19 10:10:54 $ | $Date: 2009-12-28 21:36:13 $
| $Author: marj_nl_fr $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
/**
* e107 Clock display menu plugin
*
* Handles the display of a clock/calendar in a menu
*
* @package e107_plugins
* @subpackage clock
* @version $Id: clock_menu.php,v 1.3 2009-12-28 21:36:13 e107steved Exp $;
*/
//FIXME looks pretty much to be 0.6 compatible //FIXME looks pretty much to be 0.6 compatible
if (!defined('e107_INIT')) { exit(); } if (!defined('e107_INIT')) { exit(); }
include_lan(e_PLUGIN.'/clock_menu/languages/'.e_LANGUAGE.'.php'); include_lan(e_PLUGIN.'/clock_menu/languages/'.e_LANGUAGE.'.php');
$menu_pref = e107::getConfig('menu')->getPref('');
global $menu_pref;
$indexArray = array('clock_dateprefix','clock_format','clock_datesuffix1','clock_datesuffix2','clock_datesuffix3','clock_datesuffix4'); $indexArray = array('clock_dateprefix','clock_format','clock_datesuffix1','clock_datesuffix2','clock_datesuffix3','clock_datesuffix4');
foreach($indexArray as $ind) foreach($indexArray as $ind)
{ {
@ -36,7 +47,7 @@ foreach($indexArray as $ind)
} }
} }
$ec_dir = e_PLUGIN."clock_menu/"; $ec_dir = e_PLUGIN.'clock_menu/';
$text = "\n\n<!-- ### clock ### //-->\n<div id='Clock'>&nbsp;</div>\n"; $text = "\n\n<!-- ### clock ### //-->\n<div id='Clock'>&nbsp;</div>\n";
if (!isset($clock_flat) || !$clock_flat) { if (!isset($clock_flat) || !$clock_flat) {

View File

@ -9,29 +9,41 @@
* Plugin Administration - Comment menu * Plugin Administration - Comment menu
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/clock_menu/config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/clock_menu/config.php,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2009-11-18 01:05:23 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
/**
* e107 Clock display menu plugin
*
* Handles the display of a clock/calendar in a menu
*
* @package e107_plugins
* @subpackage clock
* @version $Id: config.php,v 1.5 2009-12-28 21:36:13 e107steved Exp $;
*/
$eplug_admin = TRUE; $eplug_admin = TRUE;
require_once("../../class2.php"); require_once('../../class2.php');
if (!getperms("1")) if (!getperms('1'))
{ {
header("location:".e_BASE."index.php"); header('location:'.e_BASE.'index.php');
exit ; exit ;
} }
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN.'auth.php');
include_lan(e_PLUGIN."clock_menu/languages/admin/".e_LANGUAGE.".php"); include_lan(e_PLUGIN.'clock_menu/languages/admin/'.e_LANGUAGE.'.php');
require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER.'form_handler.php');
$rs = new form; $rs = new form;
$menu_pref = e107::getConfig('menu')->getPref('');
if (isset($_POST['update_menu'])) if (isset($_POST['update_menu']))
{ {
$temp = array(); $temp = array();
while (list($key, $value) = each($_POST)) while (list($key, $value) = each($_POST))
{ {
if ($key != "update_menu") if ($key != 'update_menu')
{ {
$temp[$key] = $value; $temp[$key] = $value;
} }
@ -42,10 +54,14 @@ if (isset($_POST['update_menu']))
} }
if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_05')) if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_05'))
{ {
$tmp = addslashes(serialize($menu_pref)); $menuPref = e107::getConfig('menu');
$sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='menu_pref' "); foreach ($temp as $k => $v)
{
$menuPref->setPref($k, $v);
} }
$ns->tablerender("", "<div style=\"text-align:center\"><b>".CLOCK_AD_L1."</b></div>"); $menuPref->save(false, true, false);
}
$ns->tablerender('', "<div style=\"text-align:center\"><b>".CLOCK_AD_L1.'</b></div>');
} }
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>

View File

@ -9,27 +9,43 @@
* Plugin Administration - Login menu * Plugin Administration - Login menu
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/config.php,v $
* $Revision: 1.9 $ * $Revision: 1.10 $
* $Date: 2009-11-18 01:05:53 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
/**
* e107 Login menu plugin
*
* Handles the login menu options
*
* @package e107_plugins
* @subpackage login
* @version $Id: config.php,v 1.10 2009-12-28 21:36:13 e107steved Exp $;
*
* @todo - sanitise options
*/
$eplug_admin = TRUE; $eplug_admin = TRUE;
require_once("../../class2.php"); require_once('../../class2.php');
if (!getperms("4")) if (!getperms('4'))
{ {
header("location:".e_BASE."index.php"); header('location:'.e_BASE.'index.php');
exit() ; exit() ;
} }
include_lan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php"); include_lan(e_PLUGIN.'login_menu/languages/'.e_LANGUAGE.'.php');
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN.'auth.php');
require_once(e_PLUGIN."login_menu/login_menu_class.php"); require_once(e_PLUGIN.'login_menu/login_menu_class.php');
$loginClass = new login_menu_class();
$menuPref = e107::getConfig('menu'); // Pref object
$loginPrefs = $menuPref->getPref('login_menu'); // Array of login-related values
if ($_POST['update_menu']) if (isset($_POST['update_menu']))
{ {
//sort/show/hide links - Start //sort/show/hide links - Start
if(varset($_POST['external_links'])) if(varset($_POST['external_links']))
@ -72,21 +88,36 @@ if ($_POST['update_menu'])
} }
//show/hide stats - End //show/hide stats - End
unset($menu_pref['login_menu']); unset($loginPrefs);
$menu_pref['login_menu'] = $_POST['pref']; $loginPrefs = $_POST['pref'];
$tmp = addslashes(serialize($menu_pref)); //TODO Save using ArrayStorage. if (!isset($loginPrefs['new_news'])) { $loginPrefs['new_news'] = '0'; }
$sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='menu_pref' "); if (!isset($loginPrefs['new_comments'])) { $loginPrefs['new_comments'] = '0'; }
if (!isset($loginPrefs['new_members'])) { $loginPrefs['new_members'] = '0'; }
foreach($loginPrefs as $k => $v)
{
$menuPref->setPref('login_menu/'.$k, $v);
}
//$menuPref->setPref('login_menu', $loginPrefs);
$menuPref->save(false, true, false);
$admin_log->log_event('MISC_03','', E_LOG_INFORMATIVE,''); $admin_log->log_event('MISC_03','', E_LOG_INFORMATIVE,'');
$ns->tablerender("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>'); $ns->tablerender("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>');
} }
if (!isset($loginPrefs['new_news']))
{ // Assume no prefs defined
$loginPrefs['new_news'] = '0';
$loginPrefs['new_comments'] = '0';
$loginPrefs['new_members'] = '0';
}
$text = ' $text = '
<div style="text-align:center"> <div style="text-align:center">
<form action="'.e_SELF.'" method="post"> <form action="'.e_SELF.'" method="post">
<table class="fborder" > <table class="fborder" >
'.login_menu_class::render_config_links().' '.$loginClass->render_config_links().'
<tr> <tr>
<td colspan="2" class="fcaption">'.LOGIN_MENU_L42.'</td> <td colspan="2" class="fcaption">'.LOGIN_MENU_L42.'</td>
@ -95,25 +126,25 @@ $text = '
<tr> <tr>
<td style="width:35%" class="forumheader3">'.LOGIN_MENU_L31.'</td> <td style="width:35%" class="forumheader3">'.LOGIN_MENU_L31.'</td>
<td style="width:65%" class="forumheader3"> <td style="width:65%" class="forumheader3">
<input type="checkbox" name="pref[new_news]" value="1"'.($menu_pref['login_menu']['new_news'] == 1 ? ' checked="checked"' : '').' /> <input type="checkbox" name="pref[new_news]" value="1"'.($loginPrefs['new_news'] == 1 ? ' checked="checked"' : '').' />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="width:35%" class="forumheader3">'.LOGIN_MENU_L34.'</td> <td style="width:35%" class="forumheader3">'.LOGIN_MENU_L34.'</td>
<td style="width:65%" class="forumheader3"> <td style="width:65%" class="forumheader3">
<input type="checkbox" name="pref[new_comments]" value="1"'.($menu_pref['login_menu']['new_comments'] == 1 ? ' checked="checked"' : '').' /> <input type="checkbox" name="pref[new_comments]" value="1"'.($loginPrefs['new_comments'] == 1 ? ' checked="checked"' : '').' />
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="width:35%" class="forumheader3">'.LOGIN_MENU_L36.'</td> <td style="width:35%" class="forumheader3">'.LOGIN_MENU_L36.'</td>
<td style="width:65%" class="forumheader3"> <td style="width:65%" class="forumheader3">
<input type="checkbox" name="pref[new_members]" value="1"'.($menu_pref['login_menu']['new_members'] == 1 ? ' checked="checked"' : '').' /> <input type="checkbox" name="pref[new_members]" value="1"'.($loginPrefs['new_members'] == 1 ? ' checked="checked"' : '').' />
</td> </td>
</tr> </tr>
'.login_menu_class::render_config_stats().' '.$loginClass->render_config_stats().'
<tr> <tr>
<td colspan="2" class="forumheader" style="text-align: center;"><input class="button" type="submit" name="update_menu" value="'.LAN_SAVE.'" /></td> <td colspan="2" class="forumheader" style="text-align: center;"><input class="button" type="submit" name="update_menu" value="'.LAN_SAVE.'" /></td>
@ -123,30 +154,6 @@ $text = '
</div> </div>
'; ';
/* OLD
<tr>
<td style="width:35%" class="forumheader3">'.LOGIN_MENU_L33.'</td>
<td style="width:65%" class="forumheader3">
<input type="checkbox" name="pref[new_chatbox]" value="1"'.($menu_pref['login_menu']['new_chatbox'] == 1 ? ' checked="checked"' : '').' />
</td>
</tr>
<tr>
<td style="width:35%" class="forumheader3">'.LOGIN_MENU_L35.'</td>
<td style="width:65%" class="forumheader3">
<input type="checkbox" name="pref[new_forum]" value="1"'.($menu_pref['login_menu']['new_forum'] == 1 ? ' checked="checked"' : '').' />
</td>
</tr>
<tr>
<td style="width:35%" class="forumheader3">'.LOGIN_MENU_L32.'</td>
<td style="width:65%" class="forumheader3">
<input type="checkbox" name="pref[new_articles]" value="1"'.($menu_pref['login_menu']['new_articles'] == 1 ? ' checked="checked"' : '').' />
</td>
</tr>
*/
$ns->tablerender(LOGIN_MENU_L41, $text); $ns->tablerender(LOGIN_MENU_L41, $text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");

View File

@ -9,14 +9,27 @@
* *
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu.php,v $
* $Revision: 1.14 $ * $Revision: 1.15 $
* $Date: 2009-11-18 01:05:53 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
*/ */
/**
* e107 Login menu plugin
*
* Handles the login menu options
*
* @package e107_plugins
* @subpackage login
* @version $Id: login_menu.php,v 1.15 2009-12-28 21:36:13 e107steved Exp $;
*/
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
if(defined("FPW_ACTIVE")) $loginPrefs = e107::getConfig('menu')->getPref('login_menu');
if(defined('FPW_ACTIVE'))
{ {
return; // prevent failed login attempts when fpw.php is loaded before this menu. return; // prevent failed login attempts when fpw.php is loaded before this menu.
} }
@ -69,6 +82,7 @@ $ip = $e107->getip();
if (USER == TRUE || ADMIN == TRUE) if (USER == TRUE || ADMIN == TRUE)
{ {
require_once(e_PLUGIN."login_menu/login_menu_class.php"); require_once(e_PLUGIN."login_menu/login_menu_class.php");
$loginClass = new login_menu_class();
//login class ??? - TODO //login class ??? - TODO
if ($sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' ")) if ($sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' "))
@ -77,15 +91,20 @@ if (USER == TRUE || ADMIN == TRUE)
} }
//get templates //get templates
if (!isset($LOGIN_MENU_LOGGED)) { if (!isset($LOGIN_MENU_LOGGED))
if (file_exists(THEME."login_menu_template.php")){ {
require(THEME."login_menu_template.php"); if (file_exists(THEME.'login_menu_template.php'))
}else{ {
require(e_PLUGIN."login_menu/login_menu_template.php"); require(THEME.'login_menu_template.php');
}
else
{
require(e_PLUGIN.'login_menu/login_menu_template.php');
} }
} }
if(!$LOGIN_MENU_LOGGED){ if(!$LOGIN_MENU_LOGGED)
require(e_PLUGIN."login_menu/login_menu_template.php"); {
require(e_PLUGIN.'login_menu/login_menu_template.php');
} }
//prepare //prepare
@ -95,7 +114,7 @@ if (USER == TRUE || ADMIN == TRUE)
// ------------ News Stats ----------- // ------------ News Stats -----------
if (varsettrue($menu_pref['login_menu']['new_news'])) if (varsettrue($loginPrefs['new_news']))
{ {
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'"; $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
$menu_data['new_news'] = $sql->db_Count("news", "(*)", "WHERE `news_datestamp` > {$time} AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.")"); $menu_data['new_news'] = $sql->db_Count("news", "(*)", "WHERE `news_datestamp` > {$time} AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.")");
@ -104,7 +123,7 @@ if (USER == TRUE || ADMIN == TRUE)
// ------------ Comments Stats ----------- // ------------ Comments Stats -----------
if (varsettrue($menu_pref['login_menu']['new_comments'])) if (varsettrue($loginPrefs['new_comments']))
{ {
$menu_data['new_comments'] = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time); $menu_data['new_comments'] = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
$new_total += $menu_data['new_comments']; $new_total += $menu_data['new_comments'];
@ -112,7 +131,7 @@ if (USER == TRUE || ADMIN == TRUE)
// ------------ Member Stats ----------- // ------------ Member Stats -----------
if (varsettrue($menu_pref['login_menu']['new_members'])) if (varsettrue($loginPrefs['new_members']))
{ {
$menu_data['new_users'] = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time); $menu_data['new_users'] = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time);
$new_total += $menu_data['new_users']; $new_total += $menu_data['new_users'];
@ -120,8 +139,8 @@ if (USER == TRUE || ADMIN == TRUE)
// ------------ Enable stats / other --------------- // ------------ Enable stats / other ---------------
$menu_data['enable_stats'] = $menu_data || varsettrue($menu_pref['login_menu']['external_stats']) ? true : false; $menu_data['enable_stats'] = $menu_data || varsettrue($loginPrefs['external_stats']) ? true : false;
$menu_data['new_total'] = $new_total + login_menu_class::get_stats_total(); $menu_data['new_total'] = $new_total + $loginClass->get_stats_total();
$menu_data['link_bullet'] = $bullet; $menu_data['link_bullet'] = $bullet;
$menu_data['link_bullet_src'] = $bullet_src; $menu_data['link_bullet_src'] = $bullet_src;

View File

@ -9,11 +9,24 @@
* *
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_class.php,v $
* $Revision: 1.7 $ * $Revision: 1.8 $
* $Date: 2009-11-18 01:05:53 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
*/ */
/**
* e107 Login menu plugin
*
* Handles the login menu options
*
* @package e107_plugins
* @subpackage login
* @version $Id: login_menu_class.php,v 1.8 2009-12-28 21:36:13 e107steved Exp $;
*
* @todo delete references to forum and chatbox plugins
*/
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
/* /*
@ -36,41 +49,55 @@ $lbox_stats[] = $LBOX_STAT;
class login_menu_class class login_menu_class
{ {
function get_coreplugs($active=true) { protected $e107;
global $pref; protected $loginPrefs; // Array of our menu prefs
public function __construct()
{
$this->e107 = e107::getInstance();
$this->loginPrefs = e107::getConfig('menu')->getPref('login_menu');
}
function get_coreplugs($active=true)
{
$list = array('forum', 'chatbox_menu'); $list = array('forum', 'chatbox_menu');
$ret = array(); $ret = array();
foreach ($list as $value) { foreach ($list as $value)
if(!$active || array_key_exists($value, $pref['plug_installed'])) {
if(!$active || e107::isInstalled($value))
$ret[] = $value; $ret[] = $value;
} }
return $ret; return $ret;
} }
function get_external_list($sort = true) {
global $sql, $pref, $menu_pref;
require_once(e_HANDLER."file_class.php"); function get_external_list($sort = true)
{
require_once(e_HANDLER.'file_class.php');
$fl = new e_file; $fl = new e_file;
$list = array(); $list = array();
$list_arr = $fl->get_files(e_PLUGIN, "e_loginbox\.php$", "standard", 1); $list_arr = $fl->get_files(e_PLUGIN, "e_loginbox\.php$", "standard", 1);
if($list_arr) { if($list_arr)
foreach ($list_arr as $item) { {
foreach ($list_arr as $item)
{
$tmp = end(explode('/', trim($item['path'], '/.'))); $tmp = end(explode('/', trim($item['path'], '/.')));
if(array_key_exists($tmp, $pref['plug_installed'])) { if(e107::isInstalled($tmp))
{
$list[] = $tmp; $list[] = $tmp;
} }
} }
} }
if($sort && $menu_pref['login_menu']['external_links']) { if($sort && $this->loginPrefs['external_links'])
$tmp = array_flip(explode(',', $menu_pref['login_menu']['external_links'])); {
$tmp = array_flip(explode(',', $this->loginPrefs['external_links']));
$cnt = count($tmp); $cnt = count($tmp);
foreach ($list as $value) { foreach ($list as $value) {
@ -85,31 +112,37 @@ class login_menu_class
return $list; return $list;
} }
function parse_external_list($active=false, $order=true) {
global $menu_pref; function parse_external_list($active=false, $order=true)
{
//prevent more than 1 call //prevent more than 1 call
if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp; if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp;
$ret = array(); $ret = array();
$lbox_admin = varsettrue($eplug_admin, false); $lbox_admin = varsettrue($eplug_admin, false);
$coreplugs = login_menu_class::get_coreplugs(); $coreplugs = $this->get_coreplugs();
$lprefs = varsettrue($menu_pref['login_menu']['external_links']) ? explode(',', $menu_pref['login_menu']['external_links']) : array(); $lprefs = varsettrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array();
$sprefs = varsettrue($menu_pref['login_menu']['external_stats']) ? explode(',', $menu_pref['login_menu']['external_stats']) : array(); $sprefs = varsettrue($this->loginPrefs['external_stats']) ? explode(',', $this->loginPrefs['external_stats']) : array();
if($active) { if($active)
{
$tmp = array_flip($lprefs); $tmp = array_flip($lprefs);
$tmp1 = array_flip($sprefs); $tmp1 = array_flip($sprefs);
$list = array_keys(array_merge($tmp, $tmp1)); $list = array_keys(array_merge($tmp, $tmp1));
} else { }
$list = array_merge($coreplugs, login_menu_class::get_external_list($order)); else
{
$list = array_merge($coreplugs, $this->get_external_list($order));
} }
foreach ($list as $item) { foreach ($list as $item)
{
//core //core
if(in_array($item, $coreplugs)) { if(in_array($item, $coreplugs))
if($tmp = call_user_func(array('login_menu_class', "get_{$item}_stats"), $get_stats)) {
// if($tmp = call_user_func(array('login_menu_class', "get_{$item}_stats"), $get_stats))
if($tmp = call_user_func(array('login_menu_class', "get_{$item}_stats"))) // $get_stats appears to be no longer used
$ret['stats'][$item] = $tmp; $ret['stats'][$item] = $tmp;
continue; continue;
@ -135,10 +168,12 @@ class login_menu_class
return $ret; return $ret;
} }
function get_forum_stats($get_stats=true) {
global $sql, $pref;
if(!array_key_exists('forum', $pref['plug_installed'])) function get_forum_stats($get_stats=true)
{
global $sql;
if(!e107::isInstalled('forum'))
return array(); return array();
$lbox_stats = array(); $lbox_stats = array();
@ -156,7 +191,8 @@ class login_menu_class
WHERE t.thread_datestamp > ".USERLV." and f.forum_class IN (".USERCLASS_LIST.") AND NOT (f.forum_class REGEXP ".$nobody_regexp.") WHERE t.thread_datestamp > ".USERLV." and f.forum_class IN (".USERCLASS_LIST.") AND NOT (f.forum_class REGEXP ".$nobody_regexp.")
"; ";
if($sql->db_Select_gen($qry)) { if($sql->db_Select_gen($qry))
{
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$lbox_stats['forum'][0]['stat_new'] = $row['count']; $lbox_stats['forum'][0]['stat_new'] = $row['count'];
} }
@ -165,10 +201,12 @@ class login_menu_class
return $lbox_stats; return $lbox_stats;
} }
function get_chatbox_menu_stats() {
global $sql, $pref;
if(!array_key_exists('chatbox_menu', $pref['plug_installed'])) function get_chatbox_menu_stats()
{
global $sql;
if(!e107::isInstalled('chatbox_menu'))
return array(); return array();
$lbox_stats[0]['stat_item'] = LOGIN_MENU_L16; $lbox_stats[0]['stat_item'] = LOGIN_MENU_L16;
@ -182,15 +220,15 @@ class login_menu_class
return $lbox_stats; return $lbox_stats;
} }
function render_config_links() {
global $menu_pref;
function render_config_links()
{
$ret = ''; $ret = '';
$lbox_infos = login_menu_class::parse_external_list(false); $lbox_infos = $this->parse_external_list(false);
if(!varsettrue($lbox_infos['links'])) return ''; if(!varsettrue($lbox_infos['links'])) return '';
$enabled = varsettrue($menu_pref['login_menu']['external_links']) ? explode(',', $menu_pref['login_menu']['external_links']) : array(); $enabled = varsettrue($this->loginPrefs['external_links']) ? explode(',', $this->loginPrefs['external_links']) : array();
$num = 1; $num = 1;
foreach ($lbox_infos['links'] as $id => $stack) { foreach ($lbox_infos['links'] as $id => $stack) {
@ -199,7 +237,7 @@ class login_menu_class
$links[] = '<a href="'.$value['link_url'].'">'.varsettrue($value['link_label'], '['.LOGIN_MENU_L44.']').'</a>'; $links[] = '<a href="'.$value['link_url'].'">'.varsettrue($value['link_label'], '['.LOGIN_MENU_L44.']').'</a>';
} }
$plug_data = login_menu_class::get_plugin_data($id); $plug_data = $this->get_plugin_data($id);
$links = implode(', ', $links); $links = implode(', ', $links);
@ -225,29 +263,33 @@ class login_menu_class
$num++; $num++;
} }
if($ret) { if($ret)
{
$ret = '<tr><td colspan="2" class="fcaption">'.LOGIN_MENU_L38.'</td></tr>'.$ret; $ret = '<tr><td colspan="2" class="fcaption">'.LOGIN_MENU_L38.'</td></tr>'.$ret;
} }
return $ret; return $ret;
} }
function render_config_stats() {
global $menu_pref;
function render_config_stats()
{
$ret = ''; $ret = '';
$lbox_infos = login_menu_class::parse_external_list(false); $lbox_infos = $this->parse_external_list(false);
$lbox_infos = varsettrue($lbox_infos['stats'], array()); $lbox_infos = varsettrue($lbox_infos['stats'], array());
if(!$lbox_infos) return ''; if(!$lbox_infos) return '';
$enabled = varsettrue($menu_pref['login_menu']['external_stats']) ? explode(',', $menu_pref['login_menu']['external_stats']) : array(); $enabled = varsettrue($this->loginPrefs['external_stats']) ? explode(',', $this->loginPrefs['external_stats']) : array();
$num = 1; $num = 1;
foreach ($lbox_infos as $id => $stack) { foreach ($lbox_infos as $id => $stack)
{
$plug_data = login_menu_class::get_plugin_data($id); $plug_data = $this->get_plugin_data($id);
if (is_array($plug_data) && count($plug_data))
{
$ret .= ' $ret .= '
<tr> <tr>
<td class="forumheader3">'.LOGIN_MENU_L37.' '.LOGIN_MENU_L46.LOGIN_MENU_L45a." {$plug_data['eplug_name']} ".LOGIN_MENU_L45b.'<br /></td> <td class="forumheader3">'.LOGIN_MENU_L37.' '.LOGIN_MENU_L46.LOGIN_MENU_L45a." {$plug_data['eplug_name']} ".LOGIN_MENU_L45b.'<br /></td>
@ -258,28 +300,34 @@ class login_menu_class
'; ';
$num++; $num++;
} }
}
if($ret) { if($ret)
{
$ret = '<tr><td colspan="2" class="fcaption">'.LOGIN_MENU_L47.'</td></tr>'.$ret; $ret = '<tr><td colspan="2" class="fcaption">'.LOGIN_MENU_L47.'</td></tr>'.$ret;
} }
return $ret; return $ret;
} }
function get_stats_total() {
global $menu_pref;
$lbox_infos = login_menu_class::parse_external_list(true, false); function get_stats_total()
{
$lbox_infos = $this->parse_external_list(true, false);
if(!varsettrue($lbox_infos['stats'])) if(!varsettrue($lbox_infos['stats']))
{
return 0; return 0;
}
$ret = 0; $ret = 0;
$lbox_active_sorted = $menu_pref['login_menu']['external_stats'] ? explode(',', $menu_pref['login_menu']['external_stats']) : array(); $lbox_active_sorted = $this->loginPrefs['external_stats'] ? explode(',', $this->loginPrefs['external_stats']) : array();
foreach ($lbox_active_sorted as $stackid) { foreach ($lbox_active_sorted as $stackid)
{
if(!varset($lbox_infos['stats'][$stackid])) if(!varset($lbox_infos['stats'][$stackid]))
continue; continue;
foreach ($lbox_infos['stats'][$stackid] as $lbox_item) { foreach ($lbox_infos['stats'][$stackid] as $lbox_item)
{
if($lbox_item['stat_new']) if($lbox_item['stat_new'])
$ret += $lbox_item['stat_new']; $ret += $lbox_item['stat_new'];
} }
@ -288,12 +336,17 @@ class login_menu_class
return $ret; return $ret;
} }
/**
* @todo - $plugin_path is undefined - needs to be obtained from somewhere
*/
function get_plugin_data($plugid) function get_plugin_data($plugid)
{ {
if(($tmp = getcachedvars('loginbox_eplug_data_'.$plugid)) !== FALSE) return $tmp; if(($tmp = getcachedvars('loginbox_eplug_data_'.$plugid)) !== FALSE) return $tmp;
$ret = array(); $ret = array();
if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) if (is_readable(e_PLUGIN.$plugin_path.'/plugin.xml'))
{ {
require_once(e_HANDLER.'xml_class.php'); require_once(e_HANDLER.'xml_class.php');
$xml = new xmlClass; $xml = new xmlClass;
@ -319,12 +372,14 @@ class login_menu_class
} }
function clean_links($link_items) { function clean_links($link_items)
{
if(empty($link_items)) return; if(empty($link_items)) return;
foreach($link_items as $key => $value) { foreach($link_items as $key => $value)
if(!varsettrue($value['link_url'])) { {
if(!varsettrue($value['link_url']))
{
unset($link_items[$key]); unset($link_items[$key]);
} }
} }

View File

@ -11,11 +11,24 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_shortcodes.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_shortcodes.php,v $
| $Revision: 1.10 $ | $Revision: 1.11 $
| $Date: 2009-11-18 01:05:53 $ | $Date: 2009-12-28 21:36:13 $
| $Author: e107coders $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
/**
* e107 Login menu plugin
*
* Shortcodes for login menu
*
* @package e107_plugins
* @subpackage login
* @version $Id: login_menu_shortcodes.php,v 1.11 2009-12-28 21:36:13 e107steved Exp $;
*
* @todo Convert to new format
*/
if (!defined('e107_INIT')) { exit(); } if (!defined('e107_INIT')) { exit(); }
global $tp; global $tp;
$login_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__); $login_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);

View File

@ -9,11 +9,22 @@
* Login menu template * Login menu template
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_template.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_template.php,v $
* $Revision: 1.10 $ * $Revision: 1.11 $
* $Date: 2009-11-18 01:05:53 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
*/ */
/**
* e107 Login menu plugin
*
* Template file for login menu
*
* @package e107_plugins
* @subpackage login
* @version $Id: login_menu_template.php,v 1.11 2009-12-28 21:36:13 e107steved Exp $;
*/
if ( ! isset($LOGIN_MENU_FORM)) if ( ! isset($LOGIN_MENU_FORM))
{ {

View File

@ -9,11 +9,23 @@
* Plugin Administration - Online menu * Plugin Administration - Online menu
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/online/config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/online/config.php,v $
* $Revision: 1.5 $ * $Revision: 1.6 $
* $Date: 2009-12-28 17:53:11 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107steved $ * $Author: e107steved $
* *
*/ */
/**
* e107 Online users plugin
*
* Handles the display of users who are online
*
* @package e107_plugins
* @subpackage online
* @version $Id: config.php,v 1.6 2009-12-28 21:36:13 e107steved Exp $;
*
*/
$eplug_admin = TRUE; $eplug_admin = TRUE;
require_once('../../class2.php'); require_once('../../class2.php');
include_lan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php'); include_lan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');

View File

@ -9,8 +9,8 @@
* e107 Main * e107 Main
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_shortcodes.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_shortcodes.php,v $
* $Revision: 1.5 $ * $Revision: 1.6 $
* $Date: 2009-12-28 17:53:11 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107steved $ * $Author: e107steved $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@ -21,12 +21,12 @@ initShortcodeClass('online_shortcodes');
class online_shortcodes class online_shortcodes
{ {
var $e107; protected $e107;
var $memberInfo = array(); // Site stats public $memberInfo = array(); // Site stats
var $currentMember = array('oid' => '0', 'oname' => '??', 'page' => 'lost'); public $currentMember = array('oid' => '0', 'oname' => '??', 'page' => 'lost');
var $currentUser = array(); // Information about current user (for last seen) public $currentUser = array(); // Information about current user (for last seen)
var $onlineMembersList = ''; public $onlineMembersList = '';
var $gen; protected $gen;
public function __construct() public function __construct()

View File

@ -9,21 +9,35 @@
* Plugin Administration - Tree menu * Plugin Administration - Tree menu
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/tree_menu/config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/tree_menu/config.php,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2009-11-18 01:06:01 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
$eplug_admin = TRUE;
require_once("../../class2.php");
include_lan(e_PLUGIN."tree_menu/languages/".e_LANGUAGE.".php");
if (!getperms("4")) /**
* e107 Tree menu plugin
*
* Provides alternative menu style
*
* @package e107_plugins
* @subpackage online
* @version $Id: config.php,v 1.5 2009-12-28 21:36:13 e107steved Exp $;
*
*/
$eplug_admin = TRUE;
require_once('../../class2.php');
include_lan(e_PLUGIN.'tree_menu/languages/'.e_LANGUAGE.'.php');
if (!getperms('4'))
{ {
header("location:".e_BASE."index.php"); header('location:'.e_BASE.'index.php');
exit ; exit ;
} }
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN.'auth.php');
$menu_pref = e107::getConfig('menu')->getPref('');
if (isset($_POST['update_menu'])) if (isset($_POST['update_menu']))
{ {
@ -38,8 +52,12 @@ if (isset($_POST['update_menu']))
if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_01')) if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_01'))
{ {
$tmp = addslashes(serialize($menu_pref)); $menuPref = e107::getConfig('menu');
$sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='menu_pref' "); foreach ($temp as $k => $v)
{
$menuPref->setPref($k, $v);
}
$menuPref->save(false, true, false);
} }
$ns->tablerender("", "<div style='text-align:center'><b>".TREE_L3."</b></div>"); $ns->tablerender("", "<div style='text-align:center'><b>".TREE_L3."</b></div>");
} }

View File

@ -9,9 +9,9 @@
* *
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/tree_menu/tree_menu.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/tree_menu/tree_menu.php,v $
* $Revision: 1.7 $ * $Revision: 1.8 $
* $Date: 2009-11-18 01:06:01 $ * $Date: 2009-12-28 21:36:13 $
* $Author: e107coders $ * $Author: e107steved $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@ -25,12 +25,17 @@ if (!defined('e107_INIT')) { exit; }
- Add a PHP function to read cookie (if existing) when page is loaded and restore menu status (writing or not window.onload js function) - Add a PHP function to read cookie (if existing) when page is loaded and restore menu status (writing or not window.onload js function)
*/ */
/* changes by jalist
26/01/2005
+ complete rewrite
+ now uses single db query, links and sublinks are built into array
*/
/**
* e107 Tree menu plugin
*
* Provides alternative menu style
*
* @package e107_plugins
* @subpackage online
* @version $Id: tree_menu.php,v 1.8 2009-12-28 21:36:13 e107steved Exp $;
*
*/
global $tp; global $tp;
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php"); include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
@ -45,8 +50,8 @@ $linkArray = $sql->db_getList();
// all main links now held in array, we now need to loop through them and assign the sublinks to the correct parent links ... // all main links now held in array, we now need to loop through them and assign the sublinks to the correct parent links ...
$mainLinkArray = array(); $mainLinkArray = array();
foreach($linkArray as $links) { foreach($linkArray as $links)
{
// Updated to stop using the deprecated method of splitting the link-name in 3. // Updated to stop using the deprecated method of splitting the link-name in 3.
// Now uses uses the link parent to determine the 'tree'. // Now uses uses the link parent to determine the 'tree'.

View File

@ -11,12 +11,21 @@
| 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.11 $ | $Revision: 1.12 $
| $Date: 2009-11-18 01:04:24 $ | $Date: 2009-12-28 21:36:13 $
| $Author: e107coders $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
require_once("class2.php");
/**
* @package e107
* @subpackage user
* @version $Id: online.php,v 1.12 2009-12-28 21:36:13 e107steved Exp $;
*
* Display list of online users, and the pages they're viewing
*/
require_once('class2.php');
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
require_once(HEADERF); require_once(HEADERF);
@ -272,25 +281,19 @@ Think these are no longer used
$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']))
{
global $sysprefs;
$menu_pref['most_members_online'] = MEMBERS_ONLINE;
$menu_pref['most_guests_online'] = GUESTS_ONLINE;
$menu_pref['most_online_datestamp'] = time();
$sysprefs->setArray('menu_pref');
}
if (!isset($gen) || !is_object($gen)) if (!isset($gen) || !is_object($gen))
{ {
$gen = new convert; $gen = new convert;
} }
$datestamp = $gen->convert_date($menu_pref['most_online_datestamp'], "short"); $siteHistory = e107::getConfig('history')->getPref('');
$ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8.($menu_pref['most_members_online'] + $menu_pref['most_guests_online']); $datestamp = $gen->convert_date($siteHistory['most_online_datestamp'], "short");
$ONLINE_TABLE_MOST_MEMBERS_ONLINE = ONLINE_EL2.$menu_pref['most_members_online'];
$ONLINE_TABLE_MOST_GUESTS_ONLINE = ONLINE_EL1.$menu_pref['most_guests_online']; $ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8.($siteHistory['most_members_online'] + $siteHistory['most_guests_online']);
$ONLINE_TABLE_MOST_MEMBERS_ONLINE = ONLINE_EL2.$siteHistory['most_members_online'];
$ONLINE_TABLE_MOST_GUESTS_ONLINE = ONLINE_EL1.$siteHistory['most_guests_online'];
$ONLINE_TABLE_DATESTAMP = $datestamp; $ONLINE_TABLE_DATESTAMP = $datestamp;
$total_members = $sql->db_Count("user","(*)","where user_ban = 0"); $total_members = $sql->db_Count("user","(*)","where user_ban = 0");