1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

login menu templates and e_loginbox linking

This commit is contained in:
secretr
2008-01-23 01:12:15 +00:00
parent b96596e310
commit c37a317af2
6 changed files with 500 additions and 160 deletions

View File

@@ -1,5 +1,4 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ + ----------------------------------------------------------------------------+
| e107 website system | e107 website system
@@ -12,32 +11,66 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $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.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:35:30 $ | $Date: 2008-01-23 01:12:15 $
| $Author: mcfly_e107 $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
$eplug_admin = TRUE; $eplug_admin = TRUE;
require_once("../../class2.php"); require_once("../../class2.php");
if (!getperms("4")) { header("location:".e_BASE."index.php"); exit ;} if (!getperms("4")) { header("location:".e_BASE."index.php"); 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");
if ($_POST['update_menu']) { if ($_POST['update_menu']) {
//sort/show/hide - Start
if(varset($_POST['external_links'])) {
$_POST['pref']['external_links'] = array();
asort($_POST['external_links_order']);
foreach ($_POST['external_links_order'] as $key => $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']); unset($menu_pref['login_menu']);
$menu_pref['login_menu'] = $_POST['pref']; $menu_pref['login_menu'] = $_POST['pref'];
$tmp = addslashes(serialize($menu_pref)); $tmp = addslashes(serialize($menu_pref));
$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' "); $sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' ");
$ns->tablerender("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>'); $ns->tablerender("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>');
} }
$text = ' $text = '
<div style="text-align:center"> <div style="text-align:center">
<form action="'.e_SELF.'?'.e_QUERY.'" method="post"> <form action="'.e_SELF.'" method="post">
<table style="width:85%" class="fborder" > <table style="width:85%;" class="fborder" >
'.login_menu_class::render_config_links().'
<tr>
<td colspan="2" class="fcaption">'.LOGIN_MENU_L42.'</td>
</tr>
<tr> <tr>
<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L31.'</td> <td style="width:30%" class="forumheader3">'.LOGIN_MENU_L31.'</td>
<td style="width:70%" class="forumheader3"> <td style="width:70%" class="forumheader3">
@@ -93,4 +126,4 @@ $ns->tablerender(LOGIN_MENU_L41, $text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
?> ?>

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_plugins/login_menu/languages/English.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/languages/English.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:35:30 $ | $Date: 2008-01-23 01:12:15 $
| $Author: mcfly_e107 $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -23,7 +23,7 @@ define("LOGIN_MENU_L3", "Signup");
define("LOGIN_MENU_L4", "Forgot password?"); define("LOGIN_MENU_L4", "Forgot password?");
define("LOGIN_MENU_L5", "Welcome"); define("LOGIN_MENU_L5", "Welcome");
define("LOGIN_MENU_L6", "Remember me"); define("LOGIN_MENU_L6", "Remember me");
define("LOGIN_MENU_L7", "Unique user ID not recognised (possible corrupted cookie).<br />Please <a href=\"".e_BASE."index.php?logout\">click here</a> 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_L8", "Logout");
define("LOGIN_MENU_L9", "Login Error"); 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."); 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_L40", "Resend Activation Email");
define("LOGIN_MENU_L41", "Login Menu Settings"); 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');
?>

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_plugins/login_menu/login_menu.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu.php,v $
| $Revision: 1.5 $ | $Revision: 1.6 $
| $Date: 2007-05-27 18:57:36 $ | $Date: 2008-01-23 01:12:15 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -24,10 +24,14 @@ 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.
} }
global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY,$bullet; global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY, $LOGIN_MENU_MESSAGE,
require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php"); $login_menu_shortcodes, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK;
$ip = $e107->getip(); $ip = $e107->getip();
//shortcodes
require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php");
//Bullet
if(defined("BULLET")) if(defined("BULLET"))
{ {
$bullet = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />"; $bullet = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />";
@@ -41,140 +45,139 @@ $ip = $e107->getip();
$bullet = ""; $bullet = "";
} }
if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE) //Corrup cookie
{ if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
$text = "<div style='text-align:center'>".LOGIN_MENU_L7."<br /><br /> {
".$bullet." <a href='".e_BASE."index.php?logout'>".LOGIN_MENU_L8."</a></div>"; $text = "<div class='core-sysmsg loginbox'>".LOGIN_MENU_L7."<br /><br />
$ns->tablerender(LOGIN_MENU_L9, $text, 'login'); {$bullet} <a href='".SITEURL."index.php?logout'>".LOGIN_MENU_L8."</a></div>";
} $ns->tablerender(LOGIN_MENU_L9, $text, 'loginbox_error');
$use_imagecode = ($pref['logcode'] && extension_loaded('gd')); }
//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) $text = '';
{
global $sec_img; // START LOGGED CODE
include_once(e_HANDLER.'secure_img_handler.php');
$sec_img = new secure_image;
}
$text = '';
if (USER == TRUE || ADMIN == TRUE) 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")){ if (file_exists(THEME."login_menu_template.php")){
require(THEME."login_menu_template.php"); require(THEME."login_menu_template.php");
}else{ }else{
require(e_PLUGIN."login_menu/login_menu_template.php"); require(e_PLUGIN."login_menu/login_menu_template.php");
} }
} }
if(!$LOGIN_MENU_LOGGED){
if(!$LOGIN_MENU_LOGGED){ // if still doesn't exist in the user template.
require(e_PLUGIN."login_menu/login_menu_template.php"); require(e_PLUGIN."login_menu/login_menu_template.php");
} }
$text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes); //prepare
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' ");
}
$new_total = 0; $new_total = 0;
$time = USERLV; $time = USERLV;
$menu_data = array();
// ------------ News Stats ----------- // ------------ 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."'"); $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
$new_total += $new_news; $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.")");
if (!$new_news) $new_total += $menu_data['new_news'];
{
$new_news = LOGIN_MENU_L26;
}
$NewItems[] = $new_news.' '.($new_news == 1 ? LOGIN_MENU_L14 : LOGIN_MENU_L15);
} }
// ------------ Comments Stats ----------- // ------------ Comments Stats -----------
if (varsettrue($menu_pref['login_menu']['new_comments'], false) == true) if (varsettrue($menu_pref['login_menu']['new_comments']))
{ {
$new_comments = 0; $menu_data['new_comments'] = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
$new_comments = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time); $new_total += $menu_data['new_comments'];
$new_total += $new_comments;
if (!$new_comments)
{
$new_comments = LOGIN_MENU_L26;
}
$NewItems[] = $new_comments.' '.($new_comments == 1 ? LOGIN_MENU_L18 : LOGIN_MENU_L19);
} }
// ------------ Chatbox Stats ----------- // ------------ Chatbox Stats -----------
if (isset($menu_pref['login_menu']['new_chatbox']) && $menu_pref['login_menu']['new_chatbox'] == true) { if (varsettrue($menu_pref['login_menu']['new_chatbox']) && in_array('chatbox_menu',$eMenuActive))
$display_chats = TRUE; {
$menu_data['new_chat'] = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.$time);
if(in_array('chatbox_menu',$eMenuActive)){ $new_total += $menu_data['new_chat'];
$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);
}
} }
// ------------ Forum Stats ----------- // ------------ 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 = " $qry = "
SELECT count(*) as count FROM #forum_t as t SELECT count(*) as count FROM #forum_t as t
LEFT JOIN #forum as f LEFT JOIN #forum as f
ON t.thread_forum_id = f.forum_id ON t.thread_forum_id = f.forum_id
WHERE t.thread_datestamp > {$time} and f.forum_class IN (".USERCLASS_LIST.") WHERE t.thread_datestamp > {$time} and f.forum_class IN (".USERCLASS_LIST.")
"; ";
if($sql->db_Select_gen($qry)) if($sql->db_Select_gen($qry))
{ {
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$new_forum = $row['count']; $menu_data['new_forum'] = $row['count'];
$new_total += $new_forum; $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 ----------- // ------------ Member Stats -----------
if (isset($menu_pref['login_menu']['new_members']) && $menu_pref['login_menu']['new_members'] == true) { if (varsettrue($menu_pref['login_menu']['new_members']))
$new_users = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time); {
$new_total += $new_users; $menu_data['new_users'] = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time);
if (!$new_users) { $new_total += $menu_data['new_users'];
$new_users = LOGIN_MENU_L26;
}
$NewItems[] = $new_users.' '.($new_users == 1 ? LOGIN_MENU_L22 : LOGIN_MENU_L23);
} }
if (isset($NewItems) && $NewItems) {
$text .= '<br /><br /><span class="smalltext">'.LOGIN_MENU_L25.'<br />'.implode(',<br />', $NewItems).'</span>'; // ------------ Enable stats / other ---------------
if ($new_total) {
if ($sql -> db_Select("plugin", "plugin_installflag", "plugin_path='list_new' AND plugin_installflag='1'")) $menu_data['enable_stats'] = $menu_data ? true : false;
{ $menu_data['new_total'] = $new_total;
$text .= '<br /><a href="'.e_PLUGIN.'list_new/list.php?new">'.LOGIN_MENU_L24.'</a>'; $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')) { if (file_exists(THEME.'images/login_menu.png')) {
$caption = '<img src="'.THEME_ABS.'images/login_menu.png" alt="" />'.LOGIN_MENU_L5.' '.USERNAME; $caption = '<img src="'.THEME_ABS.'images/login_menu.png" alt="" />'.LOGIN_MENU_L5.' '.USERNAME;
} else { } else {
$caption = LOGIN_MENU_L5.' '.USERNAME; $caption = LOGIN_MENU_L5.' '.USERNAME;
} }
//render
$ns->tablerender($caption, $text, 'login'); $ns->tablerender($caption, $text, 'login');
} else {
// END LOGGED CODE
}
// START NOT LOGGED CODE
else
{
//get templates
if (!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE) { if (!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE) {
if (file_exists(THEME."login_menu_template.php")){ if (file_exists(THEME."login_menu_template.php")){
require_once(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){ if(!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE){
require(e_PLUGIN."login_menu/login_menu_template.php"); 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 != '') { if (LOGINMESSAGE != '') {
$text = $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes); $text = $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes);
} }*/
$text .= '<form method="post" action="'.e_SELF.(e_QUERY ? '?'.e_QUERY : '').'">'; $text = '<form method="post" action="'.e_SELF.(e_QUERY ? '?'.e_QUERY : '').'">';
$text .= $tp->parseTemplate($LOGIN_MENU_FORM, true, $login_menu_shortcodes); $text .= $tp->parseTemplate($LOGIN_MENU_FORM, true, $login_menu_shortcodes);
$text .= '</form>'; $text .= '</form>';
} else { //} else {
$text = $tp->parseTemplate("<div style='padding-top: 150px'>{LM_FPW_LINK}</div>", true, $login_menu_shortcodes); // $text = $tp->parseTemplate("<div style='padding-top: 150px'>{LM_FPW_LINK}</div>", true, $login_menu_shortcodes);
} //}
if (file_exists(THEME.'images/login_menu.png')) { if (file_exists(THEME.'images/login_menu.png')) {
@@ -206,7 +210,7 @@ if (USER == TRUE || ADMIN == TRUE)
} else { } else {
$caption = LOGIN_MENU_L5; $caption = LOGIN_MENU_L5;
} }
$ns->tablerender($caption, $text, 'login'); $ns->tablerender($caption, $text, 'loginbox');
} }
// END NOT LOGGED CODE
?> ?>

View File

@@ -0,0 +1,171 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| 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 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
/*
e_loginbox.php example:
//Example link 1
$LBOX_LINK = array();
$LBOX_LINK['link_label'] = 'My link 1';
$LBOX_LINK['link_url'] = e_PLUGIN_ABS.'myplug/me.php?1';
//Additional information?
$lbox_links[] = $LBOX_LINK;
//Not implemented yet
$LBOX_STAT = array();
$LBOX_STAT['stat_item'] = 'my item';
$LBOX_STAT['stat_items'] = 'my items';
$LBOX_STAT['stat_new'] = '1';
$LBOX_STAT['stat_nonew'] = 'no my items';//or empty to omit
//Additional information?
$lbox_stats[] = $LBOX_STAT;
*/
class login_menu_class
{
function get_external_list($sort = true) {
global $sql, $pref, $menu_pref;
require_once(e_HANDLER."file_class.php");
$fl = new e_file;
$list = array();
$list_arr = $fl->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[] = '<a href="'.$value['link_url'].'">'.varsettrue($value['link_label'], '['.LOGIN_MENU_L44.']').'</a>';
}
$links = implode(', ', $links);
$ret .= '
<tr>
<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L37.' '.$links.'</td>
<td style="width:70%; text-align: left;" class="forumheader3">
<table style="margin-left: 0px">
<tr>
<td>
<input type="checkbox" name="external_links['.$id.']" value="1"'.(in_array($id, $enabled) ? ' checked="checked"' : '').' />
</td>
<td>
'.LOGIN_MENU_L43.': <input type="text" class="tbox" style="text-align: right" size="4" maxlength="3" name="external_links_order['.$id.']" value="'.$num.'" />
</td>
</tr>
</table>
</td>
</tr>
';
$num++;
}
if($ret) {
$ret = '<tr><td colspan="2" class="fcaption">'.LOGIN_MENU_L38.'</td></tr>'.$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;
}
}
?>

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_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.2 $ | $Revision: 1.3 $
| $Date: 2007-03-25 09:22:42 $ | $Date: 2008-01-23 01:12:15 $
| $Author: lisa_ $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -97,9 +97,9 @@ if(ADMIN == TRUE){
SC_END SC_END
SC_BEGIN LM_ADMINLINK_BULLET SC_BEGIN LM_ADMINLINK_BULLET
global $bullet; $data = getcachedvars('login_menu_data');
if(ADMIN==TRUE && $bullet !='bullet'){ if(ADMIN==TRUE && $data['link_bullet'] != 'bullet'){
return $bullet; return $data['link_bullet'];
} }
SC_END SC_END
@@ -123,9 +123,8 @@ SC_END
SC_BEGIN LM_BULLET SC_BEGIN LM_BULLET
global $bullet; $data = getcachedvars('login_menu_data');
return $bullet; return $data['link_bullet'];
SC_END SC_END
SC_BEGIN LM_USERSETTINGS SC_BEGIN LM_USERSETTINGS
@@ -143,8 +142,91 @@ $text = ($parm) ? $parm : LOGIN_MENU_L8;
return '<a class="login_menu_link" href="'.e_HTTP.'index.php?logout">'.$text.'</a>'; return '<a class="login_menu_link" href="'.e_HTTP.'index.php?logout">'.$text.'</a>';
SC_END 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'] : '<a href="'.$lbox_item['link_url'].'">'.varsettrue($lbox_item['link_label'], '['.LOGIN_MENU_L44.']').'</a>';
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'] ? '<a href="'.$data['listnew_link'].'">'.LOGIN_MENU_L24.'</a>' : '';
SC_END
SC_BEGIN LM_MESSAGE SC_BEGIN LM_MESSAGE
global $tp; global $tp, $LOGIN_MENU_MESSAGE;
if(!defsettrue('LOGINMESSAGE')) return '';
if($parm == "popup"){ if($parm == "popup"){
$srch = array("<br />","'"); $srch = array("<br />","'");
$rep = array("\\n","\'"); $rep = array("\\n","\'");
@@ -152,9 +234,12 @@ if($parm == "popup"){
alert('".$tp->toJS(LOGINMESSAGE)."'); alert('".$tp->toJS(LOGINMESSAGE)."');
</script>"; </script>";
}else{ }else{
return LOGINMESSAGE; return $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes);
} }
SC_END SC_END
SC_BEGIN LM_MESSAGE_TEXT
return defsettrue('LOGINMESSAGE', '');
SC_END
*/ */
?> ?>

View File

@@ -11,60 +11,99 @@
| 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_template.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_template.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.2 $
| $Date: 2006-12-02 04:35:30 $ | $Date: 2008-01-23 01:12:15 $
| $Author: mcfly_e107 $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
$sc_style['LM_SIGNUP_LINK']['pre'] = "<br />[ ";
$sc_style['LM_SIGNUP_LINK']['post'] = " ]";
$sc_style['LM_FPW_LINK']['pre'] = "<br />[ ";
$sc_style['LM_FPW_LINK']['post'] = " ]";
$sc_style['LM_RESEND_LINK']['pre'] = "<br />[ ";
$sc_style['LM_RESEND_LINK']['post'] = " ]";
$sc_style['LM_REMEMBERME']['pre'] = "<br />";
$sc_style['LM_REMEMBERME']['post'] = "";
if (!isset($LOGIN_MENU_FORM)){ if (!isset($LOGIN_MENU_FORM)){
$sc_style['LM_SIGNUP_LINK']['pre'] = "<br />[ ";
$sc_style['LM_SIGNUP_LINK']['post'] = " ]";
$sc_style['LM_FPW_LINK']['pre'] = "<br />[ ";
$sc_style['LM_FPW_LINK']['post'] = " ]";
$sc_style['LM_RESEND_LINK']['pre'] = "<br />[ ";
$sc_style['LM_RESEND_LINK']['post'] = " ]";
$sc_style['LM_REMEMBERME']['pre'] = "<br />";
$sc_style['LM_REMEMBERME']['post'] = "";
$LOGIN_MENU_FORM = " $LOGIN_MENU_FORM = "
<div style='text-align: center'>". {LM_MESSAGE}
LOGIN_MENU_L1." <div style='text-align: center'>
<br />\n ".LOGIN_MENU_L1."<br />
{LM_USERNAME_INPUT} {LM_USERNAME_INPUT}<br />
<br />". ".LOGIN_MENU_L2."<br />
LOGIN_MENU_L2." {LM_PASSWORD_INPUT}<br />
<br />\n {LM_IMAGECODE}
{LM_PASSWORD_INPUT} {LM_LOGINBUTTON}
<br />\n {LM_REMEMBERME}<br />
{LM_IMAGECODE} {LM_SIGNUP_LINK}
{LM_LOGINBUTTON} {LM_FPW_LINK}
{LM_REMEMBERME} {LM_RESEND_LINK}
<br /> </div>
{LM_SIGNUP_LINK}
{LM_FPW_LINK}
{LM_RESEND_LINK}
</div>
"; ";
} }
if (!isset($LOGIN_MENU_LOGGED)){ if (!isset($LOGIN_MENU_LOGGED)){
$sc_style['LM_ADMINLINK']['pre'] = ""; $sc_style['LM_ADMINLINK']['pre'] = '';
$sc_style['LM_ADMINLINK']['post'] = "<br />"; $sc_style['LM_ADMINLINK']['post'] = '<br />';
$sc_style['LM_EXTERNAL_LINKS']['pre'] = '<br />';
$sc_style['LM_EXTERNAL_LINKS']['post'] = '<br />';
$sc_style['LM_STATS']['pre'] = '<br /><br /><span class="smalltext">'.LOGIN_MENU_L25.':<br />';
$sc_style['LM_STATS']['post'] = '</span>';
$sc_style['LM_LISTNEW_LINK']['pre'] = '<br />';
$sc_style['LM_LISTNEW_LINK']['post'] = '';
$LOGIN_MENU_LOGGED = " $LOGIN_MENU_LOGGED = '
{LM_MAINTENANCE} {LM_MAINTENANCE}
{LM_ADMINLINK_BULLET} {LM_ADMINLINK} {LM_ADMINLINK_BULLET} {LM_ADMINLINK}
{LM_BULLET} {LM_USERSETTINGS}<br /> {LM_BULLET} {LM_USERSETTINGS}<br />
{LM_BULLET} {LM_PROFILE}<br /> {LM_BULLET} {LM_PROFILE}<br />
{LM_EXTERNAL_LINKS}
{LM_BULLET} {LM_LOGOUT} {LM_BULLET} {LM_LOGOUT}
"; {LM_STATS}
{LM_LISTNEW_LINK}
';
}
if (!isset($LOGIN_MENU_EXTERNAL_LINK)){
$LOGIN_MENU_EXTERNAL_LINK = '
{LM_BULLET} {LM_EXTERNAL_LINK}<br />
';
}
if (!isset($LOGIN_MENU_STATS)){
$sc_style['LM_NEW_NEWS']['pre'] = '';
$sc_style['LM_NEW_NEWS']['post'] = '<br />';
$sc_style['LM_NEW_COMMENTS']['pre'] = '';
$sc_style['LM_NEW_COMMENTS']['post'] = '<br />';
$sc_style['LM_NEW_CHAT']['pre'] = '';
$sc_style['LM_NEW_CHAT']['post'] = '<br />';
$sc_style['LM_NEW_FORUM']['pre'] = '';
$sc_style['LM_NEW_FORUM']['post'] = '<br />';
$sc_style['LM_NEW_USERS']['pre'] = '';
$sc_style['LM_NEW_USERS']['post'] = '<br />';
$LOGIN_MENU_STATS = '
{LM_NEW_NEWS}
{LM_NEW_COMMENTS}
{LM_NEW_CHAT}
{LM_NEW_FORUM}
{LM_NEW_USERS}
';
} }
if (!isset($LOGIN_MENU_MESSAGE)){ if (!isset($LOGIN_MENU_MESSAGE)){
$LOGIN_MENU_MESSAGE = '<div style="text-align: center;">{LM_MESSAGE}</div>'; $LOGIN_MENU_MESSAGE = '<div class="core-sysmsg loginbox">{LM_MESSAGE_TEXT}</div>';
} }
?> ?>