0 ) {
$cached = 'cached/' . $_GET['type'] . '_websites.cache';
}
$updateperiod = 10080 ; // time in minutes - 1430 = 23:50 hours:minutes
$modified = @filemtime( $cached ) ;
$nextupdate = mktime() - ( $updateperiod * 60 ) ;
$file_expiry_date = gmdate ( "D, d M Y H:i:s", ( time() + ( $updateperiod * 60 ) ) ) . ' GMT' ; // Generate expiry string
header( 'Last-Modified: ' . gmdate ( "D, d M Y H:i:s", $modified ) ) ; // Overwrite default Last Modified header
header( 'Expires: ' . $file_expiry_date ) ; // Overwrite default Expires header
header( 'Cache-Control: max-age=' . ( $updateperiod * 60 ) ) ; // Overwrite default Cache Control header
header( 'Pragma: public' ); // Overwrite default Pragma header
if ( @file_exists( $cached ) && ( $modified > $nextupdate ) ) {
$headers = getallheaders() ;
if ( stristr ( $headers['Accept-Encoding'], 'gzip' ) ) {
$cached = $cached . '.gz' ;
header('Content-Encoding: gzip') ;
}
// echo cached file
$fp = fopen( $cached, "r" ) ;
// Output the header and footer and page information
echo fread( $fp, filesize( $cached ) ) ;
} else {
//start output buferring
ob_start();
//first lets decide whether we are in a subsection of the portfolio?
$chosenSection = false ;
if ( strlen ( $_GET['type'] ) > 0 ) {
//some sort of subsection has been requested...
//lets check if we have a match...
$chosenSection = @lookupSectionIDBasedOnName ( $db , str_replace ( '_' , ' ' , $_GET['type'] ) ) ;
}
$subSection = '' ;
//we had a match and it all worked out ok...
if ( $chosenSection !== false ) {
//so get PortFolio array using the chosen section variable...
//3rd variable - true - denotes that we wish to pull sites contained in this section.
$pf = getSections ( $db , $chosenSection , true ) ;
$subSection = ' | ' . $pf[0]['Name'] ;
} else {
//if the get string request was faked or we werent set one in the first place
//pull entire portfolio in one array with a faked section called 'All'...
$pf = getEntirePortfolio ( $db ) ;
}
//get all section names to be used for the links... no need for params, as we just want the section names and descrips
$secs = getSections ( $db ) ;
$numSecs = sizeof( $secs ) ; //count
//define background colours array used in the portfolio sites' placeholders.
$cols = array ( '#F2F1ED' ,
'#EDF0F2' ,
'#F0F2ED' ,
'#FFFFFF' ,
'#EDF2F2' ,
'#FFFFFA' ,
'#E5DEDC' ) ;
$numCols = sizeof ( $cols ) ; //count
$pageTitle = 'Web Site Design & Development | Portfolio' . $subSection ;
require_once( 'page_top.php' ) ;
if ( ( is_array( $secs ) ) && ( $numSecs > 0 ) ) {
for ( $s = 0 ; $s < $numSecs ; $s++ ) {
?>[ = $secs[$s]['Name'] ;?> ] [ All Websites ] [ Search ]