start('main'); // start session - neccessary if frontend users are available // but neccessary also to check if a bot is visiting the site // -> if so then do not initialize session for larger search engines $BOTSLIST = array('googlebot', 'msnbot', 'ia_archiver', 'altavista', 'slurp', 'yahoo', 'jeeves', 'teoma', 'lycos'); $IS_A_BOT = false; foreach($BOTSLIST as $value) { if(!$IS_A_BOT && stristr($_SERVER['HTTP_USER_AGENT'], $value)) { $IS_A_BOT = true; break; } } // if no bot was found initialize session if(!$IS_A_BOT) { session_name('hashID'); session_start(); /* if (!isset($_SESSION['initiated'])) { session_regenerate_id(); $_SESSION['initiated'] = true; } */ } require_once ('config/phpwcms/conf.inc.php'); require_once ("include/inc_lib/default.inc.php"); $cache_query_string = remove_hashID($_SERVER['QUERY_STRING']); define('FE_CURRENT_URL', PHPWCMS_URL.'index.php?'.$cache_query_string); if(!isset($_SESSION['frontend_user'])) { $_SESSION['frontend_user']['id'] = 0; $_SESSION['frontend_user']['login'] = 'guest'; $_SESSION['frontend_user']['name'] = 'Guest'; // start frontend user login if(isset($_POST['fe_user_submit']) || isset($_POST['fe_user_login'])) { require_once ("include/inc_lib/general.inc.php"); require_once ("include/inc_front/front.func.inc.php"); } } // define VISIBLE_MODE // 0 = frontend (all) mode // 1 = article user mode // 2 = admin user mode if(empty($_SESSION["wcs_user_id"])) { define('VISIBLE_MODE', 0); } else { define('VISIBLE_MODE', $_SESSION["wcs_user_admin"] != 1 ? 0 : 2); } //db based page caching $cache_enabled = 0; $cache_update = 1; $cache_insert = 1; $cache_nosave = (isset($_POST) && count($_POST)) ? true : false; // don't store any page result when $_POST used $cache_searchable = ''; //chache enabled $cache_hash = md5($_SERVER['PHP_SELF'].$cache_query_string); //create hash value //now try to find current page in cache $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_cache WHERE cache_hash='".$cache_hash."'"; if($result = mysql_query($sql, $db)) { if($cache_row_value = mysql_fetch_assoc($result)) { $cache_insert = 0; } mysql_free_result($result); } if($phpwcms['cache_timeout'] && isset($cache_row_value) && is_array($cache_row_value)) { //if cached if($cache_row_value['cache_timeout'] == '') { $cache_row_value['cache_timeout'] = $phpwcms['cache_timeout']; } $cache_searchable = $cache_row_value['cache_searchable']; if($cache_row_value['cache_use'] && (time() - $cache_row_value['cache_changed']) < $cache_row_value['cache_timeout']) { $cache_update = 0; $cache_enabled = 1; } } //script caching to allow header redirect if($phpwcms["compress_page"] && isset($_SESSION['session_is_set'])) { /* if(function_exists('ini_set') && !ini_get('zlib.output_compression')) { ini_set( 'zlib.output_compression', '1' ); ini_set( 'zlib.output_compression_level', $phpwcms["compress_page"] ); ob_start(); } else { ob_start("ob_gzhandler"); //with old style GZ Compression } */ ob_start("ob_gzhandler"); //with old style GZ Compression } else { $_SESSION['session_is_set'] = true; ob_start(); //without Compression (or use browsers default) } if(!$cache_enabled || VISIBLE_MODE == 1 || VISIBLE_MODE == 2) { require_once ("config/phpwcms/conf.template_default.inc.php"); require_once ("config/phpwcms/conf.indexpage.inc.php"); require_once ("include/inc_lib/general.inc.php"); cleanupPOSTandGET(); require_once ("include/inc_lib/imagick.convert.inc.php"); require_once ("include/inc_front/front.func.inc.php"); require_once ("include/inc_front/content.func.inc.php"); $phpwcms["templates"] = TEMPLATE_PATH; $content['page_start'] = ''; $content['page_start'] .= "\n\n"; $content['page_start'] .= "\n\n".$content["pagetitle"]."\n"; $content['page_start'] .= '\n".'_'."\n"; $content['page_start'] .= '\n".$block["htmlhead"]; $content['page_start'] .= "\n\n\n\n"; if(VISIBLE_MODE == 1 || VISIBLE_MODE == 2) { $content['page_end'] = '
'; $content['page_end'] .= VISIBLE_MODE == 1 ? 'user: ' : 'admin: '; $content['page_end'] .= html_specialchars($_SESSION['wcs_user']); $content['page_end'] .= "
\n\n"; } else { $content['page_end'] = "
There is a lot of mazda6.Find the best nissan deals.More info 250r.Whether Coupe or Roadster, roof down or closed, the bmw z4.Discover new cars from hyundai.The home of the classic muscle cars.Dodge dealer viper.Use the Organic natural food store.The official Web site for toyota center in houston.In this chapter, we introduce the shopping.Explore the entire hyundai cars.Discover new cars from hundai.Welcome to kia motors.Research new 2008 & 2009 handa.Enter your postcode to find your nearest nissan dealers.Official auto manufacturer site car kia.Search accounting & finance jobs.Official 2009 Dodge ram 1500.Free business finance.What is your favorite shopping mall.The official Web site for toyota center houston texas.This review of the nissan xterra.We sell Jeep wrangler parts.An overview of the hyundai sonata.Ford Motor Company maker of cars, trucks.See the 2009 nissan altima.Beverly Center shopping malls.The 2010 forester.Discover Travel Channel TV shows, travel.Using the book, penny gadget.Britannica online encyclopedia article on toyota center.If you own, admire, or fix-up any model of the Honda crx.Discount Prices on atv parts.This Overview of the bmw x3david irby photography david irby photography une infante defunte
\n"; } // this regex's call the function if($phpwcms["rewrite_url"]) { $allowed_chars_in_url = "[".implode("]|[",array("@",",","\.","+","&","-","_","=","*","#","\/","%","?"))."]"; $content["all"] = preg_replace("/( href=\"index.php?)(([a-z]|[A-Z]|[0-9]|".$allowed_chars_in_url.")*)(\")/e","url_search('\\2')",$content["all"]); $content["all"] = preg_replace("/(onClick=\"location.href='index.php?)(([a-z]|[A-Z]|[0-9]|".$allowed_chars_in_url.")*)(\')/e","js_url_search('\\2')",$content["all"]); } // EXPERIMENTAL // now try to cleanup html code with tidy /* if(isset($phpwcms['tidy']) && $phpwcms['tidy']) { require_once ("include/inc_front/utf8.func.inc.php"); $tmp_tidy_file = PHPWCMS_ROOT.'/content/tmp/'.time().'_tidy_cleanup.html'; $tidy_written = entities_to_utf8($content['page_start'].$content["all"].$content['page_end']); $tidy_written = write_textfile($tmp_tidy_file, $tidy_written); $tidy_page_end = $content['page_end']; if($tidy_written && filesize($tmp_tidy_file)){ //echo ''; @exec($phpwcms['tidy_command'].' "'.$tmp_tidy_file.'"', $tidy_return); if(!isset($tidy_return[0])) { if(filesize($tmp_tidy_file) && ($content['page_end'] = file_get_contents($tmp_tidy_file))) { echo $content['page_start'] = ''; echo $content["all"] = ''; } else { $content['page_end'] = $tidy_page_end; } } unlink($tmp_tidy_file); } } */ // return rendered content echo $content['page_start']; echo $content["all"]; echo $content['page_end']; $phpwcms['cache_timeout'] = strval($phpwcms['cache_timeout']); // switch searchable setting // '' -> 0 -> 1 -> is searchable // '1' -> 1 -> 0 -> is not searchable $cache_searchable = intval($cache_searchable) ? 0 : 1; if(VISIBLE_MODE == 0 && $cache_nosave === false) { //don't store when $_POST isset $content['all'] = remove_hashID($content['all']); if($cache_insert) { //insert cache $sql = "INSERT INTO ".DB_PREPEND."phpwcms_cache SET "; $sql .= "cache_hash='".$cache_hash."', "; $sqb = ""; } else { //update cache $sql = "UPDATE ".DB_PREPEND."phpwcms_cache SET "; $sqb = " WHERE cache_hash='".$cache_hash."' LIMIT 1"; } $cache_URI = 'http://'.$_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF']; if(!empty($cache_query_string)) { $cache_URI .= '?' . $cache_query_string; } $sql .= "cache_uri='".aporeplace($cache_URI)."', "; $sql .= "cache_cid='".$aktion[0]."', "; $sql .= "cache_aid='".$aktion[1]."', "; $sql .= "cache_timeout='".$phpwcms['cache_timeout']."', "; $sql .= "cache_isprint='".intval($aktion[2])."', "; $sql .= "cache_changed='".time()."', "; $sql .= "cache_use='".($phpwcms['cache_timeout'] == '0' ? 0 : 1)."', "; $sql .= "cache_searchable='".$cache_searchable."', "; $sql .= "cache_page='".aporeplace($content['page_start'].$content["all"].$content['page_end'])."', "; $sql .= "cache_stripped='".aporeplace(stripped_cache_content($content['all']))."'"; $sql .= $sqb; mysql_query($sql, $db); } } else { echo $cache_row_value['cache_page']; } // show how long it needs to create content // remove comments // to use it //$timer->stop('main'); //$t = $timer->get_current('main'); //$t = number_format ( $t, 5, '.', ','); //number_format ( float number, int decimals, string dec_point, string thousands_sep) // $content["all"] = str_replace('{TIMER}', $t.' sec', $content["all"]); //echo '
processed in: '.$t.' sec Searchable: '.$cache_searchable.'
'; ob_end_flush(); ?>