Beispiel #1
0
/**
 * get the current users browser
 */
function get_browser($label = true)
{
    $browser = new \BrowserDetection();
    $l = $browser->getBrowser();
    if ($label) {
        return $l;
    }
    // return the machine name
    $browsers = get_browsers();
    return array_search($l, $browsers);
}
Beispiel #2
0
 function onAfterInitialise()
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     // We store only front-end visits
     if ($app->getName() !== 'site') {
         return;
     }
     // Extract info from BrowserDetection
     $browser_data = new BrowserDetection();
     if (!empty($browser_data)) {
         $this->browser = $browser_data->getBrowser();
         $this->browser_version = $browser_data->getVersion();
         $this->platform = $browser_data->getPlatform();
         $this->is_mobile = $browser_data->isMobile();
         $this->is_robot = $browser_data->isRobot();
         $this->uri = $_SERVER['REQUEST_URI'];
         $this->ip = $_SERVER['REMOTE_ADDR'];
     } else {
         $this->browser = JText::_('COM_JOOMMARK_UNKNOW');
         $this->browser_version = JText::_('COM_JOOMMARK_UNKNOW');
         $this->platform = JText::_('COM_JOOMMARK_UNKNOW');
     }
     // We need the referer to track where is the user
     if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != "") {
         $this->referer = $_SERVER['HTTP_REFERER'];
     } else {
         $this->referer = JText::_('COM_JOOMMARK_UNKNOW');
     }
     // Get the user name
     $user = JFactory::getUser()->name;
     // Update 'joommark_stats' table
     $query = "INSERT INTO #__joommark_stats (ip, nowpage, lastupdate_time,  current_name)" . "VALUES ( '" . $this->ip . "','" . $this->referer . "',NOW(),'" . $user . "') ON DUPLICATE KEY UPDATE nowpage = '" . $this->referer . "', lastupdate_time = NOW(), current_name = '" . $user . "' ";
     $db->setQuery($query);
     try {
         $db->execute();
     } catch (Exception $e) {
         //dump($e->getMessage(),"exception");
     }
     // Update 'joommark_serverstats' table
     $query = "INSERT INTO #__joommark_serverstats (ip, visitdate, visitedpages, browser, os)" . "VALUES ( '" . $this->ip . "', NOW(), '" . $this->referer . "', '" . $this->browser . "', '" . $this->platform . "')";
     $db->setQuery($query);
     try {
         $db->execute();
     } catch (Exception $e) {
         //dump($e->getMessage(),"exception");
     }
 }
