diff --git a/e107_plugins/login_menu/config.php b/e107_plugins/login_menu/config.php index 878bdf65b..021a1d0c8 100644 --- a/e107_plugins/login_menu/config.php +++ b/e107_plugins/login_menu/config.php @@ -1,5 +1,4 @@ $value) { + if(array_key_exists($key, $_POST['external_links'])) + $_POST['pref']['external_links'][] = $key; + } + + $_POST['pref']['external_links'] = $_POST['pref']['external_links'] ? implode(',', $_POST['pref']['external_links']) : ''; + + unset($_POST['external_links']); + + } else { + $_POST['pref']['external_links'] = ''; + } + + unset($_POST['external_links_order']); + //sort/show/hide - End + + //print_a($_POST); unset($menu_pref['login_menu']); $menu_pref['login_menu'] = $_POST['pref']; $tmp = addslashes(serialize($menu_pref)); $sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' "); $ns->tablerender("", '
'.LAN_SETSAVED.'
'); + } $text = '
-
- - + +
+ + '.login_menu_class::render_config_links().' + + + + + + + + + '; + $num++; + } + + if($ret) { + $ret = ''.$ret; + } + + return $ret; + } + + + function clean_links($link_items) { + + if(empty($link_items)) return; + + foreach($link_items as $key => $value) { + if(!varsettrue($value['link_url'])) { + unset($link_items[$key]); + } + } + + return $link_items; + } + +} + +?> \ No newline at end of file diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php index 3032216dc..67bde04d1 100755 --- a/e107_plugins/login_menu/login_menu_shortcodes.php +++ b/e107_plugins/login_menu/login_menu_shortcodes.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_shortcodes.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-03-25 09:22:42 $ -| $Author: lisa_ $ +| $Revision: 1.3 $ +| $Date: 2008-01-23 01:12:15 $ +| $Author: secretr $ +----------------------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } @@ -97,9 +97,9 @@ if(ADMIN == TRUE){ SC_END SC_BEGIN LM_ADMINLINK_BULLET -global $bullet; -if(ADMIN==TRUE && $bullet !='bullet'){ - return $bullet; +$data = getcachedvars('login_menu_data'); +if(ADMIN==TRUE && $data['link_bullet'] != 'bullet'){ + return $data['link_bullet']; } SC_END @@ -123,9 +123,8 @@ SC_END SC_BEGIN LM_BULLET -global $bullet; -return $bullet; - +$data = getcachedvars('login_menu_data'); +return $data['link_bullet']; SC_END SC_BEGIN LM_USERSETTINGS @@ -143,8 +142,91 @@ $text = ($parm) ? $parm : LOGIN_MENU_L8; return ''; SC_END +SC_BEGIN LM_EXTERNAL_LINKS +global $tp, $menu_pref, $login_menu_shortcodes, $LOGIN_MENU_EXTERNAL_LINK; +require_once(e_PLUGIN."login_menu/login_menu_class.php"); +if(!varsettrue($menu_pref['login_menu']['external_links'])) return ''; +$tmp = explode(',', $menu_pref['login_menu']['external_links']); +$lbox_infos = login_menu_class::parse_external_list($tmp); +if(!varsettrue($lbox_infos['links'])) return ''; +$ret = ''; +foreach ($lbox_infos['links'] as $id => $items) { +$lbox_items = login_menu_class::clean_links($items); +if(!$lbox_items) continue; + foreach ($lbox_items as $lbox_item) { + cachevars('login_menu_linkdata', $lbox_item); + $ret .= $tp -> parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes); + } +} +return $ret; +SC_END + +SC_BEGIN LM_EXTERNAL_LINK +$lbox_item = getcachedvars('login_menu_linkdata'); +return $parm == 'href' ? $lbox_item['link_url'] : ''.varsettrue($lbox_item['link_label'], '['.LOGIN_MENU_L44.']').''; +SC_END + +SC_BEGIN LM_EXTERNAL_LINK_LABEL +$lbox_item = getcachedvars('login_menu_linkdata'); +return varsettrue($lbox_item['link_label'], '['.LOGIN_MENU_L44.']'); +SC_END + +SC_BEGIN LM_STATS +global $LOGIN_MENU_STATS, $tp, $login_menu_shortcodes; +$data = getcachedvars('login_menu_data'); +if(!$data['enable_stats']) return ''; +return $tp -> parseTemplate($LOGIN_MENU_STATS, true, $login_menu_shortcodes); +SC_END + +SC_BEGIN LM_NEW_NEWS +$data = getcachedvars('login_menu_data'); +if(!isset($data['new_news'])) return ''; +if(!$data['new_news']) + return LOGIN_MENU_L26.' '.LOGIN_MENU_L15; +return $data['new_news'].' '.($data['new_news'] == 1 ? LOGIN_MENU_L14 : LOGIN_MENU_L15); +SC_END + +SC_BEGIN LM_NEW_COMMENTS +$data = getcachedvars('login_menu_data'); +if(!isset($data['new_comments'])) return ''; +if(!$data['new_comments']) + return LOGIN_MENU_L26.' '.LOGIN_MENU_L19; +return $data['new_comments'].' '.($data['new_comments'] == 1 ? LOGIN_MENU_L18 : LOGIN_MENU_L19); +SC_END + +SC_BEGIN LM_NEW_CHAT +$data = getcachedvars('login_menu_data'); +if(!isset($data['new_chat'])) return ''; +if(!$data['new_chat']) + return LOGIN_MENU_L26.' '.LOGIN_MENU_L17; +return $data['new_chat'].' '.($data['new_chat'] == 1 ? LOGIN_MENU_L16 : LOGIN_MENU_L17); +SC_END + +SC_BEGIN LM_NEW_FORUM +$data = getcachedvars('login_menu_data'); +if(!isset($data['new_forum'])) return ''; +if(!$data['new_forum']) + return LOGIN_MENU_L26.' '.LOGIN_MENU_L21; +return $data['new_forum'].' '.($data['new_forum'] == 1 ? LOGIN_MENU_L20 : LOGIN_MENU_L17); +SC_END + +SC_BEGIN LM_NEW_USERS +$data = getcachedvars('login_menu_data'); +if(!isset($data['new_users'])) return ''; +if(!$data['new_users']) + return LOGIN_MENU_L26.' '.LOGIN_MENU_L23; +return $data['new_users'].' '.($data['new_users'] == 1 ? LOGIN_MENU_L22 : LOGIN_MENU_L23); +SC_END + +SC_BEGIN LM_LISTNEW_LINK +$data = getcachedvars('login_menu_data'); +if($parm == 'href') return $data['listnew_link']; +return $data['listnew_link'] ? ''.LOGIN_MENU_L24.'' : ''; +SC_END + SC_BEGIN LM_MESSAGE -global $tp; +global $tp, $LOGIN_MENU_MESSAGE; +if(!defsettrue('LOGINMESSAGE')) return ''; if($parm == "popup"){ $srch = array("
","'"); $rep = array("\\n","\'"); @@ -152,9 +234,12 @@ if($parm == "popup"){ alert('".$tp->toJS(LOGINMESSAGE)."'); "; }else{ - return LOGINMESSAGE; + return $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes); } SC_END +SC_BEGIN LM_MESSAGE_TEXT +return defsettrue('LOGINMESSAGE', ''); +SC_END */ -?> +?> \ No newline at end of file diff --git a/e107_plugins/login_menu/login_menu_template.php b/e107_plugins/login_menu/login_menu_template.php index 225d52a9e..6aff8d7f2 100644 --- a/e107_plugins/login_menu/login_menu_template.php +++ b/e107_plugins/login_menu/login_menu_template.php @@ -11,60 +11,99 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_template.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:35:30 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2008-01-23 01:12:15 $ +| $Author: secretr $ +----------------------------------------------------------------------------+ */ -$sc_style['LM_SIGNUP_LINK']['pre'] = "
[ "; -$sc_style['LM_SIGNUP_LINK']['post'] = " ]"; - -$sc_style['LM_FPW_LINK']['pre'] = "
[ "; -$sc_style['LM_FPW_LINK']['post'] = " ]"; - -$sc_style['LM_RESEND_LINK']['pre'] = "
[ "; -$sc_style['LM_RESEND_LINK']['post'] = " ]"; - -$sc_style['LM_REMEMBERME']['pre'] = "
"; -$sc_style['LM_REMEMBERME']['post'] = ""; if (!isset($LOGIN_MENU_FORM)){ - + $sc_style['LM_SIGNUP_LINK']['pre'] = "
[ "; + $sc_style['LM_SIGNUP_LINK']['post'] = " ]"; + + $sc_style['LM_FPW_LINK']['pre'] = "
[ "; + $sc_style['LM_FPW_LINK']['post'] = " ]"; + + $sc_style['LM_RESEND_LINK']['pre'] = "
[ "; + $sc_style['LM_RESEND_LINK']['post'] = " ]"; + + $sc_style['LM_REMEMBERME']['pre'] = "
"; + $sc_style['LM_REMEMBERME']['post'] = ""; + $LOGIN_MENU_FORM = " -
". - LOGIN_MENU_L1." -
\n - {LM_USERNAME_INPUT} -
". - LOGIN_MENU_L2." -
\n - {LM_PASSWORD_INPUT} -
\n - {LM_IMAGECODE} - {LM_LOGINBUTTON} - {LM_REMEMBERME} -
- {LM_SIGNUP_LINK} - {LM_FPW_LINK} - {LM_RESEND_LINK} -
+ {LM_MESSAGE} +
+ ".LOGIN_MENU_L1."
+ {LM_USERNAME_INPUT}
+ ".LOGIN_MENU_L2."
+ {LM_PASSWORD_INPUT}
+ {LM_IMAGECODE} + {LM_LOGINBUTTON} + {LM_REMEMBERME}
+ {LM_SIGNUP_LINK} + {LM_FPW_LINK} + {LM_RESEND_LINK} +
"; } if (!isset($LOGIN_MENU_LOGGED)){ - $sc_style['LM_ADMINLINK']['pre'] = ""; - $sc_style['LM_ADMINLINK']['post'] = "
"; + $sc_style['LM_ADMINLINK']['pre'] = ''; + $sc_style['LM_ADMINLINK']['post'] = '
'; + + $sc_style['LM_EXTERNAL_LINKS']['pre'] = '
'; + $sc_style['LM_EXTERNAL_LINKS']['post'] = '
'; + + $sc_style['LM_STATS']['pre'] = '

