View Single Post
  #5  
Old 23rd December 2012, 04:38
ivo ivo is offline
Member
 
Join Date: Jul 2012
Croatia
Posts: 14
Lightbulb whatsgoinon.php-TS.v.7.2
If anyone has a solution that shows fewer minutes than 1h ??

PHP Code:
<?php
/*

+--------------------------------------------------------------------------
|   TS Special Edition v.7.2
|   ========================================
|   by xam
|   (c) 2005 - 2010 Template Shares Services
|   http://templateshares.net
|   ========================================
|   Web: http://templateshares.net
|   Time: $_ts_date_
|   Signature Key: $_ts_signature_key_
|   Email: contact@templateshares.net
|   TS SE IS NOT FREE SOFTWARE!
+---------------------------------------------------------------------------
*/
// Dont change for future reference.
if (!defined('TS_P_VERSION'))
{
    
define('TS_P_VERSION''1.3 by xam');
}

// Security Check.
if (!defined('IN_PLUGIN_SYSTEM'))
{
     die(
"<font face='verdana' size='2' color='darkred'><b>Error!</b> Direct initialization of this file is not allowed.</font>");
}

// BEGIN Plugin: whatsgoinon
function TS_Spider_Detect($Data='')
{  
   
      
$SpiderList = array
       
                                (
                                    
'msnbot' => 'MSN Bot',
                                    
'google' => 'Google Bot',
                                    
'yahoo' => 'Yahoo! Bot',
                                    
'alexa' => 'AleXa Bot',
                                    
'sogou' => 'Sogou Web Spider',
                                    
'baiduspider' => 'Baidu Spider',
                                    
'w3c_validator' => 'W3C Validator',
                                    
'mlbot' => 'MLBoT',
                                    
'yandex' => 'YanDeX',
                                );

    foreach (
$SpiderList as $Spider => $Name)
    {
        if (
preg_match('@'.$Spider.'@Uis'strtolower($Data)))
        {
            return array(
'<b><i><font color="#FF6633">{username}</font></i></b>'$Name);
        }
    }
    return 
false;
}

require_once(
INC_PATH.'/functions_icons.php');
$_dt TIMENOW TS_TIMEOUT
$_guests 0;
$USERLIST = array();
$BOTCACHE = array();

$_wgo_query sql_query('SELECT distinct s.userid as id, s.useragent, u.username, u.options, u.enabled, u.donor, u.leechwarn, u.warned, p.canupload, p.candownload, p.cancomment, p.canmessage, p.canshout, g.namestyle FROM ts_sessions s LEFT JOIN users u ON (s.userid=u.id) LEFT JOIN ts_u_perm p ON (u.id=p.userid) LEFT JOIN usergroups g ON (u.usergroup=g.gid) WHERE s.lastactivity > \''.$_dt.'\' ORDER by u.last_access');
$_most_ever mysql_num_rows($_wgo_query);

if (
$_most_ever)
{
    while(
$User=mysql_fetch_assoc($_wgo_query))
    {
        if (
$User['id'] == 0)
        {
            if ((
$DetectBot TS_Spider_Detect($User['useragent'])) AND !in_array($DetectBot['1'], $BOTCACHE))
            {
                
$User['namestyle'] = $DetectBot['0'];
                
$User['username'] = $DetectBot['1'];
                
$BOTCACHE[] = $DetectBot['1'];
                
$USERLIST[] = $User;
            }
            else
            {
                
$_guests++;
            }
        }
        else
        {
            
$USERLIST[] = $User;
        }
    }
}

sort($USERLISTSORT_STRING);

if (
file_exists(TSDIR.'/'.$cache.'/onlinestats.php'))
{
    include_once(
TSDIR.'/'.$cache.'/onlinestats.php');
}

if(!
$onlinestats['most_ever'])
{
    
$onlinestats['most_ever'] = 0;
}

if (
$onlinestats['most_ever'] < $_most_ever)
{
    
$_cache_array $onlinestats = array('most_ever' => $_most_ever'most_ever_time' => TIMENOW);
    
$_name 'onlinestats';
    
$_filename TSDIR.'/'.$cache.'/onlinestats.php';
    
    
$_cachecontents "<?php\n/** TS Generated Cache#2 - Do Not Alter\n * Cache Name: $_name\n * Generated: ".gmdate("r")."\n*/\n\n";
    
$_cachecontents .= "\$$_name = ".@var_export($_cache_arraytrue).";\n?>";
    @
file_put_contents($_filename$_cachecontents);
}

