<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=market.list.query
Order=10
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

$sonline = cot_import('sonline', 'G', 'TXT');
$list_url_path['sonline'] = $sonline;

if(!empty($sonline)) {
  require_once cot_incfile('whosonline', 'plug');
  global $cot_usersonline;
  $where['usersonline'] = 'm.item_userid IN ("'.implode('","', array_unique($cot_usersonline)).'")';
}

switch($sonline)
{
	case '1':
    $where['usersonline'] = '('.$where['usersonline'].' OR user_lastlog>'.($sys['now'] - 86400).')';
		break;

	case '3':
    $where['usersonline'] = '('.$where['usersonline'].' OR user_lastlog>'.($sys['now'] - (86400 * 3)).')';
		break;

	case '7':
    $where['usersonline'] = '('.$where['usersonline'].' OR user_lastlog>'.($sys['now'] - (86400 * 7)).')';
		break;

	case '14':
    $where['usersonline'] = '('.$where['usersonline'].' OR user_lastlog>'.($sys['now'] - (86400 * 14)).')';
		break;
}