Beispiel #3
0
 function testDetect()
 {
     // FIXME: Add more browsers!
     $intendedMatches = array(array('', array('name' => 'Masked', 'version' => ''), 'Detected masked user agent properly.'), array(' ', array('name' => 'Masked', 'version' => ''), 'Detected masked user agent properly.'), array('I don\'t exist!', array('name' => 'Unknown', 'version' => ''), 'Detected an unknown user agent properly.'), array('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1', array('name' => 'Firefox', 'version' => '2.0.0.1'), 'Detected Firefox 2.0.0.1.'), array('Mozilla/5.0 (Windows; U; Windows NT 6.0; fi) AppleWebKit/522.12.1 (KHTML, like Gecko) Version/3.0.1 Safari/522.12.2', array('name' => 'Safari', 'version' => '3.0.1'), 'Detected Safari 3.0.1.'), array('Mozilla/5.0 (Macintosh; U; PPC Mac OS X; tr-tr) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3', array('name' => 'Safari', 'version' => '2.0.3'), 'Detected Safari 2.0.3.'), array('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)', array('name' => 'Internet Explorer', 'version' => '7.0'), 'Detected Internet Explorer 7.0.5730.11.'), array('Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050702)', array('name' => 'Mozilla', 'version' => '1.8b'), 'Detected Mozilla rv:1.8b.'), array('Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.3 (like Gecko) Kubuntu 6.06 Dapper', array('name' => 'Konqueror', 'version' => '3.5'), 'Detected Konqueror 3.5.'), array('Opera/9.02 (Windows NT 5.1; U; en)', array('name' => 'Opera', 'version' => '9.02'), 'Detected Opera 9.02.'), array('Mozilla/5.0 (compatible; iCab 3.0.2; Macintosh; U; PPC Mac OS)', array('name' => 'iCab', 'version' => '3.0.2'), 'Detected iCab 3.0.2.'), array('iCab/2.9.1 (Macintosh; U; PPC)', array('name' => 'iCab', 'version' => '2.9.1'), 'Detected iCab 2.9.1.'), array('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061211 SeaMonkey/1.0.7', array('name' => 'SeaMonkey', 'version' => '1.0.7'), 'Detected SeaMonkey 1.0.7.'), array('Mozilla/4.0 (compatible; MSIE 7.0; America Online Browser 1.1; rev1.5; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)', array('name' => 'America Online Browser', 'version' => '1.1'), 'Detected America Online Browser 1.1.'), array('Mozilla/4.0 (compatible; MSIE 6.0; AOL 9.0; Windows NT 5.1; SV1; FreeprodTB; FunWebProducts; .NET CLR 1.1.4322; .NET CLR 2.0.50727)', array('name' => 'AOL', 'version' => '9.0'), 'Detected AOL 9.0.'), array('Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060911 Camino/1.0.3', array('name' => 'Camino', 'version' => '1.0.3'), 'Detected Camino 1.0.3.'), array('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', array('name' => 'Googlebot', 'version' => '2.1'), 'Detected Googlebot 2.1.'), array('Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)', array('name' => 'Yahoo Crawler', 'version' => ''), 'Detected Yahoo Crawler.'), array('Lynx/2.8.5rel.5 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8d', array('name' => 'Lynx', 'version' => '2.8.5'), 'Detected Lynx 2.8.5.'), array('Links (0.99pre14; CYGWIN_NT-5.1 1.5.22(0.156/4/2) i686; 80x25)', array('name' => 'Links', 'version' => '0.99pre14'), 'Detected Links 0.99pre14.'), array('curl/7.15.4 (i686-pc-cygwin) libcurl/7.15.4 OpenSSL/0.9.8d zlib/1.2.3', array('name' => 'cURL', 'version' => '7.15.4'), 'Detected cURL 7.15.4.'), array('Wget/1.10.2', array('name' => 'Wget', 'version' => '1.10.2'), 'Detected Wget 1.10.2.'), array('W3C_Validator/1.432.2.5', array('name' => 'W3C Validator', 'version' => '1.432.2.5'), 'Detected W3C Validator 1.432.2.5.'), array('W3C-checklink/4.2.1 [4.21] libwww-perl/5.803', array('name' => 'W3C Link Checker', 'version' => '4.2.1'), 'Detected W3C Link Checker 4.2.1.'), array('Jigsaw/2.2.5 W3C_CSS_Validator_JFouffa/2.0', array('name' => 'W3C CSS Validator', 'version' => '2.0'), 'Detected W3C CSS Validator 2.0.'));
     foreach ($intendedMatches as $intendedMatch) {
         $this->assertIdentical(BrowserDetection::detect($intendedMatch[0]), $intendedMatch[1], ltrim($intendedMatch[2] . ' %s'));
     }
 }
 /**
  * onAfterInitialise
  *
  * @return Exception object otherwise boolean true
  *
  * @since   1.0
  */
 public function onAfterInitialise()
 {
     // We store only front-end visits
     if ($this->app->getName() !== 'site') {
         return;
     }
     /*
      * Collecting the data
      * Extract info from BrowserDetection
      */
     $browser_data = new BrowserDetection();
     if (!empty($browser_data)) {
         $this->browser = $browser_data->getBrowser();
         $this->browser_version = $browser_data->getVersion();
         $this->platform = $browser_data->getPlatform();
         $this->is_mobile = $browser_data->isMobile();
         $this->is_robot = $browser_data->isRobot();
         $this->uri = JRequest::getVar('REQUEST_URI', ' ', 'server', 'STRING');
         $this->ip = JRequest::getVar('REMOTE_ADDR', ' ', 'server', 'STRING');
     } else {
         $this->browser = JText::_('COM_JOOMMARK_UNKNOW');
         $this->browser_version = JText::_('COM_JOOMMARK_UNKNOW');
         $this->platform = JText::_('COM_JOOMMARK_UNKNOW');
     }
     // Get the user name
     $this->userName = $this->user->name;
     // Get the user id
     $this->userId = $this->user->id;
     if (!$this->userName) {
         $this->userName = JText::_('COM_JOOMMARK_GUEST_PREFIX') . '_' . $this->generateSuffixFromSessionId($this->session->getId());
         $this->userId = 0;
     }
     // Update
     $this->updateReferer();
     $this->updateServerstats();
     $this->updateStats();
     $this->tidyingup();
 }
