1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Fixes #1223 - Adds the missing {ALERTS} shortcode to old themes - informing users of incorrect passwords etc. Essential for when the login menu is within the navigation bar.

Fixes #1077 - Online Menu was displaying the user as online when the username was correct, even if the password was not.
Corrected styling of the online-menu.
This commit is contained in:
Cameron
2015-11-13 18:04:47 -08:00
parent ef1e1565ad
commit 23b7de8d4e
6 changed files with 30 additions and 15 deletions

View File

@@ -3,5 +3,5 @@
function alerts_shortcode($parm = '') function alerts_shortcode($parm = '')
{ {
return e107::getMessage()->render(); return e107::getMessage()->setUnique()->render();
} }

View File

@@ -762,6 +762,16 @@ if ($e107_popup != 1) {
echo e107::getParser()->parseTemplate("{WMESSAGE}"); echo e107::getParser()->parseTemplate("{WMESSAGE}");
} }
if(!deftrue('e_IFRAME') && (strstr($HEADER,"{ALERTS}")===false && strstr($FOOTER,"{ALERTS}")===false)) // Old theme, missing {ALERTS}
{
if(deftrue('e_DEBUG'))
{
e107::getMessage()->addDebug("The {ALERTS} shortcode was not found in the \$HEADER or \$FOOTER template. It has been automatically added here. ");
}
echo e107::getParser()->parseTemplate("{ALERTS}");
}
if(defined("PREVIEWTHEME")) if(defined("PREVIEWTHEME"))
{ {

View File

@@ -580,6 +580,8 @@ class userlogin
define('LOGINMESSAGE', $message); define('LOGINMESSAGE', $message);
// $sql->update('online', 'user_active = 0 WHERE user_ip = "'.$this->userIP.'" LIMIT 1');
if ($doCheck) // See if ban required (formerly the checkibr() function) if ($doCheck) // See if ban required (formerly the checkibr() function)
{ {
if($pref['autoban'] == 1 || $pref['autoban'] == 3) // Flood + Login or Login Only. if($pref['autoban'] == 1 || $pref['autoban'] == 3) // Flood + Login or Login Only.

View File

@@ -105,7 +105,7 @@ class e_online
// FIXME parse url, trigger registered e_online callbacks // FIXME parse url, trigger registered e_online callbacks
$page = e107::getParser()->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter $page = e107::getParser()->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter
$ip = e107::getIPHandler()->getIP(FALSE); $ip = e107::getIPHandler()->getIP(FALSE);
$udata = ($user->isUser() ? $user->getId().'.'.$user->getName() : '0'); $udata = ($user->isUser() && USER ? $user->getId().'.'.$user->getName() : '0'); // USER check required to make sure they logged in without an error.
$agent = $_SERVER['HTTP_USER_AGENT']; $agent = $_SERVER['HTTP_USER_AGENT'];
// XXX - more exceptions, e.g. hide online location for admins/users (pref), e_jlsib.php, etc // XXX - more exceptions, e.g. hide online location for admins/users (pref), e_jlsib.php, etc
@@ -140,7 +140,7 @@ class e_online
{ {
//It has been at least 'online_timeout' seconds since this user's info last logged //It has been at least 'online_timeout' seconds since this user's info last logged
//Update user record with timestamp, current IP, current page and set pagecount to 1 //Update user record with timestamp, current IP, current page and set pagecount to 1
$query = "online_timestamp='".time()."', online_ip='{$ip}'{$update_page}, online_pagecount=1 WHERE online_user_id='{$row['online_user_id']}'"; $query = "online_timestamp='".time()."', online_ip='{$ip}'{$update_page}, online_pagecount=1, `online_active` = 1 WHERE online_user_id='{$row['online_user_id']}'";
} }
else else
{ {
@@ -149,7 +149,7 @@ class e_online
$row['online_pagecount'] ++; $row['online_pagecount'] ++;
} }
// Update user record with current IP, current page and increment pagecount // Update user record with current IP, current page and increment pagecount
$query = "online_ip='{$ip}'{$update_page}, `online_pagecount` = '".intval($row['online_pagecount'])."' WHERE `online_user_id` = '{$row['online_user_id']}'"; $query = "online_ip='{$ip}'{$update_page}, `online_pagecount` = '".intval($row['online_pagecount'])."', `online_active` = 1 WHERE `online_user_id` = '{$row['online_user_id']}'";
} }
} }
else else
@@ -159,7 +159,7 @@ class e_online
{ {
// It has been at least 'timeout' seconds since this user has connected // It has been at least 'timeout' seconds since this user has connected
// Update record with timestamp, current IP, current page and set pagecount to 1 // Update record with timestamp, current IP, current page and set pagecount to 1
$query = "`online_timestamp` = '".time()."', `online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'"; $query = "`online_timestamp` = '".time()."', `online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = 1, `online_active` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
} }
else else
{ // Another visit within the timeout period { // Another visit within the timeout period
@@ -168,7 +168,7 @@ class e_online
$row['online_pagecount'] ++; $row['online_pagecount'] ++;
} }
//Update record with current IP, current page and increment pagecount //Update record with current IP, current page and increment pagecount
$query = "`online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = ".intval($row['online_pagecount'])." WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'"; $query = "`online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = ".intval($row['online_pagecount']).", `online_active` =1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'";
} }
} }
$sql->update('online', $query); $sql->update('online', $query);
@@ -182,7 +182,7 @@ class e_online
elseif(!$user->getParentId()) elseif(!$user->getParentId())
{ {
//Current page request is from a guest //Current page request is from a guest
if ($sql->db_Select('online', '*', "`online_ip` = '{$ip}' AND `online_user_id` = '0'")) if ($sql->select('online', '*', "`online_ip` = '{$ip}' AND `online_user_id` = '0'"))
{ // Recent visitor { // Recent visitor
$row = $sql->fetch(); $row = $sql->fetch();
@@ -267,7 +267,7 @@ class e_online
'online_user_id' => $row['online_user_id'] 'online_user_id' => $row['online_user_id']
); );
if($row['online_user_id'] != 0) if($row['online_user_id'] != 0 )
{ {
$vals = explode('.', $row['online_user_id'], 2); $vals = explode('.', $row['online_user_id'], 2);
$user['user_id'] = $vals[0]; $user['user_id'] = $vals[0];
@@ -277,6 +277,7 @@ class e_online
$this->users[] = $user; $this->users[] = $user;
$members_online++; $members_online++;
} }
else else
{ {
@@ -321,7 +322,6 @@ class e_online
function userList() function userList()
{ {
return $this->users; return $this->users;
} }
function guestList() function guestList()

View File

@@ -53,7 +53,10 @@ if(!defined('e_TRACKING_DISABLED'))
$ret=''; $ret='';
foreach($listuserson as $uinfo => $row) foreach($listuserson as $uinfo => $row)
{ {
if($row['user_active'] != 1)
{
continue;
}
$pinfo = $row['user_location']; $pinfo = $row['user_location'];
$online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1)); $online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1));

View File

@@ -80,6 +80,6 @@ $ONLINE_TEMPLATE['enabled'] = "
$ONLINE_TEMPLATE['disabled'] = "{ONLINE_TRACKING_DISABLED}"; $ONLINE_TEMPLATE['disabled'] = "{ONLINE_TRACKING_DISABLED}";
//##### ONLINE MEMBER LIST EXTENDED ------------------------------------------- //##### ONLINE MEMBER LIST EXTENDED -------------------------------------------
$ONLINE_TEMPLATE['online_members_list_extended'] = "{SETIMAGE: w=40}<li>{ONLINE_MEMBER_IMAGE=avatar} {ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}</li>"; $ONLINE_TEMPLATE['online_members_list_extended'] = "{SETIMAGE: w=40}<li class='media'><span class='media-object pull-left'>{ONLINE_MEMBER_IMAGE=avatar}</span><span class='media-body'>{ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}</span></li>";
?> ?>