'.LOGIN_MENU_L25.':
'; + $sc_style['LM_STATS']['post'] = '
'; + + $sc_style['LM_LISTNEW_LINK']['pre'] = '
'; + $sc_style['LM_LISTNEW_LINK']['post'] = ''; - $LOGIN_MENU_LOGGED = " + $LOGIN_MENU_LOGGED = ' {LM_MAINTENANCE} {LM_ADMINLINK_BULLET} {LM_ADMINLINK} {LM_BULLET} {LM_USERSETTINGS}
{LM_BULLET} {LM_PROFILE}
+ {LM_EXTERNAL_LINKS} {LM_BULLET} {LM_LOGOUT} - "; + {LM_STATS} + {LM_LISTNEW_LINK} + '; +} + +if (!isset($LOGIN_MENU_EXTERNAL_LINK)){ + $LOGIN_MENU_EXTERNAL_LINK = ' + {LM_BULLET} {LM_EXTERNAL_LINK}
+ '; +} + +if (!isset($LOGIN_MENU_STATS)){ + $sc_style['LM_NEW_NEWS']['pre'] = ''; + $sc_style['LM_NEW_NEWS']['post'] = '
'; + + $sc_style['LM_NEW_COMMENTS']['pre'] = ''; + $sc_style['LM_NEW_COMMENTS']['post'] = '
'; + + $sc_style['LM_NEW_CHAT']['pre'] = ''; + $sc_style['LM_NEW_CHAT']['post'] = '
'; + + $sc_style['LM_NEW_FORUM']['pre'] = ''; + $sc_style['LM_NEW_FORUM']['post'] = '
'; + + $sc_style['LM_NEW_USERS']['pre'] = ''; + $sc_style['LM_NEW_USERS']['post'] = '
'; + + $LOGIN_MENU_STATS = ' + {LM_NEW_NEWS} + {LM_NEW_COMMENTS} + {LM_NEW_CHAT} + {LM_NEW_FORUM} + {LM_NEW_USERS} + '; } if (!isset($LOGIN_MENU_MESSAGE)){ - $LOGIN_MENU_MESSAGE = '
{LM_MESSAGE}
'; + $LOGIN_MENU_MESSAGE = '
{LM_MESSAGE_TEXT}
'; } -?> +?> \ No newline at end of file
'.LOGIN_MENU_L42.'
'.LOGIN_MENU_L31.' @@ -93,4 +126,4 @@ $ns->tablerender(LOGIN_MENU_L41, $text); require_once(e_ADMIN."footer.php"); -?> +?> \ No newline at end of file diff --git a/e107_plugins/login_menu/languages/English.php b/e107_plugins/login_menu/languages/English.php index 2a731e791..1cf740cb2 100644 --- a/e107_plugins/login_menu/languages/English.php +++ b/e107_plugins/login_menu/languages/English.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/languages/English.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:35:30 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2008-01-23 01:12:15 $ +| $Author: secretr $ +----------------------------------------------------------------------------+ */ @@ -23,7 +23,7 @@ define("LOGIN_MENU_L3", "Signup"); define("LOGIN_MENU_L4", "Forgot password?"); define("LOGIN_MENU_L5", "Welcome"); define("LOGIN_MENU_L6", "Remember me"); -define("LOGIN_MENU_L7", "Unique user ID not recognised (possible corrupted cookie).
Please click here to destroy cookie."); +define("LOGIN_MENU_L7", "Unique user ID not recognised (possible corrupted cookie). Please click the logout link below to destroy cookie."); define("LOGIN_MENU_L8", "Logout"); define("LOGIN_MENU_L9", "Login Error"); define("LOGIN_MENU_L10", "The maintenance flag is true - this means normal visitors are being redirected to sitedown.php. To reset the flag go to admin/maintenance."); @@ -62,4 +62,12 @@ define('LOGIN_MENU_L39', 'Leave Admin'); define("LOGIN_MENU_L40", "Resend Activation Email"); define("LOGIN_MENU_L41", "Login Menu Settings"); -?> +//new v0.8 +define('LOGIN_MENU_L37', 'Show'); +define('LOGIN_MENU_L38', 'Login menu - Additional Links'); + +define('LOGIN_MENU_L42', 'Login menu - Recent additions'); +define('LOGIN_MENU_L43', 'Position'); +define('LOGIN_MENU_L44', 'missing link title'); + +?> \ 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 ef53fc869..f44c620df 100644 --- a/e107_plugins/login_menu/login_menu.php +++ b/e107_plugins/login_menu/login_menu.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu.php,v $ -| $Revision: 1.5 $ -| $Date: 2007-05-27 18:57:36 $ -| $Author: e107steved $ +| $Revision: 1.6 $ +| $Date: 2008-01-23 01:12:15 $ +| $Author: secretr $ +----------------------------------------------------------------------------+ */ @@ -24,10 +24,14 @@ 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,$bullet; -require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php"); +global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY, $LOGIN_MENU_MESSAGE, + $login_menu_shortcodes, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK; $ip = $e107->getip(); +//shortcodes + require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php"); + +//Bullet if(defined("BULLET")) { $bullet = ""; @@ -41,140 +45,139 @@ $ip = $e107->getip(); $bullet = ""; } -if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE) -{ - $text = "
".LOGIN_MENU_L7."

