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:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
@@ -12,31 +11,65 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/config.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 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
$eplug_admin = TRUE;
|
||||
|
||||
require_once("../../class2.php");
|
||||
if (!getperms("4")) { header("location:".e_BASE."index.php"); exit ;}
|
||||
|
||||
include_lan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
|
||||
require_once(e_ADMIN."auth.php");
|
||||
|
||||
require_once(e_PLUGIN."login_menu/login_menu_class.php");
|
||||
|
||||
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']);
|
||||
$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("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>');
|
||||
|
||||
}
|
||||
|
||||
$text = '
|
||||
<div style="text-align:center">
|
||||
<form action="'.e_SELF.'?'.e_QUERY.'" method="post">
|
||||
<table style="width:85%" class="fborder" >
|
||||
<form action="'.e_SELF.'" method="post">
|
||||
<table style="width:85%;" class="fborder" >
|
||||
|
||||
'.login_menu_class::render_config_links().'
|
||||
|
||||
<tr>
|
||||
<td colspan="2" class="fcaption">'.LOGIN_MENU_L42.'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L31.'</td>
|
||||
|
@@ -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).<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_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');
|
||||
|
||||
?>
|
@@ -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 = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />";
|
||||
@@ -41,23 +45,37 @@ $ip = $e107->getip();
|
||||
$bullet = "";
|
||||
}
|
||||
|
||||
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>";
|
||||
$ns->tablerender(LOGIN_MENU_L9, $text, 'login');
|
||||
}
|
||||
$use_imagecode = ($pref['logcode'] && extension_loaded('gd'));
|
||||
//Corrup cookie
|
||||
if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
|
||||
{
|
||||
$text = "<div class='core-sysmsg loginbox'>".LOGIN_MENU_L7."<br /><br />
|
||||
{$bullet} <a href='".SITEURL."index.php?logout'>".LOGIN_MENU_L8."</a></div>";
|
||||
$ns->tablerender(LOGIN_MENU_L9, $text, 'loginbox_error');
|
||||
}
|
||||
|
||||
if ($use_imagecode)
|
||||
{
|
||||
//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;
|
||||
}
|
||||
$text = '';
|
||||
}
|
||||
|
||||
$text = '';
|
||||
|
||||
// START LOGGED CODE
|
||||
if (USER == TRUE || ADMIN == TRUE)
|
||||
{
|
||||
|
||||
//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");
|
||||
@@ -65,116 +83,101 @@ if (USER == TRUE || ADMIN == TRUE)
|
||||
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 (isset($NewItems) && $NewItems) {
|
||||
$text .= '<br /><br /><span class="smalltext">'.LOGIN_MENU_L25.'<br />'.implode(',<br />', $NewItems).'</span>';
|
||||
if ($new_total) {
|
||||
if ($sql -> db_Select("plugin", "plugin_installflag", "plugin_path='list_new' AND plugin_installflag='1'"))
|
||||
if (varsettrue($menu_pref['login_menu']['new_members']))
|
||||
{
|
||||
$text .= '<br /><a href="'.e_PLUGIN.'list_new/list.php?new">'.LOGIN_MENU_L24.'</a>';
|
||||
}
|
||||
}
|
||||
$menu_data['new_users'] = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time);
|
||||
$new_total += $menu_data['new_users'];
|
||||
}
|
||||
|
||||
// ------------ 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 = '<img src="'.THEME_ABS.'images/login_menu.png" alt="" />'.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");
|
||||
@@ -186,19 +189,20 @@ if (USER == TRUE || ADMIN == TRUE)
|
||||
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 .= '<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 .= '</form>';
|
||||
} else {
|
||||
$text = $tp->parseTemplate("<div style='padding-top: 150px'>{LM_FPW_LINK}</div>", true, $login_menu_shortcodes);
|
||||
}
|
||||
//} else {
|
||||
// $text = $tp->parseTemplate("<div style='padding-top: 150px'>{LM_FPW_LINK}</div>", 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
|
||||
?>
|
171
e107_plugins/login_menu/login_menu_class.php
Normal file
171
e107_plugins/login_menu/login_menu_class.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -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 '<a class="login_menu_link" href="'.e_HTTP.'index.php?logout">'.$text.'</a>';
|
||||
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
|
||||
global $tp;
|
||||
global $tp, $LOGIN_MENU_MESSAGE;
|
||||
if(!defsettrue('LOGINMESSAGE')) return '';
|
||||
if($parm == "popup"){
|
||||
$srch = array("<br />","'");
|
||||
$rep = array("\\n","\'");
|
||||
@@ -152,9 +234,12 @@ if($parm == "popup"){
|
||||
alert('".$tp->toJS(LOGINMESSAGE)."');
|
||||
</script>";
|
||||
}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
|
||||
*/
|
||||
?>
|
@@ -11,39 +11,35 @@
|
||||
| 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'] = "<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)){
|
||||
$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 = "
|
||||
<div style='text-align: center'>".
|
||||
LOGIN_MENU_L1."
|
||||
<br />\n
|
||||
{LM_USERNAME_INPUT}
|
||||
<br />".
|
||||
LOGIN_MENU_L2."
|
||||
<br />\n
|
||||
{LM_PASSWORD_INPUT}
|
||||
<br />\n
|
||||
{LM_MESSAGE}
|
||||
<div style='text-align: center'>
|
||||
".LOGIN_MENU_L1."<br />
|
||||
{LM_USERNAME_INPUT}<br />
|
||||
".LOGIN_MENU_L2."<br />
|
||||
{LM_PASSWORD_INPUT}<br />
|
||||
{LM_IMAGECODE}
|
||||
{LM_LOGINBUTTON}
|
||||
{LM_REMEMBERME}
|
||||
<br />
|
||||
{LM_REMEMBERME}<br />
|
||||
{LM_SIGNUP_LINK}
|
||||
{LM_FPW_LINK}
|
||||
{LM_RESEND_LINK}
|
||||
@@ -52,19 +48,62 @@ if (!isset($LOGIN_MENU_FORM)){
|
||||
}
|
||||
|
||||
if (!isset($LOGIN_MENU_LOGGED)){
|
||||
$sc_style['LM_ADMINLINK']['pre'] = "";
|
||||
$sc_style['LM_ADMINLINK']['post'] = "<br />";
|
||||
$sc_style['LM_ADMINLINK']['pre'] = '';
|
||||
$sc_style['LM_ADMINLINK']['post'] = '<br />';
|
||||
|
||||
$LOGIN_MENU_LOGGED = "
|
||||
$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 = '
|
||||
{LM_MAINTENANCE}
|
||||
{LM_ADMINLINK_BULLET} {LM_ADMINLINK}
|
||||
{LM_BULLET} {LM_USERSETTINGS}<br />
|
||||
{LM_BULLET} {LM_PROFILE}<br />
|
||||
{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}<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)){
|
||||
$LOGIN_MENU_MESSAGE = '<div style="text-align: center;">{LM_MESSAGE}</div>';
|
||||
$LOGIN_MENU_MESSAGE = '<div class="core-sysmsg loginbox">{LM_MESSAGE_TEXT}</div>';
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user