"; sitemap(''); $str = 'news'; if ($Replace && array_key_exists($str, $Replace)) { $str = $Replace[$str]; } $tree .= "
  •  $str "; data_save($System['datadir']. "/sitedb/database.txt", $Database); $Init[Encode] != 'UTF-8' && $tree = mb_convert_encoding($tree, $Init['Encode'], "UTF-8"); file_put_contents($System['datadir']. "/sitedb/sitemap.html", $tree); $_REQUEST[action] = ""; } if ($_REQUEST[action] == "update") { $caption = "サイト情報の更新"; $width = "480px"; $height = "260px"; } elseif ($_REQUEST[action] == "init") { $caption = "全文検索環境設定"; $width = "800px"; } else { if (is_file($System['datadir']. "/sitedb/database.txt")) { $Database = file($System['datadir']. "/sitedb/database.txt"); } $caption = "サイト情報一覧"; $width = "100%"; } $client = new window; $client->name = 'client'; $client->width = $width; $client->height = $height; $client->display = 'block'; $client->caption = $caption; $client->drag = true; $client->resize = false; $client->closebutton = true; $client->smallbutton = true; $client->border = false; $client->bgcolor = ''; $client->foldericon = $foldericon; $client->help = $help->$_REQUEST['cmd']; $client->body = "
    "; if ($_REQUEST[action] == "update") { $client->body .=<<<_
    1. サイト内キーワード検索のためのデータベースを更新します。
    2. 検索対象はhtmlドキュメントのみです。テキストファイルやPDFファイルは対象外です。
    3. 検索対象はサイトのルートディレクトリ(先頭)からになります。
    4. 会員専用等で、一般に公開しないコンテンツは予め環境設定で除外するディレクトリを設定しておかなければなりません。
      ベーシック認証等でアクセスを制限しているページがあれば、データベースの構築に失敗します。 必ず除外しておいてください。
    5. サイトの規模により長い時間が必要です。[実行]ボタンを押して、結果一覧が表示されるまで他の操作を行わないでください。


    _; } elseif ($_REQUEST['action'] == "init") { is_array($Hidden) && $hidden = join("\r", $Hidden); if (is_array($Replace)) { $keys = array_keys($Replace); foreach ($keys as $key) { $replace .= "$key=$Replace[$key]\r"; } } !$Setup['Pageview'] && $Setup['Pageview'] = 20; is_file($System['datadir']. "/sitedb/sitemap.html") && $tree = mb_convert_encoding(file_get_contents($System['datadir']. "/sitedb/sitemap.html"), "UTF-8", "auto"); !$Setup['type'] && $Setup['type'] = 0; $Type[$Setup['type']] = "checked"; !$Setup['Command'] && $Setup['Command'] = 0; $Command[ $Setup['Command'] ] = "checked"; $client->body .= "
    サンプルフォーム
    <form action=\"$Exe[find]$scriptname\" method=\"post\">
    	<input type=\"text\" name=\"keyword\" />
    	<input type=\"submit\" value=\"検索...\" />
    </form>
    ※上記サンプルフォームをコピーしてページに貼り付けるだけで検索フォームが挿入できます。
    検索方法 ドキュメントのみ取得する(絶対パス)
    SSIデータを含んだ情報を取得する(URL)
    テンプレート
    ※テンプレートに使用するファイルのパス。 省略するとシステムの「動作環境の設定」で設定したデフォルトが使用されます。 テンプレートのパス指定は/から始まる絶対パスで無ければなりません。
    除外 ※検索対象から除外するディレクトリを指定します。 指定したディレクトリの下層ディレクトリも除外されます。 また、同名の名称はどこに有っても、すべてが除外されます。
    1件ごとに改行してください。
    本システムのディレクトリ /trycms は、無条件に除外されます。
    対象範囲

    ※通常検索対象となるドキュメントの対象は、<body> から </body> 間の文字列すべてに設定されていますが、 対象となるキーワード(コメント)を設定すると、検索対象を指定の範囲にすることができます。 この機能を使用することで、各ページで共通な部分(メニューなど)を除外できます。

    <!--documnet body-->

    この間が検索対象になる

    <!--/documnet body-->

       この例では[documnet body]を設定し、すべてのドキュメントの記事の前後すべてに上記のコメントを挿入しておきます。

    ※キーワードは大文字小文字を区別しません。 また、キーワード内のスペースは自動的に全て削除され、無視されますのでご注意ください。

    表示件数
    キーワード未設定でも一覧を表示
    1ページに表示する件数
    スマートフォン設定(有料オプション)

    オプションのスマートフォン機能を導入すると、スマートフォン独自(iPhone風)のインターフェースを提供します。

    スマートフォンコンテンツは、通常サイトの一部として存在しなければなりません。 他のドメインや、サブドメインではご利用いただけません。

    サンプルフォーム
    ";
    						if (check_option('id9')) {
    							$client->body .= "
    <form action=\"$Exe[find]$scriptname\" method=\"post\" data-ajax=\"false\">
    	<input type=\"hidden\" name=\"target\" value=\"sp\" />
    	<input type=\"text\" name=\"keyword\" />
    	<input type=\"submit\" value=\"検索...\" />
    </form>";
    						} else {
    							$client->body .= " ";
    						}
    						$client->body .= "
    ※上記サンプルフォームをコピーしてページに貼り付けるだけで検索フォームが挿入できます。
    自動認識
    ドキュメントルート

    ※スマートフォン用ドキュメントルートを/からの絶対パスで設定。 スマートフォンからの検索は、このディレクトリ以下のコンテンツまたは、ニュース記事のみとなります。 未設定は、全ての記事が検索対象です。

    テンプレート

    ※スマートフォン用テンプレートは、文字コードがUTF-8で作成されていなければなりません。

    一覧形式 コンパクト
    概要を折りたたみ開いた状態表示
    概要を折りたたみ閉じた状態表示
    サイトマップ
    サイト内検索用データベースを更新すると、自動的にサイトマップが正確なツリー状に生成されています。
    ベースとなるテンプレートに、
    /jquery/treeview/treeview.css と /jquery/treeview/jquery.treeview.js をインクルードし、 マップを挿入する位置に以下のSSIとjavascriptをコピーして貼り付けてください。 サイトマップは、コンパネ上でデータベースが更新されると同時に更新されます。
    <!--#include virtual=\"/trycms/systemdata/sitedb/sitemap.html\"-->
    <script type=\"text/javascript\">
    	$(document).ready(function(){ $(\"#sitemap\").treeview(); });
    </script>
    置き換え アルファベットのディレクトリ名を日本語に置き換えて表示することが出来ます。 たとえば[products]というディレクトリを「製品紹介」等に変更できます。
    products=製品紹介
    support=サポート
    書式は、上記のようにディレクトリ名と置き換え文字列を半角「=」で区切って、 1件ごとに改行してください。
    $tree
    保存する リセット キャンセル ≪ 戻る $helpbutton
    "; $javascript .= " $(document).ready(function(){ $('#sitemap').treeview(); }); function windowGoResize() { var h = $(window).height(); document.getElementById('scroolBody').style.height=h-50+'px'; } windowGoResize(); window.onresize=windowGoResize;"; } else { if (is_file($System['datadir']. "/sitedb/database.txt")) { $date = jst_time(filemtime($System['datadir']. "/sitedb/database.txt"), 7); } $client->body .= "
    更新日 : $date
    "; $i = 1; foreach ($Database as $line) { $pg = dbfields($line); $pg[text] = description($pg['text'], 320); $client->body .= " "; $i++; } $client->body .= "
    No. 更新日 URL ワード
    $i ". $pg['date']. " ". $pg['url']. " ". $pg['title']. "
    ". $pg['text']. "
    "; $javascript .= " function windowGoResize() { var h = $(window).height(); document.getElementById('scroolBody').style.height=h-50+'px'; } windowGoResize(); window.onresize=windowGoResize;"; } $client->body .= "
    "; $html .= $client->show(); function sitemap($dir = "") { global $Setup, $Hidden, $Database, $tree, $Replace; $nonDir = array('trycms', 'jquery'); foreach ($Hidden as $line) { $nonDir[] = $line; } $Dir = array(); $File = array(); $dir = preg_replace("/^\//", "", $dir); $currentdir = $_SERVER['DOCUMENT_ROOT']. "/$dir"; $currentdir = preg_replace("/\/$/", "", $currentdir); $protocol = "http"; $_SERVER['HTTPS'] && $protocol = "https"; $currenturl = "$protocol://". $_SERVER['SERVER_NAME']. "/$dir"; $currenturl = preg_replace("/\/$/", "", $currenturl); $child = false; if ($dh = opendir($currentdir)) { while (($file = readdir($dh)) !== false) { if (!preg_match("/^\./", $file)) { $type = filetype("$currentdir/$file"); if ($type == "dir") { !in_array($file, $nonDir) && $Dir[] = $file; } elseif (preg_match("/\.(htm|html)$/i", $file)) { $File[] = $file; } } } closedir($dh); } sort($Dir); sort($File); $Files = array_merge($Dir, $File); $dom = str_replace('.', '\.', $Setup[Dom]); $dom = preg_replace("/\s/", "", $dom); if (count($Files)) { $child = true; $tree .= " "; $tree .= "
  • "; } else { $date = jst_time(filemtime("$currentdir/$file"), 7); $absolute = "$dir/$file"; !preg_match("/^\//", $absolute) && $absolute = "/$absolute"; if ($Setup['Command']) { $url = "$currenturl/$file"; } else { $url = $_SERVER['DOCUMENT_ROOT']. "/$absolute"; } $text = file_get_contents($url); if (!$text) { $text = file_get_contents("$currentdir/$file"); } preg_match("//i", $text, $m); $encode = strtoupper($m[1]); $encode && $encode != "UTF-8" && $text = mb_convert_encoding($text, "UTF-8", $encode); $text = preg_replace("/\s/", "", $text); preg_match("/(.*)<\/title>/i", $text, $m); $title = $m[1]; !$title && $title = 'non title'; if ($Setup['Dom']) { preg_match("/<!--$dom-->(.*)<!--\/$dom-->/i", $text, $m); } else { preg_match("/<body.*?>(.*)<\/body>/i", $text, $m); } $text = $m[1]; $text = preg_replace("/<script.*?<\/script>/i", "", $text); $text = preg_replace("/<style.*?<\/style>/i", "", $text); $text = strip_tags($text); $Database[] = join("\t", array( "date=$date", "path=$currentdir/$file", "url=$absolute", "title=$title", "text=$text", "\n" )); list($dt, $tm) = split(" ", $date); $tree .= " <li nowrap><span class=\"file\"><a href=\"$absolute\">$title [$dt]</a></span></li>"; } } } return($child); } function sitedb($dir) { global $Hidden, $Database, $tree; $protocol = "http"; $_SERVER['HTTPS'] && $protocol = "https"; $dir = preg_replace("/^\//", "", $dir); $currentdir = $_SERVER['DOCUMENT_ROOT']. "/$dir"; $currentdir = preg_replace("/\/$/", "", $currentdir); $currenturl = "$protocol://". $_SERVER['SERVER_NAME']. "/$dir"; $currenturl = preg_replace("/\/$/", "", $currenturl); if ($dh = opendir($currentdir)) { while (($file = readdir($dh)) !== false) { if (!preg_match("/^\./", $file)) { $type = filetype("$currentdir/$file"); if ($type == "dir") { if (!in_array($file, $Hidden)) { $Dir[] = $file; } } elseif (preg_match("/.+\.htm/i", $file)) { $date = jst_time(filemtime("$currentdir/$file"), 7); $url = "$currenturl/$file"; $absolute = "$dir/$file"; !preg_match("/^\//", $absolute) && $absolute = "/$absolute"; //$text = file_get_contents("$currentdir/$file"); $text = file_get_contents($url); preg_match("/<meta.*charset=([\w\-]+).*?>/i", $text, $m); $encode = strtoupper($m[1]); $encode && $encode != "UTF-8" && $text = mb_convert_encoding($text, "UTF-8", $encode); $text = preg_replace("/\s/", "", $text); preg_match("/<title>(.*)<\/title>/i", $text, $m); $title = $m[1]; preg_match("/<body.*?>(.*)<\/body>/i", $text, $m); $text = $m[1]; $text = preg_replace("/<script.*<\/script>/i", "", $text); $text = strip_tags($text); $Database[] = join("\t", array( "date=$date", "path=$currentdir/$file", "url=$absolute", "title=$title", "text=$text", "\n" )); } } } closedir($dh); if (count($Dir)) { sort($Dir); foreach ($Dir as $val) { sitedb("$dir/$val"); } } } } ?>