';
/**
* Helper function for fetching the line end format.
*
* @return String 'win', 'unix', or 'mac' based on the user's browser..
*/
function get_line_end_format() {
if (is_browser('win'))
return 'win';
elseif (is_browser('unix'))
return 'unix';
elseif (is_browser('mac'))
return 'mac';
else
return 'unix';
}
/**
* Gets the USER_AGENT string from the $_SERVER array, all in lower case in
* an E_NOTICE safe manner.
*
* @return string|false The user agent string as reported by the browser.
*/
function get_user_agent_string() {
if (isset($_SERVER['HTTP_USER_AGENT']))
return strtolower($_SERVER['HTTP_USER_AGENT']);
else
return '';
}
/**
* Determine the OS for the browser
*/
function is_browser($type) {
$agents = array();
$agents['unix'] = array(
'sunos','sunos 4','sunos 5',
'i86',
'irix','irix 5','irix 6','irix6',
'hp-ux','09.','10.',
'aix','aix 1','aix 2','aix 3','aix 4',
'inux',
'sco',
'unix_sv','unix_system_v','ncr','reliant','dec','osf1',
'dec_alpha','alphaserver','ultrix','alphastation',
'sinix',
'freebsd','bsd',
'x11','vax','openvms'
);
$agents['win'] = array(
'win','win95','windows 95',
'win16','windows 3.1','windows 16-bit','windows','win31','win16','winme',
'win2k','winxp',
'win98','windows 98','win9x',
'winnt','windows nt','win32',
'32bit'
);
$agents['mac'] = array(
'mac','68000','ppc','powerpc'
);
if (isset($agents[$type]))
return in_array(get_user_agent_string(),$agents[$type]);
else
return false;
}
?>