<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=usertags.main
[END_COT_EXT]
==================== */

/**
 * Online user tags
 *
 * @package WhosOnline
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */

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

if (is_array($user_data) && $user_data['user_id'] > 0 && !empty($user_data['user_name']))
{
  require_once cot_incfile('whosonline', 'plug');

  global $sys;
	$temp_array['ONLINE'] = (cot_userisonline($user_data['user_id'])) ? '1' : '0';
	$temp_array['ONLINETITLE'] = ($temp_array['ONLINE'] == '1') ? $L['Online'] : $L['Offline'];
  $temp_array['ONLINEICO'] = ($temp_array['ONLINE'] == '1') ? 'online' : 'offline';
  $temp_array['ONLINELAST'] = ($user_data['user_lastlog'] > 0 ? cot_build_timeago($sys['now'] - ($sys['now'] - $user_data['user_lastlog'])) : '');
}
else
{
	$temp_array['ONLINE'] = '0';
	$temp_array['ONLINETITLE'] = '';
  $temp_array['ONLINEICO'] = 'offline';
  $temp_array['ONLINELAST'] = '';
}
