diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 654e9b3b7f9..54544dbc30d 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -199,9 +199,9 @@ function dolibarr_syslog($message, $level=LOG_INFO) { $facility = LOG_USER; } - + openlog("dolibarr", LOG_PID | LOG_PERROR, $facility); - + if (! $level) { syslog(LOG_ERR, $message); @@ -210,7 +210,7 @@ function dolibarr_syslog($message, $level=LOG_INFO) { syslog($level, $message); } - + closelog(); } } @@ -683,7 +683,7 @@ function dolibarr_print_phone($phone,$country="FR") function dol_print_size($size) { global $langs; - + return $size.' '.$langs->trans("Bytes"); } @@ -1186,6 +1186,31 @@ function img_allow($allow) } +/** + * \brief Show mime picto + * \param file Filename + * \return string Return img tag + */ +function img_mime($file) +{ + $mime='other'; + if (eregi('\.pdf',$file)) { $mime='pdf'; } + if (eregi('\.(html|htm)',$file)) { $mime='html'; } + if (eregi('\.txt',$file)) { $mime='other'; } + if (eregi('\.php',$file)) { $mime='php'; } + if (eregi('\.pl',$file)) { $mime='pl'; } + if (eregi('\.js',$file)) { $mime='jscript'; } + if (eregi('\.(png|bmp|jpg|jpeg|gif)',$file)) $mime='image'; + if (eregi('\.(mp3|ogg|au)',$file)) $mime='audio'; + if (eregi('\.(avi|mvw|divx|xvid)',$file)) $mime='video'; + if (eregi('\.(zip|rar|divx|xvid)',$file)) $mime='archive'; + $alt='Mime type: '.$mime; + + $mime.='.png'; + return ''.$alt.''; +} + + /** \brief Return if a filename is file name of a supported image format \param file Filename @@ -1477,7 +1502,7 @@ function dolibarr_print_error($db='',$error='') if ($error) { $langs->load("errors"); - + if (is_array($error)) $errors=$error; else $errors=array($error); @@ -1766,9 +1791,9 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so print ''; print '
'.$titre.'
'; print ''; - + $maxnbofpage=10; - + $nbpages=ceil($totalnboflines/$conf->liste_limit); $cpt=($page-$maxnbofpage); if ($cpt < 0) { $cpt=0; } @@ -2332,9 +2357,9 @@ function measuring_units_string($unit,$measuring_style='') * cela surchagerait inutilement d'une requete supplémentaire * pour quelque chose qui est somme toute peu variable */ - + global $langs; - + if ($measuring_style == 'weight') { $measuring_units[3] = $langs->trans("WeightUnitton"); @@ -2551,7 +2576,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') if ($countrycode == 'FR') { $countryfound=1; - + // Definition des dates feriees fixes if($jour == 1 && $mois == 1) $ferie=true; // 1er janvier if($jour == 1 && $mois == 5) $ferie=true; // 1er mai @@ -2561,7 +2586,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') if($jour == 1 && $mois == 11) $ferie=true; // 1 novembre if($jour == 11 && $mois == 11) $ferie=true; // 11 novembre if($jour == 25 && $mois == 12) $ferie=true; // 25 decembre - + // Calcul du jour de paques $date_paques = easter_date($annee); $jour_paques = date("d", $date_paques); @@ -2581,7 +2606,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') $mois_ascension = date("m", $date_ascension); if($jour_ascension == $jour && $mois_ascension == $mois) $ferie=true; //Ascension - + // Calcul de Pentecote (11 jours apres Paques) $date_pentecote = mktime(date("H", $date_ascension), date("i", $date_ascension), diff --git a/htdocs/theme/common/mime/archive.png b/htdocs/theme/common/mime/archive.png new file mode 100644 index 00000000000..f6aad0ffec2 Binary files /dev/null and b/htdocs/theme/common/mime/archive.png differ diff --git a/htdocs/theme/common/mime/audio.png b/htdocs/theme/common/mime/audio.png new file mode 100644 index 00000000000..c866378acaa Binary files /dev/null and b/htdocs/theme/common/mime/audio.png differ diff --git a/htdocs/theme/common/mime/doc.png b/htdocs/theme/common/mime/doc.png new file mode 100644 index 00000000000..dc72990b017 Binary files /dev/null and b/htdocs/theme/common/mime/doc.png differ diff --git a/htdocs/theme/common/mime/flash.png b/htdocs/theme/common/mime/flash.png new file mode 100644 index 00000000000..1d15dee1fe0 Binary files /dev/null and b/htdocs/theme/common/mime/flash.png differ diff --git a/htdocs/theme/common/mime/html.png b/htdocs/theme/common/mime/html.png new file mode 100644 index 00000000000..6b3a01f5848 Binary files /dev/null and b/htdocs/theme/common/mime/html.png differ diff --git a/htdocs/theme/common/mime/image.png b/htdocs/theme/common/mime/image.png new file mode 100644 index 00000000000..c2d36d3c39f Binary files /dev/null and b/htdocs/theme/common/mime/image.png differ diff --git a/htdocs/theme/common/mime/jscript.png b/htdocs/theme/common/mime/jscript.png new file mode 100644 index 00000000000..b98f0c96264 Binary files /dev/null and b/htdocs/theme/common/mime/jscript.png differ diff --git a/htdocs/theme/common/mime/notavailable.png b/htdocs/theme/common/mime/notavailable.png new file mode 100644 index 00000000000..05ff3180a72 Binary files /dev/null and b/htdocs/theme/common/mime/notavailable.png differ diff --git a/htdocs/theme/common/mime/other.png b/htdocs/theme/common/mime/other.png new file mode 100644 index 00000000000..59bd215ef5c Binary files /dev/null and b/htdocs/theme/common/mime/other.png differ diff --git a/htdocs/theme/common/mime/php.png b/htdocs/theme/common/mime/php.png new file mode 100644 index 00000000000..b9630b7801f Binary files /dev/null and b/htdocs/theme/common/mime/php.png differ diff --git a/htdocs/theme/common/mime/pl.png b/htdocs/theme/common/mime/pl.png new file mode 100644 index 00000000000..7dd4876729d Binary files /dev/null and b/htdocs/theme/common/mime/pl.png differ diff --git a/htdocs/theme/common/mime/ppt.png b/htdocs/theme/common/mime/ppt.png new file mode 100644 index 00000000000..999bed49a21 Binary files /dev/null and b/htdocs/theme/common/mime/ppt.png differ diff --git a/htdocs/theme/common/mime/quicktime.png b/htdocs/theme/common/mime/quicktime.png new file mode 100644 index 00000000000..3089b46401a Binary files /dev/null and b/htdocs/theme/common/mime/quicktime.png differ diff --git a/htdocs/theme/common/mime/real.png b/htdocs/theme/common/mime/real.png new file mode 100644 index 00000000000..9ca3fbf536e Binary files /dev/null and b/htdocs/theme/common/mime/real.png differ diff --git a/htdocs/theme/common/mime/script.png b/htdocs/theme/common/mime/script.png new file mode 100644 index 00000000000..16315d6a6d4 Binary files /dev/null and b/htdocs/theme/common/mime/script.png differ diff --git a/htdocs/theme/common/mime/svg.png b/htdocs/theme/common/mime/svg.png new file mode 100644 index 00000000000..bfc5645d9ad Binary files /dev/null and b/htdocs/theme/common/mime/svg.png differ diff --git a/htdocs/theme/common/mime/text.png b/htdocs/theme/common/mime/text.png new file mode 100644 index 00000000000..67cb8041b28 Binary files /dev/null and b/htdocs/theme/common/mime/text.png differ diff --git a/htdocs/theme/common/mime/ttf.png b/htdocs/theme/common/mime/ttf.png new file mode 100644 index 00000000000..f3cc58c2a3c Binary files /dev/null and b/htdocs/theme/common/mime/ttf.png differ diff --git a/htdocs/theme/common/mime/video.png b/htdocs/theme/common/mime/video.png new file mode 100644 index 00000000000..eca195f5eba Binary files /dev/null and b/htdocs/theme/common/mime/video.png differ diff --git a/htdocs/theme/common/mime/xls.png b/htdocs/theme/common/mime/xls.png new file mode 100644 index 00000000000..569bb370cb7 Binary files /dev/null and b/htdocs/theme/common/mime/xls.png differ