- ".$bullet." ".LOGIN_MENU_L8."
"; - $ns->tablerender(LOGIN_MENU_L9, $text, 'login'); -} -$use_imagecode = ($pref['logcode'] && extension_loaded('gd')); +//Corrup cookie + if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE) + { + $text = "
".LOGIN_MENU_L7."

+ {$bullet} ".LOGIN_MENU_L8."
"; + $ns->tablerender(LOGIN_MENU_L9, $text, 'loginbox_error'); + } + +//Image code + $use_imagecode = ($pref['logcode'] && extension_loaded('gd')); + + if ($use_imagecode) + { + global $sec_img; + include_once(e_HANDLER.'secure_img_handler.php'); + $sec_img = new secure_image; + } -if ($use_imagecode) -{ - global $sec_img; - include_once(e_HANDLER.'secure_img_handler.php'); - $sec_img = new secure_image; -} -$text = ''; + $text = ''; + +// START LOGGED CODE if (USER == TRUE || ADMIN == TRUE) { - if (!isset($LOGIN_MENU_LOGGED)) { + + //login class ??? + 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' "); + } + + //get templates + if (!isset($LOGIN_MENU_LOGGED)) { if (file_exists(THEME."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 still doesn't exist in the user template. + if(!$LOGIN_MENU_LOGGED){ require(e_PLUGIN."login_menu/login_menu_template.php"); } - $text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes); - - 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' "); - } - + //prepare $new_total = 0; $time = USERLV; + $menu_data = array(); // ------------ News Stats ----------- - if (isset($menu_pref['login_menu']) && $menu_pref['login_menu']['new_news'] == true) + if (varsettrue($menu_pref['login_menu']['new_news'])) { - $new_news = $sql->db_Count("news", "(*)", "WHERE `news_datestamp` > {$time} AND news_class REGEXP '".e_CLASS_REGEXP."'"); - $new_total += $new_news; - if (!$new_news) - { - $new_news = LOGIN_MENU_L26; - } - $NewItems[] = $new_news.' '.($new_news == 1 ? LOGIN_MENU_L14 : LOGIN_MENU_L15); + $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.")"); + $new_total += $menu_data['new_news']; } // ------------ Comments Stats ----------- - if (varsettrue($menu_pref['login_menu']['new_comments'], false) == true) + if (varsettrue($menu_pref['login_menu']['new_comments'])) { - $new_comments = 0; - $new_comments = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time); - $new_total += $new_comments; - if (!$new_comments) - { - $new_comments = LOGIN_MENU_L26; - } - $NewItems[] = $new_comments.' '.($new_comments == 1 ? LOGIN_MENU_L18 : LOGIN_MENU_L19); + $menu_data['new_comments'] = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time); + $new_total += $menu_data['new_comments']; } // ------------ Chatbox Stats ----------- - if (isset($menu_pref['login_menu']['new_chatbox']) && $menu_pref['login_menu']['new_chatbox'] == true) { - $display_chats = TRUE; - - if(in_array('chatbox_menu',$eMenuActive)){ - $new_chat = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.$time); - $new_total += $new_chat; - } else { - $display_chats = FALSE; - } - if (isset($new_chat) && !$new_chat) { - $new_chat = ($display_chats ? LOGIN_MENU_L26 : ''); - } - if ($display_chats == true) { - $NewItems[] = $new_chat.' '.($new_chat == 1 ? LOGIN_MENU_L16 : LOGIN_MENU_L17); - - } + if (varsettrue($menu_pref['login_menu']['new_chatbox']) && in_array('chatbox_menu',$eMenuActive)) + { + $menu_data['new_chat'] = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.$time); + $new_total += $menu_data['new_chat']; } // ------------ Forum Stats ----------- - if (isset($menu_pref['login_menu']['new_forum']) && $menu_pref['login_menu']['new_forum'] == true) { + if (varsettrue($menu_pref['login_menu']['new_forum'])) + { $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 > {$time} and f.forum_class IN (".USERCLASS_LIST.") "; + if($sql->db_Select_gen($qry)) { $row = $sql->db_Fetch(); - $new_forum = $row['count']; - $new_total += $new_forum; + $menu_data['new_forum'] = $row['count']; + $new_total += $menu_data['new_forum']; } - if (!$new_forum) { - $new_forum = LOGIN_MENU_L26; - } - $NewItems[] = $new_forum.' '.($new_forum == 1 ? LOGIN_MENU_L20 : LOGIN_MENU_L21); } // ------------ Member Stats ----------- - if (isset($menu_pref['login_menu']['new_members']) && $menu_pref['login_menu']['new_members'] == true) { - $new_users = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time); - $new_total += $new_users; - if (!$new_users) { - $new_users = LOGIN_MENU_L26; - } - $NewItems[] = $new_users.' '.($new_users == 1 ? LOGIN_MENU_L22 : LOGIN_MENU_L23); + if (varsettrue($menu_pref['login_menu']['new_members'])) + { + $menu_data['new_users'] = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time); + $new_total += $menu_data['new_users']; } - if (isset($NewItems) && $NewItems) { - $text .= '

