/** * Get the Browser Array from private var or fetch it from cache or XML * @access public * @return array */ public static function getOsArray() { if (!is_null(self::$_osList)) { return self::$_osList; } $registry = Zend_Registry::getInstance(); $cacheKey = 'os_xml'; $value = Dot_Cache::load($cacheKey); if (false != $value) { $os = $value; } else { $xml = new Zend_Config_Xml(CONFIGURATION_PATH . '/useragent/os.xml'); $os = $xml->type->toArray(); self::$_osList = $os; Dot_Cache::save($os, $cacheKey); } return $os; }
/** * Display user logins list * @access public * @param string $templateFile * @param array $list * @param int $page * @param int $browser * @param int $loginDate * @param int $sortField * @param int $orderBy * @return void */ public function loginsUser($templateFile, $list, $page, $browser, $loginDate, $sortField, $orderBy) { $dotGeoip = new Dot_Geoip(); $geoIpWorking = true; $this->tpl->setFile('tpl_main', 'user/' . $templateFile . '.tpl'); $this->tpl->setBlock('tpl_main', 'browser', 'browser_row'); $browserArray = Dot_UserAgent_Utilities::getBrowserArray(); foreach ($browserArray as $key => $val) { $this->tpl->setVar('BROWSERNAME', ucfirst($val['uaBrowser'])); if (strtolower($val['uaBrowser']) == strtolower($browser)) { $this->tpl->setVar('BROWSERSEL', 'selected'); } else { $this->tpl->setVar('BROWSERSEL', ''); } $this->tpl->parse('browser_row', 'browser', true); } $this->tpl->setVar('FILTERDATE', $loginDate); $this->tpl->setBlock('tpl_main', 'list', 'list_block'); $this->tpl->paginator($list['pages']); $this->tpl->setVar('PAGE', $page); $this->tpl->setVar('FILTER_URL', '/admin/user/logins'); $sortableFields = array('username', 'dateLogin'); foreach ($sortableFields as $field) { $linkSort = '/admin/user/logins/sort/' . $field . '/order/'; $linkSort .= $orderBy == 'asc' ? 'desc' : 'asc'; $this->tpl->setVar('LINK_SORT_' . strtoupper($field), $linkSort); if ($field != $sortField) { $sortClass = 'sortable'; } elseif ($orderBy == 'asc') { $sortClass = 'sort_up'; } else { $sortClass = 'sort_down'; } $this->tpl->setVar('CLASS_SORT_' . strtoupper($field), $sortClass); } foreach ($list['data'] as $k => $v) { $country = $dotGeoip->getCountryByIp($v['ip']); if ($country['response'] != 'OK' && $geoIpWorking === true) { $geoIpWorking = false; $this->session->message['txt'] = $country['response']; $this->session->message['type'] = 'warning'; } $this->tpl->setVar('ID', $v['id']); $this->tpl->setVar('USERID', $v['userId']); $this->tpl->setVar('USERNAME', $v['username']); $this->tpl->setVar('IP', $v['ip']); $this->tpl->setVar('COUNTRYIMAGE', strtolower($country[0])); $this->tpl->setVar('COUNTRYNAME', $country[1]); $this->tpl->setVar('REFERER', $v['referer']); $this->tpl->setVar('WHOISURL', $this->settings->whoisUrl); $this->tpl->setVar('USERAGENT', $v['userAgent']); $this->tpl->setVar('BROWSERIMAGE', Dot_UserAgent_Utilities::getBrowserIcon($v['userAgent'])); $os = Dot_UserAgent_Utilities::getOsIcon($v['userAgent']); $this->tpl->setVar('OSIMAGE', $os['icon']); $this->tpl->setVar('OSMAJOR', $os['major']); $this->tpl->setVar('OSMINOR', $os['minor']); $this->tpl->setVar('DATELOGIN', Dot_Kernel::timeFormat($v['dateLogin'], 'long')); $this->tpl->parse('list_block', 'list', true); } }
* * @category DotKernel * @package Frontend * @copyright Copyright (c) 2009-2015 DotBoost Technologies Inc. (http://www.dotboost.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @version $Id: IndexController.php 897 2015-02-24 18:04:40Z gabi $ */ /** * Frontend Module - Index Controller * Is doing all the job for specific frontend control stuff * @author DotKernel Team <*****@*****.**> */ // initialize the session // if you don't use the session object in this module, feel free to remove this line Dot_Session::start(); if (Dot_UserAgent_Utilities::isMobile(Dot_Request::getUserAgent())) { if (!$registry->session->visitId) { $registry->session->visitId = Dot_Statistic::registerVisit(); } // if the Statistic module is integrate, record the deviceInfo too, and record TRUE in $session->mobile if (!$registry->session->mobile) { $registry->session->mobile = Dot_Statistic::registerMobileDetails($registry->session->visitId, array()); //redirect to mobile controller , only if the session is not set. //Otherwise will trap the user in mobile controller if (isset($registry->configuration->settings->mobile->redirect) && $registry->configuration->settings->mobile->redirect == true) { header('location: ' . $registry->configuration->website->params->url . '/mobile'); exit; } } } // start the template object, empty for the moment
/** * Display user logins list * @access public * @param string $templateFile * @param array $list * @param int $page * @return void */ public function loginsUser($templateFile, $list, $page) { $dotGeoip = new Dot_Geoip(); $geoIpWorking = true; $this->tpl->setFile('tpl_main', 'admin/' . $templateFile . '.tpl'); $this->tpl->setBlock('tpl_main', 'list', 'list_block'); $this->tpl->paginator($list['pages']); $this->tpl->setVar('PAGE', $page); foreach ($list['data'] as $k => $v) { $country = $dotGeoip->getCountryByIp($v['ip']); if ($country['response'] != 'OK' && $geoIpWorking === true) { $geoIpWorking = false; $this->session->message['txt'] = $country['response']; $this->session->message['type'] = 'warning'; } $this->tpl->setVar('ID', $v['id']); $this->tpl->setVar('ADMINID', $v['adminId']); $this->tpl->setVar('USERNAME', $v['username']); $this->tpl->setVar('IP', $v['ip']); $this->tpl->setVar('COUNTRYIMAGE', strtolower($country[0])); $this->tpl->setVar('COUNTRYNAME', $country[1]); $this->tpl->setVar('REFERER', $v['referer']); $this->tpl->setVar('WHOISURL', $this->settings->whoisUrl); $this->tpl->setVar('USERAGENT', $v['userAgent']); $this->tpl->setVar('BROWSERIMAGE', Dot_UserAgent_Utilities::getBrowserIcon($v['userAgent'])); $os = Dot_UserAgent_Utilities::getOsIcon($v['userAgent']); $this->tpl->setVar('OSIMAGE', $os['icon']); $this->tpl->setVar('OSMAJOR', $os['major']); $this->tpl->setVar('OSMINOR', $os['minor']); $this->tpl->setVar('DATELOGIN', Dot_Kernel::timeFormat($v['dateLogin'], 'long')); $this->tpl->parse('list_block', 'list', true); } }