0 )
{
if (isset($url_hash['query']))
{
parse_str( $url_hash['query'], $query_hash);
// 検索キー取り出し
if (isset($query_hash['q']))
$keyword = $query_hash['q'];
if (!$keyword)
{
if (isset($query_hash['Text']))
$keyword = $query_hash['Text'];
}
if (!$keyword)
{
if (isset($query_hash['search']))
$keyword = $query_hash['search'];
}
if (!$keyword)
{
if (isset($query_hash['p']))
$keyword = $query_hash['p'];
}
if (!$keyword)
{
if (isset($query_hash['MT']))
$keyword = $query_hash['MT'];
}
if (!$keyword)
{
if (isset($query_hash['query']))
$keyword = $query_hash['query'];
}
}
if ($keyword)
{
$pos = strpos($keyword, " site:");
if ($pos)
$keyword = substr($keyword, 0, $pos);
}
if ($keyword)
{
# $keyword = mb_convert_encoding($keyword, "UTF-8", "SJIS, SJIS-win, UTF-8");
$keywordlen = strlen($keyword);
if (strcasecmp($keyword, "table")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "tr")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "td")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "div")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "pre")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "p")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "href")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "img")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "b")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "font")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "li")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "ul")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "style")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "a href")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "a")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "title")==0)
$keywordlen = 0;
else if (strcasecmp($keyword, "alt")==0)
$keywordlen = 0;
}
}
}
$datafile = $_SERVER['QUERY_STRING'];
if (!$datafile) { $datafile = "explzh.htm"; }
$datadir = getcwd()."/";
if (strcmp($datafile, "explzh.htm")==0 || strcmp($datafile, "history.htm")==0)
$explzh = 1;
else if (strcmp($datafile, "explzh64.htm")==0)
$explzh = 2;
else if (strcmp($datafile, "add_module.htm")==0 || strcmp($datafile, "add_module64.htm")==0)
$explzh = -1;
else if (strcmp($datafile, "ftpimg.htm")==0)
$explzh = -2;
else if (strcmp($datafile, "history2.htm")==0)
$explzh = -3;
if (!file_exists($datadir . $datafile))
{
NotFoundFile();
exit();
}
$flag = 0;
$conl = file($datadir.$datafile);
if ($conl) {
// 正規表現で src="*.jpg" または src="*.png" を探し、クエリパラメータを追加
// 既存のクエリパラメータがあれば、それを新しいものに置き換えます。
$t = time();
$picpattern = '/
/i';
$replacement = '
';
foreach($conl as $value) {
if ($value=="\n") { continue; }
if (!$flag) {
if (stristr($value, "")) {
if ($explzh==2)
{
$title = mb_substr($value, 7, strlen($value)-17, 'UTF-8'); // 64bit
$explzh = 1;
}
else if ($explzh==1)
{
$title = mb_substr($value, 7, strlen($value)-16, 'UTF-8');
// $title = substr($value, 7, strlen($value)-16);
}
else
{
$title = mb_substr($value, 7, strlen($value)-16, 'UTF-8');
// $title = substr($value, 7, strlen($value)-16);
}
$title = "Explzh - " . $title;
}
else if (stristr($value, "
")) {
$title_h1 = substr($value, 4);
$title_h1 = str_ireplace("
\n", "", $title_h1);
}
else if (stristr($value, "")) {
$flag = 1;
}
continue;
}
if (stristr($value, ""))
break;
if ($keywordlen && ($word = stristr($value, $keyword)))
{
$pos1 = stripos($value, "href=");
if (!$pos1)
$pos1 = stripos($value, "src=");
if ($pos1)
{
$pos1 += 4;
$pos2 = stripos($value, ">", $pos1);
$pos3 = strpos($value, $word);
if (!($pos1<$pos3 && $pos2>$pos3))
{
$pos1 = 0;
}
}
if (!$pos1) {
$word = substr($word, 0, $keywordlen);
$relace_keyword = "" . $word . "";
$value = str_replace($word, $relace_keyword, $value);
}
}
$value = preg_replace($picpattern, $replacement, $value);
$body .= $value;
}
}
//****************************************************************************
function NotFoundFile() {
$redirectUrl = "http";
if ($_SERVER['HTTPS'])
$redirectUrl .= "s";
$redirectUrl .= "://";
$redirectUrl .= $_SERVER['HTTP_HOST'];
$redirectUrl .= "/errordoc/404.html";
header("HTTP/1.0 404 Not Found");
echo file_get_contents($redirectUrl);
exit();
}
//****************************************************************************
function output_header() {
global $title;
global $www_meta;
$datafile = "https://www." . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER["REQUEST_URI"]);
if ($www_meta)
{
print $www_meta;
}
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "$title\n";
}
//****************************************************************************
function output_body() {
global $body;
global $title;
global $explzh;
// global $mobile;
echo "\n";
echo "" . $title . "\n";
// if (!$mobile)
// {
echo ' ';
echo '
';
// }
echo($body); // 出力する
if ($explzh==1) {
echo "\n\n";
history_out();
echo "\n\n";
echo "\n\n";
}
else if ($explzh==-3) {
echo "\n\n";
history_out2();
echo "\n\n";
}
}
//****************************************************************************
function output_google() {
global $keyword;
$string_out = <<< EOF
EOF;
echo($string_out); // 出力する
}
function history_out2() {
global $keyword;
$keywordlen = strlen($keyword);
$ul_flgs = 0;
$flag = 2;
$file = "";
$insert = 0;
$filecontent = file_get_contents(getcwd()."/history_old.txt");
$content = explode("\n", $filecontent);
print "
";
foreach ($content as $lines)
{
if (!$keywordlen)
$lines = mb_ereg_replace("(https?|ftp)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)", "\\1\\2", $lines);
if ( !$lines )
{
if ( $insert )
{
if ($ul_flgs==2)
print "";
if ($ul_flgs)
print "";
$ul_flgs = 0;
print "";
print " |
";
$insert = 0;
}
$flag = 1;
}
else
{
if ( $flag==1 )
{
print "";
print "| ";
print "$lines";
print " |
";
print "";
print "";
$insert = 1;
} else if ( !$flag ) {
if ($keywordlen && ($word = stristr($lines, $keyword)))
{
$pos1 = stripos($lines, "href=");
if (!$pos1)
$pos1 = stripos($lines, "src=");
if ($pos1)
{
$pos1 += 4;
$pos2 = stripos($lines, ">", $pos1);
$pos3 = strpos($lines, $word);
if ($pos1<$pos3 && $pos2>$pos3)
{
$pos1 = 0;
}
}
if (!$pos1) {
$word = substr($word, 0, $keywordlen);
$relace_keyword = "" . $word . "";
$lines = str_replace($word, $relace_keyword, $lines);
}
}
if ( strstr($lines, '・')===$lines ) {
if ($ul_flgs==2)
print "";
if ($ul_flgs)
print "";
$ret = substr($lines, 3);
print "- $ret";
$ul_flgs = 1;
} else if ( strstr($lines, " ・")===$lines ) {
if ($ul_flgs==2)
print "
";
$ret = substr($lines, 5);
if ($ul_flgs!=2)
print "- $ret";
else
print "
- $ret";
$ul_flgs = 2;
} else if ( strstr($lines, " ")===$lines ) {
$ret = substr($lines, 4);
print "$ret";
} else if ( strstr($lines, " ")===$lines ) {
$ret = substr($lines, 2);
print "$ret";
} else {
print $lines;
}
$flag = 0;
}
$flag = 0;
}
}
}
function history_out() {
global $keyword;
global $mobile;
$ads_gg = 0;
$keywordlen = strlen($keyword);
$ul_flgs = 0;
$flag = 2;
$dowCnt = 10;
$exp = "explz";
$msg = "のダウンロード";
$file = "";
$insert = 0;
$filecontent = file_get_contents(getcwd()."/history.txt");
// $filecontent = mb_convert_encoding($filecontent, "UTF-8", "SJIS, SJIS-win, UTF-8");
$content = explode("\n", $filecontent);
print "
";
foreach ($content as $lines)
{
if (strcmp($lines, 'Ver.6.06 2012/3/22')==0)
break;
if (!$keywordlen)
$lines = mb_ereg_replace("(https?|ftp)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)", "\\1\\2", $lines);
if ( !$lines )
{
if ( $insert )
{
if ($ul_flgs==2)
print " ";
if ($ul_flgs)
print "";
$ul_flgs = 0;
print " ";
if ( $dowCnt ) {
print "";
}
print " |
";
$insert = 0;
if ( $dowCnt )
{
// 割られる数と割る数
// 余りを計算
if ($dowCnt!=10 && ($dowCnt % 5 === 0))
{
if ($mobile)
{
/*
echo '';
echo '';
echo '';
echo '';
*/
}
}
$dowCnt--;
}
else
{
if (!$ads_gg)
{
if (!$mobile)
{
echo '';
echo '';
}
$ads_gg = 1;
}
}
}
$flag = 1;
}
else
{
if ( $flag==1 )
{
print "";
print "| ";
if ( $dowCnt )
{
$file = $exp;
$file .= substr( $lines, 4, 1 );
$file .= substr( $lines, 6, 2 );
// print "$lines ";
print "$lines ";
print " |
";
print "| ";
$url = "http://";
$url .= $_SERVER['HTTP_HOST'];
$url .= "/archiver/explzh/explzh.htm#" . $file;
}
else
{
$file = $exp;
$file .= substr( $lines, 4, 1 );
$file .= substr( $lines, 6, 2 );
print "$lines ";
print " |
";
print "";
}
print "";
$insert = 1;
}
else if ( !$flag )
{
if ($keywordlen && ($word = stristr($lines, $keyword)))
{
$pos1 = stripos($lines, "href=");
if (!$pos1)
$pos1 = stripos($lines, "src=");
if ($pos1)
{
$pos1 += 4;
$pos2 = stripos($lines, ">", $pos1);
$pos3 = strpos($lines, $word);
if ($pos1<$pos3 && $pos2>$pos3)
{
$pos1 = 0;
}
}
if (!$pos1) {
$word = substr($word, 0, $keywordlen);
$relace_keyword = "" . $word . "";
$lines = str_replace($word, $relace_keyword, $lines);
}
}
if ( strstr($lines, '・')===$lines ) {
if ($ul_flgs==2)
print "";
if ($ul_flgs)
print "";
$ret = substr($lines, 3);
print "- $ret";
$ul_flgs = 1;
} else if ( strstr($lines, " ・")===$lines ) {
if ($ul_flgs==2)
print "
";
$ret = substr($lines, 5);
if ($ul_flgs!=2)
print "- $ret";
else
print "
- $ret";
$ul_flgs = 2;
} else if ( strstr($lines, " ")===$lines ) {
$ret = substr($lines, 4);
print "$ret";
} else if ( strstr($lines, " ")===$lines ) {
$ret = substr($lines, 2);
print "$ret";
} else {
print $lines;
}
$flag = 0;
}
$flag = 0;
}
}
# fclose($fp);
}
?>
\n";
echo "\n";
$string_out = <<< EOF
EOF;
echo($string_out); // 出力する
?>
|
Explzh for WindowsWindows 用の高機能圧縮解凍ソフト\n");
else
echo("Explzh for Windows$title_h1\n");
?>
|
";
echo " Japanese | ";
echo " English";
echo "\n";
?>
|
|
|
";
echo '';
echo '';
*/
// }
?>
|