";
if ($_REQUEST['target'] == "sp") {
if ($Setup['Listsummary']) {
$text .= "
";
} else {
$text .= "
";
}
} elseif ($Setup['nonDesign'] || $_REQUEST['target'] == "mb") {
$text .= "
";
} else {
$text .= "
";
}
!$Setup['Listview'] && $Setup['Listview'] = 50;
$Pageview = $Setup['Listview'];
!$_REQUEST['start'] && $_REQUEST['start'] = 0;
$max = count($Docs) - 1;
$end = $_REQUEST['start'] + $Pageview - 1;
$end > $max && $end = $max;
if ($_REQUEST['start'] > 0) {
$prev = $_REQUEST['start'] - $Pageview;
if ($_REQUEST['target'] == "mb" || $_REQUEST['target'] == "sp") {
$prevButton = "
". $Setup['Prevbutton']. "";
} else {
$prevButton = "
". $Setup['Prevbutton']. "";
}
}
if ($max > $end) {
$next = $_REQUEST['start'] + $Pageview;
if ($_REQUEST['target'] == "mb" || $_REQUEST['target'] == "sp") {
$nextButton = "
". $Setup['Nextbutton']. "";
} else {
$nextButton = "
". $Setup['Nextbutton']. "";
}
}
for($i = $_REQUEST['start']; $i <= $end; $i++) {
$doc = dbfields($Docs[$i]);
list($y, $m, $d, $t, $n) = preg_split("/[\/\s \:]/", $doc['Viewdate']);
if ((!$doc['Viewdate'] || jst_time(time(), 6) >= $doc['Viewdate']) &&
(!$doc['Closedate'] || jst_time(time(), 6) <= $doc['Closedate']) && $doc['Auth']) {
$text .= lineview($doc, $Setup['nonDesign']);
}
}
if ($Setup['Listsummary'] && $_REQUEST['target'] == "sp") {
$text .= "
";
} elseif ($Setup['nonDesign'] || $_REQUEST['target'] == "mb") {
$text .= "
";
} else {
$text .= "
";
}
$returnButton = "戻る";
if ($_REQUEST['target']) {
if ($_REQUEST['target'] == "mb") {
$prevButton = mb_convert_encoding($prevButton, "SJIS", "UTF-8");
$nextButton = mb_convert_encoding($nextButton, "SJIS", "UTF-8");
$returnButton = mb_convert_encoding($returnButton, "SJIS", "UTF-8");
}
$text .= "
$prevButton
$nextButton
";
} else {
$text .= "
";
}
$text .= "
";
} elseif ($_REQUEST['viewID'] && $doc['Auth'] &&
(!$doc['Viewdate'] || jst_time(time(), 6) >= $doc['Viewdate']) &&
(!$doc['Closedate'] || jst_time(time(), 6) <= $doc['Closedate'])) {
list($year, $month, $day) = split("/", $doc['Date']);
$date = dateFmt($Setup['Dateformat'], $year, $month, $day);
$doc['Subject'] = tag_decode($doc['Subject'], 1);
$doc['Body'] = tag_decode($doc['Body'], 1);
if ($_REQUEST['target'] == "mb") {
$date = mb_convert_encoding($date, "SJIS", "UTF-8");
$subject = mb_convert_encoding(strip_tags($doc['Subject']), "SJIS", "UTF-8");
if ($Setup['imgview']) {
$body = preg_replace("/<(img.*?)>/", "<$1>", $doc['Body']);
$body = strip_tags($body);
$body = str_replace("<", "
<", $body);
$body = str_replace(">", ">
", $body);
} else {
$body = strip_tags($doc['Body']);
}
$body = mb_convert_encoding($body, "SJIS", "UTF-8");
$text .= "
$date
$subject
$body
";
} elseif ($_REQUEST['target'] == "sp") {
$subject = strip_tags($doc['Subject']);
/*
* data-collapsed = false:開いた状態からスタート
* = true :閉じた状態からスタート
* data-theme = A-E:タイトルバーのテーマ
* data-content-theme = A-E:コンテンツ内部のテーマ
*/
$text = "
$subject
$date
". $doc['Body']. "
";
if ($Setup['comment_user']) {
$subject = strip_tags($doc['Subject']);
$text .= "
". $Setup['form_title']. "
";
}
$text .= "
戻る
";
} else {
if (!$Setup['nonTitle']) {
$text = "
$date
". $doc['Subject']. "
";
}
$text .= "
";
if ($Setup['comment_user']) {
$subject = strip_tags($doc['Subject']);
$text .= "
";
}
$text .= "
";
}
}
/*
ページの生成
*/
if ($Setup['Template'] == "auto") {
/* 環境設定のメインテンプレートに"auto"が設定されている場合は、
* 詳細を呼び出したhtmlがテンプレートになる
*/
$temp = str_replace("http://".$_SERVER['SERVER_NAME'], "", $_SERVER['HTTP_REFERER']);
} else {
if (is_array($Template)) {
list($temp, $title) = split(":", $Template[0]);
}
$Setup['Template'] && $temp = $Setup['Template'];
(($_REQUEST['target'] == "mb" || $_REQUEST['target'] == "sp") && $Setup['Mobile_temp']) && $temp = $Setup['Mobile_temp'];
($_REQUEST['target'] == "sp" && $Setup['sp_temp']) && $temp = $Setup['sp_temp'];
}
if (is_file($_SERVER['DOCUMENT_ROOT']. $temp)) {
$html = file_get_contents($_SERVER['DOCUMENT_ROOT']. $temp);
} else {
$html = join("", systemtemplate());
}
$html = preg_replace("/\n/", "\r", $html);
($_REQUEST['target'] != "mb" && $Init['Encode'] != "UTF-8") && $html = mb_convert_encoding($html, 'UTF-8', $Init['Encode']);
while(preg_match("//i", $html, $m)) {
$tg = $m[0];
if (trim($m[1]) == 'list') {
$link = "
". $Setup['Name']. "";
$html = str_replace($tg, $link, $html);
} else {
$html = str_replace($tg, $Setup['Name'], $html);
}
}
if ($_REQUEST['viewID']) {
$doc['Subject'] = tag_decode($doc['Subject'], true);
$title = strip_tags($doc['Subject']);
$html = preg_replace("//i", $title, $html);
$html = preg_replace("//i", $doc['Subject'], $html);
$html = preg_replace("//i", $doc['Date'], $html);
} else {
$html = preg_replace("//i", $Setup['Name'], $html);
$html = preg_replace("//i", $Setup['Name'], $html);
}
$html = preg_replace("/().*()/i", $text, $html);
$k=1;
while(preg_match("//i", $html, $m)) {
$tg = "";
$separator = $m[1];
$separator = str_replace("?", '\?', $separator);
$ssi = $m[2];
list($leftdoc, $rightdoc) = split($separator, $line);
if ($ssi) {
list($exe, $param) = split("\?", $ssi);
if ($Init['ssiurl']) {
$url = $System['protocol']. $_SERVER['SERVER_NAME']. $ssi;
$ssitext = file_get_contents($url);
} else {
$url = $_SERVER['DOCUMENT_ROOT']. $ssi;
if (is_file($_SERVER['DOCUMENT_ROOT']. $ssi)) {
$ssitext = file_get_contents($url);
}
}
}
$html = str_replace($tg, $ssitext, $html);
}
} else {
sort($Docs);
if ($Setup['Sort'] == 0) {
$Docs = array_reverse($Docs);
} elseif ($Setup['Sort'] == 2) {
foreach ($Docs as &$val) {
$doc = dbfields($Docs[$i]);
$val = "sort=". $doc['Subject']. "\t$line";
}
sort($Docs);
}
!$Setup['Name'] && $Setup['Name'] = "新着情報";
$html = "";
!$_REQUEST['ajax'] && $html .= "
";
if ($_REQUEST['target'] == "sp") {
if ($Setup['Listsummary']) {
$html .= "
". $Setup['Name']. "
";
if ($Setup['Listsummary'] == 3) {
$html .= "
";
}
} else {
$html .= "
- ". $Setup['Name']. "
";
}
} elseif ($Setup['nonDesign'] || $_REQUEST['mobile'] || $_REQUEST['target'] == "mb") {
if ($Setup['Listsummary'] == 3) {
$html .= "
";
} else {
$html .= "
";
}
} else {
$html .= "
";
}
!$Setup['Pageview'] && $Setup['Pageview'] = 5;
$_REQUEST['pv'] && $Setup['Pageview'] = $_REQUEST['pv'];
$max = count($Docs);
!$_REQUEST['start'] && $_REQUEST['start'] = 0;
$end = $_REQUEST['start'] + $Setup['Pageview'] - 1;
$end > $max && $end = $max;
$i = 0;
for($j = $_REQUEST['start']; $j < $max; $j++) {
if ($i >= $Setup['Pageview']) break;
$doc = dbfields($Docs[$j]);
if ((!$doc['Viewdate'] || jst_time(time(), 6) >= $doc['Viewdate']) &&
(!$doc['Closedate'] || jst_time(time(), 6) <= $doc['Closedate']) && $doc['Auth']) {
$html .= lineview($doc, $Setup['nonDesign']);
$i++;
}
}
if ($Setup['nonDesign'] || $_REQUEST['mobile'] || $_REQUEST['target'] == "mb" || $_REQUEST['target'] == "sp") {
if ($Setup['Listsummary'] == 3) {
$Setup['Listsummary'] == 3 && $_REQUEST['target'] == "sp" && $html .= "";
$html .= "
";
} else {
$html .= "
";
if ($Setup['Listsummary'] == 2) {
$html .= "
";
}
}
} else {
$html .= "
";
}
if ($Setup['Pager'] && !$_REQUEST['mobile'] && !$_REQUEST['target']) {
$html .= "
";
} elseif ($max > $end) {
if ($Setup[Listbutton]) {
$button = "
";
} else {
$button = 'すべて表示...';
}
if ($_REQUEST['mobile'] || $_REQUEST['target'] == "mb") {
$button = mb_convert_encoding($button, "SJIS", "UTF-8");
$html .= "
";
} elseif ($_REQUEST['target'] == "sp") {
$html .= "
";
} else {
$html .= "
";
}
}
!$_REQUEST['ajax'] && $html .= "
";
if ($Setup['Listsummary'] == 3 && !$_REQUEST['target']) {
$html .= "
";
}
}
if ($_REQUEST['mobile'] || $_REQUEST['target'] == "mb") {
header("Content-type:text/html; charset=SHIFT_JIS");
echo $html;
} else {
echo_encode($html);
}
function lineview($Doc, $mode) {
global $System, $Init, $Setup, $Exe, $i, $scriptname;
list($year, $month, $day) = split("/", $Doc['Date']);
$date = trim(dateFmt($Setup['Dateformat'], $year, $month, $day));
$Doc['Subject'] = tag_decode($Doc['Subject'], 1);
$Doc['Summary'] = str_replace("\r", "
", $Doc['Summary']);
if ($Doc['filecode']) {
$file = $Doc['filecode'];
} else {
$file = $_REQUEST['file'];
}
$url = "";
$Stress = "";
if ($Setup['Stress'] || $Doc['Stress']) {
/* 強調画像 */
!$Setup['Stresslimit'] && $Setup['Stresslimit'] = 7;
if (dateserial($Doc['Date']) + $Setup['Stresslimit'] * 86400 >= time()) {
if ($Doc['Stress']) {
$Stress = "
";
} else {
$Stress = "
";
}
}
}
if ($_REQUEST['target'] == "mb") {
$date = mb_convert_encoding($date, "SJIS", "UTF-8");
$subject = mb_convert_encoding(strip_tags($Doc['Subject']), "SJIS", "UTF-8");
if ($Doc['Link_mb'] || $Doc['Body']) {
if ($Doc['Link_mb']) {
$url = $Doc['Link_mb'];
} elseif ($Doc['Body']) {
$url = "$scriptname?file=$file&viewID=". $Doc['ID']. "&target=mb";
}
}
$url && $subject = "$subject";
$line = "
- $date
$subject$Stress ";
} elseif ($_REQUEST['target'] == "sp") {
/* スマートフォン */
$url = "";
if ($Doc['Link_sp'] || $Doc['Body']) {
if ($Doc['Link_sp']) {
$url = $Doc['Link_sp'];
} elseif ($Doc['Body']) {
$url = "$scriptname/$file/". $Doc['ID']. "/sp/";
}
}
$subject = "". strip_tags($Doc['Subject']). "";
if ($Setup['Listsummary']) {
$subject = "
$subject$Stress
$date
";
if ($url) {
!$Setup['more_button'] && $Setup['more_button'] = "つづきを読む";
$link = "". $Setup['more_button']. "
";
}
$theme = "data-theme=\"c\" data-content-theme=\"c\"";
$Setup['Listsummary'] == 3 && $theme = "";
$collapsed = "";
if ($Setup['Listsummary'] == 1 || ($Setup['Listsummary'] == 3 && $i == 0)) {
$collapsed = "data-collapsed=\"false\"";
} elseif ($Setup['Listsummary'] == 2) {
$collapsed = "data-collapsed=\"true\"";
}
$line .= "
$subject
". $Doc['Summary']. "
$link
";
} else {
$icon = "";
if ($Setup['Imagewidth']) {
$icon = $Doc['Image'];
!$icon && $img = "/trycmd/images/exspc.gif\" height=\"40";
$icon = "
";
$subject = $icon. " ". $subject;
"$date
".
"". $Doc['Summary']. "
";
} else {
if ($Doc['Icon']) {
$icon = "
";
} elseif ($Setup['Icon']) {
$icon = "
";
}
$subject = $icon. " $subject$Stress";
}
$inc = "$icon
$date
$subject
";
$onclick = ""; $none = "none;";
if ($url && !$Setup['Titlelink'] && !$Doc['Titlelink']) {
$onclick = " onclick=\"location.href='$url';\"";
$none = "block;";
$inc = "$inc
";
}
$line = "
-
$inc
";
}
} elseif ($mode) {
$subject = $Doc['Subject'];
if ($Doc['link']) {
$url = $Doc['link'];
} elseif ($Doc['Body']) {
$url = "$scriptname/$file/". $Doc['ID']. "/";
}
if (!$Setup['Titlelink'] && !$Doc['Titlelink'] && $link) {
$subject = "$subject";
}
$icon = "";
if ($Doc['Icon']) {
$icon = "";
} elseif ($Setup['Icon']) {
$icon = "";
}
$listimage = "";
if ($Setup['Imagewidth'] && $Doc['Image']) {
$Setup['Listsummary'] = 1;
if ($Setup['popupimg']) {
$listimage = "
";
} else {
$listimage = "
";
}
}
if ($url && $Setup['Listsummary']) {
!$Setup['more_button'] && $Setup['more_button'] = "つづきを読む";
$link = "";
}
if ($Setup['Listsummary'] == 3) {
$subject = strip_tags($subject);
$line = "
$icon
$date
$subject
$Stress
$listimage
". $Doc['Summary']. "$link
";
} elseif ($Setup['Listsummary']) {
$onclick = "";
if ($Setup['Listsummary'] == 2) {
$onclick = " onclick=\"$('#". $Doc['ID']. "-summary').toggle();\"";
}
$line = "
- $icon
$date
$subject
$Stress
$listimage";
$Setup['Listsummary'] && $line .= "". $Doc['Summary']. "$link
";
$line .= "
";
} else {
$onclick = ""; $none = "none;";
if ($url && !$Setup['Titlelink'] && !$Doc['Titlelink']) {
$onclick = " onclick=\"location.href='$url';\"";
$none = "block;";
$subject = "$subject";
}
$line = "
- $icon
$date
$subject
";
}
} else {
$colspan = 1;
$w = 100;
$line = "";
$titleicon = $Setup['Icon'];
$Doc['Icon'] && $titleicon = $Doc['Icon'];
if ($Setup['Listicon'] && $titleicon) {
$line .= "
 | ";
$w -= 1;
$colspan++;
}
if ($date) {
$line .= "
$date | ";
$w -= 4;
$colspan++;
}
if ($Doc['Link'] || $Doc['Body']) {
if ($Doc['Link']) {
$url = $Doc['Link'];
} elseif ($Doc['Body']) {
$url = "$scriptname/$file/". $Doc['ID']. "/";
}
$target = '';
$Doc['Target'] && $target = "target=\"". $Doc['Target']. "\"";
}
$listimage = "";
if ($Setup['Imagewidth'] && $Doc['Image']) {
$Setup['Listsummary'] = 1;
if ($Setup['popupimg']) {
$listimage = "
";
} else {
$listimage = "
";
}
}
if ($url) {
!$Setup['more_button'] && $Setup['more_button'] = "つづきを読む";
$link = "";
}
if ($Setup['Listsummary'] > 1) {
$line .= "
". $Doc['Subject']. " $Stress
$listimage". $Doc['Summary']. "
$link
|
";
} else {
$line .= "";
if ($url && !$Setup['Titlelink'] && !$Doc['Titlelink']) {
$line .= "". $Doc['Subject']. " ";
} else {
$line .= $Doc['Subject'];
}
$line .= " $Stress | ";
if ($Setup['Listsummary']) {
$line .= "
|
$listimage ". $Doc['Summary']. "
$link
|
";
}
}
if ($Setup['Lineimg']) {
$lineimage = $_SERVER['DOCUMENT_ROOT']. $Setup['Lineimg'];
if (is_file($lineimage)) {
list($w, $h, $t, $a) = getimagesize($lineimage);
$h = $h."px";
$line .= "
|
";
}
}
}
return($line);
}
function dateFmt($id, $year, $month, $day) {
if ($id == 1) {
$date = sprintf("%04d/%02d/%02d", $year, $month, $day);
} elseif ($id == 2) {
$date = sprintf("%04d年%02d月%02d日 ", $year, $month, $day);
} elseif ($id == 3) {
$date = sprintf("%02d/%02d", $month, $day);
} elseif ($id == 4) {
$date = sprintf("%02d月%02d日 ", $month, $day);
} elseif ($id == 5) {
$date = sprintf("%04d/%02d/%02d", $year, $month, $day);
$serialtime = dateserial($date, $Init{Timelag});
$date = gengo($serialtime);
}
return($date);
}
?>