Moved code into correct file
This commit is contained in:
parent
a3f942ff70
commit
6f24a7abfd
@ -136,6 +136,37 @@ session_start();
|
||||
require_once("master.inc.php");
|
||||
|
||||
|
||||
// Detection browser
|
||||
// TODO rename conf->browser into user->browser
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"]))
|
||||
{
|
||||
// If phone/smartphone, we set phone os name.
|
||||
if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='android';
|
||||
elseif (preg_match('/blackberry/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='blackberry';
|
||||
elseif (preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='iphone';
|
||||
elseif (preg_match('/ipod/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='iphone';
|
||||
elseif (preg_match('/palm/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='palm';
|
||||
elseif (preg_match('/symbian/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='symbian';
|
||||
elseif (preg_match('/webos/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='webos';
|
||||
elseif (preg_match('/maemo/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='maemo';
|
||||
// MS products at end
|
||||
elseif (preg_match('/iemobile/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
|
||||
elseif (preg_match('/windows ce/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
|
||||
// Name
|
||||
if (preg_match('/firefox/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='firefox';
|
||||
elseif (preg_match('/chrome/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='chrome';
|
||||
elseif (preg_match('/iceweasel/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='iceweasel';
|
||||
elseif ((empty($conf->browser->phone) || preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) && preg_match('/safari/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='safari'; // Safari is often present in string but its not.
|
||||
elseif (preg_match('/opera/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='opera';
|
||||
// MS products at end
|
||||
elseif (preg_match('/msie/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='ie';
|
||||
else $conf->browser->name='unknown';
|
||||
// Other
|
||||
if (in_array($conf->browser->name,array('firefox','iceweasel'))) $conf->browser->firefox=1;
|
||||
//$conf->browser->phone='android';
|
||||
}
|
||||
|
||||
|
||||
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
|
||||
if (! empty($conf->file->main_force_https))
|
||||
{
|
||||
|
||||
@ -81,36 +81,6 @@ if (! empty($dolibarr_main_document_root_alt))
|
||||
}
|
||||
}
|
||||
|
||||
// Detection browser
|
||||
// TODO Move this into main.inc.php and rename conf->browser into user->browser
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"]))
|
||||
{
|
||||
// If phone/smartphone, we set phone os name.
|
||||
if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='android';
|
||||
elseif (preg_match('/blackberry/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='blackberry';
|
||||
elseif (preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='iphone';
|
||||
elseif (preg_match('/ipod/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='iphone';
|
||||
elseif (preg_match('/palm/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='palm';
|
||||
elseif (preg_match('/symbian/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='symbian';
|
||||
elseif (preg_match('/webos/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='webos';
|
||||
elseif (preg_match('/maemo/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='maemo';
|
||||
// MS products at end
|
||||
elseif (preg_match('/iemobile/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
|
||||
elseif (preg_match('/windows ce/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
|
||||
// Name
|
||||
if (preg_match('/firefox/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='firefox';
|
||||
elseif (preg_match('/chrome/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='chrome';
|
||||
elseif (preg_match('/iceweasel/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='iceweasel';
|
||||
elseif ((empty($conf->browser->phone) || preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) && preg_match('/safari/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='safari'; // Safari is often present in string but its not.
|
||||
elseif (preg_match('/opera/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='opera';
|
||||
// MS products at end
|
||||
elseif (preg_match('/msie/i',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='ie';
|
||||
else $conf->browser->name='unknown';
|
||||
// Other
|
||||
if (in_array($conf->browser->name,array('firefox','iceweasel'))) $conf->browser->firefox=1;
|
||||
//$conf->browser->phone='android';
|
||||
}
|
||||
|
||||
// Chargement des includes principaux de librairies communes
|
||||
if (! defined('NOREQUIREUSER')) require_once(DOL_DOCUMENT_ROOT ."/user/class/user.class.php"); // Need 500ko memory
|
||||
if (! defined('NOREQUIRETRAN')) require_once(DOL_DOCUMENT_ROOT ."/core/class/translate.class.php");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user