/",$todaystoriesoutput,$search_navi_data); $data = ""; $TEXT_FILE = "/var/www/html/function/navigation-lightblue.inc"; if($fp = @fopen($TEXT_FILE,'r')) { while(!feof($fp)){ $file_data = fgets($fp, 4096); if(trim($file_data) != ""){ $lightblue_navi_data .= trim($file_data)."\n"; } } } @fclose($fp); $TEXT_FILE = "/var/www/html/function/ga_tag.inc"; $analytics_tag = ""; if($fp = @fopen($TEXT_FILE,'r')) { while(!feof($fp)){ $file_data = fgets($fp, 4096); if(trim($file_data) != ""){ $analytics_tag .= trim($file_data)."\n"; } } } @fclose($fp); require('/var/www/html/function/dfp_ad_tag.php'); $TEXT_FILE = "/var/www/html/function/jtlogonavi.inc"; $newJTnavi = ""; if($fp = @fopen($TEXT_FILE,'r')) { while(!feof($fp)){ $file_data = fgets($fp, 4096); if(trim($file_data) != ""){ $newJTnavi .= trim($file_data)."\n"; } } } @fclose($fp); /* テンプレートファイル読み込み */ if(!($fp = file_exists("../cgi-bin/globaltmp5.html"))){ $message = "\n
\n
\n
\n

No file

Please try again!

\n\n\n"; print($message); exit; } $fp = fopen('../cgi-bin/globaltmp5.html','r'); // 終端に達するまでループ while (!feof($fp)) { $line = fgets($fp); $template = $template . $line; } fclose($fp); // 20060731 add Writer List 読み込み if(!($wfp = file_exists("../cgi-bin/writerlist.txt"))){ $message = "\n
\n
\n\n

No file

Please try again!

