0) || (isset($htmlErrorList) && $htmlErrorList != ''));
}
//--------------------------------------------------
// If an error has occurred, we should replace the
// page title - useful for screen reader users,
// to inform them of a problem
if ($GLOBALS['tplErrorOccurred']) {
$GLOBALS['tplPageTitle'] = ' - An error has occurred';
}
//--------------------------------------------------
// Folder
if (isset($GLOBALS['webAddressBase'])) {
$urlAssetsFolder = $GLOBALS['webAddressBase'];
} else {
$urlAssetsFolder = $GLOBALS['webAddress'];
}
//--------------------------------------------------
// Create the skip links
$GLOBALS['tplAccessKeys'] = array();
$GLOBALS['tplAccessKeys']['skipToErr'] = returnSubmittedValue('accessKeySkipToErr', 'COOKIE');
$GLOBALS['tplAccessKeys']['skipToCont'] = returnSubmittedValue('accessKeySkipToCont', 'COOKIE');
$GLOBALS['tplAccessKeys']['skipToNav'] = returnSubmittedValue('accessKeySkipToNav', 'COOKIE');
if ($GLOBALS['tplAccessKeys']['skipToErr'] == '') $GLOBALS['tplAccessKeys']['skipToErr'] = 'e';
if ($GLOBALS['tplAccessKeys']['skipToCont'] == '') $GLOBALS['tplAccessKeys']['skipToCont'] = '1';
if ($GLOBALS['tplAccessKeys']['skipToNav'] == '') $GLOBALS['tplAccessKeys']['skipToNav'] = '2';
$GLOBALS['tplSkipLinksHtml'] = '
';
if ($GLOBALS['tplErrorOccurred'] && isset($GLOBALS['tplErrorListId'])) {
$GLOBALS['tplSkipLinksHtml'] .= "\n\t\t" . 'Skip to errors ' . ($GLOBALS['tplAccessKeys']['skipToErr'] == '-' ? '' : ' (access key: ' . html($GLOBALS['tplAccessKeys']['skipToErr']) . ') ') . ' ';
}
$GLOBALS['tplSkipLinksHtml'] .= "\n\t\t" . 'Skip to page content ' . ($GLOBALS['tplAccessKeys']['skipToCont'] == '-' ? '' : ' (access key: ' . html($GLOBALS['tplAccessKeys']['skipToCont']) . ') ') . ' ';
$GLOBALS['tplSkipLinksHtml'] .= "\n\t\t" . 'Skip to navigation bar ' . ($GLOBALS['tplAccessKeys']['skipToNav'] == '-' ? '' : ' (access key: ' . html($GLOBALS['tplAccessKeys']['skipToNav']) . ') ') . ' ';
$GLOBALS['tplSkipLinksHtml'] .= "\n\t" . ' ' . "\n";
//--------------------------------------------------
// JavaScript
//--------------------------------------------------
// If flash is required
if (is_file(ROOT . '/a/js/flashReplace/index.php')) {
$GLOBALS['tplJavaScriptFiles'][] = $urlAssetsFolder . '/a/js/flashReplace.js';
$GLOBALS['tplJavaScriptFiles'][] = $urlAssetsFolder . '/a/js/flashReplace/?a=' . urlencode(preg_replace('/\/*$/', '', implode('/', $GLOBALS['tplFolder'])));
}
//--------------------------------------------------
// Build the JS HTML code - taking that the user
// has not disabled it.
$jsDisable = returnSubmittedValue('jsDisable', 'COOKIE');
if ($jsDisable != 'true') {
if (count($GLOBALS['tplJavaScriptFiles']) > 0) {
$GLOBALS['tplJavaScriptHtml'] = '' . "\n\t";
}
foreach ($GLOBALS['tplJavaScriptFiles'] as $file) {
$GLOBALS['tplJavaScriptHtml'] .= '' . "\n\t";
}
}
//--------------------------------------------------
// CSS
//--------------------------------------------------
// Setup the css files for this site:
// mediaNormal - the normal media type
// mediaSelected - the selected media type
// default - is used by default
// altTitle - if set, provided to browser as alt
// altSticky - set true to keep over page loads
// accessKey - the html access key used in links
if (!isset($cssLinks)) {
$cssLinks = array();
$cssLinks['core']['mediaNormal'] = 'all';
$cssLinks['core']['mediaSelected'] = 'all';
$cssLinks['core']['showDefault'] = true;
$cssLinks['core']['altTitle'] = '';
$cssLinks['core']['altSticky'] = false;
$cssLinks['core']['accessKey'] = 'n';
$cssLinks['print']['mediaNormal'] = 'print';
$cssLinks['print']['mediaSelected'] = 'print,screen';
$cssLinks['print']['showDefault'] = true;
$cssLinks['print']['altTitle'] = 'Print';
$cssLinks['print']['altSticky'] = false;
$cssLinks['print']['accessKey'] = 'p';
$cssLinks['high']['mediaNormal'] = 'screen,screen';
$cssLinks['high']['mediaSelected'] = 'screen,screen';
$cssLinks['high']['showDefault'] = false;
$cssLinks['high']['altTitle'] = 'High Contrast';
$cssLinks['high']['altSticky'] = true;
$cssLinks['high']['accessKey'] = 'h';
}
//--------------------------------------------------
// Version Number
$version = intval(isset($GLOBALS['tplCssVersion']) ? $GLOBALS['tplCssVersion'] : 0);
//--------------------------------------------------
// Return the required values for this script
$styleSheetGet = returnSubmittedValue('styleSheetName', 'GET');
$styleSheetCookie = returnSubmittedValue('styleSheetName', 'COOKIE');
//--------------------------------------------------
// Decide on the style sheets to use
//--------------------------------------------------
// If the 'normal' style sheet has been selected,
// then this indicates a need for a reset
if ($styleSheetGet == 'normal' || $styleSheetCookie == 'normal') {
$styleSheetGet = '';
$styleSheetCookie = '';
setcookie('styleSheetName', '', 0, '/');
}
//--------------------------------------------------
// Check that the get/cookie references a style
// sheet and that the cookie is a valid sticky
// option
if (!isset($cssLinks[$styleSheetGet])) {
$styleSheetGet = '';
}
if (!isset($cssLinks[$styleSheetCookie]) || $cssLinks[$styleSheetCookie]['altSticky'] != true) {
$styleSheetCookie = '';
}
//--------------------------------------------------
// If a style sheet has been specified through
// the GET request, then store it in a cookie,
// otherwise get the style sheet name from
// the cookie
if ($styleSheetGet != '') {
$styleSheetName = $styleSheetGet;
if ($cssLinks[$styleSheetName]['altSticky'] == true) {
setcookie('styleSheetName', $styleSheetName, 0, '/');
}
} else {
$styleSheetName = $styleSheetCookie;
}
//--------------------------------------------------
// Return the name of the root (first) folder
if (isset($GLOBALS['tplFolder'][0]) && $GLOBALS['tplFolder'][0] != '') {
$rootFolders = $GLOBALS['tplFolder'];
} else {
$rootFolders = array('home');
}
//--------------------------------------------------
// Build an array of style sheet files
foreach ($cssLinks as $cssFileName => $cInfo) {
$cssLinks[$cssFileName]['files'] = array();
$file = '/a/css/global/' . $cssFileName . '.css';
if (is_file(ROOT . $file)) {
$cssLinks[$cssFileName]['files'][] = $file;
}
}
$buildUpAddress = '/a/css/';
foreach ($rootFolders as $f) {
if ($f != '') {
$buildUpAddress .= $f . '/';
foreach ($cssLinks as $cssFileName => $cInfo) {
$file = $buildUpAddress . $cssFileName . '.css';
if (is_file(ROOT . $file)) {
$cssLinks[$cssFileName]['files'][] = $file;
}
}
}
}
//--------------------------------------------------
// Create the HTML in an 'easy to insert' var
$GLOBALS['tplCssLinksHtml'] = '';
foreach ($cssLinks as $cssFileName => $cInfo) {
if ($cInfo['showDefault'] == true || $styleSheetName == $cssFileName) {
foreach ($cInfo['files'] as $file) {
$GLOBALS['tplCssLinksHtml'] .= ' ' . "\n\t";
}
}
}
if ($GLOBALS['tplCssLinksHtml'] != '') {
$GLOBALS['tplCssLinksHtml'] .= "\n\t";
}
foreach ($cssLinks as $cssFileName => $cInfo) {
if ($cInfo['altTitle'] != '' && $styleSheetName != $cssFileName) {
foreach ($cInfo['files'] as $file) {
$GLOBALS['tplCssLinksHtml'] .= ' ' . "\n\t";
}
}
}
//--------------------------------------------------
// Create the $queryString which can be
// added to the beginning of the style sheet
// switcher url's
$GLOBALS['tplCssSwitcherQuery'] = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
$GLOBALS['tplCssSwitcherQuery'] = preg_replace('/styleSheetName=[^&]*&/', '', $GLOBALS['tplCssSwitcherQuery']);
$GLOBALS['tplCssSwitcherQuery'] = preg_replace('/(^|&)styleSheetName=[^&]*$/', '', $GLOBALS['tplCssSwitcherQuery']);
if ($GLOBALS['tplCssSwitcherQuery'] != '') {
$GLOBALS['tplCssSwitcherQuery'] .= '&';
}
//--------------------------------------------------
// Create the style sheet switcher code
//--------------------------------------------------
// Start
$GLOBALS['tplCssSwitcherHtml'] = '';
//--------------------------------------------------
// Normal style (reset)
$accessKey = returnSubmittedValue('accessKeyCssNormal', 'COOKIE');
if ($accessKey == '') {
$accessKey = 'n';
}
$GLOBALS['tplAccessKeys']['cssNormal'] = $accessKey;
$GLOBALS['tplCssSwitcherHtml'] .= "\n\t\t" . 'View normal style ' . ($accessKey == '-' ? '' : ' (access key: ' . html($accessKey) . ') ') . ' ';
//--------------------------------------------------
// Additional styles
foreach ($cssLinks as $cssFileName => $cInfo) {
if ($cInfo['altTitle'] != '') {
$accessKey = returnSubmittedValue('accessKeyCss' . ucfirst($cssFileName), 'COOKIE');
if ($accessKey == '') {
$accessKey = $cInfo['accessKey'];
}
$GLOBALS['tplAccessKeys']['css' . ucfirst($cssFileName)] = $accessKey;
$GLOBALS['tplCssSwitcherHtml'] .= "\n\t\t" . 'View ' . html(strtolower($cInfo['altTitle'])) . ' style ' . ($accessKey == '-' ? '' : ' (access key: ' . html($accessKey) . ') ') . ' ';
}
}
//--------------------------------------------------
// End
$GLOBALS['tplCssSwitcherHtml'] .= "\n\t" . ' ' . "\n";
//--------------------------------------------------
// Kill the assets if this browser is not supported.
//--------------------------------------------------
// A list of browsers which will be harmed by
// the CSS or JS
if (!isset($browserBlackList)) {
$browserBlackList = array();
$browserBlackList[] = '/MSIE [1-4]\./';
$browserBlackList[] = '/MSIE.*; Mac_PowerPC/';
$browserBlackList[] = '/Netscape\/[4-7]\./';
}
//--------------------------------------------------
// Run the test
if (isset($_SERVER['HTTP_USER_AGENT'])) {
foreach ($browserBlackList as $browserRegExp) {
if (preg_match($browserRegExp, $_SERVER['HTTP_USER_AGENT'])) {
$GLOBALS['tplCssLinksHtml'] = '';
$GLOBALS['tplJavaScriptHtml'] = '';
$GLOBALS['tplExtraHeadHtml'] = '';
$GLOBALS['tplSkipLinksHtml'] = '';
$GLOBALS['tplCssSwitcherHtml'] = '';
}
}
}
//--------------------------------------------------
// Send the XML prolog if we are in XML mode
if ($GLOBALS['pageMimeType'] == 'application/xhtml+xml') {
echo '' . "\n";
}
?>