mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
login menu - done
This commit is contained in:
parent
865c2b7c0a
commit
de0ae158a7
@ -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.3 $
|
||||
| $Date: 2008-02-01 00:37:10 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-02-06 00:23:28 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -61,8 +61,7 @@ if ($_POST['update_menu']) {
|
||||
$_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));
|
||||
|
@ -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.3 $
|
||||
| $Date: 2008-02-01 00:37:10 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-02-06 00:23:28 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -74,5 +74,6 @@ 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');
|
||||
define('LOGIN_MENU_L48', 'Menu Config');
|
||||
|
||||
?>
|
@ -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.7 $
|
||||
| $Date: 2008-02-01 00:37:10 $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-02-06 00:23:28 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -24,8 +24,8 @@ 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, $LOGIN_MENU_STATITEM,
|
||||
$login_menu_shortcodes, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK;
|
||||
global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY, $LOGIN_MENU_MESSAGE, $LOGIN_MENU_STATITEM, $LM_STATITEM_SEPARATOR,
|
||||
$login_menu_shortcodes, $LOGIN_MENU_FORM, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK;
|
||||
$ip = $e107->getip();
|
||||
|
||||
//shortcodes
|
||||
@ -35,17 +35,20 @@ $ip = $e107->getip();
|
||||
if(defined("BULLET"))
|
||||
{
|
||||
$bullet = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />";
|
||||
$bullet_src = THEME_ABS."images/".BULLET;
|
||||
}
|
||||
elseif(file_exists(THEME."images/bullet2.gif"))
|
||||
{
|
||||
$bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
|
||||
$bullet_src = THEME_ABS."images/bullet2.gif";
|
||||
}
|
||||
else
|
||||
{
|
||||
$bullet = "";
|
||||
$bullet_src = "";
|
||||
}
|
||||
|
||||
//Corrup cookie
|
||||
//Corrup cookie - template? - TODO
|
||||
if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
|
||||
{
|
||||
$text = "<div class='core-sysmsg loginbox'>".LOGIN_MENU_L7."<br /><br />
|
||||
@ -70,7 +73,7 @@ if (USER == TRUE || ADMIN == TRUE)
|
||||
{
|
||||
require_once(e_PLUGIN."login_menu/login_menu_class.php");
|
||||
|
||||
//login class ??? - REMOVE IT
|
||||
//login class ??? - TODO
|
||||
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' ");
|
||||
@ -109,35 +112,6 @@ 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))
|
||||
{
|
||||
$menu_data['new_chat'] = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.$time);
|
||||
$new_total += $menu_data['new_chat'];
|
||||
}
|
||||
|
||||
// ------------ Forum Stats -----------
|
||||
|
||||
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
|
||||
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();
|
||||
$menu_data['new_forum'] = $row['count'];
|
||||
$new_total += $menu_data['new_forum'];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ------------ Member Stats -----------
|
||||
|
||||
@ -149,14 +123,15 @@ if (USER == TRUE || ADMIN == TRUE)
|
||||
|
||||
// ------------ Enable stats / other ---------------
|
||||
|
||||
$menu_data['enable_stats'] = $menu_data ? true : false;
|
||||
$menu_data['new_total'] = $new_total;
|
||||
$menu_data['enable_stats'] = $menu_data || $menu_pref['login_menu']['external_stats'] ? true : false;
|
||||
$menu_data['new_total'] = $new_total + login_menu_class::get_stats_total();
|
||||
$menu_data['link_bullet'] = $bullet;
|
||||
$menu_data['link_bullet_src'] = $bullet_src;
|
||||
|
||||
// ------------ List New Link ---------------
|
||||
|
||||
$menu_data['listnew_link'] = '';
|
||||
if ($new_total && array_key_exists('list_new', $pref['plug_installed']))
|
||||
if ($menu_data['new_total'] && array_key_exists('list_new', $pref['plug_installed']))
|
||||
{
|
||||
$menu_data['listnew_link'] = e_PLUGIN.'list_new/list.php?new';
|
||||
}
|
||||
@ -173,7 +148,7 @@ if (USER == TRUE || ADMIN == TRUE)
|
||||
}
|
||||
|
||||
//render
|
||||
$ns->tablerender($caption, $text, 'login');
|
||||
$ns->tablerender($caption, $text, 'loginbox');
|
||||
|
||||
// END LOGGED CODE
|
||||
}
|
||||
@ -191,22 +166,10 @@ else
|
||||
if(!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE){
|
||||
require(e_PLUGIN."login_menu/login_menu_template.php");
|
||||
}
|
||||
|
||||
|
||||
//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 .= $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);
|
||||
//}
|
||||
|
||||
$text = '<form method="post" action="'.e_SELF.(e_QUERY ? '?'.e_QUERY : '').'">';
|
||||
$text .= $tp->parseTemplate($LOGIN_MENU_FORM, true, $login_menu_shortcodes);
|
||||
$text .= '</form>';
|
||||
|
||||
if (file_exists(THEME.'images/login_menu.png')) {
|
||||
$caption = '<img src="'.THEME_ABS.'images/login_menu.png" alt="" />'.LOGIN_MENU_L5;
|
||||
|
@ -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.2 $
|
||||
| $Date: 2008-02-01 00:37:10 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-02-06 00:23:28 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -26,23 +26,31 @@ e_loginbox.php example:
|
||||
$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
|
||||
//Example stats
|
||||
$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_coreplugs() {
|
||||
return array('forum', 'chatbox_menu');
|
||||
function get_coreplugs($active=true) {
|
||||
global $pref;
|
||||
|
||||
$list = array('forum', 'chatbox_menu');
|
||||
$ret = array();
|
||||
|
||||
foreach ($list as $value) {
|
||||
if(!$active || array_key_exists($value, $pref['plug_installed']))
|
||||
$ret[] = $value;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_external_list($sort = true) {
|
||||
@ -87,7 +95,7 @@ class login_menu_class
|
||||
|
||||
$ret = array();
|
||||
$lbox_admin = varsettrue($eplug_admin, false);
|
||||
$coreplugs = login_menu_class::get_coreplugs();
|
||||
$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();
|
||||
@ -129,22 +137,6 @@ 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;
|
||||
@ -249,8 +241,7 @@ class login_menu_class
|
||||
$ret = '';
|
||||
$lbox_infos = login_menu_class::parse_external_list(false);
|
||||
$lbox_infos = varsettrue($lbox_infos['stats'], array());
|
||||
//$lbox_infos = array_merge(login_menu_class::parse_coreplug_list(false), $lbox_infos);
|
||||
//print_a($lbox_infos);
|
||||
|
||||
if(!$lbox_infos) return '';
|
||||
|
||||
$enabled = varsettrue($menu_pref['login_menu']['external_stats']) ? explode(',', $menu_pref['login_menu']['external_stats']) : array();
|
||||
@ -278,6 +269,28 @@ class login_menu_class
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_stats_total() {
|
||||
global $menu_pref;
|
||||
|
||||
$lbox_infos = login_menu_class::parse_external_list(true, false);
|
||||
if(!varsettrue($lbox_infos['stats']))
|
||||
return 0;
|
||||
|
||||
$ret = 0;
|
||||
$lbox_active_sorted = $menu_pref['login_menu']['external_stats'] ? explode(',', $menu_pref['login_menu']['external_stats']) : array();
|
||||
|
||||
foreach ($lbox_active_sorted as $stackid) {
|
||||
if(!varset($lbox_infos['stats'][$stackid]))
|
||||
continue;
|
||||
foreach ($lbox_infos['stats'][$stackid] as $lbox_item) {
|
||||
if($lbox_item['stat_new'])
|
||||
$ret += $lbox_item['stat_new'];
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_plugin_data($plugid) {
|
||||
|
||||
if(($tmp = getcachedvars('loginbox_eplug_data_'.$plugid)) !== FALSE) return $tmp;
|
||||
|
@ -11,47 +11,65 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_shortcodes.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-02-01 00:37:10 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2008-02-06 00:23:28 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
global $tp;
|
||||
$login_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
||||
|
||||
/*
|
||||
SC_BEGIN LM_USERNAME_INPUT
|
||||
return "<input class='tbox login user' type='text' name='username' size='15' value='' maxlength='30' />\n";
|
||||
return "<input class='tbox login user' type='text' name='username' id='username' size='15' value='' maxlength='30' />\n";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_PASSWORD_INPUT
|
||||
return "<input class='tbox login pass' type='password' name='userpass' size='15' value='' maxlength='20' />\n\n";
|
||||
return "<input class='tbox login pass' type='password' name='userpass' id='userpass' size='15' value='' maxlength='20' />\n\n";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_IMAGECODE
|
||||
global $use_imagecode, $sec_img;
|
||||
if($use_imagecode)
|
||||
{
|
||||
return '<input type="hidden" name="rand_num" value="'.$sec_img->random_number.'" />
|
||||
'.$sec_img->r_image().'
|
||||
<br /><input class="tbox login verify" type="text" name="code_verify" size="15" maxlength="20" /><br />';
|
||||
//DEPRECATED - use LM_IMAGECODE_NUMBER, LM_IMAGECODE_BOX instead
|
||||
if($use_imagecode) {
|
||||
return '<input type="hidden" name="rand_num" id="rand_num" value="'.$sec_img->random_number.'" />
|
||||
'.$sec_img->r_image().'
|
||||
<br /><input class="tbox login verify" type="text" name="code_verify" id="code_verify" size="15" maxlength="20" /><br />';
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_IMAGECODE_NUMBER
|
||||
global $use_imagecode, $sec_img;
|
||||
if($use_imagecode) {
|
||||
return '<input type="hidden" name="rand_num" id="rand_num" value="'.$sec_img->random_number.'" />
|
||||
'.$sec_img->r_image();
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_IMAGECODE_BOX
|
||||
global $use_imagecode, $sec_img;
|
||||
if($use_imagecode) {
|
||||
return '<input class="tbox login verify" type="text" name="code_verify" id="code_verify" size="15" maxlength="20" />';
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_LOGINBUTTON
|
||||
return "<input class='button' type='submit' name='userlogin' value='".LOGIN_MENU_L28."' />";
|
||||
return "<input class='button login' type='submit' name='userlogin' id='userlogin' value='".LOGIN_MENU_L28."' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_REMEMBERME
|
||||
global $pref;
|
||||
if($parm == "hidden"){
|
||||
return "<input type='hidden' name='autologin' value='1' />";
|
||||
return "<input type='hidden' name='autologin' id='autologin' value='1' />";
|
||||
}
|
||||
if($pref['user_tracking'] != "session")
|
||||
{
|
||||
return "<input type='checkbox' name='autologin' value='1' checked='checked' />".LOGIN_MENU_L6;
|
||||
return "<input type='checkbox' name='autologin' id='autologin' value='1' checked='checked' />".($parm ? $parm : "<label for='autologin'>".LOGIN_MENU_L6."</label>");
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_SIGNUP_LINK
|
||||
@ -60,19 +78,19 @@ if ($pref['user_reg'])
|
||||
{
|
||||
if (!$pref['auth_method'] || $pref['auth_method'] == 'e107')
|
||||
{
|
||||
return "<a class='login_menu_link signup' href='".e_SIGNUP."' title=\"".LOGIN_MENU_L3."\">".LOGIN_MENU_L3."</a>";
|
||||
return $parm == 'href' ? e_SIGNUP : "<a class='login_menu_link signup' id='login_menu_link_signup' href='".e_SIGNUP."' title=\"".LOGIN_MENU_L3."\">".LOGIN_MENU_L3."</a>";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_FPW_LINK
|
||||
global $pref;
|
||||
if (!$pref['auth_method'] || $pref['auth_method'] == 'e107')
|
||||
{
|
||||
return "<a class='login_menu_link fpw' href='".e_BASE."fpw.php' title=\"".LOGIN_MENU_L4."\">".LOGIN_MENU_L4."</a>";
|
||||
return $parm == 'href' ? SITEURL.'fpw.php' : "<a class='login_menu_link fpw' id='login_menu_link_fpw' href='".SITEURL."fpw.php' title=\"".LOGIN_MENU_L4."\">".LOGIN_MENU_L4."</a>";
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_RESEND_LINK
|
||||
@ -82,76 +100,87 @@ if ($pref['user_reg'])
|
||||
if(isset($pref['user_reg_veri']) && $pref['user_reg_veri'] == 1){
|
||||
if (!$pref['auth_method'] || $pref['auth_method'] == 'e107' )
|
||||
{
|
||||
return "<a class='login_menu_link resend' href='".e_SIGNUP."?resend' title=\"".LOGIN_MENU_L40."\">".LOGIN_MENU_L40."</a>";
|
||||
return $parm == 'href' ? e_SIGNUP.'?resend' : "<a class='login_menu_link resend' id=login_menu_link_resend' href='".e_SIGNUP."?resend' title=\"".LOGIN_MENU_L40."\">".LOGIN_MENU_L40."</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_MAINTENANCE
|
||||
global $pref;
|
||||
if(ADMIN == TRUE){
|
||||
return ($pref['maintainance_flag'] == 1 ? '<div style="text-align:center"><strong>'.LOGIN_MENU_L10.'</strong></div><br />' : '' );
|
||||
return ($pref['maintainance_flag'] == 1 ? LOGIN_MENU_L10 : '' );
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_ADMINLINK_BULLET
|
||||
$data = getcachedvars('login_menu_data');
|
||||
if(ADMIN==TRUE && $data['link_bullet'] != 'bullet'){
|
||||
return $data['link_bullet'];
|
||||
if(ADMIN==TRUE){
|
||||
return $parm == 'src' ? $data['link_bullet_src'] : $data['link_bullet'];
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_ADMINLINK
|
||||
global $ADMIN_DIRECTORY, $eplug_admin;
|
||||
|
||||
//die(e_PAGE);
|
||||
|
||||
if(ADMIN == TRUE) {
|
||||
if (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || $eplug_admin == true || substr(e_PAGE, 0, 6) == 'admin_')
|
||||
{
|
||||
return '<a class="login_menu_link" href="'.e_BASE.'index.php">'.LOGIN_MENU_L39.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<a class="login_menu_link" href="'.e_ADMIN_ABS.'admin.php">'.LOGIN_MENU_L11.'</a>';
|
||||
}
|
||||
return $parm == 'href' ? e_ADMIN_ABS.'admin.php' : '<a class="login_menu_link admin" id="login_menu_link_admin" href="'.e_ADMIN_ABS.'admin.php">'.LOGIN_MENU_L11.'</a>';
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN LM_ADMIN_CONFIGURE
|
||||
if(ADMIN == TRUE) {
|
||||
return $parm == 'href' ? e_PLUGIN.'login_menu/config.php' : '<a class="login_menu_link config" id="login_menu_link_config" href="'.e_PLUGIN.'login_menu/config.php">'.LOGIN_MENU_L48.'</a>';
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_BULLET
|
||||
$data = getcachedvars('login_menu_data');
|
||||
return $data['link_bullet'];
|
||||
return $parm == 'src' ? $data['link_bullet_src'] : $data['link_bullet'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_USERSETTINGS
|
||||
$text = ($parm) ? $parm : LOGIN_MENU_L12;
|
||||
return '<a class="login_menu_link" href="'.e_HTTP.'usersettings.php">'.$text.'</a>';
|
||||
return '<a class="login_menu_link usersettings" id="login_menu_link_usersettings" href="'.e_HTTP.'usersettings.php">'.$text.'</a>';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_USERSETTINGS_HREF
|
||||
return e_HTTP.'usersettings.php';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_PROFILE
|
||||
$text = ($parm) ? $parm : LOGIN_MENU_L13;
|
||||
return '<a class="login_menu_link" href="'.e_HTTP.'user.php?id.'.USERID.'">'.$text.'</a>';
|
||||
return '<a class="login_menu_link profile" id="login_menu_link_profile" href="'.e_HTTP.'user.php?id.'.USERID.'">'.$text.'</a>';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_PROFILE_HREF
|
||||
return e_HTTP.'user.php?id.'.USERID;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_LOGOUT
|
||||
$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 logout" id="login_menu_link_logout" href="'.e_HTTP.'index.php?logout">'.$text.'</a>';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_LOGOUT_HREF
|
||||
return e_HTTP.'index.php?logout';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_EXTERNAL_LINKS
|
||||
global $tp, $menu_pref, $login_menu_shortcodes, $LOGIN_MENU_EXTERNAL_LINK;
|
||||
if(!varsettrue($menu_pref['login_menu']['external_links'])) return '';
|
||||
$lbox_infos = login_menu_class::parse_external_list(true, false);
|
||||
$lbox_active = $menu_pref['login_menu']['external_links'] ? explode(',', $menu_pref['login_menu']['external_links']) : array();
|
||||
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) {
|
||||
foreach ($lbox_active as $stackid) {
|
||||
$lbox_items = login_menu_class::clean_links(varset($lbox_infos['links'][$stackid]));
|
||||
if(!$lbox_items) continue;
|
||||
foreach ($lbox_items as $num=>$lbox_item) {
|
||||
$lbox_item['link_id'] = $stackid.'_'.$num;
|
||||
cachevars('login_menu_linkdata', $lbox_item);
|
||||
$ret .= $tp -> parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes);
|
||||
}
|
||||
@ -161,7 +190,7 @@ 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>';
|
||||
return $parm == 'href' ? $lbox_item['link_url'] : '<a href="'.$lbox_item['link_url'].'" class="login_menu_link external" id="login_menu_link_external_'.$lbox_item['link_id'].'">'.varsettrue($lbox_item['link_label'], '['.LOGIN_MENU_L44.']').'</a>';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_EXTERNAL_LINK_LABEL
|
||||
@ -177,66 +206,79 @@ return $tp -> parseTemplate($LOGIN_MENU_STATS, true, $login_menu_shortcodes);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_NEW_NEWS
|
||||
global $LOGIN_MENU_STATITEM, $tp;
|
||||
$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);
|
||||
$tmp = array();
|
||||
if($data['new_news']){
|
||||
$tmp['LM_STAT_NEW'] = "return '".$data['new_news']."';";
|
||||
$tmp['LM_STAT_LABEL'] = $data['new_news'] == 1 ? "return '".LOGIN_MENU_L14."';" : "return '".LOGIN_MENU_L15."';";
|
||||
$tmp['LM_STAT_EMPTY'] = '';
|
||||
} else {
|
||||
$tmp['LM_STAT_NEW'] = '';
|
||||
$tmp['LM_STAT_LABEL'] = '';
|
||||
$tmp['LM_STAT_EMPTY'] = "return '".LOGIN_MENU_L26." ".LOGIN_MENU_L15."';";
|
||||
}
|
||||
return $tp -> parseTemplate($LOGIN_MENU_STATITEM, false, $tmp);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_NEW_COMMENTS
|
||||
global $LOGIN_MENU_STATITEM, $tp;
|
||||
$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);
|
||||
$tmp = array();
|
||||
if($data['new_comments']){
|
||||
$tmp['LM_STAT_NEW'] = "return '".$data['new_comments']."';";
|
||||
$tmp['LM_STAT_LABEL'] = $data['new_comments'] == 1 ? "return '".LOGIN_MENU_L18."';" : "return '".LOGIN_MENU_L19."';";
|
||||
$tmp['LM_STAT_EMPTY'] = '';
|
||||
} else {
|
||||
$tmp['LM_STAT_NEW'] = '';
|
||||
$tmp['LM_STAT_LABEL'] = '';
|
||||
$tmp['LM_STAT_EMPTY'] = "return '".LOGIN_MENU_L26." ".LOGIN_MENU_L19."';";
|
||||
}
|
||||
return $tp -> parseTemplate($LOGIN_MENU_STATITEM, false, $tmp);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_NEW_USERS
|
||||
global $LOGIN_MENU_STATITEM, $tp;
|
||||
$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);
|
||||
$tmp = array();
|
||||
if($data['new_users']){
|
||||
$tmp['LM_STAT_NEW'] = "return '".$data['new_users']."';";
|
||||
$tmp['LM_STAT_LABEL'] = $data['new_users'] == 1 ? "return '".LOGIN_MENU_L22."';" : "return '".LOGIN_MENU_L23."';";
|
||||
$tmp['LM_STAT_EMPTY'] = '';
|
||||
} else {
|
||||
$tmp['LM_STAT_NEW'] = '';
|
||||
$tmp['LM_STAT_LABEL'] = '';
|
||||
$tmp['LM_STAT_EMPTY'] = "return '".LOGIN_MENU_L26." ".LOGIN_MENU_L23."';";
|
||||
}
|
||||
return $tp -> parseTemplate($LOGIN_MENU_STATITEM, false, $tmp);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_PLUGIN_STATS
|
||||
global $tp, $menu_pref, $LOGIN_MENU_STATITEM, $LM_STATITEM_SEPARATOR;
|
||||
global $tp, $menu_pref, $new_total, $LOGIN_MENU_STATITEM, $LM_STATITEM_SEPARATOR;
|
||||
if(!varsettrue($menu_pref['login_menu']['external_stats'])) return '';
|
||||
$lbox_infos = login_menu_class::parse_external_list(true, false);
|
||||
if(!varsettrue($lbox_infos['stats'])) return '';
|
||||
$lbox_active_sorted = $menu_pref['login_menu']['external_stats'] ? explode(',', $menu_pref['login_menu']['external_stats']) : array();
|
||||
$ret = array();
|
||||
$sep = varset($LM_STATITEM_SEPARATOR, '<br />');
|
||||
foreach ($lbox_infos['stats'] as $id => $items) {
|
||||
foreach ($items as $lbox_item) {
|
||||
foreach ($lbox_active_sorted as $stackid) {
|
||||
if(!varset($lbox_infos['stats'][$stackid])) continue;
|
||||
foreach ($lbox_infos['stats'][$stackid] as $lbox_item) {
|
||||
$tmp = array();
|
||||
if($lbox_item["stat_new"]){
|
||||
if($lbox_item['stat_new']){
|
||||
$tmp['LM_STAT_NEW'] = "return '{$lbox_item['stat_new']}';";
|
||||
$tmp['LM_STAT_LABEL'] = $lbox_item["stat_new"] == 1 ? "return '{$lbox_item['stat_item']}';" : "return '{$lbox_item['stat_items']}';";
|
||||
$tmp['LM_STAT_EMPTY'] = '';
|
||||
$new_total += $lbox_item['stat_new'];
|
||||
} else {
|
||||
//if(empty($lbox_item['stat_nonew'])) continue;
|
||||
$tmp['LM_STAT_NEW'] = '';
|
||||
$tmp['LM_STAT_LABEL'] = '';
|
||||
$tmp['LM_STAT_EMPTY'] = "return '{$lbox_item['stat_nonew']}';";
|
||||
}
|
||||
//print_a($lbox_infos['stats']);
|
||||
$ret[] = $tp -> parseTemplate($LOGIN_MENU_STATITEM, false, $tmp);
|
||||
}
|
||||
}
|
||||
@ -246,7 +288,7 @@ 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>' : '';
|
||||
return $data['listnew_link'] ? '<a href="'.$data['listnew_link'].'" class="login_menu_link listnew" id="login_menu_link_listnew">'.LOGIN_MENU_L24.'</a>' : '';
|
||||
SC_END
|
||||
|
||||
SC_BEGIN LM_MESSAGE
|
||||
|
@ -11,13 +11,33 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_template.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-02-01 00:37:10 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-02-06 00:23:28 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
if (!isset($LOGIN_MENU_FORM)){
|
||||
|
||||
/*
|
||||
NEW SHORTCODES/PARAMETERS:
|
||||
|
||||
$LOGIN_MENU_LOGGED
|
||||
- LM_REMEMBERME (parm: 'href' or empty)
|
||||
- LM_SIGNUP_LINK (parm: 'href' or empty)
|
||||
- LM_FPW_LINK (parm: 'href' or empty)
|
||||
- LM_RESEND_LINK (parm: 'href' or empty)
|
||||
- LM_IMAGECODE_NUMBER
|
||||
- LM_IMAGECODE_BOX
|
||||
|
||||
$LOGIN_MENU_MESSAGE
|
||||
- LM_MESSAGE_TEXT
|
||||
|
||||
DEPRECATED SHORTCODES:
|
||||
- LM_IMAGECODE - use LM_IMAGECODE_NUMBER, LM_IMAGECODE_BOX instead
|
||||
*/
|
||||
|
||||
$sc_style['LM_SIGNUP_LINK']['pre'] = "<br />[ ";
|
||||
$sc_style['LM_SIGNUP_LINK']['post'] = " ]";
|
||||
|
||||
@ -30,6 +50,12 @@ if (!isset($LOGIN_MENU_FORM)){
|
||||
$sc_style['LM_REMEMBERME']['pre'] = "<br />";
|
||||
$sc_style['LM_REMEMBERME']['post'] = "";
|
||||
|
||||
$sc_style['LM_IMAGECODE_NUMBER']['pre'] = "<br />";
|
||||
$sc_style['LM_IMAGECODE_NUMBER']['post'] = "<br />";
|
||||
|
||||
$sc_style['LM_IMAGECODE_BOX']['pre'] = "";
|
||||
$sc_style['LM_IMAGECODE_BOX']['post'] = "<br />";
|
||||
|
||||
$LOGIN_MENU_FORM = "
|
||||
{LM_MESSAGE}
|
||||
<div style='text-align: center'>
|
||||
@ -37,7 +63,7 @@ if (!isset($LOGIN_MENU_FORM)){
|
||||
{LM_USERNAME_INPUT}<br />
|
||||
".LOGIN_MENU_L2."<br />
|
||||
{LM_PASSWORD_INPUT}<br />
|
||||
{LM_IMAGECODE}
|
||||
{LM_IMAGECODE_NUMBER}{LM_IMAGECODE_BOX}
|
||||
{LM_LOGINBUTTON}
|
||||
{LM_REMEMBERME}<br />
|
||||
{LM_SIGNUP_LINK}
|
||||
@ -47,7 +73,48 @@ if (!isset($LOGIN_MENU_FORM)){
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
if (!isset($LOGIN_MENU_MESSAGE)){
|
||||
$LOGIN_MENU_MESSAGE = '<div class="login-menu-message">{LM_MESSAGE_TEXT}</div>';
|
||||
}
|
||||
|
||||
if (!isset($LOGIN_MENU_LOGGED)){
|
||||
|
||||
/*
|
||||
NEW SHORTCODES and/or PARAMETERS:
|
||||
|
||||
$LOGIN_MENU_LOGGED
|
||||
- LM_ADMIN_CONFIGURE (parm: 'href' or empty)
|
||||
- LM_ADMINLINK (parm: 'href' or empty)
|
||||
- LM_PROFILE_HREF
|
||||
- LM_LOGOUT_HREF
|
||||
- LM_USERSETTINGS_HREF
|
||||
- LM_EXTERNAL_LINKS
|
||||
- LM_STATS
|
||||
- LM_LISTNEW_LINK
|
||||
|
||||
$LOGIN_MENU_EXTERNAL_LINK
|
||||
- LM_EXTERNAL_LINK (parm: 'href' or empty)
|
||||
- LM_EXTERNAL_LINK_LABEL
|
||||
|
||||
$LOGIN_MENU_STATS
|
||||
- LM_NEW_NEWS
|
||||
- LM_NEW_COMMENTS
|
||||
- LM_NEW_USERS
|
||||
- LM_PLUGIN_STATS
|
||||
|
||||
$LM_STATITEM_SEPARATOR - plugin stats separator
|
||||
|
||||
$LOGIN_MENU_STATITEM
|
||||
- LM_STAT_NEW
|
||||
- LM_STAT_LABEL
|
||||
- LM_STAT_EMPTY
|
||||
|
||||
*/
|
||||
|
||||
$sc_style['LM_MAINTENANCE']['pre'] = '<div style="text-align:center"><strong>';
|
||||
$sc_style['LM_MAINTENANCE']['post'] = '</strong></div><br />';
|
||||
|
||||
$sc_style['LM_ADMINLINK']['pre'] = '';
|
||||
$sc_style['LM_ADMINLINK']['post'] = '<br />';
|
||||
|
||||
@ -57,11 +124,15 @@ if (!isset($LOGIN_MENU_LOGGED)){
|
||||
$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']['pre'] = '<br /><br />';
|
||||
$sc_style['LM_LISTNEW_LINK']['post'] = '';
|
||||
|
||||
$sc_style['LM_ADMIN_CONFIGURE']['pre'] = '';
|
||||
$sc_style['LM_ADMIN_CONFIGURE']['post'] = '<br />';
|
||||
|
||||
$LOGIN_MENU_LOGGED = '
|
||||
{LM_MAINTENANCE}
|
||||
{LM_ADMINLINK_BULLET} {LM_ADMIN_CONFIGURE}
|
||||
{LM_ADMINLINK_BULLET} {LM_ADMINLINK}
|
||||
{LM_BULLET} {LM_USERSETTINGS}<br />
|
||||
{LM_BULLET} {LM_PROFILE}<br />
|
||||
@ -97,8 +168,6 @@ if (!isset($LOGIN_MENU_STATS)){
|
||||
$LOGIN_MENU_STATS = '
|
||||
{LM_NEW_NEWS}
|
||||
{LM_NEW_COMMENTS}
|
||||
{LM_NEW_CHAT}
|
||||
{LM_NEW_FORUM}
|
||||
{LM_NEW_USERS}
|
||||
{LM_PLUGIN_STATS}
|
||||
';
|
||||
@ -112,7 +181,4 @@ if (!isset($LOGIN_MENU_STATITEM)){
|
||||
';
|
||||
}
|
||||
|
||||
if (!isset($LOGIN_MENU_MESSAGE)){
|
||||
$LOGIN_MENU_MESSAGE = '<div class="core-sysmsg loginbox">{LM_MESSAGE_TEXT}</div>';
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user