bsmither Posted April 23, 2015 Share Posted April 23, 2015 Lost the numeric indicator on the tab?Doesn't make sense. It all works fine here. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 23, 2015 Author Share Posted April 23, 2015 /* BSMITHER IGNORE BOTS HACK */ if (isset($_GET['bots']) && $_GET['bots']=='true') { $filter = ''; $GLOBALS['smarty']->assign('BOTS', true); } else { $filter = '(S.session_last > S.session_start) AND '; $GLOBALS['smarty']->assign('BOTS', false); } $thisBotStringArray = array('alexa','appie','archiver','ask jeeves','baiduspider','bot','crawl','crawler','curl','eventbox','facebookexternal','fast', 'firefly','froogle','gigabot','girafabot','google','googlebot','infoseek','inktomi','java','larbin','looksmart','mechanize','monitor','msnbot','nambu', 'nationaldirectory','novarra','pear','perl','python','rabaz','radian','rankivabot','scooter','slurp','sogou web spider','spade','sphere','spider','technoratisnoop', 'tecnoseek','teoma','toolbar','transcoder','twitt','url_spider_sql','webalta','webbug','webfindbot','wordpress','www.galaxy.com','yahoo','yandex','zyborg',); $query = sprintf("SELECT S.*, C.first_name, C.last_name FROM %1\$sCubeCart_sessions AS S LEFT JOIN %1\$sCubeCart_customer AS C ON S.customer_id = C.customer_id WHERE ".$filter."S.session_last>".$timeLimit." ORDER BY S.session_last DESC", $glob['dbprefix']); if (($results = $GLOBALS['db']->query($query)) !== false) { $GLOBALS['main']->addTabControl($lang['statistics']['title_customers_active'], 'stats_online', false, false, count($smarty_data['users_online'])); $GLOBALS['smarty']->assign('USERS_ONLINE', $smarty_data['users_online']); $smarty_data['users_online'] = array(); foreach ($results as $user) { $user_agentstring = $user['useragent']; $foundBots = array_filter($thisBotStringArray, function($str) use ($user_agentstring){ return (false !== strpos($user_agentstring,$str)); }); if (!empty($foundBots)) continue; $user['is_admin'] = ((int)$user['admin_id'] > 0) ? 1 : 0; //END BSMITHER IGNORE BOTS HACK Did I mess up the code? Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 23, 2015 Share Posted April 23, 2015 Change: if (!empty($foundBots)) continue; To: if (!empty($foundBots) && !empty($filter)) continue;In this same area of making edits, find and delete:$GLOBALS['main']->addTabControl($lang['statistics']['title_customers_active'], 'stats_online', false, false, count($results));Add the new line seen here just above the existing line (that is, do not move the existing line):/* NEW */ $GLOBALS['main']->addTabControl($lang['statistics']['title_customers_active'], 'stats_online', false, false, count($smarty_data['users_online'])); $GLOBALS['smarty']->assign('USERS_ONLINE', $smarty_data['users_online']); Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 23, 2015 Author Share Posted April 23, 2015 Still no count./* BSMITHER IGNORE BOTS HACK */ if (isset($_GET['bots']) && $_GET['bots']=='true') { $filter = ''; $GLOBALS['smarty']->assign('BOTS', true); } else { $filter = '(S.session_last > S.session_start) AND '; $GLOBALS['smarty']->assign('BOTS', false); } $thisBotStringArray = array('alexa','appie','archiver','ask jeeves','baiduspider','bot','crawl','crawler','curl','eventbox','facebookexternal','fast', 'firefly','froogle','gigabot','girafabot','google','googlebot','infoseek','inktomi','java','larbin','looksmart','mechanize','monitor','msnbot','nambu', 'nationaldirectory','novarra','pear','perl','python','rabaz','radian','rankivabot','scooter','slurp','sogou web spider','spade','sphere','spider','technoratisnoop', 'tecnoseek','teoma','toolbar','transcoder','twitt','url_spider_sql','webalta','webbug','webfindbot','wordpress','www.galaxy.com','yahoo','yandex','zyborg',); $query = sprintf("SELECT S.*, C.first_name, C.last_name FROM %1\$sCubeCart_sessions AS S LEFT JOIN %1\$sCubeCart_customer AS C ON S.customer_id = C.customer_id WHERE ".$filter."S.session_last>".$timeLimit." ORDER BY S.session_last DESC", $glob['dbprefix']); if (($results = $GLOBALS['db']->query($query)) !== false) { $GLOBALS['main']->addTabControl($lang['statistics']['title_customers_active'], 'stats_online', false, false, count($smarty_data['users_online'])); $GLOBALS['smarty']->assign('USERS_ONLINE', $smarty_data['users_online']); $smarty_data['users_online'] = array(); foreach ($results as $user) { $user_agentstring = $user['useragent']; $foundBots = array_filter($thisBotStringArray, function($str) use ($user_agentstring){ return (false !== strpos($user_agentstring,$str)); }); if (!empty($foundBots) && !empty($filter)) continue; $user['is_admin'] = ((int)$user['admin_id'] > 0) ? 1 : 0; //END BSMITHER IGNORE BOTS HACK Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 23, 2015 Share Posted April 23, 2015 In the original, untouched file, notice the following code at the bottom: $smarty_data['users_online'][] = $user; } $GLOBALS['smarty']->assign('USERS_ONLINE', $smarty_data['users_online']); } $GLOBALS['smarty']->assign('GRAPH_DATA',$g_graph_data); $page_content = $GLOBALS['smarty']->fetch('templates/statistics.index.php');Just above where you see this in the untouched file: $GLOBALS['smarty']->assign('USERS_ONLINE', $smarty_data['users_online']); is where:$GLOBALS['main']->addTabControl($lang['statistics']['title_customers_active'], 'stats_online', false, false, count($smarty_data['users_online']));gets added. In your current file, as it stands:$GLOBALS['main']->addTabControl($lang['statistics']['title_customers_active'], 'stats_online', false, false, count($smarty_data['users_online'])); $GLOBALS['smarty']->assign('USERS_ONLINE', $smarty_data['users_online']);is in the wrong place, so move the pair of lines down to where the 'assign' statement is supposed to be. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted April 23, 2015 Author Share Posted April 23, 2015 That was it!! Thank You!! I would think this would be a code change everyone would want on v6. Please consider making a GitHub request. You've helped me with lots of edits that need to be stock IMHO. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.