'.LOGIN_MENU_L25.'
'.implode(',
', $NewItems).'
'; - if ($new_total) { - if ($sql -> db_Select("plugin", "plugin_installflag", "plugin_path='list_new' AND plugin_installflag='1'")) - { - $text .= '
'.LOGIN_MENU_L24.''; - } - } + + // ------------ Enable stats / other --------------- + + $menu_data['enable_stats'] = $menu_data ? true : false; + $menu_data['new_total'] = $new_total; + $menu_data['link_bullet'] = $bullet; + + // ------------ List New Link --------------- + + $menu_data['listnew_link'] = ''; + if ($new_total && array_key_exists('list_new', $pref['plug_installed'])) + { + $menu_data['listnew_link'] = e_PLUGIN.'list_new/list.php?new'; } + // ------------ Pass the data & parse ------------ + cachevars('login_menu_data', $menu_data); + $text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes); + + //menu caption if (file_exists(THEME.'images/login_menu.png')) { $caption = ''.LOGIN_MENU_L5.' '.USERNAME; } else { $caption = LOGIN_MENU_L5.' '.USERNAME; } + + //render $ns->tablerender($caption, $text, 'login'); -} else { + +// END LOGGED CODE +} +// START NOT LOGGED CODE +else +{ + //get templates if (!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE) { if (file_exists(THEME."login_menu_template.php")){ require_once(THEME."login_menu_template.php"); @@ -185,20 +188,21 @@ if (USER == TRUE || ADMIN == TRUE) if(!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE){ require(e_PLUGIN."login_menu/login_menu_template.php"); } - - if (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE) - { - + + + //if (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE) + //{ + /* if (LOGINMESSAGE != '') { $text = $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes); - } + }*/ - $text .= ''; + $text = ''; $text .= $tp->parseTemplate($LOGIN_MENU_FORM, true, $login_menu_shortcodes); $text .= ''; - } else { - $text = $tp->parseTemplate("
{LM_FPW_LINK}
", true, $login_menu_shortcodes); - } + //} else { + // $text = $tp->parseTemplate("
{LM_FPW_LINK}
", true, $login_menu_shortcodes); + //} if (file_exists(THEME.'images/login_menu.png')) { @@ -206,7 +210,7 @@ if (USER == TRUE || ADMIN == TRUE) } else { $caption = LOGIN_MENU_L5; } - $ns->tablerender($caption, $text, 'login'); + $ns->tablerender($caption, $text, 'loginbox'); } - -?> +// END NOT LOGGED CODE +?> \ No newline at end of file diff --git a/e107_plugins/login_menu/login_menu_class.php b/e107_plugins/login_menu/login_menu_class.php new file mode 100644 index 000000000..de3fbe474 --- /dev/null +++ b/e107_plugins/login_menu/login_menu_class.php @@ -0,0 +1,171 @@ +get_files(e_PLUGIN, "e_loginbox\.php$", "standard", 1); + + if($list_arr) { + foreach ($list_arr as $item) { + $tmp = end(explode('/', trim($item['path'], '/.'))); + + if(array_key_exists($tmp, $pref['plug_installed'])) { + $list[] = $tmp; + } + } + } + + if($sort && $menu_pref['login_menu']['external_links']) { + $tmp = array_flip(explode(',', $menu_pref['login_menu']['external_links'])); + + $cnt = count($tmp); + foreach ($list as $value) { + $list_ord[$value] = varset($tmp[$value], $cnt++); + } + + asort($list_ord); + $list = array_keys($list_ord); + unset($list_ord); + } + + return $list; + } + + function parse_external_list($list) { + + //prevent more than 1 call + if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp; + + $ret = array(); + foreach ($list as $item) { + if(file_exists(e_PLUGIN.$item."/e_loginbox.php")) { + + $lbox_links = array(); + $lbox_stats = array(); + require(e_PLUGIN.$item."/e_loginbox.php"); + + /* Front-end only! + if($check) { + $lbox_links = login_menu_class::clean_links($lbox_links); + }*/ + + if(!empty($lbox_links)) $ret['links'][$item] = $lbox_links; + if(!empty($lbox_stats)) $ret['stats'][$item] = $lbox_stats; + + } + } + cachevars('loginbox_elist', $ret); + + return $ret; + } + + 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); + if(!varsettrue($lbox_infos['links'])) return ''; + + $enabled = varsettrue($menu_pref['login_menu']['external_links']) ? explode(',', $menu_pref['login_menu']['external_links']) : array(); + + $num = 1; + foreach ($lbox_infos['links'] as $id => $stack) { + $links = array(); + foreach ($stack as $value) { + $links[] = ''.varsettrue($value['link_label'], '['.LOGIN_MENU_L44.']').''; + } + + $links = implode(', ', $links); + + $ret .= ' +
'.LOGIN_MENU_L37.' '.$links.' + + + + + + +
+ + + '.LOGIN_MENU_L43.': +
+ +
'.LOGIN_MENU_L38.'