get_exception();
}
}
/* 出力準備 */
$smarty = new SmartyEx();
$smarty->prepare();
/* マイプロフィール */
include('common/myprofile.inc');
/* Spotクラスインスタンス生成 */
if ($err_str === "") {
try {
$spot = new Spot($locomill->get_db3());
} catch (SpotError $e) {
$err_str .= $e->get_exception();
}
}
/* PlusMenuクラスインスタンス生成 */
if ($err_str === "") {
try {
$pmenu = new PlusMenu($locomill->get_db3());
} catch (PlusMenuError $e) {
$err_str .= $e->get_exception();
}
}
/* Request値の検証 */
if ($err_str === "") {
if (isset($_POST) === true && empty($_POST) === false) {
$rq = $_POST;
} elseif (isset($_GET) === true && empty($_GET) === false) {
$rq = $_GET;
}
}
/* スポットデータ取得 */
if ($err_str === "") {
try {
if ($spot->check_id($rq['id'])) {
$spot_id = $rq['id'];
} else {
throw new SpotError('・正しい手続きでアクセスしていません。
');
}
if ($pmenu->check_id($rq['m'])) {
$menu_id = $rq['m'];
} else {
throw new SpotError('・正しい手続きでアクセスしていません。
');
}
$spot_data = $spot->get_data($spot_id);
if ($preview != 1) {
// 表示判定
if ($spot_data['enable'] != 1 || $now <= $spot_data['start_stamp'] || (0 < $spot_data['end_stamp'] && $spot_data['end_stamp'] <= $now)) {
$the_corner_id = 6;
$adver_param = array("terminal_type" => 1, "corner_id" => $the_corner_id);
$adver_b_type = array(1);
include('common/banners.inc');
header("HTTP/1.0 404 Not Found");
$smarty->display('parts/spot/disabled.tpl');
exit;
}
if ($spot_data['is_closed'] == 1) {
// 閉店
$the_corner_id = 6;
$adver_param = array("terminal_type" => 1, "corner_id" => $the_corner_id);
$adver_b_type = array(1);
include('common/banners.inc');
header("HTTP/1.0 404 Not Found");
$smarty->display('parts/spot/closed.tpl');
exit;
}
}
$spot_data = $spot->adjust($spot_data);
} catch (SpotError $e) {
ErrorRedirect(404);
}
}
/* コンテンツメニュー */
if ($err_str === "") {
$feature_type = 'pc';
$page_type = 'menu';
include('common/spotmenu.inc');
// メニューが無効の場合
if ($preview != 1 && empty($plus_menu) && $is_plus != 1 && $is_pr != 1) {
$err_str .= '・ページを表示できません。
';
}
}
/* プラスメニューデータ取得 */
if ($err_str === "") {
try {
if ($preview != 1) {
$temp = $pmenu->get_data($menu_id, 1);
} else {
$temp = $pmenu->get_data_2($menu_id, $spot_id, 1, true, true);
}
if (!empty($temp) && $spot_id == $temp['spot_id']) {
$menu_data['id'] = $temp['id'];
$menu_data['title_01'] = $temp['title_01'];
$menu_data['title_02'] = $temp['title_02'];
$temp = $pmenu->get_block_data_array($menu_id, 1);
$old = array(1 => 'rsv_txt_49', 2 => 'rsv_txt_50', 3 => '');
$block_count = array(1 => 1, 2 => 3, 3 => 2, 4 => 2, 5 => 1, 6 => 2, 7 => 2, 8 => 2);
if (!empty($temp)) {
foreach ($temp AS $bid => $bdata) {
$block = array();
$block['title'] = $bdata['block_title'];
$block['title_enable'] = $bdata['block_title_enable'];
$block['type'] = $bdata['block_type'];
$block['block'] = array();
for ($i = 1; $i <= 3; $i++) {
if ($block_count[$block['type']] < $i)
continue;
$temp2 = array();
$temp2['caption'] = $bdata[sprintf('block_caption_%02d', $i)];
$temp2['comment'] = tagConvertPmenu(linkage_url($bdata[sprintf('block_comment_%02d', $i)], '_blank'));
$temp2['is_image'] = 0;
$temp2['image_src'] = '';
$upimg_path = $pmenu->get_upimg_path();
if (!empty($bdata[sprintf('block_image_%02d', $i)]['up_name']) && file_exists($upimg_path . '/' . $bdata[sprintf('block_image_%02d', $i)]['up_name'])) {
$temp2['is_image'] = 1;
$temp2['image_src'] = '/img' . LOCOMILL_UPIMG_PLUS_MENU_BLOCK_PATH . '/' . $bdata[sprintf('block_image_%02d', $i)]['up_name'];
} elseif (!empty($old[$i]) && !empty($bdata[$old[$i]])) {
$temp2['is_image'] = 1;
$temp2['image_src'] = '/old_images/' . $bdata[$old[$i]];
}
$upimg_path_thum = $pmenu->get_upimg_path('thum');
if (!empty($bdata[sprintf('block_image_%02d', $i)]['up_name']) && file_exists($upimg_path_thum . '/' . $bdata[sprintf('block_image_%02d', $i)]['up_name'])) {
$temp2['thumnail_src'] = '/img' . LOCOMILL_UPIMG_PLUS_MENU_BLOCK_PATH . '_thum/' . $bdata[sprintf('block_image_%02d', $i)]['up_name'];
} else {
$temp2['thumnail_src'] = $temp2['image_src'];
}
if (!empty($temp2['is_image']) || !empty($temp2['caption']) || !empty($temp2['comment'])) {
$block['block'][] = $temp2;
}
}
$count = count($block['block']);
if (in_array($block['type'], array(2, 6, 7, 8)) && $count < $block_count[$block['type']]) {
for ($i = 1; $i <= $block_count[$block['type']] - $count; $i++) {
$block['block'][] = array();
}
}
$block_list[$bid] = $block;
}
}
} else {
$err_str .= "情報が見つかりませんでした。";
}
} catch (PlusMenuError $e) {
$err_str .= $e->get_exception();
}
}
/* 変数の準備 */
// ページタイプ
$smarty->assign("PAGE_TYPE", $page_type);
// スポットデータ
$smarty->assign("SPOT_ID", $spot_id);
$smarty->assign("SPOT_DATA", $spot_data);
// プレビュー
$smarty->assign("PREVIEW", $preview);
$smarty->assign("PV_MODE", $pv_mode);
$smarty->assign("PV_URL", $pv_url);
// メニューページデータ
$smarty->assign("CURRENT_PLUS_MENU_ID", $menu_id);
$smarty->assign("MENU_DATA", $menu_data);
$smarty->assign("BLOCK_ARRAY", $block_list);
// イマココ
$imakoko = getTopicsPath('spot');
if ($err_str === "") {
$imakoko[] = array(sprintf('/search_result/?type=spot&C1=%d', $spot_data['category_01_01_id']), $spot_data['category_01_01_name']);
$imakoko[] = array(sprintf('/search_result/?type=spot&C2=%d', $spot_data['category_01_02_id']), $spot_data['category_01_02_name']);
$imakoko[] = array(sprintf('/search_result/?type=spot&C3=%d', $spot_data['category_01_03_id']), $spot_data['category_01_03_name']);
$imakoko[] = array(sprintf('/spot/home/?id=%d', $spot_id), $spot_data['name_01']);
$imakoko[] = array(sprintf('/spot/menu/?id=%d&m=%d', $spot_id, $menu_data['id']), $menu_data['title_01']);
}
$smarty->assign("IMAKOKO_ARRAY", $imakoko);
// 最新情報
include('common/whatsnew.inc');
/* AccessDailyクラスインスタンス生成 */
if ($err_str === "" && $preview != 1) {
try {
$access = new AccessDaily($locomill->get_db());
$params = array("corner_type" => 1,
"terminal" => 1,
"corner_id" => $spot_data['id'],
"sub_id" => $menu_id,
"page" => $_SERVER['PHP_SELF'],
"title" => 'PLUS MENU:' . $menu_data['title_01'],
"refer_url" => (isset($_SERVER['HTTP_REFERER'])? $_SERVER['HTTP_REFERER']: ''),
"refer_name" => "",
"keyword" => "",
"file_name" => $_SERVER['REQUEST_URI'],
"member_data" => (isset($locomill->session->sess_data['member_data'])? $locomill->session->sess_data['member_data']: array()));
$access->do_logging($params);
} catch (AccessDailyError $e) {
$access->output_error($e->get_exception());
}
}
/* 広告系 */
$the_corner_id = 6;
$adver_param = array("terminal_type" => 1,
"corner_id" => $the_corner_id,
"category_03_id" => $spot_data['category_01_03_id']);
$adver_b_type = ($spot_data['adver_block_flg'] == 1)? array(7): array(1, 7);
include('common/banners.inc');
// バナー広告
if ($spot_data['adver_block_flg'] == 1) {
if (!empty($spot_data['orig_billboard'])) {
$billboard_out = htmlspecialchars_decode($spot_data['orig_billboard']);
} else {
// 代替ビルボード
$billboard_out = '
';
}
$smarty->assign("ADVER_01", $billboard_out);
}
// エラー文字列
$smarty->assign("ERR_STR", $err_str);
if (!empty($err_str) || $preview == 1) {
header("HTTP/1.0 404 Not Found");
}
// ブラウザキャッシュ対策
if ($err_str === "") {
header('Etag: ' . md5($spot_data['id'] . '-' . time()));
}
// Smarty Cache
$cache_id = '';
if ($err_str === "" && $preview != 1) {
$smarty = getSmartyCache($smarty);
$cache_id = getSmartyCacheId(array_merge($spot_data, $rq), array('id', 'update_stamp', 'isSP', 'm'));
}
/* 出 力 */
$smarty->display('spot/menu/index.tpl', $cache_id);