###
# dynastyle.php
#
# A script that checks the user browser
# and redirects it to the appropriate stylesheet
#
# Author : Tuan Lam (tuan.lam@epfl.ch)
# Version: 1.2
# Date : 06.12.2001
# Modification pour sti - lk - 25 janvier 2002
# Modification pour ajout style variable - lk - 25 fvrier 2002
#
# Copyleft e-pfl 2001
#
###
if (ereg( 'MSIE ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='IE';
} elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='OPERA';
} elseif (ereg( 'Mozilla/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='MOZILLA';
} else {
$BROWSER_VER=0;
$BROWSER_AGENT='OTHER';
}
/*
Determine platform
*/
if (strstr($HTTP_USER_AGENT,'Win')) {
$BROWSER_PLATFORM='Win';
} else if (strstr($HTTP_USER_AGENT,'Mac')) {
$BROWSER_PLATFORM='Mac';
} else if (strstr($HTTP_USER_AGENT,'Linux')) {
$BROWSER_PLATFORM='Linux';
} else if (strstr($HTTP_USER_AGENT,'Unix') || strstr($HTTP_USER_AGENT,'SunOS') ) {
$BROWSER_PLATFORM='Unix';
} else {
$BROWSER_PLATFORM='Other';
}
/* Modification pour sti - lk - 25 janvier 2002 */
$stylefile = "epfl-sti.css" ;
$style_unix = "epfl-sti-unix.css" ;
$style_nts = "epfl-sti-nts.css" ;
$style_var = "epfl-sti-var.css" ;
$style_nts_var = "epfl-sti-nts-var.css" ;
$styledyn = $HTTP_COOKIE_VARS["epfl_sti_style"];
if ( $style == "unix" )
{
$stylefile = $style_unix ;
}
if ( ereg("Linux|Unix", $BROWSER_PLATFORM))
{
$stylefile = $style_unix ;
}
elseif ( ( $BROWSER_AGENT == "MOZILLA" ) && ( $BROWSER_PLATFORM == "Win" ) )
{
$stylefile = $style_nts ;
}
if ( $styledyn == "var" )
{
$stylefile = $style_var;
}
if ($debug) {
echo $HTTP_USER_AGENT;
echo "
";
echo $styledyn;
echo "
";
echo $stylefile;
exit;
}
$fp = fopen ($stylefile, "r");
if ($fp){
print fread($fp,filesize("$stylefile"));
}
fclose($fp);
?>