/** * Create a new event instance. * * @return void */ public function __construct(Request $request) { $browser = getBrowserInfo(); $this->request = $request->all(); array_set($this->request, 'name', $request->user()->name); array_set($this->request, 'ip', clientIP()); array_set($this->request, 'browser', $browser['browser']); array_set($this->request, 'platform', $browser['platform']); }
require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; $langs->load("admin"); $langs->load("install"); $langs->load("other"); if (!$user->admin) { accessforbidden(); } /* * View */ $form = new Form($db); llxHeader(); print_fiche_titre($langs->trans("InfoBrowser"), '', 'setup'); $tmp = getBrowserInfo(); // Browser $var = true; print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td>' . $langs->trans("Parameter") . '</td><td colspan="2">' . $langs->trans("Value") . '</td></tr>' . "\n"; $var = !$var; print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("UserAgent") . '</td><td colspan="2">' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>' . "\n"; $var = !$var; print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("BrowserName") . '</td><td colspan="2">' . $tmp['browsername'] . '</td></tr>' . "\n"; $var = !$var; print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("BrowserOS") . '</td><td colspan="2">' . $tmp['browseros'] . '</td></tr>' . "\n"; $var = !$var; print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("Version") . '</td><td colspan="2">' . $tmp['browserversion'] . '</td></tr>' . "\n"; $var = !$var; print '<tr ' . $bc[$var] . '><td width="300">' . $langs->trans("Layout") . ' (phone/tablet/classic)</td><td colspan="2">' . $tmp['layout'] . '</td></tr>' . "\n"; $var = !$var;
$useforcedwizard = true; include_once $forcedfile; } dolibarr_install_syslog("--- check: Dolibarr install/upgrade process started"); /* * View */ pHeader('', ''); // No next step for navigation buttons. Next step is defined by clik on links. //print "<br>\n"; //print $langs->trans("InstallEasy")."<br><br>\n"; print '<h3>' . $langs->trans("MiscellaneousChecks") . ":</h3>\n"; // Check browser $useragent = $_SERVER['HTTP_USER_AGENT']; if (!empty($useragent)) { $tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); $browserversion = $tmp['browserversion']; $browsername = $tmp['browsername']; if ($browsername == 'ie' && $browserversion < 7) { print '<img src="../theme/eldy/img/warning.png" alt="Error"> ' . $langs->trans("WarningBrowserTooOld") . "<br>\n"; } } // Check PHP version if (versioncompare(versionphparray(), array(5, 2, 3)) < 0) { print '<img src="../theme/eldy/img/error.png" alt="Error"> ' . $langs->trans("ErrorPHPVersionTooLow", '5.2.3'); $checksok = 0; // 0=error, 1=warning } else { if (versioncompare(versionphparray(), array(5, 3, 0)) < 0) { print '<img src="../theme/eldy/img/warning.png" alt="Error"> ' . $langs->trans("ErrorPHPVersionTooLow", '5.3.0'); $checksok = 0;
*/ if (isset($_COOKIE[COOKIE_NAME_NO_STAT . $site->getId()])) { printDebug("Excluded from stats with the cookie!"); redirectToUrlIfNecessary(); loadImage($logo, $idSite); } /* * page variables */ $a_vars = getRequestVar('a_vars', array(), 'array'); /* * visitor config, as saved in the database */ $userAgent = secureVar(@$_SERVER['HTTP_USER_AGENT']); $os = getOs($userAgent); $a_browser = getBrowserInfo($userAgent); $resolution = getRequestVar('res', 'unknown', 'string'); $colorDepth = getRequestVar('col', 32, 'numeric'); $browserLang = secureVar(@$_SERVER['HTTP_ACCEPT_LANGUAGE']); $localTime = getRequestVar('h', date("H"), 'numeric') . ':' . getRequestVar('m', date("i"), 'numeric') . ':' . getRequestVar('s', date("s"), 'numeric'); // assign pageCategory default value of the parse_url::path?query $pageUrlParamsProcessed = processParams($pageUrl, $siteParams); // fix add site.com because else parse_url bugs with ':' in query string if (!ereg('^http://', $pageUrlParamsProcessed)) { $urlParse = parse_url('http://site.com' . $pageUrlParamsProcessed); } else { $urlParse = parse_url($pageUrlParamsProcessed); } if (isset($urlParse['path'])) { $pageNameDefault = substr($urlParse['path'], 1); }
/** * testDolHtmlCleanLastBr * * @return void */ public function testGetBrowserVersion() { $_SERVER['HTTP_USER_AGENT']='Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; KITV4 Wanadoo; KITV5 Wanadoo)'; // MSIE 5.0 $tmp=getBrowserInfo(); $this->assertEquals('ie',$tmp['browsername']); $this->assertEquals('5.0',$tmp['browserversion']); $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firefox/0.9.1'; // Firefox 0.9.1 $tmp=getBrowserInfo(); $this->assertEquals('firefox',$tmp['browsername']); $this->assertEquals('0.9.1',$tmp['browserversion']); $_SERVER['HTTP_USER_AGENT']='Mozilla/3.0 (Windows 98; U) Opera 6.03 [en]'; $tmp=getBrowserInfo(); $this->assertEquals('opera',$tmp['browsername']); $this->assertEquals('6.03',$tmp['browserversion']); $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21'; $tmp=getBrowserInfo(); $this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('19.0.1042.0',$tmp['browserversion']); $_SERVER['HTTP_USER_AGENT']='chrome (Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11)'; $tmp=getBrowserInfo(); $this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('17.0.963.56',$tmp['browserversion']); $_SERVER['HTTP_USER_AGENT']='Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1'; $tmp=getBrowserInfo(); $this->assertEquals('safari',$tmp['browsername']); $this->assertEquals('533.21.1',$tmp['browserversion']); }
/** * Attempt to login a user via the bolt_authtoken cookie * * @return bool */ public function loginAuthtoken() { // If there's no cookie, we can't resume a session from the authtoken. if (empty($_COOKIE['bolt_authtoken'])) { return false; } $authtoken = $_COOKIE['bolt_authtoken']; $remoteip = $_SERVER['REMOTE_ADDR']; $browser = getBrowserInfo(); $this->deleteExpiredSessions(); // Check if there's already a token stored for this token / IP combo. try { $query = "SELECT * FROM " . $this->authtokentable . " WHERE token=? AND ip=? AND useragent=?"; $query = $this->app['db']->getDatabasePlatform()->modifyLimitQuery($query, 1); $row = $this->db->executeQuery($query, array($authtoken, $remoteip, $browser), array(\PDO::PARAM_STR))->fetch(); } catch (\Doctrine\DBAL\DBALException $e) { // Oops. User will get a warning on the dashboard about tables that need to be repaired. } // If there's no row, we can't resume a session from the authtoken. if (empty($row)) { return false; } $checksalt = $this->getAuthtoken($row['username'], $row['salt']); if ($checksalt == $row['token']) { $user = $this->getUser($row['username']); $update = array('lastseen' => date('Y-m-d H:i:s'), 'lastip' => $_SERVER['REMOTE_ADDR'], 'failedlogins' => 0, 'throttleduntil' => $this->throttleUntil(0)); // Attempt to update the last login, but don't break on failure. try { $this->db->update($this->usertable, $update, array('id' => $user['id'])); } catch (\Doctrine\DBAL\DBALException $e) { // Oops. User will get a warning on the dashboard about tables that need to be repaired. } $user['sessionkey'] = $this->getAuthtoken($user['username']); $this->session->set('user', $user); $this->session->getFlashBag()->set('success', __("Session resumed.")); $this->currentuser = $user; $this->setAuthtoken(); return true; } else { // Delete the authtoken cookie.. setcookie('bolt_authtoken', '', time() - 1, '/', $this->app['config']->get('general/cookies_domain'), $this->app['config']->get('general/cookies_https_only'), true); return false; } }
/** * testGetBrowserInfo * * @return void */ public function testGetBrowserInfo() { // MSIE 5.0 $user_agent = 'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; KITV4 Wanadoo; KITV5 Wanadoo)'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('ie', $tmp['browsername']); $this->assertEquals('5.0', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); // Firefox 0.9.1 $user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firefox/0.9.1'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('firefox', $tmp['browsername']); $this->assertEquals('0.9.1', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); $user_agent = 'Mozilla/3.0 (Windows 98; U) Opera 6.03 [en]'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('opera', $tmp['browsername']); $this->assertEquals('6.03', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); $user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('chrome', $tmp['browsername']); $this->assertEquals('19.0.1042.0', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); $user_agent = 'chrome (Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11)'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('chrome', $tmp['browsername']); $this->assertEquals('17.0.963.56', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); $user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('safari', $tmp['browsername']); $this->assertEquals('533.21.1', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); //Internet Explorer 11 $user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('ie', $tmp['browsername']); $this->assertEquals('11.0', $tmp['browserversion']); $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); //iPad $user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25'; $tmp = getBrowserInfo($user_agent); $this->assertEquals('safari', $tmp['browsername']); $this->assertEquals('8536.25', $tmp['browserversion']); $this->assertEquals('ios', $tmp['browseros']); $this->assertEquals('tablet', $tmp['layout']); $this->assertEquals('iphone', $tmp['phone']); }