diff --git a/e107_core/shortcodes/single/alerts.php b/e107_core/shortcodes/single/alerts.php index f61325fe8..860f59ece 100644 --- a/e107_core/shortcodes/single/alerts.php +++ b/e107_core/shortcodes/single/alerts.php @@ -3,5 +3,5 @@ function alerts_shortcode($parm = '') { - return e107::getMessage()->render(); + return e107::getMessage()->setUnique()->render(); } diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index 9274d9e68..d2514d02e 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -762,6 +762,16 @@ if ($e107_popup != 1) { 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")) { diff --git a/e107_handlers/login.php b/e107_handlers/login.php index 1dcab555f..4e67a4bfd 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -580,6 +580,8 @@ class userlogin 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($pref['autoban'] == 1 || $pref['autoban'] == 3) // Flood + Login or Login Only. diff --git a/e107_handlers/online_class.php b/e107_handlers/online_class.php index a267bf85b..ae7023c43 100755 --- a/e107_handlers/online_class.php +++ b/e107_handlers/online_class.php @@ -105,7 +105,7 @@ class e_online // FIXME parse url, trigger registered e_online callbacks $page = e107::getParser()->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter $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']; // XXX - more exceptions, e.g. hide online location for admins/users (pref), e_jlsib.php, etc @@ -126,7 +126,7 @@ class e_online // !deftrue('e_AJAX_REQUEST') // TODO add option to hide users from online list? boolean online_hide field? // don't do anything if main admin logged in as another user - if ($user->isUser() && !$user->getParentId()) + if ($user->isUser() && !$user->getParentId()) { // Find record that matches IP or visitor, or matches user info if ($sql->select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'")) @@ -140,7 +140,7 @@ class e_online { //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 - $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 { @@ -149,7 +149,7 @@ class e_online $row['online_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 @@ -159,7 +159,7 @@ class e_online { // 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 - $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 { // Another visit within the timeout period @@ -168,7 +168,7 @@ class e_online $row['online_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); @@ -182,7 +182,7 @@ class e_online elseif(!$user->getParentId()) { //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 $row = $sql->fetch(); @@ -267,16 +267,17 @@ class e_online '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); $user['user_id'] = $vals[0]; $user['user_name'] = $vals[1]; $member_list .= "{$vals[1]} "; $listuserson[$row['online_user_id']] = $row['online_location']; - - $this->users[] = $user; + + $this->users[] = $user; $members_online++; + } else { @@ -320,8 +321,7 @@ class e_online function userList() { - return $this->users; - + return $this->users; } function guestList() diff --git a/e107_plugins/online/online_menu.php b/e107_plugins/online/online_menu.php index 08cc143c8..6391a47a1 100644 --- a/e107_plugins/online/online_menu.php +++ b/e107_plugins/online/online_menu.php @@ -53,7 +53,10 @@ if(!defined('e_TRACKING_DISABLED')) $ret=''; foreach($listuserson as $uinfo => $row) { - + if($row['user_active'] != 1) + { + continue; + } $pinfo = $row['user_location']; $online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1)); diff --git a/e107_plugins/online/online_menu_template.php b/e107_plugins/online/online_menu_template.php index d444dbfdb..1301be31f 100644 --- a/e107_plugins/online/online_menu_template.php +++ b/e107_plugins/online/online_menu_template.php @@ -80,6 +80,6 @@ $ONLINE_TEMPLATE['enabled'] = " $ONLINE_TEMPLATE['disabled'] = "{ONLINE_TRACKING_DISABLED}"; //##### ONLINE MEMBER LIST EXTENDED ------------------------------------------- -$ONLINE_TEMPLATE['online_members_list_extended'] = "{SETIMAGE: w=40}