diff --git a/e107_plugins/login_menu/login_menu.php b/e107_plugins/login_menu/login_menu.php
index 4cf9b296c..1e2a311e4 100644
--- a/e107_plugins/login_menu/login_menu.php
+++ b/e107_plugins/login_menu/login_menu.php
@@ -2,29 +2,12 @@
/*
* e107 website system
*
- * Copyright (C) 2008-2009 e107 Inc (e107.org)
+ * Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
- *
- *
- * $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu.php,v $
- * $Revision$
- * $Date$
- * $Author$
*/
-/**
- * e107 Login menu plugin
- *
- * Handles the login menu options
- *
- * @package e107_plugins
- * @subpackage login
- * @version $Id$;
- */
-
-
if (!defined('e107_INIT')) { exit; }
$loginPrefs = e107::getConfig('menu')->getPref('login_menu');
@@ -35,48 +18,49 @@ if(defined('FPW_ACTIVE'))
}
global $eMenuActive, $pref, $e107, $sql, $tp, $ns, $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;
+ $login_menu_shortcodes, $LOGIN_MENU_FORM, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK; //FIXME
+
$ip = e107::getIPHandler()->getIP(FALSE);
//shortcodes
- require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php");
+require(e_PLUGIN."login_menu/login_menu_shortcodes.php");
//Bullet
- if(defined("BULLET"))
- {
- $bullet = "
";
- $bullet_src = THEME_ABS."images/".BULLET;
- }
- elseif(file_exists(THEME."images/bullet2.gif"))
- {
- $bullet = "
";
- $bullet_src = THEME_ABS."images/bullet2.gif";
- }
- else
- {
- $bullet = "";
- $bullet_src = "";
- }
+if(defined("BULLET"))
+{
+ $bullet = "
";
+ $bullet_src = THEME_ABS."images/".BULLET;
+}
+elseif(file_exists(THEME."images/bullet2.gif"))
+{
+ $bullet = "
";
+ $bullet_src = THEME_ABS."images/bullet2.gif";
+}
+else
+{
+ $bullet = "";
+ $bullet_src = "";
+}
//Corrup cookie - template? - TODO
- if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
- {
- $text = "
";
- $ns->tablerender(LOGIN_MENU_L9, $text, 'loginbox_error');
- }
+if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
+{
+ $text = "";
+ $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;
- }
+$use_imagecode = ($pref['logcode'] && extension_loaded('gd'));
- $text = '';
+if ($use_imagecode)
+{
+ global $sec_img;
+ include_once(e_HANDLER.'secure_img_handler.php');
+ $sec_img = new secure_image;
+}
+
+$text = '';
// START LOGGED CODE
if (USER == TRUE || ADMIN == TRUE)
@@ -85,19 +69,22 @@ if (USER == TRUE || ADMIN == TRUE)
$loginClass = new login_menu_class();
//login class ??? - TODO
- if ($sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' "))
+ if ($sql->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' ");
+ $sql->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.'templates/login_menu/login_menu_template.php')) // Preferred v2.x location.
+ {
+ require(THEME.'templates/login_menu/login_menu_template.php');
+ }
+ elseif(file_exists(THEME.'login_menu_template.php'))
{
require(THEME.'login_menu_template.php');
}
- else
{
require(e_PLUGIN.'login_menu/login_menu_template.php');
}
@@ -107,6 +94,7 @@ if (USER == TRUE || ADMIN == TRUE)
require(e_PLUGIN.'login_menu/login_menu_template.php');
}
+
//prepare
$new_total = 0;
$time = USERLV;
@@ -117,7 +105,7 @@ if (USER == TRUE || ADMIN == TRUE)
if (varsettrue($loginPrefs['new_news']))
{
$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.")");
+ $menu_data['new_news'] = $sql->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'];
}
@@ -125,7 +113,7 @@ if (USER == TRUE || ADMIN == TRUE)
if (varsettrue($loginPrefs['new_comments']))
{
- $menu_data['new_comments'] = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
+ $menu_data['new_comments'] = $sql->count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
$new_total += $menu_data['new_comments'];
}
@@ -133,7 +121,7 @@ if (USER == TRUE || ADMIN == TRUE)
if (varsettrue($loginPrefs['new_members']))
{
- $menu_data['new_users'] = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time);
+ $menu_data['new_users'] = $sql->count('user', '(user_join)', 'WHERE user_join > '.$time);
$new_total += $menu_data['new_users'];
}