setPrefix(''); $breadcrumb->setBreadcrumbPre('
  • '); $breadcrumb->setBreadcrumbSuf('
  • '); $breadcrumb->setDivider(' '); $breadcrumb->add("  首頁", "/", NULL, "fa fa-home"); $action = (empty($_REQUEST['action']))?"home":$_REQUEST['action']; $option = (empty($_REQUEST['option']))?NULL:$_REQUEST['option']; $type = (empty($_REQUEST['type']))?NULL:$_REQUEST['type']; $ajax = (!empty($_REQUEST['ajax']))?$_REQUEST['ajax']:NULL; $manu_id = (empty($_REQUEST['mid']))?NULL:$_REQUEST['mid']; $manu_id = (empty($_REQUEST['manu_id']))?$manu_id:$_REQUEST['manu_id']; $page_num = (empty($_REQUEST['page']))?1:$_REQUEST['page']; //轉換區域id /區域id/地區/區域名稱 or /區域id/分頁/地區/區域名稱 $request_cid = (empty($_REQUEST['cid']))?NULL:$_REQUEST['cid']; //針對seo修復舊版房地王的網址,讓舊版網址可順利執行 $cat_id = (empty($cat_id))?$request_cid:$cat_id; //轉換建案id /id/建商/建案 $request_pid = (empty($_REQUEST['pid']))?null:$_REQUEST['pid']; $id = (empty($id))?$request_pid:$id; $qsa = $_SERVER['QUERY_STRING']; $uri=urldecode($_SERVER['REQUEST_URI']); $args=explode("/",$uri); $QUERY_STRING=""; //儲存file_cache網址的規則, 列表為cid=4&page= //print_nice($args);exit ; //print_nice($args); $isHome = false ; if($action == "home"){ $isHome = true ; } //房地王舊版網址轉為新版網址 require_once(ROOT."transform.php"); //房地王SEO中文網址轉為英文網址 require_once(ROOT."seoChinese.php"); if ($ismobile && empty($_REQUEST['pc'])){ if($action == "home" ){ header('Location: /m/'); }else if($type=='savecom' || $type=='contactList'){ //沒有手機版 }else if($option == "list" || $option == "one" || $option=='search' || $option=='favorite' || $option=='reservation' || $option=='searchhouse'){ header('Location: /m'.$uri); } } //echo "
    action=".$action.", option=".$option.", page=".$page_num.", type=".$type." , id=".$id." , tpl = ".$tpl; $cache = false; //台北代理商顯示銷售電話 限制台北桃園 $lookTel = array("") ; //87177 $lookWebId = array("1", "2") ; //房地王首頁、地圖搜尋、一覽表時不使用FILE_CACHE if ($QUERY_STRING =="/" || ($action=='search' && $option=='map') || ($action=='house' && $option=='table')){ $FILE_CACHE = false; } if(in_array( $gMid , $lookTel) && in_array($web_id , $lookWebId)){ $FILE_CACHE = false; } if ($FILE_CACHE && $action !="home"){ $file_cache_name=$template->get_cache_file($QUERY_STRING); //讀file_cache檔案前,先指定file_cache檔名,才能讀取成功 $content = $template->fetch_cache_file2($FILE_CACHE_TIME); // echo $file_cache_name;exit; // echo $content;exit; if (!empty($content)){ $cache = true; } $type_rest = empty($_REQUEST['type'])?"":$_REQUEST['type'] ; if($type_rest=="savecom" || $type_rest=="contactList"){ //電話諮詢列表時,cache指定為false,主程式才能進入house/index.html $cache = false; $QUERY_STRING = empty($_SERVER['QUERY_STRING'])?"":$_SERVER['QUERY_STRING']; } if($gStatus ==255 && !isset($_REQUEST['ajax']) && $action !='pdf'){ $cache_file=$template->get_cache_file($QUERY_STRING); if(is_file($cache_file)){ $cache_time = date('Y-m-d H:i:s', filemtime($cache_file)); $now_time = time(); $expired_time=60-ceil(($now_time - strtotime($cache_time))/60); if(!empty($QUERY_STRING)){ if($expired_time<0 || $expired_time >60){ //file cache已過期 echo "EXPIRED"; }else{ if ($action=="house" && $option=="list"){ echo "".$QUERY_STRING . " , maked time:" . $cache_time . ", " . $expired_time . "分, 刪除file cache"; }else { echo "".$QUERY_STRING . " , maked time:" . $cache_time . ", " . $expired_time . "分, 刪除file cache"; } } } } } } //設定SEO的Title,keywords, description require_once(ROOT."setSEOTitle.php"); if (isset($action)){ if ($action == 'home' || $action=='print' || $action=='pdf'){ $tpl="$action.html"; }else{ if(file_exists("$action/index.html")){ $tpl="$action/index.html"; }else{ $tpl="home.html"; } } } //echo "
    QUERY_STRING:".$QUERY_STRING; //echo "
    tpl=".$tpl."
    ";//exit; if (!$cache){ ob_start(); include($tpl); $content=ob_get_contents(); // echo $content;exit(); ob_get_clean(); } //echo "
    action=".$action.", option=".$option.", page=".$page_num.", type=".$type." , id=".$id." , tpl = ".$tpl; if ($FILE_CACHE){ if (!$cache && !empty($QUERY_STRING)){ if($template->status !="CURRENT"){ //一小時內,file_cache的狀態為CURRENT,故不寫入;狀態為空值或EXPIRED,才寫入 $template->get_cache_file($QUERY_STRING); //寫檔案前,先指定file_cache檔名,才能寫入成功 $template->write_cache_file($content); } } } // 取得廣告json function getBannerJson($location , $web_id ,$random , $city , $count , $width , $height , $slider=false){ global $banner ,$mc,$WEB_ARRAY; $res = array(); // $WEB_ARRAY=array(1=>1,2=>52,3=>66,4=>103,5=>196,6=>218,7=>257); $random = (empty( $random))?false: $random; $city = ($city==1)?true:false; if (!empty($web_id)){ $banner->setWebID($web_id); $city_id=$WEB_ARRAY[$web_id]; $key=$city_id."_".$location; $banners = $mc->getCache($key); if(empty($banners)){ $banners = $banner->get($location, '' , $city); $mc->set($key, $banners); } if ($random && is_array($banners) && count($banners)>1){ shuffle($banners); } // $bannerHtml = getAdType2Html($banners , $count , $location , $width , $height , $slider); return json_encode($banners) ; } } $bannerJsonFH = getBannerJson("FH" , $web_id , 'false' , "1" , "all" , "0","0"); $bannerJsonFA = getBannerJson("FA" , $web_id , 'false' , "1" , "all" , "0","0"); $loArr = array('B1','B2','B3','T8'); $bArr = array(); foreach( $loArr as $k=>$v){ $city_id=$WEB_ARRAY[$web_id]; $key=$city_id."_".$v; $bArr[$v] = $mc->getCache($key); if(empty($bArr[$v])){ $bArr[$v] = $banner->get($v); } } $b1_arr = $bArr['B1'] ; $b2_arr = $bArr['B2'] ; $b3_arr = $bArr['B3'] ; $t8_arr = $bArr['T8'] ; $bannB1Count=(empty($b1_arr))?0:count($b1_arr); $bannB2Count=(empty($b2_arr))?0:count($b2_arr); $bannB3Count=(empty($b3_arr))?0:count($b3_arr); $bannT8Count=(empty($t8_arr))?0:count($t8_arr); $breadcrumb_html = $breadcrumb->show(); ?> <?=$site_title?> " /> 0){?>
    Close(); unset($conn); } //判斷是否為手機裝置, true:手機裝置, false:否 /* USER-AGENTS ================================================== */ function check_user_agent ( $type = NULL ) { $user_agent = strtolower ( $_SERVER['HTTP_USER_AGENT'] ); if(preg_match("/ipad/", $user_agent)) { // echo false; return true; }else if ( $type == 'bot' ) { // matches popular bots if ( preg_match ( "/googlebot|adsbot|yahooseeker|yahoobot|msnbot|watchmouse|pingdom\.com|feedfetcher-google/", $user_agent ) ) { return true; // watchmouse|pingdom\.com are "uptime services" } } else if ( $type == 'browser' ) { // matches core browser types if ( preg_match ( "/mozilla\/|opera\//", $user_agent ) ) { return true; } } else if ( $type == 'mobile' ) { // matches popular mobile devices that have small screens and/or touch inputs // mobile devices have regional trends; some of these will have varying popularity in Europe, Asia, and America // detailed demographics are unknown, and South America, the Pacific Islands, and Africa trends might not be represented, here if ( preg_match ( "/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|iemobile|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo/", $user_agent ) ) { // these are the most common return true; } else if ( preg_match ( "/mobile|pda;|avantgo|eudoraweb|minimo|netfront|brew|teleca|lg;|lge |wap;| wap /", $user_agent ) ) { // these are less common, and might not be worth checking return true; } } return false; } ?>