Файл: wboard/source/system/controller/online.php
Строк: 36
<?php
/**
 * Wboard
 * List of users in online
 * @author Screamer
 * @copyright 2013
 */
class Module_Online extends Module
{
    /**
     * Index of Online
     * @return (void)
     */
    public function index()
    {
        if ($this->is_root === FALSE) {
            // Access denied
            $this->redirect('w_action/err');
        }
        $get_list = $this->model->online_list();
        $list = '';
        foreach ($get_list as $item) {
            $item['ip'] = long2ip($item['ip']);
            $item['ip_via_proxy'] = $item['ip_via_proxy'] == 0 ? $this->lng->none : long2ip($item['ip_via_proxy']);
            $item['user_agent'] = htmlspecialchars($item['user_agent'], ENT_QUOTES, 'UTF-8');
            $item['is_online'] = time() > $item['time'] + 300 ? FALSE : TRUE;
            $item['time'] = $this->helper->display_time($item['time']);
            $item['referer'] = array(
                'link' => htmlspecialchars($item['referer'], ENT_QUOTES, 'UTF-8'),
                'title' => htmlspecialchars(
                    (mb_substr($item['referer'], 0, 150) . (mb_strlen($item['referer']) > 150 ? '...' : '')),
                    ENT_QUOTES,
                    'UTF-8'
                ),
            );
            $list .= $this->tpl->load('online_item', $item);
        }
        $this->tpl->title = $this->lng->online;
        $this->tpl->set_output($this->tpl->load('_container', array('data' => $list, 'total' => sizeof($get_list))));
    }
}