$_hidden_members=$_active_members=0;
$_usernames=array();

foreach (
$USERLIST as $_active_users)
{
    if(
TS_Match($_active_users['options'], 'B1') && $_active_users['id'] != $CURUSER['id'] && !$is_mod)
    {
        
$_hidden_members++;
        continue;
    }
    else
    {
        if (
TS_Match($_active_users['options'], 'B1'))
        {
            
$_hidden_members++;
        }
        else
        {
            
$_active_members++;
        }

        if (
$_active_users['id'])
        {
            
$_usernames[] = '<span style="white-space: nowrap;"><a href="'.ts_seo($_active_users['id'], $_active_users['username']).'">'.get_user_color($_active_users['username'], $_active_users['namestyle']).'</a>'.(TS_Match($_active_users['options'], 'B1') ? '+' '').get_user_icons($_active_users).'</span>';
        }
        else
        {
            
$_usernames[] = '<span style="white-space: nowrap;">'.get_user_color($_active_users['username'], $_active_users['namestyle']).'</span>';
        }
    }
}

$Legends '
<script type="text/javascript">
    function ShowDescription22(TextToShow)
    {
        if (TextToShow != "")
        {
            TSGetID("WaitingToShow33").innerHTML = TextToShow;
        }
        else
        {
            TSGetID("WaitingToShow33").innerHTML = "";
        }
    }
</script>
'
;

if (!isset(
$UsergroupCache) OR (isset($UsergroupCache) AND !is_array($UsergroupCache)))
{
    
$UsergroupCache = array();
    if (
$UseMemcached)
    {
        if (
$UsergroupCache $TSMemcache->check('ugcacheplugins'))
        {
            
//Cache exists, lets use it.
        
}
        else
        {
            
$Query sql_query('SELECT title, namestyle FROM usergroups');
            while(
$P=mysql_fetch_assoc($Query))
            {
                
$UsergroupCache[] = $P;
            }
            
$TSMemcache->add('ugcacheplugins'$UsergroupCache);
        }
    }
    else
    {
        
$Query sql_query('SELECT title, namestyle FROM usergroups');
        while(
$P=mysql_fetch_assoc($Query))
        {
            
$UsergroupCache[] = $P;
        }
    }
}

foreach(
$UsergroupCache as $right)
{
    
preg_match('#<span style="color:(.*);">#Ui'$right['namestyle'], $results);
    if (isset(
$results['1']))
    {
        
$Legends .= '
        <div style="float:left;">&nbsp;</div>
        <div class="alt2" style="float:left; height:8px; width:8px; padding:0px;cursor: pointer;" group="'
.$right['title'].'" bold="y" clr="'.$results['1'].'" onmouseover="ShowDescription22(\''.$right['title'].'\');" onmouseout="ShowDescription22(\'\');">
            <div class="tborder" style="height:8px; width:8px; background:'
.$results['1'].';"></div>
        </div>'
;
    }
}

$whatsgoinon '
<table width="100%" cellpadding="3" cellspacing="0" border="0" align="center">
    <tr>
        <td class="subheader" colspan="2">
            '
.($is_mod '<span style="float: right;">[<a href="'.$BASEURL.'/'.$staffcp_path.'/index.php?do=who_is_online"><b>'.$lang->index['show'].'</b></a>]</span>' '').$lang->index['activeusers'].' '.ts_nf($_most_ever).sprintf($lang->index['dactiveusers'], ts_nf($_guests), ts_nf($_active_members), ts_nf($_hidden_members)).'
        </td>
    <tr>
        <td colspan="2">
            <div style="float: right;">'
.$Legends.'</div>
            <div>'
.sprintf($lang->index['online'], ts_nf($onlinestats['most_ever']), my_datee($dateformat$onlinestats['most_ever_time']), my_datee($timeformat$onlinestats['most_ever_time'])).'</div>
            '
.implode(', '$_usernames).'
            <div style="float: right;" id="WaitingToShow33" name="WaitingToShow33"></div>
        </td>
    </tr>
</table>'
;
// END Plugin: whatsgoinon
?>

Last edited by ivo; 23rd December 2012 at 05:00.
Reply With Quote