diff --git a/ChangeLog b/ChangeLog index d40521e4833..974e864518f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -87,7 +87,7 @@ For developers: - If module numberwords is installed, code can use langs->getLabelFromNumber to get value of an amount in text. - A module can add subsitution keys in makesubsitutions() functions. - +- Add $conf->browser->phone defined to optimise code for smartphone browsers. ***** Changelog for 2.6 compared to 2.5 ***** diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 95c2e0a4ef9..a8abc1b4536 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -163,7 +163,6 @@ function dol_loginfunction($langs,$conf,$mysoc) print '" tabindex="1" />'; // Show logo (search in order: small company logo, large company logo, theme logo, common logo) - $title=''; $width=0; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) @@ -179,9 +178,14 @@ function dol_loginfunction($langs,$conf,$mysoc) { $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; } - print '
browser->name='firefox';
elseif (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='iceweasel';
elseif (eregi('safari',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='safari';
@@ -178,6 +179,16 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
elseif (eregi('opera',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='opera';
elseif (eregi('msie',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->name='ie';
else $conf->browser->name='unknown';
+ // If phone/smartphone, we set osname.
+ if (eregi('android',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='android';
+ elseif (eregi('blackberry',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='blackberry';
+ elseif (eregi('iphone',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='iphone';
+ elseif (eregi('palm',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='palm';
+ elseif (eregi('symbian',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='symbian';
+ elseif (eregi('webos',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='webos';
+ elseif (eregi('iemobile',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
+ elseif (eregi('windows ce',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->phone='windowsmobile';
+ // Other
if (in_array($conf->browser->name,array('firefox','iceweasel'))) $conf->browser->firefox=1;
}