From 0fd7ba478a79bc2cf6f675b4de07930dddd66fa4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 1 Nov 2015 17:27:41 +0100 Subject: [PATCH] Fix: add Mac OS --- htdocs/core/lib/functions.lib.php | 43 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5b990ac509c..fcadfb9e521 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -179,6 +179,7 @@ function getBrowserInfo($user_agent) // OS if (preg_match('/linux/i', $user_agent)) { $os='linux'; } + elseif (preg_match('/macintosh/i', $user_agent)) { $os='macintosh'; } // Name if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; } @@ -703,7 +704,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0) { global $conf,$langs, $hookmanager; - + $out="\n".'
'."\n"; // Show title @@ -733,7 +734,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi $displaytab=0; $nbintab=0; $popuptab=0; - + for ($i = 0 ; $i <= $maxkey ; $i++) { if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) @@ -777,7 +778,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi else { // The popup with the other tabs - if (! $popuptab) + if (! $popuptab) { $popuptab=1; $outmore.='
'; @@ -795,13 +796,13 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi $outmore.=''.$links[$i][1].''."\n"; $outmore.='
'; - + $nbintab++; } $displaytab=$i; } if ($popuptab) $outmore.='
'; - + if ($displaytab > $limittoshow) { $tabsname=str_replace("@", "", $picto); @@ -817,7 +818,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi } $out.="\n"; - + if (! $notab) $out.="\n".'
'."\n"; $parameters=array('tabname' => $active); @@ -900,7 +901,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r print '
'; print '
'; } - + /** * Show a string with the label tag dedicated to the HTML edit field. * @@ -1382,7 +1383,7 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0) function dol_print_url($url,$target='_blank',$max=32,$withpicto=0) { global $langs; - + if (empty($url)) return ''; $link=''; return $out; @@ -2958,7 +2959,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($cpt > 2) $pagelist.='dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...'; else if ($cpt == 2) $pagelist.='dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page=1'.$options.'&sortfield='.$sortfield.'&sortorder='.$sortorder.'">2'; } - + do { if ($cpt==$page) @@ -2972,7 +2973,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so $cpt++; } while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage); - + if ($cpt<$nbpages) { if ($cpt<$nbpages-2) $pagelist.= 'dol_use_jmobile)?' class="pagination"':'').'>dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...'; @@ -4402,7 +4403,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) } else if ($nameorder == 2) { - $ret.=$firstname; + $ret.=$firstname; } else { @@ -5225,7 +5226,7 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0) /** * Return the filename of file to get the thumbs - * + * * @param string $file Original filename * @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini') * @param string $extImgTarget Force image format for thumbs. Use '' to keep same extension than original image. @@ -5235,10 +5236,10 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='') { $dirName = dirname($file); if ($dirName == '.') $dirName=''; - + $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse $fileName = basename($fileName); - + if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':''); if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':''); if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i',$file)?'.gif':''); @@ -5246,9 +5247,9 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='') if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i',$file)?'.bmp':''); if (! $extImgTarget) return $file; - + $subdir=''; if ($extName) $subdir = 'thumbs/'; - + return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb }