extranet/www/includeheader.php
2010-03-03 13:21:24 +00:00

64 lines
1.9 KiB
PHP

<?php
require_once 'includecss.php';
if($sortie!='prt') require_once 'includejs.php';
function isBuggyIe()
{
$encodeToIe6 = false;
$ua = $_SERVER['HTTP_USER_AGENT'];
// quick escape for non-IEs
if (0 !== strpos($ua, 'Mozilla/4.0 (compatible; MSIE ')
|| false !== strpos($ua, 'Opera')) {
return false;
}
// no regex = faaast
$version = (float)substr($ua, 30);
return $encodeToIe6
? ($version < 6 || ($version == 6 && false === strpos($ua, 'SV1')))
: ($version < 7);
}
$compressoff = false;
/* == Traitement des feuilles de styles == */
if(isset($tabStyles) && count($tabStyles)>0){
foreach($tabStyles as $name => $group){
if( in_array('all', $group['pages']) || in_array($page, $group['pages']) ){
if( ENVIRONNEMENT == 'DEV' || $sortie=='pdf' || $compressoff || isBuggyIe() ){
foreach($group['list'] as $style){
echo '<link rel="stylesheet" type="text/css" media="all" href="./css/';
if (isset($path_css)) {
echo $path_css;
}
echo $style.'" />';
echo "\n";
}
}else{
echo '<link rel="stylesheet" type="text/css" media="all" href="'.EXTRANET_URL.'min/?g='.$name.'"/>';
echo "\n";
}
}
}
}
/* == Traitement des scripts javascripts == */
$compressoff = false;
if(isset($tabScripts) && count($tabScripts)>0){
foreach($tabScripts as $name => $group){
if(in_array('all', $group['pages']) || in_array($page, $group['pages'])){
if( ENVIRONNEMENT == 'DEV' || $compressoff || isBuggyIe()){
foreach($group['list'] as $script){
echo '<script type="text/javascript" src="./js/'.$script.'"></script>';
echo "\n";
}
}else{
echo '<script type="text/javascript" src="'.EXTRANET_URL.'min/?g='.$name.'"></script>';
echo "\n";
}
}
}
}