Beispiel #5
0
 private function showUser()
 {
     // FIXME: Does $_GET['userID'] exist?
     if (isset($_GET['privledged']) && $_GET['privledged'] == 'false' && $this->_userID == $_GET['userID']) {
         $privledged = false;
     } else {
         /* Bail out if the user doesn't have SA permissions. */
         if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) {
             CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
             return;
             //$this->fatal(ERROR_NO_PERMISSION);
         }
         $privledged = true;
     }
     $userID = $_GET['userID'];
     $users = new Users($this->_siteID);
     $data = $users->get($userID);
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'No user found with selected ID.');
     }
     $data['successfulDate'] = DateUtility::fixZeroDate($data['successfulDate'], 'Never');
     $data['unsuccessfulDate'] = DateUtility::fixZeroDate($data['unsuccessfulDate'], 'Never');
     $accessLevels = $users->getAccessLevels();
     $loginAttempts = $users->getLastLoginAttempts($userID, self::MAX_RECENT_LOGINS);
     if (!empty($loginAttempts)) {
         foreach ($loginAttempts as $rowIndex => $row) {
             $loginAttempts[$rowIndex]['shortUserAgent'] = implode(' ', BrowserDetection::detect($loginAttempts[$rowIndex]['userAgent']));
             if ($loginAttempts[$rowIndex]['successful'] == 0) {
                 $loginAttempts[$rowIndex]['successful'] = 'No';
             } else {
                 $loginAttempts[$rowIndex]['successful'] = 'Yes';
             }
         }
     }
     $siteIDPosition = strpos($data['username'], '@' . $_SESSION['CATS']->getSiteID());
     // FIXME: The last test here might be redundant.
     if ($siteIDPosition !== false && substr($data['username'], $siteIDPosition) == '@' . $_SESSION['CATS']->getSiteID()) {
         $data['username'] = str_replace('@' . $_SESSION['CATS']->getSiteID(), '', $data['username']);
     }
     /* Get user categories, if any. */
     $modules = ModuleUtility::getModules();
     $categories = array();
     foreach ($modules as $moduleName => $parameters) {
         $moduleCategories = $parameters[MODULE_SETTINGS_USER_CATEGORIES];
         if ($moduleCategories != false) {
             foreach ($moduleCategories as $category) {
                 $categories[] = $category;
             }
         }
     }
     $EEOSettings = new EEOSettings($this->_siteID);
     $EEOSettingsRS = $EEOSettings->getAll();
     $this->_template->assign('privledged', $privledged);
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', '');
     $this->_template->assign('data', $data);
     $this->_template->assign('categories', $categories);
     $this->_template->assign('accessLevels', $accessLevels);
     $this->_template->assign('EEOSettingsRS', $EEOSettingsRS);
     $this->_template->assign('currentUser', $this->_userID);
     $this->_template->assign('loginDisplay', self::MAX_RECENT_LOGINS);
     $this->_template->assign('loginAttempts', $loginAttempts);
     $this->_template->display('./modules/settings/ShowUser.tpl');
 }
 /**
  * Returns the current page of login activity.
  *
  * @return array contacts data
  */
 public function getPage()
 {
     $sql = sprintf("SELECT\n                user_login.user_login_id AS userLoginID,\n                user_login.user_id AS userID,\n                user_login.ip AS ip,\n                user_login.user_agent AS shortUserAgent,\n                DATE_FORMAT(\n                    user_login.date, '%%m-%%d-%%y (%%h:%%i %%p)'\n                ) AS date,\n                user_login.date AS dateSort,\n                user_login.host AS hostname,\n                user.first_name AS firstName,\n                user.last_name AS lastName\n            FROM\n                user_login\n            LEFT JOIN user\n                ON user_login.user_id = user.user_id\n            WHERE\n                user_login.successful = %s\n            AND\n                user.is_test_user = 0\n            AND\n                user_login.site_id = %s\n            AND\n                user.site_id = %s\n            ORDER BY\n                %s %s\n            LIMIT %s, %s", $this->_successful ? '1' : '0', $this->_siteID, $this->_siteID, $this->_sortBy, $this->_sortDirection, $this->_thisPageStartRow, $this->_rowsPerPage);
     $rs = $this->_db->getAllAssoc($sql);
     foreach ($rs as $rowIndex => $row) {
         if (empty($row['hostname'])) {
             if (ENABLE_HOSTNAME_LOOKUP) {
                 $rs[$rowIndex]['hostname'] = @gethostbyaddr($row['ip']);
                 if (empty($rs[$rowIndex]['hostname'])) {
                     $rs[$rowIndex]['hostname'] = '(unresolvable)';
                 }
                 $this->updateHostName($row['userLoginID'], $row['hostname']);
             } else {
                 $rs[$rowIndex]['hostname'] = $row['ip'];
             }
         }
         if ($row['hostname'] == '(unresolvable)') {
             $rs[$rowIndex]['hostname'] = '';
         }
         $rs[$rowIndex]['shortUserAgent'] = implode(' ', BrowserDetection::detect($row['shortUserAgent']));
     }
     return $rs;
 }
Beispiel #7
0
    title: 'Here!'
  });

}

function initData(datos){
	//mostramos los datos recibidos del JSON
	$('#datos').html("<br/><strong>IP</strong>: "+datos.ip);
	if(datos.country_name.length != 0)$('#datos').append("<br/><br/> <strong>Pais</strong> : "+datos.country_name);
	if(datos.region_name.length != 0)$('#datos').append("<br/> <strong>Region</strong> : "+datos.region_name);
	if(datos.city.length != 0)$('#datos').append("<br/> <strong>Ciudad</strong> : "+datos.city);
	if(datos.zip_code.length != 0)$('#datos').append("<br/><strong>Cod Postal</strong> : "+datos.zip_code);
	
	if(cliente_servidor == 'cliente'){//mostramos más datos del cliente
		<?php 
$browser = new BrowserDetection();
?>
		$('#datos').append("<br/><br/> <strong>Navegador</strong> : "+"<?php 
echo $browser->getBrowser();
?>
");
		$('#datos').append("<br/> <strong>Version</strong> : "+"<?php 
echo $browser->getVersion();
?>
");
		$('#datos').append("<br/> <strong>SO</strong> : "+"<?php 
echo $browser->getPlatform();
?>
");
		
	}