diff --git a/e107_plugins/login_menu/config.php b/e107_plugins/login_menu/config.php
index 021a1d0c8..090d25c4d 100644
--- a/e107_plugins/login_menu/config.php
+++ b/e107_plugins/login_menu/config.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/config.php,v $
-| $Revision: 1.2 $
-| $Date: 2008-01-23 01:12:15 $
+| $Revision: 1.3 $
+| $Date: 2008-02-01 00:37:10 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -29,7 +29,7 @@ require_once(e_PLUGIN."login_menu/login_menu_class.php");
if ($_POST['update_menu']) {
- //sort/show/hide - Start
+ //sort/show/hide links - Start
if(varset($_POST['external_links'])) {
$_POST['pref']['external_links'] = array();
@@ -49,9 +49,20 @@ if ($_POST['update_menu']) {
}
unset($_POST['external_links_order']);
- //sort/show/hide - End
+ //sort/show/hide links - End
- //print_a($_POST);
+ //show/hide stats - Start
+ if(varset($_POST['external_stats'])) {
+
+ $_POST['pref']['external_stats'] = implode(',', array_keys($_POST['external_stats']));
+ unset($_POST['external_stats']);
+
+ } else {
+ $_POST['pref']['external_stats'] = '';
+ }
+ //show/hide stats - End
+
+ print_a($_POST);
unset($menu_pref['login_menu']);
$menu_pref['login_menu'] = $_POST['pref'];
$tmp = addslashes(serialize($menu_pref));
@@ -72,47 +83,27 @@ $text = '
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+ '.login_menu_class::render_config_stats().'
@@ -121,6 +112,30 @@ $text = '
';
+
+/* OLD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
$ns->tablerender(LOGIN_MENU_L41, $text);
diff --git a/e107_plugins/login_menu/languages/English.php b/e107_plugins/login_menu/languages/English.php
index 1cf740cb2..bb6eebd6d 100644
--- a/e107_plugins/login_menu/languages/English.php
+++ b/e107_plugins/login_menu/languages/English.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/languages/English.php,v $
-| $Revision: 1.2 $
-| $Date: 2008-01-23 01:12:15 $
+| $Revision: 1.3 $
+| $Date: 2008-02-01 00:37:10 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -46,15 +46,15 @@ define("LOGIN_MENU_L26", "no");
define("LOGIN_MENU_L27", "and");
define("LOGIN_MENU_L28", "Login");
-define("LOGIN_MENU_L29", "new article");
-define("LOGIN_MENU_L30", "new articles");
+//define("LOGIN_MENU_L29", "new article");
+//define("LOGIN_MENU_L30", "new articles");
// New config options
define('LOGIN_MENU_L31', 'Show New News Posts');
-define('LOGIN_MENU_L32', 'Show New Article Posts');
-define('LOGIN_MENU_L33', 'Show New Chatbox Posts');
+//define('LOGIN_MENU_L32', 'Show New Article Posts');
+//define('LOGIN_MENU_L33', 'Show New Chatbox Posts');
define('LOGIN_MENU_L34', 'Show New Comment Posts');
-define('LOGIN_MENU_L35', 'Show New Forum Posts');
+//define('LOGIN_MENU_L35', 'Show New Forum Posts');
define('LOGIN_MENU_L36', 'Show New Members');
@@ -66,8 +66,13 @@ define("LOGIN_MENU_L41", "Login Menu Settings");
define('LOGIN_MENU_L37', 'Show');
define('LOGIN_MENU_L38', 'Login menu - Additional Links');
-define('LOGIN_MENU_L42', 'Login menu - Recent additions');
+define('LOGIN_MENU_L42', 'Login menu - Recent core additions');
define('LOGIN_MENU_L43', 'Position');
define('LOGIN_MENU_L44', 'missing link title');
+define('LOGIN_MENU_L45', 'link(s) -');
+define('LOGIN_MENU_L45a', ''); //pre
+define('LOGIN_MENU_L45b', 'plugin'); //post
+define('LOGIN_MENU_L46', 'recent items -');
+define('LOGIN_MENU_L47', 'Login menu - Recent plugin additions');
?>
\ No newline at end of file
diff --git a/e107_plugins/login_menu/login_menu.php b/e107_plugins/login_menu/login_menu.php
index f44c620df..720fb4f41 100644
--- a/e107_plugins/login_menu/login_menu.php
+++ b/e107_plugins/login_menu/login_menu.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu.php,v $
-| $Revision: 1.6 $
-| $Date: 2008-01-23 01:12:15 $
+| $Revision: 1.7 $
+| $Date: 2008-02-01 00:37:10 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -24,7 +24,7 @@ if(defined("FPW_ACTIVE"))
return; // prevent failed login attempts when fpw.php is loaded before this menu.
}
-global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY, $LOGIN_MENU_MESSAGE,
+global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY, $LOGIN_MENU_MESSAGE, $LOGIN_MENU_STATITEM,
$login_menu_shortcodes, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK;
$ip = $e107->getip();
@@ -68,8 +68,9 @@ $ip = $e107->getip();
// START LOGGED CODE
if (USER == TRUE || ADMIN == TRUE)
{
+ require_once(e_PLUGIN."login_menu/login_menu_class.php");
- //login class ???
+ //login class ??? - REMOVE IT
if ($sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' "))
{ // User now logged in - delete 'guest' record (tough if several users on same IP)
$sql->db_Delete('online', "`online_ip` = '{$ip}' AND `online_user_id` = '0' ");
@@ -108,7 +109,8 @@ if (USER == TRUE || ADMIN == TRUE)
$menu_data['new_comments'] = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
$new_total += $menu_data['new_comments'];
}
-
+
+/*
// ------------ Chatbox Stats -----------
if (varsettrue($menu_pref['login_menu']['new_chatbox']) && in_array('chatbox_menu',$eMenuActive))
@@ -119,7 +121,7 @@ if (USER == TRUE || ADMIN == TRUE)
// ------------ Forum Stats -----------
- if (varsettrue($menu_pref['login_menu']['new_forum']))
+ if (varsettrue($menu_pref['login_menu']['new_forum']) && array_key_exists('forum', $pref['plug_installed']))
{
$qry = "
SELECT count(*) as count FROM #forum_t as t
@@ -135,6 +137,7 @@ if (USER == TRUE || ADMIN == TRUE)
$new_total += $menu_data['new_forum'];
}
}
+*/
// ------------ Member Stats -----------
diff --git a/e107_plugins/login_menu/login_menu_class.php b/e107_plugins/login_menu/login_menu_class.php
index de3fbe474..a1323172a 100644
--- a/e107_plugins/login_menu/login_menu_class.php
+++ b/e107_plugins/login_menu/login_menu_class.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_class.php,v $
-| $Revision: 1.1 $
-| $Date: 2008-01-23 01:12:15 $
+| $Revision: 1.2 $
+| $Date: 2008-02-01 00:37:10 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -41,6 +41,10 @@ $lbox_stats[] = $LBOX_STAT;
class login_menu_class
{
+ function get_coreplugs() {
+ return array('forum', 'chatbox_menu');
+ }
+
function get_external_list($sort = true) {
global $sql, $pref, $menu_pref;
@@ -76,26 +80,48 @@ class login_menu_class
return $list;
}
- function parse_external_list($list) {
-
+ function parse_external_list($active=false, $order=true) {
+ global $menu_pref;
//prevent more than 1 call
if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp;
-
+
$ret = array();
+ $lbox_admin = varsettrue($eplug_admin, false);
+ $coreplugs = login_menu_class::get_coreplugs();
+
+ $lprefs = $menu_pref['login_menu']['external_links'] ? explode(',', $menu_pref['login_menu']['external_links']) : array();
+ $sprefs = $menu_pref['login_menu']['external_stats'] ? explode(',', $menu_pref['login_menu']['external_stats']) : array();
+
+ if($active) {
+ $tmp = array_flip($lprefs);
+ $tmp1 = array_flip($sprefs);
+ $list = array_keys(array_merge($tmp, $tmp1));
+ } else {
+ $list = array_merge($coreplugs, login_menu_class::get_external_list($order));
+ }
+
foreach ($list as $item) {
- if(file_exists(e_PLUGIN.$item."/e_loginbox.php")) {
+
+ //core
+ if(in_array($item, $coreplugs)) {
+ if($tmp = call_user_func(array('login_menu_class', "get_{$item}_stats"), $get_stats))
+ $ret['stats'][$item] = $tmp;
+
+ continue;
+ }
- $lbox_links = array();
- $lbox_stats = array();
- require(e_PLUGIN.$item."/e_loginbox.php");
+ $lbox_links = array();
+ $lbox_stats = array();
+ $lbox_links_active = (!$active || in_array($item, $lprefs));
+ $lbox_stats_active = (!$active || in_array($item, $sprefs));
+
+ if(file_exists(e_PLUGIN.$item."/e_loginbox.php")) {
+
- /* Front-end only!
- if($check) {
- $lbox_links = login_menu_class::clean_links($lbox_links);
- }*/
+ include(e_PLUGIN.$item."/e_loginbox.php");
- if(!empty($lbox_links)) $ret['links'][$item] = $lbox_links;
- if(!empty($lbox_stats)) $ret['stats'][$item] = $lbox_stats;
+ if(!empty($lbox_links) && $lbox_links_active) $ret['links'][$item] = $lbox_links;
+ if(!empty($lbox_stats) && $lbox_stats_active) $ret['stats'][$item] = $lbox_stats;
}
}
@@ -103,15 +129,78 @@ class login_menu_class
return $ret;
}
+ /*
+ function parse_coreplug_stats($get_stats=true) {
+ global $pref;
+ $lbox_stats = array();
+
+ $coreplugs = login_menu_class::get_coreplugs();
+ foreach($coreplugs as $plug_id) {
+ if(array_key_exists($plug_id, $pref['plug_installed'])) {
+ if($tmp = call_user_func(array('login_menu_class', "get_{$plug_id}_stats"), $get_stats))
+ $lbox_stats[$plug_id] = $tmp;
+ }
+ }
+
+ return $lbox_stats;
+ }
+ */
+
+ function get_forum_stats($get_stats=true) {
+ global $sql, $pref;
+
+ if(!array_key_exists('forum', $pref['plug_installed']))
+ return array();
+
+ $lbox_stats = array();
+ $lbox_stats[0]['stat_item'] = LOGIN_MENU_L20;
+ $lbox_stats[0]['stat_items'] = LOGIN_MENU_L21;
+ $lbox_stats[0]['stat_new'] = 0;
+ $lbox_stats[0]['stat_nonew'] = LOGIN_MENU_L26.' '.LOGIN_MENU_L21;
+ if($get_stats) {
+
+ $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
+ $qry = "
+ SELECT count(*) as count FROM #forum_t as t
+ LEFT JOIN #forum as f
+ ON t.thread_forum_id = f.forum_id
+ 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)) {
+ $row = $sql->db_Fetch();
+ $lbox_stats['forum'][0]['stat_new'] = $row['count'];
+ }
+ }
+
+ return $lbox_stats;
+ }
+
+ function get_chatbox_menu_stats() {
+ global $sql, $pref;
+
+ if(!array_key_exists('chatbox_menu', $pref['plug_installed']))
+ return array();
+
+ $lbox_stats[0]['stat_item'] = LOGIN_MENU_L16;
+ $lbox_stats[0]['stat_items'] = LOGIN_MENU_L17;
+ $lbox_stats[0]['stat_new'] = 0;
+ $lbox_stats[0]['stat_nonew'] = LOGIN_MENU_L26.' '.LOGIN_MENU_L17;
+ if($get_stats) {
+ $lbox_stats['chatbox_menu'][0]['stat_new'] = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.USERLV);
+ }
+
+ return $lbox_stats;
+ }
function render_config_links() {
global $menu_pref;
$ret = '';
- $list = login_menu_class::get_external_list(true);
- $lbox_infos = login_menu_class::parse_external_list($list);
+
+ $lbox_infos = login_menu_class::parse_external_list(false);
if(!varsettrue($lbox_infos['links'])) return '';
-
+
$enabled = varsettrue($menu_pref['login_menu']['external_links']) ? explode(',', $menu_pref['login_menu']['external_links']) : array();
$num = 1;
@@ -121,12 +210,14 @@ class login_menu_class
$links[] = ''.varsettrue($value['link_label'], '['.LOGIN_MENU_L44.']').'';
}
+ $plug_data = login_menu_class::get_plugin_data($id);
+
$links = implode(', ', $links);
$ret .= '
-
-
+