View file module/visit.php

File size: 2.25Kb
<?php
if ( !defined('IN_PHPBB') )
{
      die("Hacking attempt");
}
$template->set_filenames(array(
	'visit' => 'module/visit_body.tpl')
);  
    
$template->assign_block_vars('visit', array(
        'TOP_TIME' => $CFG['top_time'])
);
       
        $time = time() - 3600*$CFG['top_time'];

        $sql = "SELECT user_id, username, user_session_time, user_avatar_type, user_allowavatar, user_avatar, user_nic_color FROM " . USERS_TABLE . " 
	        WHERE user_id NOT IN(" . ANONYMOUS . ", " . $userdata['user_id'] . ") 
                AND user_session_time >= " . $time . "
	        ORDER BY user_session_time DESC LIMIT 6";	       
      	if ( !$result = $db->sql_query($sql) )
        {
	          message_die(GENERAL_ERROR, "Не возможно получить информацию пользователей", '', __LINE__, __FILE__, $sql);
        }
      	$userrow = array();
	while( $row = $db->sql_fetchrow($result) )
	{
		$userrow[] = $row;
	}
        for ($i = 0; $i < count($userrow); $i += 6)      
        {
                $template->assign_block_vars('visit.last', array());
		
		for ($j = $i; $j < ($i + 6); $j++)
		{ 
			if( $j >= count($userrow) )
			{
				break;
			}
                        avatar_img($userrow[$j]['user_avatar_type'], $userrow[$j]['user_allowavatar'], $userrow[$j]['user_avatar'], $avatar_img, $avatar_mini);
                        
                        $row_class = ( !($j % 2) ) ? 'row_easy' : 'row_hard';
                        $template->assign_block_vars('visit.last.userrow', array(
                                'ROW_CLASS' => $row_class, 
                                'AVATAR_IMG' => $avatar_img,
                                'AVATAR_MINI' => $avatar_mini,
		                'USERNAME_FULL' => '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $userrow[$j]['user_id']) . '" style="color: '.$userrow[$j]['user_nic_color'].'">' . $userrow[$j]['username'] . '</a>',		
		                'USER_LAST' => create_date($board_config['default_dateformat'], $userrow[$j]['user_session_time'], $board_config['board_timezone']))
	                );
                }         
        }
$template->assign_var_from_handle('MODULE_VISIT', 'visit'); 

?>