\n\n\n"; print($message); exit; } $wfp = fopen('../cgi-bin/writerlist.txt','r'); // 終端に達するまでループ while (!feof($wfp)) { $wline = fgets($wfp); $writerlist = $writerlist . $wline; } fclose($wfp); $writerlist = strtolower($writerlist); // Lower Case All $type = substr($thefile,0,2); $year = substr($thefile,2,4); $month = substr($thefile,6,2); $day = substr($thefile,8,2); $bottom = substr($thefile,10,2); $code = $type; $twitter_cate = "japantimes"; $navi = "Home"; if($nomemberflg == 1){ $filepath = $thisweeksdir; if(preg_match("/^nn|np|ni|wn/",$type)){ $navi = "Home > News"; }elseif (preg_match("/^nc/",$type)){ $navi = "Home > Life in Japan > Technology"; }elseif (preg_match("/^nb|wb/",$type)){ $navi = "Home > News"; }elseif (preg_match("/^nr/",$type)){ $navi = "Home > News"; }elseif (preg_match("/^eo|ed/",$type)){ $navi = "Home > Opinion"; }elseif (preg_match("/^s/",$type)){ $twitter_cate = "sports"; if((preg_match("/^sb/",$type)) && (preg_match("/^j|o/",$bottom))){ $navi = "Home > Sports > Japanese BaseballMLB"; }elseif(preg_match("/^sb/",$type)){ $navi = "Home > Sports > MLBJapanese Baseball"; }elseif(preg_match("/^sc|sj|sw/",$type)){ $navi = "Home > Sports > Soccer"; }elseif(preg_match("/^ss/",$type)){ $navi = "Home > Sports > Sumo"; }elseif(preg_match("/^so/",$type)){ $navi = "Home > Sports > Olympics"; }elseif(preg_match("/^sk/",$type)){ $navi = "Home > Sports > Basketball"; }elseif((preg_match("/^sp/",$type)) && (preg_match("/^it|f/",$bottom))){ $navi = "Home > Sports > Figure Skating"; }else{ $navi = "Home > Sports > Other Sports"; } }elseif (preg_match("/^f|ek|bi/",$type)){ $twitter_cate = "life"; if(preg_match("/^fa/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment > Art"; }elseif(preg_match("/^fb/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment > Book"; }elseif(preg_match("/^fc/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment > Art"; }elseif(preg_match("/^fe/",$type)){ $navi = "Home > Life in Japan > Environment"; }elseif(preg_match("/^ff/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment > Film"; }elseif(preg_match("/^fg/",$type)){ $navi = "Home > Life in Japan > Food"; }elseif(preg_match("/^fl/",$type)){ $navi = "Home > Life in Japan > Features"; }elseif(preg_match("/^fs/",$type)){ $navi = "Home > Life in Japan > Lifestyle"; }elseif(preg_match("/^fm/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment > Music"; }elseif(preg_match("/^fp/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment"; }elseif(preg_match("/^ft/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment > Theater"; }elseif(preg_match("/^fv/",$type)){ $navi = "Home > Life in Japan > Travel"; }elseif(preg_match("/^ek/",$type)){ $navi = "Home > Life in Japan > Education"; }elseif(preg_match("/^bi/",$type)){ $navi = "Home > Life in Japan > Bilingual"; }elseif(preg_match("/^fd/",$type)){ $navi = "Home > Life in Japan > Media"; }elseif(preg_match("/^fn/",$type)){ $navi = "Home > Life in Japan"; }elseif(preg_match("/^fq/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment"; }elseif(preg_match("/^fo/",$type)){ $twitter_cate = "entertainment"; $navi = "Home > Entertainment"; }else{ $twitter_cate = "entertainment"; $navi = "Home > Entertainment"; } }elseif(preg_match("/^c/",$type)){ $navi = "Home"; }elseif(preg_match("/^rc/",$type)){ $navi = "Home > Opinion"; }elseif(preg_match("/^gc/",$type)){ $navi = "Home > News > Cabinet Profile"; } }else{ if(preg_match("/^nn|np|ni|wn/",$type)){ $filepath = "$homepath/news/$type$month-$year"; $navi = "Home > News"; }elseif (preg_match("/^nc/",$type)){ $filepath = "$homepath/news/$type$month-$year"; $navi = "Home > Life in Japan > Technology"; }elseif (preg_match("/^nb/",$type)){ $filepath = "$homepath/business/$type$month-$year"; $navi = "Home > News"; }elseif (preg_match("/^nr/",$type)){ $filepath = "$homepath/news/$type$year"; $navi = "Home > News"; }elseif (preg_match("/^eo|ed/",$type)){ $filepath = "$homepath/opinion/$type$year"; $navi = "Home > Opinion"; }elseif (preg_match("/^s/",$type)){ $twitter_cate = "sports"; $filepath = "$homepath/sports/sports$year"; if((preg_match("/^sb/",$type)) && (preg_match("/^j|o/",$bottom))){ $navi = "Home > Sports > Japanese BaseballMLB"; }elseif(preg_match("/^sb/",$type)){ $navi = "Home > Sports > MLBJapanese Baseball"; }elseif(preg_match("/^sc|sj|sw/",$type)){ $navi = "Home > Sports > Soccer"; }elseif(preg_match("/^ss/",$type)){ $navi = "Home > Sports > Sumo"; }elseif(preg_match("/^so/",$type)){ $navi = "Home > Sports > Olympics"; }elseif(preg_match("/^sk/",$type)){ $navi = "Home > Sports > Basketball"; }elseif((preg_match("/^sp/",$type)) && (preg_match("/^it|f/",$bottom))){ $navi = "Home > Sports > Figure Skating"; }else{ $navi = "Home > Sports > Other Sports"; } }elseif (preg_match("/^f|ek|bi/",$type)){ $twitter_cate = "life"; if(preg_match("/^fa/",$type)){ $twitter_cate = "entertainment"; $type = "arts"; $navi = "Home > Entertainment > Art"; }elseif(preg_match("/^fb/",$type)){ $twitter_cate = "entertainment"; $type = "books"; $navi = "Home > Entertainment > Book"; }elseif(preg_match("/^fc/",$type)){ $twitter_cate = "entertainment"; $type = "crafts"; $navi = "Home > Entertainment > Art"; }elseif(preg_match("/^fe/",$type)){ $type = "enviro"; $navi = "Home > Life in Japan > Environment"; }elseif(preg_match("/^ff/",$type)){ $twitter_cate = "entertainment"; $type = "film"; $navi = "Home > Entertainment > Film"; }elseif(preg_match("/^fg/",$type)){ $type = "gourmet"; $navi = "Home > Life in Japan > Food"; }elseif(preg_match("/^fl/",$type)){ $type = "life"; $navi = "Home > Life in Japan > Features"; }elseif(preg_match("/^fs/",$type)){ $type = "life"; $navi = "Home > Life in Japan > Lifestyle"; }elseif(preg_match("/^fm/",$type)){ $twitter_cate = "entertainment"; $type = "music"; $navi = "Home > Entertainment > Music"; }elseif(preg_match("/^fp/",$type)){ $twitter_cate = "entertainment"; $type = "arts"; $navi = "Home > Entertainment"; }elseif(preg_match("/^ft/",$type)){ $twitter_cate = "entertainment"; $type = "theater"; $navi = "Home > Entertainment > Theater"; }elseif(preg_match("/^fv/",$type)){ $type = "travel"; $navi = "Home > Life in Japan > Travel"; }elseif(preg_match("/^ek/",$type)){ $type = "edu"; $navi = "Home > Life in Japan > Education"; }elseif(preg_match("/^bi/",$type)){ $type = "bilingual"; $navi = "Home > Life in Japan > Bilingual"; }elseif(preg_match("/^fd/",$type)){ $type = "media"; $navi = "Home > Life in Japan > Media"; }elseif(preg_match("/^fn/",$type)){ $type = "gourmet"; $navi = "Home > Life in Japan"; }elseif(preg_match("/^fq/",$type)){ $twitter_cate = "entertainment"; $type = "other"; $navi = "Home > Entertainment"; }elseif(preg_match("/^fo/",$type)){ $twitter_cate = "entertainment"; $type = "other"; $navi = "Home > Entertainment"; }else{ $twitter_cate = "entertainment"; $navi = "Home > Entertainment"; } $filepath = "$homepath/features/$type$year"; }elseif(preg_match("/^c/",$type)){ $filepath = "$homepath/techno/techno$year"; $navi = "Home"; }elseif(preg_match("/^rc/",$type)){ $filepath = "$homepath/ric/ric$year"; $navi = "Home > Opinion"; }elseif(preg_match("/^gc/",$type)){ $filepath = "$homepath/cabinets/$year$month$day"; $navi = "Home > News > Cabinet Profile"; }elseif(preg_match("/^ad|ns/",$type)){ $filepath = "$homepath/supplements/$type$year"; $navi = "Home > "; }else{ missing("missing",$template); exit; } } $sns_array = array("twitter","facebook","youtube","addthis"); // $sns_array = array("twitter","twitter"); shuffle($sns_array); $months = array( "01"=>"January", "02"=>"February", "03"=>"March", "04"=>"April", "05"=>"May", "06"=>"June", "07"=>"July", "08"=>"August", "09"=>"September", "10"=>"October", "11"=>"November", "12"=>"December" ); $youbi = getyoubi($year,$month,$day); $category_define = define_category(); $category = $category_define{$code}; $category = "[$category]"; $alphamonth = $months[$month]; $day = preg_replace("/^0/","",$day); $xml = preg_replace("/\.html$/",".xml",$thefile); $xml = preg_replace("/\.htm$/",".xml",$xml); $file = "$filepath/$xml"; //まずは存在チェック if(!($fp = file_exists($file))){ missing("missing",$template); exit; } // add 20070615 kono // 1) Bloomberg story(nb-n1...9) : The preservation term is 14 days. //------------------------------------------------------------------ $time = mktime (0, 0, 0, date("m"), date("d"), date("y")); $date_today = date('Y-m-d', $time); $date_story = $year."-".$month."-".$day; $result = intval((strtotime($date_today) - strtotime($date_story)) / (24 * 60 * 60)) + 1; if(preg_match("/^nn/",substr($thefile,0,2)) && (2006 > $year)){ $bloomberg_cancel = 1; } // add 20081007 kato // Tokyo_Confidential(fd-t1...9) : ALL cut if((preg_match("/^fd/",substr($thefile,0,2)) && preg_match("/^t/",substr($thefile,10,2)))){ missing("Tokyo_Confidential",$template,$thefile); exit; } // if(preg_match("/^nn20100521a2/",substr($thefile,0,12) ) ){ // missing("verify",$template,$thefile); // exit; // } if((preg_match("/^fl/",substr($thefile,0,2)) && preg_match("/^t/",substr($thefile,10,2))) && $Tokyo_C == 1){ missing("Tokyo_Confidential",$template,$thefile); exit; } // if(preg_match("/nn20110305cc|sp20110320eo/",$thefile)){ if(preg_match("/nn20110305cc|nn20111004f1|rc20110519a5|nb20120517a8|rc20120715a4|fq20121102a1|fb20121021a1/",$thefile)){ missing("deleted",$template); exit; } if((preg_match("/^nb|^nn|^eo/",substr($thefile,0,2)) && preg_match("/^n\d/",substr($thefile,10,2))) && ($result > $term) && $bloomberg_cancel != 1){ missing("expire",$template); exit; } if( preg_match("/^fl/",substr($thefile,0,2)) && preg_match("/^tk/",substr($thefile,10,2)) ){ missing("deleted",$template); exit; } $fp = fopen($file,'r'); global $string; $photo_flg = 0; $photodir = ""; $count = 0; $pcnt = 0; $tcnt = 0; $mflg = 0; $iflg = 0; $icnt = 0; $des_flg = 1; $b_p_flg; $dateline = ""; $para_cnt = 0; while (!feof($fp)) { // ファイルから一行読み込む $line = fgets($fp); // add 20080107 kato if(ereg("", $line) && $des_flg == 1){ $des_line = ereg_replace("", "", $line); $des_line = ereg_replace("", "", $des_line); $des_line = ereg_replace("", "", $des_line); $des_line = ereg_replace("", "", $des_line); $des_line = ereg_replace("", "", $des_line); $des_line = ereg_replace("", "", $des_line); $des_line = ereg_replace("\"", """, $des_line); $des_line = preg_replace("/]*?>/", "",$des_line); $des_line = ereg_replace("", "", $des_line); $des_line = preg_replace("/]*?>/", "",$des_line); $des_line = ereg_replace("", "", $des_line); $des_line = preg_replace("/]*?>/", "",$des_line); $des_line = ereg_replace("", "", $des_line); $des_line = preg_replace("/]*?>/", "",$des_line); $des_line = ereg_replace("", "", $des_line); $des_line = trim($des_line); $description = "\n\n"; $description .= ""; $des_flg = 0; } if(preg_match("//",$line)){ $photo_flg++; } if($photo_flg == 1){ if(preg_match("/")){ //musicのnomooterは無視 # if(!preg_match("/fm/",substr($thefile,0,2))){ $mflg=1; # } } if(strstr($line,"(.+)<\/DATELINE>/",$line,$tmpdl)){ $dateline = $tmpdl[1]; $para_cnt=0; } if(strstr($line,"")){ $para_cnt++; if( ($para_cnt == 1) && ($dateline) ){ $line = preg_replace("//","$dateline — ",trim($line)); } } if(!(preg_match("/^fq|^fo|ff|rc/",substr($thefile,0,2)) || (preg_match("/fm/",substr($thefile,0,2)) && preg_match("/l2|l3/",substr($thefile,10,2))) || (preg_match("/fe/",substr($thefile,0,2)) && preg_match("/li|at/",substr($thefile,10,2))) || (preg_match("/fl/",substr($thefile,0,2)) && preg_match("/vf/",substr($thefile,10,2))) || $mflg==1)){ /* if(!(preg_match("/^fq|^fo|ff|rc/",substr($thefile,0,2)) || (preg_match("/fe/",substr($thefile,0,2)) && preg_match("/li|at/",substr($thefile,10,2))) || (preg_match("/fl/",substr($thefile,0,2)) && preg_match("/vf/",substr($thefile,10,2))) || $mflg==1)){ */ if(strstr($line,"")){ $pcnt++; // Photo doesn't exist. // if($pcnt == 2){ if($pcnt == 1){ $line = trim($line)."\n"; } } if(strstr($line,"")){ $tcnt++; // Photo exists. if($tcnt == 1 && $iflg == 1){ $line = "".$line; } if($b_p_flg == 2 && $iflg == 1){ $b_p_flg++; $line = "".$line; } if($b_p_flg == 1){ $b_p_flg++; } } } if(strstr($line,"")){ $b_p_flg = 1; } // add 20070503 kono context ads end ---------------------- $string = $string . $line; $count++; } fclose($fp); // add 20070503 kono context ads start ---------------------- // $mooter_tag $mooter_tag2 Global variables exist in the [context.php] if($tcnt > 0){ $string = preg_replace("/<\/PARAGRAPH>/","",$string); /* napster終了 lrg終了 if( preg_match("/^nc/",substr($thefile,0,2)) ){ $string = preg_replace("/<\/TABLE>/",$openxadtag2."
",$string); }elseif(preg_match("/fm/",substr($thefile,0,2)) ){ $string = preg_replace("/<\/TABLE>/",$openxadtag4."",$string); }else{ $string = preg_replace("/<\/TABLE>/",$mooter_tag2."",$string); } */ $string = preg_replace("/<\/TABLE>/",$mooter_tag2."",$string); }else{ /* napster終了 lrg終了 if( preg_match("/^nc/",substr($thefile,0,2)) ){ $string = preg_replace("/<\/PARAGRAPH>/","
".$openxadtag1,$string); }elseif(preg_match("/fm/",substr($thefile,0,2)) ){ $string = preg_replace("/<\/PARAGRAPH>/","
".$openxadtag3,$string); }else{ $string = preg_replace("/<\/PARAGRAPH>/","
".$mooter_tag,$string); } */ $string = preg_replace("/<\/PARAGRAPH>/","".$mooter_tag,$string); } // add 20070503 kono context ads end ---------------------- // headline $headline = preg_replace("/.*(.+)<\/HEADLINE>.*/s","$1",$string); // byline if(preg_match("/(.*)<\/WRITER>/",$string)){ $byline = preg_replace("/.*(.+)<\/WRITER>.*/s","$1",$string); }else{ $byline = ""; } $headline = preg_replace("/<.*?>/","",$headline); $byline = preg_replace("/<.*?>/","",$byline); $byline = str_replace("Staff writer","",$byline); $byline = trim($byline); if(preg_match("//",$string)){ $RelatedLink_string = preg_replace("/.*(.+)<\/RELATEDLINK>.*/s","$1",$string); }else{ $RelatedLink_string = ""; } if($RelatedLink_string){ if(preg_match("//",$RelatedLink_string)){ $RelatedLink_string = str_replace("","",$RelatedLink_string); }else{ $RelatedLink_string = str_replace("","\n\t\t",$RelatedLink_string); } $RelatedLinkReplace = array( "" => "", "" => "", "" => "

", " "

\n\t\t" => "

", "" => "
By ", "" => "
", "" => "", " "

\n\t\t.+<\/RELATEDLINK>(.*)/s","$1
\n".$RelatedLink_string."$2",$string); } $NextURL = ""; $RelatedLink_string = ""; if(preg_match("/(.+)<\/CONTINUEBTN>/s",$string,$tmp)){ $NextURL = $tmp[1].".html"; $RelatedLink_string = $tmp[3]; $split_str = ""; $RelatedArray = split($split_str,$RelatedLink_string); if(is_array($RelatedArray)){ $RelatedLink_string = <<   EOS; foreach($RelatedArray as $key => $val){ $val = preg_replace("//s","",$val); if(preg_match("/"; } if($key == 0){ $RelatedLink_string .= <<
$val EOS; }elseif( ($key+1) == count($RelatedArray) ){ $RelatedLink_string .= <<
NEXT PAGE >>
EOS; }else{ $RelatedLink_string .= <<|  $val EOS; } } $string = preg_replace("/(.*)(.*)/s","$1".$RelatedLink_string."$2",$string); } } $NextURL = ""; $RelatedLink_string = ""; if(preg_match("//s",$string,$tmp)){ $NextURL = $tmp[1].".html"; $RelatedLink_string = <<
<< PREVIOUS PAGE
EOS; $string = preg_replace("/(.*)(.*)/s","$1".$RelatedLink_string."$3",$string); } $template = preg_replace("/Welcome to The Japan Times online/",$headline,$template); $template = preg_replace("/todaysdatehere/","$youbi, $alphamonth $day, $year",$template); /***** XML → HTML *****/ //Zap XML Tag $string1 = preg_replace("/<\?.+>/","",$string); // zap start $string1 = preg_replace("/<\?xml version=\"1\.0\" standalone=\"no\"\?>/","",$string); // zap start $string1 = preg_replace("/<\?xml\-stylesheet type=\"text\/xsl\" href=\"c:\/JTWeb4\/cgi\-bin\/jt\-plain\.xsl\"\?>/","",$string); // zap start $string = preg_replace("/.+/s","",$string); $string = preg_replace("/(.+)<\/TYPE>/","",$string); $filetagstr = ""; if(preg_match("/(.+)<\/FILE>/s",$string,$tmp)){ $filetagstr = $tmp[1]; if(preg_match("/(\d{4})(\d{2})(\d{2})/s",$filetagstr,$tmp)){ $year = $tmp[1]; $month = $tmp[2]; $day = $tmp[3]; $youbi = getyoubi($year,$month,$day); } $string = preg_replace("/.*<\/FILE>/","",$string); } // $string = preg_replace("/(.+)<\/FILE>/","",$string); $string = preg_replace("/(.+)<\/KEYWORD>/","",$string); $string = preg_replace("/.*?<\/PAGENAME>/","",$string); $string = preg_replace("/.*?<\/LEADPACK>/","",$string); $string = preg_replace("/.*?<\/WEBONLY>/","",$string); $publicity = ""; if(preg_match("/(.+)<\/PUBLICITY>/s",$string,$tmp)){ $publicity = "
".$tmp[1]."
\n"; $string = preg_replace("/.*<\/PUBLICITY>/","",$string); } $string = preg_replace("/.*?<\/JTCATEGORY>/s","",$string); $string = preg_replace("/.*?<\/WWFILENAME>/s","",$string); //COLUMNNAME $string = preg_replace("//","
",$string);; $string = preg_replace("/<\/COLUMNNAME>/","
\n",$string); //SERIESNAME $string = preg_replace("//","
",$string); $string = preg_replace("/<\/SERIESNAME>/","
\n",$string); //KICKER $string = preg_replace("//","

",$string); $string = preg_replace("/<\/KICKER>/","

\n",$string); //CREDIT // $string = preg_replace("//","
",$string); $string = preg_replace("//","
",$string); $string = preg_replace("/<\/CREDIT>/","
\n",$string); //HEADLINE&DECK $string = preg_replace("//","

",$string); if(preg_match("/<\/DECK>/" ,$string)){ $string = preg_replace("//","

",$string); $string = preg_replace("/<\/HEADLINE>/","

\n\n",$string); $string = preg_replace("/<\/DECK>/","

\n\n",$string); }else{ $string = preg_replace("/<\/HEADLINE>/","

\n",$string); } if(preg_match("/(.+)<\/DATELINE>/",$string,$temp)){ $string = preg_replace("/.+<\/DATELINE>/","",$string); } // $string = preg_replace("//","
",$string); // $string = preg_replace("/<\/DATELINE>/","
\n",$string); //WRITER&WRITERSTITLE if(preg_match("//",$string)){ // 20060731 Writer Link 付け $bylinetmp = $byline; $bylinetmp = strtolower($bylinetmp); if(preg_match("/$bylinetmp/",$writerlist)){ //change 20061220 chifuri $string = preg_replace("//","
\n
\n\n",$string); }else{ $string = preg_replace("//","
\n
By ",$string); $string = preg_replace("/<\/WRITER>/","
\n\n",$string); } if(preg_match("//",$string)){ $string = preg_replace("//","
",$string); $string = preg_replace("/<\/WRITERSTITLE>/","
\n\n",$string); } } //SPECIALNOTE $string = preg_replace("//","
",$string); $string = preg_replace("/<\/SPECIALNOTE>/","
\n",$string); //PARAGRAPH // $string = preg_replace("//",$dateline,$string); // $string = preg_replace("//","

",$string); $string = preg_replace("//","

",$string); $string = preg_replace("/<\/PARAGRAPH>/","

\n\n",$string); //PHOTO // $string = preg_replace("//","

",$string); $string = preg_replace("//","

",$string); $string = preg_replace("/<\/PHOTO>/","

\n\n",$string); // $string = preg_replace("//","

",$string); // $string = preg_replace("/<\/PHOTO>/","

\n\n",$string); //SUBHEAD // $string = preg_replace("//","
",$string); // $string = preg_replace("/<\/SUBHEAD>/","
\n\n",$string); $string = preg_replace("//","

",$string); $string = preg_replace("/<\/SUBHEAD>/","

\n\n",$string); //BOOK $string = preg_replace("//","
",$string); $string = preg_replace("/<\/BOOK>/","
\n\n",$string); //BIO // $string = preg_replace("//","
",$string); $string = preg_replace("//","
",$string); $string = preg_replace("/<\/BIO>/","
\n\n",$string); //MAINBODY $string = preg_replace("/http:\/\/www\.japantimes\.co\.jp/","",$string); // 080220 lingospot (News only) /* if(preg_match("/^n/",$type)){ $lingo = "\n"; if($calltype == "rss"){ $lingo_s = "\n\n\n"; }else{ $lingo_s = "\n\n"; } $string = preg_replace("//","
\n$lingo",$string); $string = preg_replace("/<\/MAINBODY>/","
\n\n",$string); $template = preg_replace("()","$lingo_s",$template); }else{ $string = preg_replace("//","
",$string); $string = preg_replace("/<\/MAINBODY>/","
\n\n",$string); } */ $string = preg_replace("//","
",$string); $string = preg_replace("/<\/MAINBODY>/","
\n\n",$string); //FOOTER(start) if($thefile == "ek20070918wh.html"){ $debate_code = "
\n\n\n\n"; }elseif($thefile == "ek20070821wh.html"){ $debate_code = "
\n\n\n"; }elseif($thefile == "ek20070717wh.html"){ $debate_code = "
View the forum thread. blog comments powered by Disqus"; } // chg 070503 kono $toeditor global variable exists in the [context.php] $toeditor = preg_replace("/ARTICLEINFO/","ARTICLEINFO=$thefile&HEADLINE=$headline",$toeditor); //20071122 kato google_ad change if(preg_match("/^n|^e|^r/",$code)){ $context_tag = $context_tag1; if(preg_match("/^ek/",$code)){ $context_tag = $context_tag2; } }elseif(preg_match("/^f/",$code)){ $context_tag = $context_tag2; }elseif(preg_match("/^s/",$code)){ $context_tag = $context_tag3; }else{ $context_tag = $context_tag4; } $string = preg_replace("/
/","\n\n$debate_code\n
\n$context_tag\n
\n
\n\n".$toeditor,$string); //NEWSPAPERNAME $string = preg_replace("/.*<\/NEWSPAPERNAME>/","
\n
The Japan Times",$string); //DATE $dispdate = preg_replace("/.*(.*?)<\/DATE>.+/s","$1",$string); $string = preg_replace("/(.*?)<\/DATE>/","
\n\n",$string); //COPYRIGHT $copyright = preg_replace("/.*(.*?)<\/COPYRIGHT>.*/s","$1",$string); $string = preg_replace("/(.*?)<\/COPYRIGHT>/","
$copyright
\n",$string); $footernavi = footernavi($xml,$filepath,$alphamonth,$day); if($footernavi != ""){ $string = "$string\n
$footernavi
\n\n"; } //FOOTER(end)&disqus $string = preg_replace("/<\/FOOTER>/","
\n",$string); // -- Put blue back into URLs -------- $string = preg_replace("//","",$string); $string = preg_replace("/<\/A>/","",$string); $string = preg_replace("//","
",$string); // $string = preg_replace("//","
",$string); $string = preg_replace("//","",$string); $string = preg_replace("//","",$string); $string = preg_replace("//","",$string); $string = preg_replace("/<\/B>/","",$string); $string = preg_replace("//","",$string); $string = preg_replace("//","",$string); $string = preg_replace("/\.\.\/movie-new\.htm/","/entertainment/movie_listings.html",$string); $string = preg_replace("//","
",$string); // Change Photo Pass // $string = preg_replace("/SRC=\"\.\.\/images/","src=\"http://www.japantimes.co.jp/images",$string); $string = preg_replace("/SRC=\"\.\.\/images/","src=\"/images",$string); // $string = preg_replace("/SRC=\"\/images/","src=\"http://www.japantimes.co.jp/images",$string); $string = preg_replace("/SRC=\"\/images/","src=\"/images",$string); // patch(hodo-bu) $string = dopatch($string); // email this article // add 20070607 kono bookmark $option = insert_option($thefile,$headline,$byline,$category,$bookmark); $option_bottom = insert_option_bottom($thefile,$headline,$byline,$category,$bookmark_bottom); //20110425 ドルマーク後のスペース停止 // $string = preg_replace('/\$(\d)/',"\$ $1",$string); $string = preg_replace('/\$(\d)/',"$$1",$string); $template = preg_replace("/()()/i","$1\n$navi\n$2",$template); $template = preg_replace("/.*/s","",$template); $template = preg_replace("/(<\/head>)/s","$output_dfp_header$analytics_tag$1",$template); if(isset($_SESSION[first_name])){ $memberboxtag = "
\n"; $template = preg_replace("/().+()/s","$1$memberboxtag$2",$template); $template = preg_replace("/().+()/s","$1$memberboxtag$2",$template); } $template = preg_replace("/().+()/s","$1$2",$template); $string = preg_replace("/<\/JTARTICLE>/s","",$string); if(preg_match("/^s/",$xml)){ $spnavi = footernavi_sp($xml,$filepath,$alphamonth,$day,$youbi); } // 20060907 add for DART if(preg_match("/^s/",$xml)){ $template = preg_replace("/japantimes\.search/","japantimes.sports.article",$template); }elseif(preg_match("/^(ed|eo|r)/",$xml)){ $template = preg_replace("/japantimes\.search/","japantimes.opinion.article",$template); }elseif(preg_match("/^(fl|fs|ek|fg|fd|fv|fe)/",$xml)){ $template = preg_replace("/japantimes\.search/","japantimes.life.article",$template); }elseif(preg_match("/^(f|c)/",$xml)){ $template = preg_replace("/japantimes\.search/","japantimes.entertainment.article",$template); }else{ $template = preg_replace("/japantimes\.search/","japantimes.news.article",$template); } // 20070718 added by Hiramatsu // $tempdate = preg_replace("/,/","",$dispdate); // $temptime = strtotime($tempdate); // $yy = date("Y", $temptime); // $mm = date("m", $temptime); // $dd = date("d", $temptime); // $youbi = getyoubi($yy,$mm,$dd); // chg 070226 insert context ad tag $template = preg_replace("/maincontentareahere/i","\n$option
$publicity
$youbi, $dispdate

\n$string\n
\n$spnavi

\n",$template); $template = preg_replace("//i","\n
\n$option_bottom\n
\n",$template); $template = preg_replace("/().+()/s","$1\n$option
$youbi, $dispdate

\n$string\n
\n$spnavi\n$2",$template); if($year == "2008" && $month == "09" && $day == "12"){ if(preg_match("/^fq/",$type)){ $template = preg_replace("/().*(<\/title>)/s","<title>$headline The Japan Times Online",$template); }else{ $template = preg_replace("/().*(<\/title>)/s","<title>$headline | The Japan Times Online",$template); } }else{ $template = preg_replace("/().*(<\/title>)/s","<title>$headline | The Japan Times Online",$template); } $template = preg_replace("/(<\?php include\('\/var\/www\/html\/function\/navigation.inc'\);\?>)/s","$search_navi_data",$template); $template = preg_replace("/().*()/s","$1$lightblue_navi_data$2",$template); $template = preg_replace("/(<\?php include\('\/var\/www\/html\/function\/jtlogonavi.inc'\);\?>)/s","$newJTnavi",$template); // 20070612 kato add $template = preg_replace("()","\n".poll_main("../images/","$thefile","$headline","2"),$template); // add 20080107 kato $poll_iframe_tag = <<

EOM; $template = preg_replace("()",$poll_iframe_tag,$template); $template = preg_replace("()","$description",$template); include('/var/www/html/function/ads/T1-TE1_textad.php'); $template = preg_replace("/()(.+)()/s","$1\n$output_ad\n$3",$template); // $template = preg_replace("/()(.+)( EOM; $template = preg_replace("/().*()/s","$1\n$twitter_tag\n$2",$template); }elseif($sns_array[0] == "addthis"){ $twitter_tag = <<
EOM; $template = preg_replace("/().*()/s","$1\n$twitter_tag\n$2",$template); } // OUTPUT print ($template); } // 20060801 add function footernavi_sp($xml,$filepath,$alphamonth,$day,$youbi){ $othernavi = ""; $othercount = 0; $yyyy = substr($xml,2,4); $datecode = substr($xml,2,8); if (is_dir($filepath)) { if ($dh = @opendir($filepath)) { while (($file = readdir($dh)) !== false) { $dcode = substr($file,2,8); if($dcode != $datecode){ continue; } if(preg_match("/^s/",$file)){ // sports if($xml != $file){ $otherfile = "$filepath/$file"; if(!($wfp = file_exists("$otherfile"))){ continue; } $ofp = fopen($otherfile,'r'); // 終端に達するまでループ while (!feof($ofp)) { // ファイルから一行読み込む $oline = fgets($ofp); $otherstrings = $otherstrings . $oline; } // ファイルをクローズする fclose($ofp); if(preg_match("/(.*)<\/HEADLINE>/",$otherstrings)){ $otherhead = preg_replace("/.*(.+)<\/HEADLINE>.*/s","$1",$otherstrings); }else{ continue; } if(!preg_match("/s(b|j)\d{8}g\d/",$file)){ $othercount++; $others{$file} = $otherhead; } } } } closedir($dh); } } if($othercount > 0){ $othernavi = "
\n
    "; foreach ($others as $key => $val) { $html = preg_replace("/\.xml$/",".html",$key); $othernavi = "$othernavi\n
  • $val
  • \n"; } $othernavi = "$othernavi\n
\n
"; } return $othernavi; } function footernavi($xml,$filepath,$alphamonth,$day){ $footernavi = ""; $previousnavi = ""; $nextnavi = ""; $filetype = substr($xml,0,2); $datecode = substr($xml,2,8); $bottomcode = substr($xml,10,2); $bottom_ab = substr($xml,10,1); $total = 0; if(preg_match("/^nn|nb/",$xml)){ // news,business news if(preg_match("/^x|f|k|d|i|t|ve|jp|n|bm|bb|cc|w/",$bottomcode)){ // features return $footernavi; }elseif (is_dir($filepath)) { if ($dh = @opendir($filepath)) { while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".."){ if(($filetype == substr($file,0,2)) && ($datecode == substr($file,2,8))){ //**// 20070309 add kato !preg_match i if(!preg_match("/^x|f|k|d|i|ve|jp|n|bb|bm|cc|w/",substr($file,10,2))){ // features $total++; } } } } closedir($dh); } } }elseif(preg_match("/^fd/",$xml) && preg_match("/^t\d/",$bottomcode)){ // Tokyo Confindential if(is_dir($filepath)) { if ($dh = @opendir($filepath)) { while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".."){ if(($filetype == substr($file,0,2)) && ($datecode == substr($file,2,8))){ if(preg_match("/^fd/",substr($file,0,2)) && preg_match("/^t/",substr($file,10,2))){ // features $total++; } } } } closedir($dh); } } }elseif(preg_match("/^rc/",$xml)){ // RIC add 20061208 chifuri if(is_dir($filepath)) { if ($dh = @opendir($filepath)) { while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".."){ if(($filetype == substr($file,0,2)) && ($datecode == substr($file,2,8))){ if(preg_match("/^rc/",substr($file,0,2))){ // features $total++; } } } } closedir($dh); } } }else{ return $footernavi; } $previous = ""; $previousposition = 0; $nextposition = 0; $positioncount = 0; $next = ""; $position = substr($xml,11,1); if($total == 1){ return $footernavi; } if($bottom_ab == "t"){ $positioncount = $position; }elseif($bottom_ab == "b"){ $positioncount = $position + 9; }elseif($bottom_ab == "c"){ $positioncount = $position + 18; }else{ $positioncount = $position; } if($bottomcode == "t1"){ if($total > 1){ $next = "$filetype$datecode" . "t2.html"; } }elseif($bottomcode == "a1"){ if($total > 1){ $next = "$filetype$datecode" . "a2.html"; } }elseif($positioncount == $total){ if($bottomcode == "b1"){ $previous = "$filetype$datecode" . "a9.html"; }elseif($bottomcode == "c1"){ $previous = "$filetype$datecode" . "b9.html"; }else{ $previousposition = $position - 1; $previous = "$filetype$datecode" . "$bottom_ab$previousposition" . ".html"; } }else{ if($bottomcode == "a9"){ $previous = "$filetype$datecode" . "a8.html"; if(($position + 1) <= $total){ $next = "$filetype$datecode" . "b1.html"; } }elseif($bottomcode == "b9"){ $previous = "$filetype$datecode" . "b8.html"; if(($position + 9) <= $total){ $next = "$filetype$datecode" . "c1.html"; } }elseif($bottomcode == "c1"){ $previous = "$filetype$datecode" . "b9.html"; if($total > 18){ $next = "$filetype$datecode" . "c2.html"; } }elseif($bottomcode == "b1"){ $previous = "$filetype$datecode" . "a9.html"; if($total > 10){ $next = "$filetype$datecode" . "b2.html"; } }else{ $previousposition = $position - 1; $previous = "$filetype$datecode" . "$bottom_ab$previousposition" . ".html"; $nextposition = $position + 1; $next = "$filetype$datecode" . "$bottom_ab$nextposition" . ".html"; } } $category = ""; if(preg_match("/^fd/",$xml)){ // Tokyo Confindential $category = "Tokyo Confidential"; }elseif(preg_match("/^nn/",$xml)){ $category = "National"; }elseif(preg_match("/^nb/",$xml)){ $category = "Business"; }elseif(preg_match("/^rc/",$xml)){ $category = "READERS IN COUNCIL"; }else{ return $footernavi; } if($previous != ""){ if(preg_match("/^fd/",$xml)){ $previousnavi = "\"Previous\""; }elseif(preg_match("/^rc/",$xml)){ $previousnavi = "\"Previous\""; }else{ $footernavi = "$footernavi\"Previous\""; } } if($next != ""){ if(preg_match("/^fd/",$xml)){ $nextnavi = "\"Next\""; }elseif(preg_match("/^rc/",$xml)){ $nextnavi = "\"Next\""; }else{ $footernavi = "$footernavi \"Next\""; } } if(preg_match("/^fd/",$xml)){ $footernavi = "$previousnavi  Article $positioncount of $total in $category, $alphamonth $day  $nextnavi"; }elseif(preg_match("/^rc/",$xml)){ $footernavi = "$previousnavi  Letter $positioncount of $total in $category, $alphamonth $day  $nextnavi"; }else{ $footernavi = "

Article $positioncount of $total in $category news

$footernavi"; } return $footernavi; } function getfileinfo($file){ $file = trim($file); //20070612 kato if(!preg_match("/\w{2}\d{8}\w{2}\.htm/",$file) && !preg_match("/\w{4}\_poll.html/",$file)){ $message = "\n
\n
\n\n
\n

\nSorry, we don't seem to have that kinda file around here.\n

\n

\nPlease try again!\n

\n
\n\n\n"; print($message); exit; } /* まずは、ここ一週間のファイル(会員登録する必要がない)を検索 */ $nomemberflg = 0; $thisweeksdir = "../currentplain"; $path = opendir($thisweeksdir); while($filename = readdir($path)){ $filename = preg_replace("/xml$/","html",$filename); if($filename == $file){ $nomemberflg = 1; } } closedir($path); return $nomemberflg; } function getyoubi($year, $month, $day){ global $youbi; $mm = $month; $mm = ereg_replace("^0","",$mm); $dd = $day; $dd = preg_replace("/^0/","",$dd); if ($mm == 1 || $mm == 2) { $yyyy = $year; $yyyy--; $mt = $mm; $mt += 12; }else{ $yyyy = $year; $mt = $mm; } # Zeller(ツェラー)の公式 $i = ($yyyy + (int)($yyyy/4) - (int)($yyyy/100) + (int)($yyyy/400) + (int)((13*$mt + 8)/5) + $dd) % 7; $wday = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); $youbi = $wday[$i]; return $youbi; } // add 20070607 kono bookmark function insert_option($thefile, $headline, $byline, $category, $bookmark){ global $option; // add 20070507 kono convert a headline $con_head = rawurlencode($headline); // $startTag = "
Welcome $_SESSION[first_name]\n
Your profile  |  Log out
"; // $startTag = "
"; $startTag = "
\n"; $endTag = "
 
"; # printer friendly $printertag = ""; $printertag = "$printertag\n\"print\n"; $adstag = "%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0aThe%20Japan%20Times%20Online%0ahttp%3a%2f%2fwww%2ejapantimes%2eco%2ejp%0aStay%20updated%20with%20daily%20news%20and%20news%20about%20Japan%3a%0aE%2dmail%3a%20https%3a%2f%2fform%2ejapantimes%2eco%2ejp%2fagree%2fagree%2ehtml%0aRSS%3a%20http%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2finfo%2frss_feeds%2ehtml%0aTwitter%3a%20http%3a%2f%2ftwitter%2ecom%2fjapantimes%0aTo%20advertise%20in%20The%20Japan%20Times%3a%20http%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2finfo%2fads%2ehtml%0a%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0a"; // chg 20070507 kono convert a headline if(trim($byline) != ""){ $mailbody = "%0a$category%0a$con_head%0aBy%20$byline%0ahttp%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2fcgi%2dbin%2f$thefile%0a%0a%0a%0a%0a%0a$adstag"; }else{ $mailbody = "%0a$category%0a$con_head%20http%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2fcgi%2dbin%2f$thefile%0a%0a%0a%0a%0a%0a$adstag"; } $mailtag = "\n"; $mailtag = "$mailtag\n\"email\n"; // $bookmarktag = "$bookmark"; // $bookmarktag = "$bookmark"; $bookmarktag = "$bookmark"; // 20070824 kato NN out $HTTP_USER_AGENT = getenv( "HTTP_USER_AGENT" ); if(!ereg( "Netscape", $HTTP_USER_AGENT )){ $answertag = ''; // $answertag = "\"Answer"; $answersc = ''; // $answersc = ""; $option = "$startTag\n$printertag\n$mailtag\n$bookmarktag\n$answertag\n$answersc\n$endTag\n"; }else{ $option = "$startTag\n$printertag\n$mailtag\n$endTag\n"; // $option = "$startTag\n$printertag\n$mailtag\n$bookmarktag\n$endTag\n"; } // $option = "$startTag\n$printertag\n$mailtag\n$bookmarktag\n$answertag\n$answersc\n$endTag\n"; return $option; } function insert_option_bottom($thefile, $headline, $byline, $category, $bookmark_bottom){ global $option_bottom; $con_head = rawurlencode($headline); $startTag = <<
EOM; $endTag = << EOM; # printer friendly $printertag = ""; $printertag = "$printertag\n\"print\n
\n"; $adstag = "%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0aThe%20Japan%20Times%20Online%0ahttp%3a%2f%2fwww%2ejapantimes%2eco%2ejp%0aStay%20updated%20with%20daily%20news%20and%20news%20about%20Japan%3a%0aE%2dmail%3a%20https%3a%2f%2fform%2ejapantimes%2eco%2ejp%2fagree%2fagree%2ehtml%0aRSS%3a%20http%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2finfo%2frss_feeds%2ehtml%0aTwitter%3a%20http%3a%2f%2ftwitter%2ecom%2fjapantimes%0aTo%20advertise%20in%20The%20Japan%20Times%3a%20http%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2finfo%2fads%2ehtml%0a%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0a"; // chg 20070507 kono convert a headline if(trim($byline) != ""){ $mailbody = "%0a$category%0a$con_head%0aBy%20$byline%0ahttp%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2fcgi%2dbin%2f$thefile%0a%0a%0a%0a%0a%0a$adstag"; }else{ $mailbody = "%0a$category%0a$con_head%20http%3a%2f%2fwww%2ejapantimes%2eco%2ejp%2fcgi%2dbin%2f$thefile%0a%0a%0a%0a%0a%0a$adstag"; } $mailtag = "\n\n"; // $bookmarktag = "$bookmark"; // $bookmarktag = "$bookmark"; $bookmarktag = "$bookmark_bottom"; // 20070824 kato NN out $HTTP_USER_AGENT = getenv( "HTTP_USER_AGENT" ); if(!ereg( "Netscape", $HTTP_USER_AGENT )){ $answertag = ''; // $answertag = "\"Answer"; $answersc = ''; // $answersc = ""; $option_bottom = "$startTag\n$printertag\n$mailtag\n$bookmarktag\n$answertag\n$answersc\n$endTag\n"; }else{ $option_bottom = "$startTag\n$printertag\n$mailtag\n$endTag\n"; // $option = "$startTag\n$printertag\n$mailtag\n$bookmarktag\n$endTag\n"; } // $option = "$startTag\n$printertag\n$mailtag\n$bookmarktag\n$answertag\n$answersc\n$endTag\n"; return $option_bottom; } function insert_adstag(){ global $javascript; # ---- JAVASCRIPT ---- $javascript = <<
EOM; $template = preg_replace("/().*()/s","$1\n$twitter_tag\n$2",$template); }elseif($sns_array[0] == "addthis"){ $twitter_tag = <<
EOM; $template = preg_replace("/().*()/s","$1\n$twitter_tag\n$2",$template); } print ($template); } ?>