'17841423418722722', // ビジネスアカウントID
'access_token' => 'EAANKUvBmmWEBAIf9ajuDZArBGq3PjNIxlOZCepmWbnVq2BIdLDhPprzyS5QTb7CCLVRNKe0H0iafTRiPPWKJiRdEbLhSGzyN6adQzgBP1z1cTYeXO4nqkDESX4ZCqZCdkEysaLpXRDZBTUbnnOdsWLh4bZAz4vO9EXaqPu2GZCZBKzKYHeQgifqg');
$template_file = 'feature/common/error.tpl';
/* PHPエラー表示設定 */
ini_set("display_errors", LOCOMILL_DISPLAY_ERROR);
/* Locomillクラスインスタンス生成 */
if ($err_str === "") {
try {
$locomill = new Locomill($_COOKIE);
} catch (LocomillError $e) {
$err_str .= $e->get_exception();
}
}
/* 出力準備 */
$smarty = new SmartyEx();
$smarty->prepare();
/* マイプロフィール */
include('common/myprofile.inc');
/* Areaクラスインスタンス生成 */
if ($err_str === "") {
try {
$area = new Area($locomill->get_db4());
$temp = $area->get_data_array('area_master_01_tbl', false);
foreach ($temp AS $v)
$area_01_array[$v['id']] = array('name' => $v['name']);
$temp = $area->get_data_array('area_master_03_tbl', false);
foreach ($temp AS $v)
$area_03_array[$v['id']] = array('name' => $v['name'], 'area_03_group_id' => $v['area_03_group_id']);
$temp = $area->get_data_array('area_tbl', false);
foreach ($temp AS $v)
$area_04_array[$v['id']] = array('name' => $v['name']);
$area_02_flag_array = $area->get_area_02_flag_array();
} catch (AreaError $e) {
$err_str .= $e->get_exception();
}
}
/* Categoryクラスインスタンス生成 */
if ($err_str === "") {
try {
$category = new Category($locomill->get_db4());
$temp = $category->get_data_array(3, -1, true, true, 1);
foreach ($temp AS $v)
$category_03_array[$v['id']] = $v['name_01'];
$temp = $category->get_data_array(2, -1, true, true, 3);
foreach ($temp AS $v)
$category_02_array[$v['id']] = $v['name_01'];
} catch (CategoryError $e) {
$err_str .= $e->get_exception();
}
}
/* Featureクラスインスタンス生成 */
if ($err_str === "") {
try {
$feature = new Feature($locomill->get_db4());
$feature->set_media_limit("PC");
} catch (FeatureError $e) {
$err_str .= $e->get_exception();
}
}
/* Spotクラスインスタンス生成 */
if ($err_str === "") {
try {
$spot = new Spot($locomill->get_db4());
} catch (SpotError $e) {
$err_str .= $e->get_exception();
}
}
/* Eventクラスインスタンス生成 */
if ($err_str === "") {
try {
$event = new Event($locomill->get_db4());
} catch (EventError $e) {
$err_str .= $e->get_exception();
}
}
/* Hospitalクラスインスタンス生成 */
if ($err_str === "") {
try {
$hospital = new Hospital($locomill->get_db4());
} catch (HospitalError $e) {
$err_str .= $e->get_exception();
}
}
/* HospitalCategoryクラスインスタンス生成 */
if ($err_str === "") {
try {
$hospital_category = new HospitalCategory($locomill->get_db4());
} catch (HospitalCategoryError $e) {
$err_str .= $e->get_exception();
}
}
/* Kuchikomiクラスインスタンス生成 */
if ($err_str === "") {
try {
$kuchikomi = new Kuchikomi($locomill->get_db4());
} catch (KuchikomiError $e) {
$err_str .= $e->get_exception();
}
}
/* KuchikomiCampaignクラスインスタンス生成 */
if ($err_str === "") {
try {
$kuchikomi_campaign = new KuchikomiCampaign($locomill->get_db());
} catch (KuchikomiCampaignError $e) {
$err_str .= $e->get_exception();
}
}
/* KuchikomiShortクラスインスタンス生成 */
if ($err_str === "") {
try {
$kuchikomi_short = new KuchikomiShort($locomill->get_db4());
} catch (KuchikomiShortError $e) {
$err_str .= $e->get_exception();
}
}
/* Goodクラスインスタンス生成 */
if ($err_str === "") {
try {
$good = new Good($locomill->get_db3());
} catch (GoodError $e) {
$err_str .= $e->get_exception();
}
}
/* GoodTypeクラスインスタンス生成 */
if ($err_str === "") {
try {
$good_type = new GoodType($locomill->get_db3());
$good_type_array = $good_type->get_data_array(true);
} catch (GoodTypeError $e) {
$err_str .= $e->get_exception();
}
}
/* PresentItemクラスインスタンス生成 */
if ($err_str === "") {
try {
$present_item = new PresentItem($locomill->get_db4());
} catch (PresentItemError $e) {
$err_str = $e->get_exception();
}
}
/* MemberMaster07クラスインスタンス生成 */
if ($err_str === "") {
try {
$mm_07 = new MemberMaster07($locomill->get_db4());
} catch (MemberMaster07Error $e) {
$err_str = $e->get_exception();
}
}
/* Couponクラスインスタンス生成 */
if ($err_str === "") {
try {
$coupon = new Coupon($locomill->get_db4());
} catch (CouponError $e) {
$err_str = $e->get_exception();
}
}
/* LocomillClientクラスインスタンス生成 */
if ($err_str === "") {
try {
$lc = new LocomillClient($locomill->get_db4());
} catch (LocomillClientError $e) {
$err_str .= $e->get_exception();
}
}
/* Pagerクラスインスタンス生成 */
if ($err_str === "") {
try {
$pager = new Pager();
} catch (PagerError $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 ($is_ichiuma) {
if (!empty($rq['t'])) {
$theme_key = $rq['t'];
} else {
ErrorRedirect(404);
}
$day = (!empty($rq['d']))? $rq['d']: 0;
} elseif ($feature->check_id($rq['id'])) {
$document_id = $rq['id'];
} else {
ErrorRedirect(404);
}
if ($document_id == 6530) {
header('Location: http://www.kantobustravel.co.jp/reserve_plan.shtml?2142');
exit;
} elseif ($document_id == 7509 && LOCOMILL_HOSTNAME == 'www') {
header('Status: 301 Moved Permanently');
header('Location: /feature/home.shtml?id=7582');
exit;
} elseif ($document_id == 12480 && LOCOMILL_HOSTNAME == 'www') {
header('Location: /feature/home.shtml?id=12490');
exit;
} elseif ($document_id == 12486 && LOCOMILL_HOSTNAME == 'www') {
header('Status: 301 Moved Permanently');
header('Location: /feature/home.shtml?id=12514');
exit;
}
// ブロックページ
$page = (isset($rq['p']) && preg_match("/^[0-9]{1,9}$/", $rq['p']))? $rq['p']: 1;
// クチコミページ
$k_page = (isset($rq['kp']) && preg_match("/^[0-9]{1,9}$/", $rq['kp']))? $rq['kp']: 1;
}
// 特集データ取得
if ($err_str === "") {
try {
if ($is_ichiuma) {
$feature_data = $feature->get_data_by_theme($theme_key);
$document_data = $feature->get_document_by_day($day, $feature_data['id'], 0, true, false);
$document_id = $document_data['id'];
unset($theme_key, $day);
} else {
$document_data = $feature->get_document($document_id, 0, true, false);
$feature_data = $feature->get_data($document_data['feature_id']);
}
} catch (FeatureError $e) {
ErrorRedirect(404);
}
if ($page_is_enable && ($document_data['enable'] == 2 || $feature_data['enable'] == 2)) {
ErrorRedirect(404);
} elseif ($page_is_enable && (strtotime($document_data['close_stamp']) < $now || strtotime($feature_data['close_stamp']) < $now)) {
$template_file = 'feature/common/error.tpl';
if (strtotime($feature_data['close_stamp']) < $now) {
$err_str .= $feature_data['title_01'] . 'の掲載は終了しました。
' . "\n";
}
if (strtotime($document_data['close_stamp']) < $now) {
$err_str .= $document_data['title_01'] . 'の掲載は終了しました。
' . "\n";
}
} elseif ($page_is_enable && ($now < strtotime($document_data['open_stamp']) || $now < strtotime($feature_data['open_stamp']))) {
$template_file = 'feature/common/error.tpl';
$err_str .= $feature_data['title_01'] . 'は、
' . "\n";
$err_str .= date('Y/m/d H:i', strtotime($feature_data['open_stamp'])) . '~' . date('Y/m/d H:i', strtotime($feature_data['close_stamp'])) . '
' . "\n";
$err_str .= 'の掲載となります。' . "\n";
$err_str .= '
' . "\n";
$err_str .= $document_data['title_01'] . 'は、
' . "\n";
$err_str .= date('Y/m/d H:i', strtotime($document_data['open_stamp'])) . '~' . date('Y/m/d H:i', strtotime($document_data['close_stamp'])) . '
' . "\n";
$err_str .= 'の掲載となります。';
}
// 一旨の場合、テーマがあれば専用ディレクトリへ
if ($feature_data['type_id'] == 3 && !$is_ichiuma && !empty($feature_data['theme_key'])) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: /ichiuma/' . ($page_is_enable? '': 'index_pre.shtml') . '?t=' . $feature_data['theme_key'] . '&d=' . date('j', strtotime($document_data['open_stamp'])));
exit;
}
}
// 特集データ整形
if ($err_str === "") {
try {
if (($feature_data['is_login'] == 1 || $document_data['is_login'] == 1) && $is_login != 1) {
header("location: /login/?is_keep=1&rdr=/feature/home" . $pv_mode . ".shtml?id=" . $document_id);
exit;
}
$open_stamp = strtotime($document_data['open_stamp']);
$ssl_open_stamp = mktime(0, 0, 0, 9, 26, 2017); // SSLかけた日
$document_block_array = $feature->get_document_block_array($document_id, 1);
$document_data['block'] = $document_block_array;
$document_data = $feature->document_smarty_format($document_data);
$feature_data = $feature->feature_smarty_format($feature_data);
$feature_id = $feature_data['id'];
if ($is_ichiuma) {
$document_data['page_url'] = sprintf('https://%s/ichiuma/?t=%s&d=%d', LOCOMILL_DOMAIN_FQDN, $feature_data['theme_key'], date('j', strtotime($document_data['public_date_origin'])));
} else {
$document_data['page_url'] = sprintf('%s://%s/feature/home.shtml?id=%d', ($open_stamp < $ssl_open_stamp? 'http':'https'), LOCOMILL_DOMAIN_FQDN, $document_data['id']);
$document_data['canonical_url'] = sprintf('https://%s/feature/home.shtml?id=%d', LOCOMILL_DOMAIN_FQDN, $document_data['id']);
}
$document_data['my_good_type'] = 0;
$is_good = array();
if (!empty($login_user_id)) {
try {
$is_good = $good->get_data_by_member_feature(2, $document_data['id'], $login_user_id);
if (!empty($is_good)) {
$document_data['my_good_type'] = $is_good['good_type'];
}
unset($is_good);
} catch(GoodError $e) {
}
}
try {
$document_data['good_type'] = $good->get_type_array_feature(2, $document_data['id']);
} catch(GoodError $e) {
$document_data['good_type'] = array();
}
} catch (FeatureError $e) {
$err_str .= $e->get_exception();
}
}
// 他記事メニュー作成(左メニュー・前記事・次記事)
if ($err_str === "") {
try {
$temp = $feature->get_document_array($feature_id, ($page_is_enable? 1: 0), true, false);
if (!empty($temp)) {
$find = 0;
$pv = 0;
$pv_name = '';
foreach ($temp AS $did => $row) {
// ブロックからスポット・イベント・病院IDを抜き出す
$row['block'] = $feature->get_document_block_array($row['id'], 1);
$spot_id = $event_id = $hospital_id = array();
foreach ($row['block'] AS $k => $v) {
if (!empty($v['spot_id']))
$spot_id[] = $v['spot_id'];
if (!empty($v['event_id']))
$event_id[] = $v['event_id'];
if (!empty($v['hospital_id']))
$hospital_id[] = $v['hospital_id'];
}
unset($row['block']);
// 基本情報
$doc = $feature->document_smarty_format($row);
// 店舗データ
$info_data = array();
if (!empty($row['shop_id']) || !empty($row['event_id']) || !empty($row['hospital_id']) || count($spot_id) == 1 || count($event_id) == 1 || count($hospital_id) == 1) {
if (!empty($row['shop_id']) || count($spot_id) == 1) {
try {
if (!empty($row['shop_id'])) {
$info_data = $spot->get_data($row['shop_id'], false, false);
} else {
$info_data = $spot->get_data($spot_id[0], false, false);
}
} catch (SpotError $e) {
throw new FeatureError('info_spot' . $row['shop_id'] . $e->get_exception());
}
if (!empty($info_data) && ($info_data['enable'] == 1 || $page_is_enable === false)) {
$doc['spot_type'] = 'SPOT';
$doc['is_closed'] = $info_data['is_closed'];
$doc['close_reason'] = $info_data['close_reason'];
$doc['shop_category_name'] = $category_03_array[$info_data['category_01_03_id']];
} else {
continue;
}
} elseif (!empty($row['event_id']) || count($event_id) == 1) {
try {
if (!empty($row['event_id'])) {
$info_data = $event->get_data($row['event_id'], false);
} else {
$info_data = $event->get_data($event_id[0], false);
}
} catch (EventError $e) {
throw new FeatureError('info_event' . $row['event_id'] . $e->get_exception());
}
if (!empty($info_data) && ($info_data['enable'] == 1 || $page_is_enable === false)) {
$doc['spot_type'] = 'EVENT';
$doc['is_closed'] = 0;
$doc['close_reason'] = '';
$doc['shop_category_name'] = $category_02_array[$info_data['category_01_02_id']];
} else {
continue;
}
} elseif (!empty($row['hospital_id']) || count($hospital_id) == 1) {
try {
if (!empty($row['hospital_id'])) {
$info_data = $hospital->get_data($row['hospital_id'], false);
} else {
$info_data = $hospital->get_data($hospital_id[0], false);
}
} catch (HospitalError $e) {
throw new FeatureError('info_hospital' . $row['hospital_id'] . $e->get_exception());
}
if (!empty($info_data) && ($info_data['enable'] == 1 || $page_is_enable === false)) {
$doc['spot_type'] = 'HOSPITAL';
$doc['is_closed'] = 0;
$doc['close_reason'] = '';
$doc['shop_category_name'] = '';
$cat_id = array_values(array_diff(explode('_', $info_data['category_main_id']), array('')));
if (!empty($cat_id[0])) {
$doc['shop_category_name'] = $hospital_category->get_name($cat_id[0]);
}
unset($cat_id);
} else {
continue;
}
}
$doc['shop_id'] = $info_data['id'];
$doc['shop_name'] = $info_data['name_01'];
$doc['prefect_name'] = ($info_data['area_01_id'] == LOCOMILL_AREA_01_DEFAULT_ID)? '': $area_01_array[$info_data['area_01_id']]['name'];
$doc['town_name'] = $area_03_array[$info_data['area_03_id']]['name'];
$doc['local_name'] = $area_04_array[$info_data['area_id']]['name'];
$doc['prefect_area_id'] = $area_03_array[$info_data['area_03_id']]['area_03_group_id'];
$doc['prefect_area_name'] = $area_02_flag_array[$doc['prefect_area_id']];
}
unset($info_data);
if ($find == 0 && $did == $document_id) {
$prev_document_id = $pv;
$prev_document_name = strip_tags($pv_name);
$find = 1;
}
if ($find == 1 && $did != $document_id) {
$next_document_id = $did;
$next_document_name = strip_tags($doc['title_01']);
$find = 2;
}
$leftmenu_array[$doc['id']]['feature'] = $doc['title_01'];
$doc_array[$did] = $doc;
$pv = $did;
$pv_name = $doc['title_01'];
}
}
unset($temp, $did, $row, $doc);
} catch (FeatureError $e) {
$err_str .= $e->get_exception();
}
}
/* 変数の準備 */
$smarty->assign('DOCUMENT_ID', $document_id);
$smarty->assign('NEXT_DOCUMENT_ID', $next_document_id);
$smarty->assign('NEXT_DOCUMENT_NAME', $next_document_name);
$smarty->assign('PREV_DOCUMENT_ID', $prev_document_id);
$smarty->assign('PREV_DOCUMENT_NAME', $prev_document_name);
// 特集基本データ
$smarty->assign("CURRENT_FEATURE_DATA", $feature_data);
// 記事データ補完
if (!empty($document_data)) {
$doc = $document_data;
$spot_data = $event_data = $hospital_data = $client_data = array();
$column_array = array('id', 'name_01', 'search_result_caption', 'address_01', 'address_02', 'address_03',
'tel_01', 'tel_02', 'tel_03', 'fax_01', 'fax_02', 'fax_03');
// ショップインフォ・スポットデータ
if (!empty($document_data['shop_id'])) {
try {
$spot_data = $spot->get_data($document_data['shop_id'], false, false);
} catch (SpotError $e) {
$err_str .= 'info_spot' . $document_data['shop_id'] . $e->get_exception();
}
if (!empty($spot_data) && (($spot_data['enable'] == 1 && $spot_data['start_stamp'] <= $now && $now <= $spot_data['end_stamp']) || $page_is_enable === false)) {
foreach ($column_array AS $v) {
$document_spot_data[$v] = $spot_data[$v];
}
$document_spot_data['type'] = 'SPOT';
$document_spot_data['category_name'] = $category_03_array[$spot_data['category_01_03_id']];
$document_spot_data['prefect_name'] = ($spot_data['area_01_id'] == LOCOMILL_AREA_01_DEFAULT_ID)? '': $area_01_array[$spot_data['area_01_id']]['name'];
$document_spot_data['town_name'] = $area_03_array[$spot_data['area_03_id']]['name'];
$document_spot_data['local_name'] = $area_04_array[$spot_data['area_id']]['name'];
$document_spot_data['tel_01_caption'] = (!empty($spot_data['tel_01_caption']))? $spot_data['tel_01_caption']: 'TEL';
$document_spot_data['tel_02_caption'] = (!empty($spot_data['tel_02_caption']))? $spot_data['tel_02_caption']: 'TEL';
$document_spot_data['tel_03_caption'] = (!empty($spot_data['tel_03_caption']))? $spot_data['tel_03_caption']: 'TEL';
$document_spot_data['fax_01_caption'] = (!empty($spot_data['fax_01_caption']))? $spot_data['fax_01_caption']: 'FAX';
$document_spot_data['fax_02_caption'] = (!empty($spot_data['fax_02_caption']))? $spot_data['fax_02_caption']: 'FAX';
$document_spot_data['fax_03_caption'] = (!empty($spot_data['fax_03_caption']))? $spot_data['fax_03_caption']: 'FAX';
$document_spot_data['is_closed'] = $spot_data['is_closed'];
$document_spot_data['close_reason'] = $spot_data['close_reason'];
$document_spot_data['kuchikomi_num'] = $spot_data['kuchikomi_num'];
if (!empty($spot_data['image_01']['up_name'])) {
$document_spot_data['is_image_01'] = 1;
$document_spot_data['image_01_src'] = '/img' . LOCOMILL_UPIMG_SPOT_01_PATH . '/' . $spot_data['image_01']['up_name'];
} elseif (!empty($spot_data['rsv_txt_06'])) {
$document_spot_data['is_image_01'] = 1;
$document_spot_data['image_01_src'] = '/old_images/' . $spot_data['rsv_txt_06'];
} else {
$document_spot_data['is_image_01'] = 0;
$document_spot_data['image_01_src'] = '/common/img/s_img.jpg';
}
$document_spot_data['is_enable'] = ($spot_data['enable'] == 1 && $spot_data['start_stamp'] <= strtotime($document_data['public_date_origin']))? 1: 2;
}
unset($spot_data);
}
// ショップインフォ・イベントデータ
if (!empty($document_data['event_id'])) {
try {
$event_data = $event->get_data($document_data['event_id'], false);
} catch (EventError $e) {
$err_str .= 'info_event' . $document_data['event_id'] . $e->get_exception();
}
if (!empty($event_data) && (($event_data['enable'] == 1 && $event_data['start_stamp'] <= $now && $now <= $event_data['end_stamp']) || $page_is_enable === false)) {
foreach ($column_array AS $v) {
$document_event_data[$v] = $event_data[$v];
}
$document_event_data['category_name'] = $category_02_array[$event_data['category_01_02_id']];
$document_event_data['prefect_name'] = ($event_data['area_01_id'] == LOCOMILL_AREA_01_DEFAULT_ID)? '': $area_01_array[$event_data['area_01_id']]['name'];
$document_event_data['town_name'] = $area_03_array[$event_data['area_03_id']]['name'];
$document_event_data['local_name'] = $area_04_array[$event_data['area_id']]['name'];
$document_event_data['tel_01_caption'] = (!empty($event_data['tel_01_caption']))? $event_data['tel_01_caption']: 'TEL';
$document_event_data['tel_02_caption'] = (!empty($event_data['tel_02_caption']))? $event_data['tel_02_caption']: 'TEL';
$document_event_data['tel_03_caption'] = (!empty($event_data['tel_03_caption']))? $event_data['tel_03_caption']: 'TEL';
$document_event_data['fax_01_caption'] = (!empty($event_data['fax_01_caption']))? $event_data['fax_01_caption']: 'FAX';
$document_event_data['fax_02_caption'] = (!empty($event_data['fax_02_caption']))? $event_data['fax_02_caption']: 'FAX';
$document_event_data['fax_03_caption'] = (!empty($event_data['fax_03_caption']))? $event_data['fax_03_caption']: 'FAX';
$document_event_data['is_closed'] = 0;
$document_event_data['close_reason'] = '';
$document_event_data['kuchikomi_num'] = $event_data['kuchikomi_num'];
$document_event_data['kuchikomi_enable'] = ($now < $event_data['evt_start_01'])? 0: 1;
if (!empty($event_data['image_01']['up_name'])) {
$document_event_data['is_image_01'] = 1;
$document_event_data['image_01_src'] = '/img' . LOCOMILL_UPIMG_EVENT_01_PATH . '/' . $event_data['image_01']['up_name'];
} else {
$document_event_data['is_image_01'] = 0;
$document_event_data['image_01_src'] = '/common/img/e_img.jpg';
}
$document_event_data['is_enable'] = ($event_data['enable'] == 1 && $event_data['start_stamp'] <= strtotime($document_data['public_date_origin']))? 1: 2;
}
unset($event_data);
}
// ショップインフォ・病院データ
if (!empty($document_data['hospital_id'])) {
try {
$hospital_data = $hospital->get_data($document_data['hospital_id'], false);
} catch (HospitalError $e) {
$err_str .= 'info_hospital' . $document_data['hospital_id'] . $e->get_exception();
}
if (!empty($hospital_data) && (($hospital_data['enable'] == 1 && $hospital_data['start_stamp'] <= $now && $now <= $hospital_data['end_stamp']) || $page_is_enable === false)) {
foreach ($column_array AS $v) {
$document_hospital_data[$v] = $hospital_data[$v];
}
$document_hospital_data['category_name'] = '';
$cat_id = explode('_', $hospital_data['category_main_id']);
$cat_id = array_values(array_diff($cat_id, array('')));
if (!empty($cat_id[0])) {
$document_hospital_data['category_name'] = $hospital_category->get_name($cat_id[0]);
}
unset($cat_id);
$document_hospital_data['prefect_name'] = ($hospital_data['area_01_id'] == LOCOMILL_AREA_01_DEFAULT_ID)? '': $area_01_array[$hospital_data['area_01_id']]['name'];
$document_hospital_data['town_name'] = $area_03_array[$hospital_data['area_03_id']]['name'];
$document_hospital_data['local_name'] = $area_04_array[$hospital_data['area_id']]['name'];
$document_hospital_data['tel_01_caption'] = (!empty($hospital_data['tel_01_caption']))? $hospital_data['tel_01_caption']: 'TEL';
$document_hospital_data['tel_02_caption'] = (!empty($hospital_data['tel_02_caption']))? $hospital_data['tel_02_caption']: 'TEL';
$document_hospital_data['tel_03_caption'] = (!empty($hospital_data['tel_03_caption']))? $hospital_data['tel_03_caption']: 'TEL';
$document_hospital_data['fax_01_caption'] = (!empty($hospital_data['fax_01_caption']))? $hospital_data['fax_01_caption']: 'FAX';
$document_hospital_data['fax_02_caption'] = (!empty($hospital_data['fax_02_caption']))? $hospital_data['fax_02_caption']: 'FAX';
$document_hospital_data['fax_03_caption'] = (!empty($hospital_data['fax_03_caption']))? $hospital_data['fax_03_caption']: 'FAX';
$document_hospital_data['is_closed'] = 0;
$document_hospital_data['close_reason'] = '';
$document_hospital_data['kuchikomi_num'] = 0;
if (!empty($hospital_data['image_01']['up_name'])) {
$document_hospital_data['is_image_01'] = 1;
$document_hospital_data['image_01_src'] = '/img' . LOCOMILL_UPIMG_HOSPITAL_01_PATH . '/' . $hospital_data['image_01']['up_name'];
} elseif (!empty($hospital_data['rsv_txt_06'])) {
$document_hospital_data['is_image_01'] = 1;
$document_hospital_data['image_01_src'] = '/old_images/' . $hospital_data['rsv_txt_06'];
} else {
$document_hospital_data['is_image_01'] = 0;
$document_hospital_data['image_01_src'] = LOCOMILL_UPIMG_NOIMAGE_SMALL_PATH;
}
$document_hospital_data['is_enable'] = ($hospital_data['enable'] == 1 && $hospital_data['start_stamp'] <= strtotime($document_data['public_date_origin']))? 1: 2;
}
unset($hospital_data);
}
// 連絡先データ
if (!empty($document_data['client_id']) && $feature_data['type_id'] == 5) {
try {
$client_data = $lc->get_data($document_data['client_id'], false);
} catch (LocomillClientError $e) {
$err_str .= 'info_client' . $document_data['client_id'] . $e->get_exception();
}
if (!empty($client_data) && $client_data['enable'] == 1) {
$document_client_data['name_01_name'] = $client_data['name_01_name'];
$document_client_data['prefect_name'] = ($client_data['prefect'] == LOCOMILL_AREA_01_DEFAULT_ID)? '': $area_01_array[$client_data['prefect']]['name'];
$document_client_data['town_name'] = $area_03_array[$client_data['city']]['name'];
$document_client_data['local_name'] = $area_04_array[$client_data['town']]['name'];
$document_client_data['address_01'] = $client_data['address_01'];
$document_client_data['address_02'] = $client_data['address_02'];
$document_client_data['tel_01'] = $client_data['tel_01'];
$document_client_data['rsv_txt_10'] = $client_data['rsv_txt_10'];
if (!empty($client_data['image_01']['up_name'])) {
$document_client_data['is_image_01'] = 1;
$document_client_data['image_01_src'] = '/img/client/01/' . $client_data['image_01']['up_name'];
} else {
$document_client_data['is_image_01'] = 0;
$document_client_data['image_01_src'] = LOCOMILL_UPIMG_NOIMAGE_SMALL_PATH;
}
}
unset($client_data);
}
// 特集の代表スポット・イベント・病院
if (!empty($document_spot_data)) {
$doc['shop_name'] = $document_spot_data['name_01'];
$doc['town_name'] = $document_spot_data['town_name'];
$doc['shop_category_name'] = $document_spot_data['category_name'];
} elseif (!empty($document_event_data)) {
$doc['shop_name'] = $document_event_data['name_01'];
$doc['town_name'] = $document_event_data['town_name'];
$doc['shop_category_name'] = $document_event_data['category_name'];
} elseif (!empty($document_hospital_data)) {
$doc['shop_name'] = $document_hospital_data['name_01'];
$doc['town_name'] = $document_hospital_data['town_name'];
$doc['shop_category_name'] = $document_hospital_data['category_name'];
}
// 左メニュー目次作成
if (!empty($document_block_array)) {
foreach ($document_block_array AS $bid => $block) {
if ($block['enable'] != 1)
continue;
if (!empty($block['headline_01']) && substr($block['headline_01'], 0, 4) == '[MN]') {
$leftmenu_array[$block['document_id']]['block'][$block['id']]['name'] = str_replace('[MN]', '', $block['headline_01']);
}
}
}
// 記事ブロックをページに分割
$block_page_array = array();
if (!empty($document_block_array)) {
$p = 1;
foreach ($document_block_array AS $k => $v) {
if ($v['layout_id'] == 96 || $v['layout_id'] == 97) {
if (!empty($block_page_array[$p]))
$p++;
} else {
$block_page_array[$p][$k] = $v;
if (isset($leftmenu_array[$v['document_id']]['block'][$v['id']])) {
$leftmenu_array[$v['document_id']]['block'][$v['id']]['page'] = $p;
}
}
}
}
unset($document_block_array);
// 記事ブロック
if (isset($block_page_array[$page])) {
$column_array = array('id', 'document_id', 'layout_id', 'class_name', 'headline_02', 'price_01', 'price_02',
'price_01_caption', 'price_02_caption', 'rollover', 'cont_flg');
foreach ($block_page_array[$page] AS $bid => $block) {
if ($block['enable'] != 1) {
continue;
}
try {
$bdoc = $feature->document_block_smarty_format($block, $document_data, $page_is_enable);
} catch (FeatureError $e) {
$err_str .= $e->get_exception();
}
// プレゼント
if ($block['layout_id'] == 54 && !empty($block['present_id'])) {
$bdoc['present_array'] = array();
try {
$present_data = $present_item->get_data_array_by_parent($block['present_id'], (($page_is_enable)? true: false), false);
} catch (PresentItemError $e) {
$err_str .= 'block_present' . $block['present_id'] . $e->get_exception();
}
if (!empty($present_data)) {
$bdoc['present_url'] = sprintf('/corner/present/form/%s?id=%d', $pv_url, $block['present_id']);
foreach ($present_data AS $k => $v) {
$temp = array();
$temp['name_01'] = $v['name_01'];
$temp['lottery_max'] = $v['lottery_max'];
$temp['lottery_max_txt'] = $v['lottery_max_txt'];
$temp['start'] = date('Y/n/j/ H:i', $v['start_stamp']);
$temp['end'] = (mktime(0, 0, 0, 12, 31, 2037) <= $v['end_stamp'])? '': date('Y/n/j/ H:i', $v['end_stamp']);
if (!empty($v['image_01']['up_name'])) {
$temp['present_item_image_src'] = '/img' . LOCOMILL_UPIMG_PRESENT_ITEM_PATH . '/' . $v['image_01']['up_name'];
} else {
$temp['present_item_image_src'] = LOCOMILL_UPIMG_NOIMAGE_PATH;
}
$temp['spot_name'] = '';
$temp['spot_url'] = '';
try {
$spot_data = $spot->get_data($v['spot_id']);
$temp['spot_name'] = $spot_data['name_01'];
if ($spot_data['enable'] == 1 && $now <= $spot_data['end_stamp']) {
$temp['spot_url'] = "/spot/home/?id=" . $v['spot_id'];
}
} catch (SpotError $e) {
$spot_data = array();
}
$bdoc['present_array'][$k] = $temp;
}
}
unset($present_data);
}
// プレゼント賞品
if ($block['layout_id'] == 55 && !empty($block['present_item_id'])) {
try {
$present_item_data = $present_item->get_data($block['present_item_id']);
} catch (PresentItemError $e) {
$err_str = 'block_presentitem' . $block['present_item_id'] . $e->get_exception();
}
if ($page_is_enable == false || ($present_item_data['start_stamp'] <= $now && $now <= $present_item_data['end_stamp'])) {
$bdoc['is_present_item'] = 1;
$bdoc['present_item_name_01'] = $present_item_data['name_01'];
$bdoc['present_item_lottery_max'] = $present_item_data['lottery_max'];
$bdoc['present_item_lottery_max_txt'] = $present_item_data['lottery_max_txt'];
$bdoc['present_item_start'] = date('Y/n/j/ H:i', $present_item_data['start_stamp']);
$bdoc['present_item_end'] = (mktime(0, 0, 0, 12, 31, 2037) <= $present_item_data['end_stamp'])? '': date('Y/n/j/ H:i', $present_item_data['end_stamp']);
$bdoc['present_item_url'] = sprintf('/corner/present/form/%s?id=%d&item=%d', $pv_url, $present_item_data['present_id'], $present_item_data['id']);
if (!empty($present_item_data['image_01']['up_name'])) {
$bdoc['present_item_image_src'] = '/img' . LOCOMILL_UPIMG_PRESENT_ITEM_PATH . '/' . $present_item_data['image_01']['up_name'];
} else {
$bdoc['present_item_image_src'] = LOCOMILL_UPIMG_NOIMAGE_PATH;
}
$bdoc['present_item_spot_name'] = '';
$bdoc['present_item_spot_url'] = '';
try {
$spot_data = $spot->get_data($present_item_data['spot_id']);
$bdoc['present_item_spot_name'] = $spot_data['name_01'];
if ($spot_data['enable'] == 1 && $now <= $spot_data['end_stamp']) {
$bdoc['present_item_spot_url'] = "/spot/home/?id=" . $present_item_data['spot_id'];
}
} catch (SpotError $e) {
$spot_data = array();
}
} else {
$bdoc['is_present_item'] = 0;
}
unset($present_item_data);
}
// ポイント交換賞品
if ($block['layout_id'] == 56 && !empty($block['point_item_id'])) {
try {
$point_item_data = $mm_07->get_data($block['point_item_id']);
} catch (MemberMaster07Error $e) {
$err_str = 'block_pointitem' . $block['point_item_id'] . $e->get_exception();
}
if ($page_is_enable == false || ($point_item_data['enable'] == 1 && $point_item_data['is_dispose'] == 2 && $point_item_data['start_stamp'] <= $now && $now <= $point_item_data['end_stamp'])) {
$point_item_data = $mm_07->adjust($point_item_data);
$bdoc['is_point_item'] = 1;
$bdoc['point_item_name_01'] = $point_item_data['name_01'];
$bdoc['point_item_spot_name'] = $point_item_data['spot_name'];
$bdoc['point_item_spot_area'] = $point_item_data['spot_area'];
$bdoc['point_item_image_src'] = $point_item_data['list_image_src'];
$bdoc['point_item_url'] = sprintf('/point/detail.shtml?id=%d', $point_item_data['id']);
$bdoc['point_item_point'] = $point_item_data['point'];
$bdoc['point_item_stock_enable'] = $point_item_data['stock_enable'];
$bdoc['point_item_stock'] = $point_item_data['stock'];
$bdoc['point_item_change_type'] = $point_item_data['change_type'];
} else {
$bdoc['is_point_item'] = 0;
}
unset($point_item_data);
}
// クーポン
if ($block['layout_id'] == 57 && !empty($block['coupon_id'])) {
try {
$coupon_data = $coupon->get_data($block['coupon_id']);
} catch (CouponError $e) {
$err_str = 'block_coupon' . $block['coupon_id'] . $e->get_exception();
}
if ($page_is_enable == false || ($coupon_data['enable'] == 1 && $coupon_data['c_start'] <= $now && $now <= $coupon_data['c_end'])) {
$parent_data = array();
if ($coupon_data['attr'] == 1 && !empty($coupon_data['spot_id'])) {
try {
$parent_data = $spot->get_data($coupon_data['spot_id']);
$parent_data = $spot->adjust($parent_data);
} catch (SpotError $e) {
continue;
}
} elseif ($coupon_data['attr'] == 2 && !empty($coupon_data['event_id'])) {
try {
$parent_data = $event->get_data($coupon_data['event_id']);
$parent_data = $event->adjust($parent_data);
} catch (EventError $e) {
continue;
}
}
if (!empty($parent_data)) {
$bdoc['is_coupon'] = 1;
$bdoc['coupon_contents_01'] = $coupon_data['contents_01'];
$bdoc['coupon_limit'] = (mktime(0, 0, 0, 12, 31, 2037) <= $coupon_data['c_end'])? '': date('Y/n/j', $coupon_data['c_end']);
$bdoc['coupon_spot_name'] = $parent_data['name_01'];
$bdoc['coupon_image_src'] = $parent_data['image_01_src'];
$bdoc['coupon_url'] = sprintf('/%s/coupon/?id=%d&coupon_id=%d', ($coupon_data['attr'] == 1? 'spot': 'event'), $parent_data['id'], $coupon_data['id']);
try {
$bdoc['coupon_spot_area'] = $area->get_name('area_master_03_tbl', $parent_data['area_03_id']);
} catch (AreaError $e) {
$bdoc['coupon_spot_area'] = '';
}
} else {
$bdoc['is_coupon'] = 0;
}
} else {
$bdoc['is_coupon'] = 0;
}
unset($point_item_data);
}
// クチコミブロック
if (in_array($block['layout_id'], array(60, 61))) {
$bdoc['kuchikomi_page_next'] = 2;
$bdoc['kuchikomi_num'] = $block['kuchikomi_num'];
$where = $color = array();
if ($block['layout_id'] == 60) {
$where['is_comment'] = 1;
} elseif ($block['layout_id'] == 61) {
$where['img'] = 1;
}
if ($block['kuchikomi_start_date'] != '0000-00-00') {
$where['display_start_date'] = $block['kuchikomi_start_date'];
}
if ($block['kuchikomi_end_date'] != '0000-00-00') {
$where['display_end_date'] = $block['kuchikomi_end_date'];
}
if (!empty($block['kuchikomi_word'])) {
$temp = array_diff(explode(',', $block['kuchikomi_word']), array(''));
$where['word'] = $temp;
$color = array_merge($color, $temp);
}
if (!empty($block['kuchikomi_category'])) {
$temp = explode(',', $block['kuchikomi_category']);
$where['C1'] = $temp;
}
if (!empty($block['kuchikomi_tag'])) {
$temp = explode(',', $block['kuchikomi_tag']);
$where['tag_id'] = $temp;
}
if (!empty($block['kuchikomi_spot_id'])) {
$temp = array_diff(explode(',', $block['kuchikomi_spot_id']), array(''));
$where['spot_id'] = $temp;
}
if (!empty($block['kuchikomi_kuchikomi_id'])) {
$temp = array_diff(explode(',', $block['kuchikomi_kuchikomi_id']), array(''));
$where['kuchikomi_id'] = $temp;
}
$bdoc['kuchikomi_array'] = array();
$sql = $kuchikomi->get_id_query_feature($where);
$result = $locomill->get_db4()->query($sql);
if ($result !== false) {
$bdoc['kuchikomi_all_num'] = $locomill->get_db4()->num($result);
if (0 < $bdoc['kuchikomi_all_num']) {
$count = 1;
while ($row = $locomill->get_db4()->fetch_array($result)) {
$data = $kuchikomi->adjust($row['id'], $login_user_id, true);
$data['COMMENT_S'] = mb_strimwidth($data['COMMENT'], 0, 100, '…');
if (!empty($block['kuchikomi_color']) && !empty($color)) {
$bdoc['kuchikomi_color'] = $block['kuchikomi_color'];
foreach ($color AS $v) {
$data['COMMENT'] = str_replace($v, sprintf('%s', $v), $data['COMMENT']);
$data['COMMENT_S'] = str_replace($v, sprintf('%s', $v), $data['COMMENT_S']);
}
}
$bdoc['kuchikomi_array'][$row['id']] = $data;
$count++;
if ($block['kuchikomi_num'] < $count)
break;
}
}
} else {
$err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db4()->get_db_connect());
}
}
// クチコミぐっときた
if ($block['layout_id'] == 62 && !empty($block['kuchikomi_id'])) {
try {
$kuchikomi_data = $kuchikomi->get_data($block['kuchikomi_id']);
} catch (MemberMaster07Error $e) {
$err_str = 'block_kuchikomi' . $block['kuchikomi_id'] . $e->get_exception();
}
if ($page_is_enable == false || ($kuchikomi_data['enable'] == 1 && $kuchikomi_data['is_dispose'] == 2 && $kuchikomi_data['display_stamp'] <= $now)) {
$bdoc['is_kuchikomi_good'] = 1;
$bdoc['kuchikomi_id'] = $block['kuchikomi_id'];
$bdoc['kuchikomi_comment'] = $kuchikomi_data['comment'];
$bdoc['my_good_type'] = 0;
$is_good = array();
if (!empty($login_user_id)) {
try {
$is_good = $good->get_data_by_member($kuchikomi_data['id'], $login_user_id);
if (!empty($is_good)) {
$bdoc['my_good_type'] = $is_good['good_type'];
}
unset($is_good);
} catch( GoodError $e ) {
}
}
$bdoc['good_num'] = $kuchikomi_data['good_num'];
try {
$bdoc['good_type'] = $good->get_type_array($kuchikomi_data['id']);
} catch( GoodError $e ) {
$bdoc['good_type'] = array();
}
} else {
$bdoc['is_kuchikomi_good'] = 0;
}
unset($kuchikomi_data);
}
// あるあるブロック
if (in_array($block['layout_id'], array(63))) {
$bdoc['kuchikomi_page_next'] = 2;
$bdoc['kuchikomi_num'] = $block['kuchikomi_num'];
$wlist = array();
$wlist[] = '`enable` = 1';
$wlist[] = '`is_dispose` = 2';
$wlist[] = sprintf('`display_stamp` <= %d', time());
if ($block['kuchikomi_start_date'] != '0000-00-00') {
$wlist[] = sprintf('%d <= `display_stamp`', strtotime($block['kuchikomi_start_date']));
}
if ($block['kuchikomi_end_date'] != '0000-00-00') {
$wlist[] = sprintf('`display_stamp` <= %d', strtotime($block['kuchikomi_end_date']));
}
if (!empty($block['kuchikomi_tag'])) {
$temp = explode(',', $block['kuchikomi_tag']);
$temp2 = array();
foreach ($temp AS $v) {
$temp2[] = sprintf('FIND_IN_SET(%s, `area_ids`)', $v);
}
$wlist[] = sprintf('(%s)', implode(' OR ', $temp2));
}
$bdoc['kuchikomi_array'] = array();
$sql = sprintf('SELECT * FROM `kuchikomi_short_tbl` WHERE %s ORDER BY `display_stamp`DESC', implode(' AND ', $wlist));
$result = $locomill->get_db4()->query($sql);
if ($result !== false) {
$bdoc['kuchikomi_all_num'] = $locomill->get_db4()->num($result);
if (0 < $bdoc['kuchikomi_all_num']) {
$count = 1;
while ($row = $locomill->get_db4()->fetch_array($result)) {
$data = $kuchikomi_short->adjust($row['id'], $login_user_id);
$bdoc['kuchikomi_array'][$row['id']] = $data;
$count++;
if ($block['kuchikomi_num'] < $count)
break;
}
}
} else {
$err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db4()->get_db_connect());
}
}
// SNSハッシュタグ
$bdoc['hashtag_array'] = array();
if ($block['layout_id'] == 65) {
// 廃止
}
if ($block['layout_id'] == 66) {
$bdoc['hashtag_page_next'] = 1;
$uri = 'https://graph.facebook.com/v3.3/ig_hashtag_search';
$params = array('user_id' => $facebook_auth['user_id'],
'q' => $block['sns_hashtag'],
'access_token' => $facebook_auth['access_token']);
$result = curl_post(http_build_query($params), $uri, false);
$body = json_decode($result, true);
if (!empty($body['data'])) {
$uri = sprintf('https://graph.facebook.com/v3.3/%s/top_media', $body['data'][0]['id']);
$params = array('user_id' => $facebook_auth['user_id'],
'fields' => 'media_url,media_type,comments_count,id,like_count,children{media_url,permalink},permalink,caption',
'limit' => 40,
'access_token' => $facebook_auth['access_token']);
$result = curl_post(http_build_query($params), $uri, false);
$body = json_decode($result, true);
if (!empty($body['data'])) {
$count = 0;
foreach ($body['data'] AS $v) {
$box = floor($count / 4);
if (!isset($bdoc['hashtag_array'][$box])) {
$bdoc['hashtag_array'][$box] = array();
}
$count++;
$temp = array();
$temp['url'] = $v['permalink'];
$temp['image'] = array();
if ($v['media_type'] == 'IMAGE') {
$temp['image'][] = $v['media_url'];
} else {
foreach ($v['children']['data'] AS $v2) {
$temp['image'][] = $v2['media_url'];
}
}
$temp['text'] = $v['caption'];
$bdoc['hashtag_array'][$box][] = $temp;
}
}
unset($uri, $params, $result, $body);
}
}
$block_array[$bid] = $bdoc;
}
}
// プレゼント
if (!empty($doc['is_present'])) {
try {
$temp = $present_item->get_data_array_by_parent($doc['present_id'], (($page_is_enable)? true: false), false);
} catch (PresentItemError $e) {
$err_str .= 'info_present' . $document_data['client_id'] . $e->get_exception();
}
if (!empty($temp)) {
foreach ($temp AS $k => $v) {
$v['start'] = date('Y/n/j/ H:i', $v['start_stamp']);
$v['end'] = (mktime(0, 0, 0, 12, 31, 2037) <= $v['end_stamp'])? '': date('Y/n/j/ H:i', $v['end_stamp']);
$v['url'] = '/corner/present/form/' . $pv_url . '?id=' . $v['present_id'];
$present_array[$k] = $v;
}
}
unset($temp);
}
// プレゼント賞品
if (!empty($doc['is_present_item'])) {
try {
$present_item_array = $present_item->get_data($doc['present_item_id']);
} catch (PresentItemError $e) {
$err_str = 'info_presentitem' . $document_data['client_id'] . $e->get_exception();
}
if ($page_is_enable == false || ($present_item_array['start_stamp'] <= time() && time() <= $present_item_array['end_stamp'])) {
$present_item_array['start'] = date('Y/n/j/ H:i', $present_item_array['start_stamp']);
$present_item_array['end'] = (mktime(0, 0, 0, 12, 31, 2037) <= $present_item_array['end_stamp'])? '': date('Y/n/j/ H:i', $present_item_array['end_stamp']);
$present_item_array['url'] = '/corner/present/form/' . $pv_url . '?id=' . $present_item_array['present_id'] . '&item=' . $present_item_array['id'];
} else {
$present_item_array = array();
}
}
}
$smarty->assign("LEFT_MENU", ($feature_data['type_id'] == 5? $leftmenu_array: $leftmenu_array[$document_data['id']]));
$smarty->assign("LEFT_DOCUMENT_NUM", count($leftmenu_array));
$smarty->assign("PAGE_NUM", count($block_page_array));
$smarty->assign("PAGE", $page);
$smarty->assign("CURRENT_DOCUMENT_DATA", $doc);
$smarty->assign("CURRENT_DOCUMENT_BLOCK_LIST", $block_array);
$smarty->assign("CURRENT_DOCUMENT_SHOP_DATA", $document_spot_data);
$smarty->assign("CURRENT_DOCUMENT_EVENT_DATA", $document_event_data);
$smarty->assign("CURRENT_DOCUMENT_HOSPITAL_DATA", $document_hospital_data);
$smarty->assign("CURRENT_DOCUMENT_CLIENT_DATA", $document_client_data);
$smarty->assign("PRESENT_DATA", $present_array);
$smarty->assign("PRESENT_ITEM_DATA", $present_item_array);
// Add Okayama - 208.10.12
$smarty->assign("CURRENT_DOCUMENT_DATA_CSS_01", $doc['css_01'], '', false);
// 全体の最新記事取得
$latest_array = array();
if ($err_str === "") {
try {
$temp = $feature->get_latest_document(4);
foreach ($temp AS $row) {
// 基本情報
$doc = $feature->document_smarty_format($row);
$doc['feature_title_01'] = $row['feature_title_01'];
if (!empty($doc['theme_key'])) {
$doc['link'] = '/ichiuma/?t=' . $doc['theme_key'] . '&d=' . date('j', strtotime($doc['public_date_origin']));
} else {
$doc['link'] = '/feature/home.shtml?id=' . $doc['id'];
}
// 店舗データ
$info_data = array();
if (!empty($row['shop_id']) || !empty($row['event_id']) || !empty($row['hospital_id'])) {
if (!empty($row['shop_id'])) {
try {
$info_data = $spot->get_data($row['shop_id'], false, false);
} catch (SpotError $e) {
throw new FeatureError('info_spot' . $row['shop_id'] . $e->get_exception());
}
if (!empty($info_data) && ($info_data['enable'] == 1 || $page_is_enable === false)) {
$doc['spot_type'] = 'SPOT';
} else {
continue;
}
} elseif (!empty($row['event_id'])) {
try {
$info_data = $event->get_data($row['event_id'], false);
} catch (EventError $e) {
throw new FeatureError('info_event' . $row['event_id'] . $e->get_exception());
}
if (!empty($info_data) && ($info_data['enable'] == 1 || $page_is_enable === false)) {
$doc['spot_type'] = 'EVENT';
} else {
continue;
}
} elseif (!empty($row['hospital_id'])) {
try {
$info_data = $hospital->get_data($row['hospital_id'], false);
} catch (HospitalError $e) {
throw new FeatureError('info_hospital' . $row['hospital_id'] . $e->get_exception());
}
if (!empty($info_data) && ($info_data['enable'] == 1 || $page_is_enable === false)) {
$doc['spot_type'] = 'HOSPITAL';
} else {
continue;
}
}
}
unset($info_data);
$latest_array[$row['id']] = $doc;
}
} catch (FeatureError $e) {
$err_str .= $e->get_exception();
}
}
$smarty->assign("GLOBAL_LATEST_DOCUMENT_LIST", $latest_array);
unset($latest_array);
// 関連特集取得
if ($err_str === "") {
try {
$tags = array_diff(explode(',', $feature_data['tag']), array(''));
if (!empty($tags)) {
$type_conf = 0;
$enable_conf = 1;
$tag_feature_array = $feature->get_tags_features($tags, $type_conf, $enable_conf, $feature_id);
}
} catch (FeatureError $e) {
$err_str .= $e->get_exception();
}
}
$smarty->assign("RELATED_FEATURE_LIST", $tag_feature_array);
// クチコミ取得(スポット)
$kuchikomi_num = 0;
$kuchikomi_array = array();
if ($err_str === "") {
if (!empty($document_data['shop_id']) && $document_data['spot_kuchikomi_enable'] == 1) {
$cond = array('table' => 'new', 'limit' => $k_item_line);
$sql = $kuchikomi->get_id_query(1, $document_data['shop_id'], true, $cond);
$result = $locomill->get_db4()->query($sql);
if ($result !== false) {
$kuchikomi_num = $locomill->get_db4()->num($result);
if ($kuchikomi_num > 0) {
while ($row = $locomill->get_db4()->fetch_array($result)) {
$kuchikomi_array[$row['id']] = $kuchikomi->adjust($row['id'], $member_data['id']);
}
}
} else {
$err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db4()->get_db_connect());
}
}
}
$smarty->assign("SPOT_KUCHIKOMI_ARRAY", $kuchikomi_array);
unset($kuchikomi_num, $kuchikomi_arrayy);
// クチコミ取得(イベント)
$kuchikomi_num = 0;
$kuchikomi_array = array();
if ($err_str === "") {
if (!empty($document_data['event_id']) && $document_data['spot_kuchikomi_enable'] == 1) {
$cond = array('table' => 'new', 'limit' => $k_item_line);
$sql = $kuchikomi->get_id_query(2, $document_data['event_id'], true, $cond);
$result = $locomill->get_db4()->query($sql);
if ($result !== false) {
$kuchikomi_num = $locomill->get_db4()->num($result);
if ($kuchikomi_num > 0) {
while ($row = $locomill->get_db4()->fetch_array($result)) {
$kuchikomi_array[$row['id']] = $kuchikomi->adjust($row['id'], $member_data['id']);
}
}
} else {
$err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db4()->get_db_connect());
}
}
}
$smarty->assign("EVENT_KUCHIKOMI_ARRAY", $kuchikomi_array);
unset($kuchikomi_num, $kuchikomi_array);
// クチコミ取得(特集)
$kuchikomi_num = 0;
$kuchikomi_item_line = 0;
$kuchikomi_array = array();
$left_info_public = $right_info_public = $page_info_public = '';
if ($err_str === "") {
if ($document_data['kuchikomi_enable'] == 1) {
$kuchikomi_item_line = 10;
$sql = $kuchikomi->get_id_query(4, $document_id);
$result = $locomill->get_db4()->query($sql);
if ($result !== false) {
$kuchikomi_num = $locomill->get_db4()->num($result);
if ($kuchikomi_num > 0) {
$k_page = $pager->exec($kuchikomi_num, $k_page, $kuchikomi_item_line, 10);
if ($pager->get_err_str() === "") {
if ($locomill->get_db4()->seek($result, $pager->get_start_row()) == true) {
for ($i = $pager->get_start_row(); $i < $pager->get_end_row(); $i++) {
$row = $locomill->get_db4()->fetch_array($result);
$kuchikomi_array[$row['id']] = $kuchikomi->adjust($row['id'], $login_user_id);
}
} else {
$err_str = "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db4()->get_db_connect());
}
} else {
$err_str = "・ページ情報の処理に失敗しました。
";
}
}
} else {
$err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db4()->get_db_connect());
}
$left_info_public = $pager->get_left_info_public();
$right_info_public = $pager->get_right_info_public();
$page_info_public = $pager->get_page_info_public();
}
}
$smarty->assign_ex("KUCHIKOMI_NUM", $kuchikomi_num, "0");
$smarty->assign_ex("KUCHIKOMI_LINE", $kuchikomi_item_line, "0");
$smarty->assign("KUCHIKOMI_ARRAY", $kuchikomi_array);
$smarty->assign("PAGE_NEXT", 2);
$smarty->assign("K_PAGE", $k_page);
// <<前へ
$smarty->assign_ex("BEFORE_LINK", $left_info_public, "");
// 次へ>>
$smarty->assign_ex("NEXT_LINK", $right_info_public, "");
// ページインフォ
$smarty->assign_ex("PAGE_INFO_LINK", $page_info_public, "");
// クチコミキャンペーン
if ($err_str === "") {
try {
$temp = $kuchikomi_campaign->get_data_array(4, time(), $document_data);
if (!empty($temp)) {
foreach ($temp AS $v) {
if (!empty($v['point_num'])) {
$v['image_src'] = '';
$upimg_path = $kuchikomi_campaign->get_upimg_path(2);
if ($locomill->user_agent['isSP'] && !empty($v['image_02']['up_name']) && file_exists($upimg_path . '/' . $v['image_02']['up_name'])) {
$v['image_src'] = str_replace(UPIMG_BASE_PATH, '/img', $upimg_path . '/' . $v['image_02']['up_name']);
}
$upimg_path = $kuchikomi_campaign->get_upimg_path(1);
if (empty($v['image_src']) && !empty($v['image_01']['up_name']) && file_exists($upimg_path . '/' . $v['image_01']['up_name'])) {
$v['image_src'] = str_replace(UPIMG_BASE_PATH, '/img', $upimg_path . '/' . $v['image_01']['up_name']);
}
$kuchikomi_campaign_array[] = $v;
}
}
}
} catch (KuchikomiCampaignError $e) {
$err_str .= $e->get_exception();
}
}
$smarty->assign("KUCHIKOMI_CAMPAIGN_ARRAY", escapeHTML($kuchikomi_campaign_array));
// 特集タイプ別処理
if ($err_str === "") {
if ($is_ichiuma) {
$template_file = 'ichiuma/home.tpl';
} else {
$template_file = 'feature/home.tpl';
}
switch ($feature_data['type_id']) {
case 1:
// 大特集
$sea_array = $feature->get_search_array($feature_id);
$smarty->assign("SEARCH_LIST", $sea_array);
if ($feature_data['is_area_search_02'] == 1) {
$area2_array = $feature->get_area_array($feature_id, 2);
$smarty->assign("AREA_02_LIST", $area2_array);
}
if ($feature_data['is_area_search_01'] == 1 || $feature_data['is_area_search_03'] == 1) {
$area3_array = $feature->get_area_array($feature_id, 3);
$smarty->assign("AREA_03_LIST", $area3_array);
}
if ($feature_data['is_area_search_01'] == 1) {
$area1_array = array();
if (!empty($area3_array)) {
foreach ($area3_array AS $k => $v) {
if (!isset($area1_array[$v['area_03_group_id']])) {
$area1_array[$temp['id']] = array('id' => $v['area_03_group_id'], 'name' => $area_02_flag_array[$v['area_03_group_id']]);
}
}
ksort($area1_array);
}
$smarty->assign("AREA_01_LIST", $area1_array);
}
break;
case 2:
// 小特集
$area_doc_array = array();
if (!empty($doc_array)) {
foreach ($doc_array AS $did => $row) {
// エリア別一覧を生成
if (!isset($area_doc_array[$row['prefect_area_id']])) {
$area_doc_array[$row['prefect_area_id']] = array('name' => $row['prefect_area_name'], 'doc' => array());
}
$area_doc_array[$row['prefect_area_id']]['doc'][] = $row;
}
ksort($area_doc_array);
}
$smarty->assign("AREA_DOCUMENT_LIST", $area_doc_array);
break;
case 3:
// デイリー
// デイリーコンフィグデータ取得
$temp = $feature->get_extra_conf($feature_id);
$extra_conf = array();
if (!empty($temp)) {
// 次の特集
$extra_conf['next_year_id'] = '';
$extra_conf['next_year'] = '';
if (!empty($temp['next_feature_id'])) {
try {
$ndata = $feature->get_first_date_doc($temp['next_feature_id']);
} catch (FeatureError $e) {
$ndata = array();
}
if (!empty($ndata)) {
$extra_conf['next_year_id'] = $ndata['id'];
$extra_conf['next_year'] = date('Y', strtotime($ndata['public_date']));
}
}
// 前の特集
$extra_conf['prev_feature_id'] = '';
$extra_conf['prev_feature_year'] = '';
if (!empty($temp['prev_feature_id'])) {
try {
$ndata = $feature->get_last_date_doc($temp['prev_feature_id']);
} catch (FeatureError $e) {
$ndata = array();
}
if (!empty($ndata)) {
$extra_conf['prev_year_id'] = $ndata['id'];
$extra_conf['prev_year'] = date('Y', strtotime($ndata['public_date']));
}
}
}
$smarty->assign("EXTRA_CONFIG", $extra_conf);
// 記事月日
$wk = array('日', '月', '火', '水', '木', '金', '土', '日');
$mkt = strtotime($document_data['public_date_origin']);
list($yy, $mm, $dd, $ww, $tt) = explode('-', date('Y-m-d-w-t', $mkt));
$smarty->assign("DOCUMENT_YEAR", $yy);
$smarty->assign("DOCUMENT_MONTH", $mm);
$smarty->assign("DOCUMENT_DAY", $dd);
$smarty->assign("DOCUMENT_WEEKDAY", $wk[$ww]);
// 祝日取得
try {
$holiday = new Holiday($locomill->get_db4());
$holiday_array = $holiday->get_term_holiday(date('Y-m-1', $mkt), date('Y-m-t', $mkt), 1);
} catch (HolidayError $e) {
$err_str .= $e->get_exception();
}
// 記事一覧カレンダー生成
$calender_doc_array = array();
for ($i = 1; $i <= $tt; $i++) {
$w = date('w', mktime(0, 0, 0, $mm, $i, $yy));
$dd = sprintf('%04d/%02d/%02d', $yy, $mm, $i);
$ddh = sprintf('%04d-%02d-%02d', $yy, $mm, $i);
if ((empty($holiday_array[$ddh]) && 0 < $w && $w < 6) || sprintf('%02d-%02d', $mm, $i) == '01-01') {
$dobj = array();
if (!empty($doc_array)) {
foreach ($doc_array AS $did => $ddata) {
if ($ddata['public_date'] == $dd) {
$dobj = $ddata;
break;
}
}
}
$cal_array = array();
$cal_array['day'] = sprintf('%d/%d', $mm, $i);
if (!empty($dobj)) {
$cal_array['id'] = $dobj['id'];
if ($is_ichiuma) {
$cal_array['link'] = sprintf('/ichiuma/%s?t=%s&d=%d', $pv_url, $feature_data['theme_key'], $i);
} else {
$cal_array['link'] = sprintf('/feature/home%s.shtml?id=%d', $pv_mode, $dobj['id']);
}
$cal_array['shop_name'] = $dobj['shop_name'];
$cal_array['image_01_src'] = $dobj['image_01_src'];
$cal_array['is_present'] = 0;
if (!empty($dobj['is_present'])) {
try {
$temp = $present_item->get_data_array_by_parent($dobj['present_id'], (($page_is_enable)? true: false), false);
} catch (PresentItemError $e) {
$temp = array();
}
if (!empty($temp)) {
$cal_array['is_present'] = 1;
}
unset($temp);
}
if (!empty($dobj['is_present_item']) && empty($cal_array['is_present'])) {
try {
$present_item_array = $present_item->get_data($dobj['present_item_id']);
} catch (PresentItemError $e) {
$present_item_array = array();
}
if ($page_is_enable == false || ($present_item_array['start_stamp'] <= $now && $now <= $present_item_array['end_stamp'])) {
$cal_array['is_present'] = 1;
}
unset($present_item_array);
}
$present_id = $present_item_id = array();
if (empty($cal_array['is_present'])) {
$block = $feature->get_document_block_array($dobj['id'], 1);
foreach ($block AS $v) {
if (!empty($v['present_id']))
$present_id[] = $v['present_id'];
if (!empty($v['present_item_id']))
$present_item_id[] = $v['present_item_id'];
}
unset($block);
}
if (!empty($present_id) && empty($cal_array['is_present'])) {
foreach ($present_id AS $v) {
try {
$temp = $present_item->get_data_array_by_parent($v, (($page_is_enable)? true: false), false);
} catch (PresentItemError $e) {
$temp = array();
}
if (!empty($temp)) {
unset($temp);
$cal_array['is_present'] = 1;
break;
}
}
}
if (!empty($present_item_id) && empty($cal_array['is_present'])) {
foreach ($present_item_id AS $v) {
try {
$present_item_array = $present_item->get_data($v);
} catch (PresentItemError $e) {
$present_item_array = array();
}
if ($page_is_enable == false || ($present_item_array['start_stamp'] <= $now && $now <= $present_item_array['end_stamp'])) {
unset($present_item_array);
$cal_array['is_present'] = 1;
break;
}
}
}
unset($present_id, $present_item_id);
} else {
$cal_array['id'] = 0;
$cal_array['link'] = 'javascript:void(0)';
$cal_array['shop_name'] = '';
$cal_array['image_01_src'] = '';
$cal_array['is_present'] = 0;
}
if (sprintf('%02d-%02d', $mm, $i) != '01-01' || !empty($dobj)) {
$calender_doc_array[$i] = $cal_array;
}
}
}
$smarty->assign("CALENDER_DOCUMENT_LIST", $calender_doc_array);
unset($doc_array);
// 関連ID取得
try {
if ($is_ichiuma) {
$daily_links = $feature->get_daily_theme_links($document_id, $feature_id, true, ($page_is_enable? true: false));
} else {
$daily_links = $feature->get_daily_links($document_id, true, ($page_is_enable? true: false));
}
} catch (FeatureError $e) {
$daily_links = array();
}
if (!empty($daily_links['month'])) {
foreach ($daily_links['month'] AS $k => $v) {
$temp = $feature->get_document($v['first'], 0, true, false);
$temp = $feature->document_smarty_format($temp);
$daily_links['month'][$k]['image_01_src'] = $temp['image_01_src'];
}
unset($temp);
}
$smarty->assign("DAILY_LINK_DATA", $daily_links);
break;
case 4:
// マンスリー
// 公開年度
$smarty->assign("FEATURE_YEAR", date('Y', strtotime($feature_data['public_date'])));
// マンスリーコンフィグデータ取得
$temp = $feature->get_extra_conf($feature_id);
$extra_conf = array();
if (!empty($temp)) {
for ($i = 1; $i <= 12; $i++) {
$extra_conf['month'][$i]['caption'] = $temp[sprintf('caption_%02d_01', $i)];
}
for ($i = 1; $i <= 3; $i++) {
if (!empty($temp[sprintf('image_01_%02d', $i)]['up_name'])) {
$extra_conf[sprintf('is_image_%02d', $i)] = 1;
$extra_conf[sprintf('image_%02d_src', $i)] = '/img' . LOCOMILL_UPIMG_FEATURE_EXTRA_PATH . '/' . $temp[sprintf('image_01_%02d', $i)]['up_name'];
} else {
$extra_conf[sprintf('is_image_%02d', $i)] = 0;
$extra_conf[sprintf('image_%02d_src', $i)] = '';
}
}
// 次の記事
$extra_conf['next_feature_id'] = '';
$extra_conf['next_feature_year'] = '';
if (!empty($temp['next_feature_id'])) {
try {
$ndata = $feature->get_data($temp['next_feature_id'], 4, ($page_is_enable? 1: 0));
} catch (FeatureError $e) {
$ndata = array();
}
if (!empty($ndata)) {
$extra_conf['next_feature_id'] = $ndata['id'];
$extra_conf['next_feature_year'] = date('Y', strtotime($ndata['public_date']));
}
}
// 前の記事
$extra_conf['prev_feature_id'] = '';
$extra_conf['prev_feature_year'] = '';
if (!empty($temp['prev_feature_id'])) {
try {
$ndata = $feature->get_data($temp['prev_feature_id'], 4, ($page_is_enable? 1: 0));
} catch (FeatureError $e) {
$ndata = array();
}
if (!empty($ndata)) {
$extra_conf['prev_feature_id'] = $ndata['id'];
$extra_conf['prev_feature_year'] = date('Y', strtotime($ndata['public_date']));
}
}
}
$smarty->assign("EXTRA_CONFIG", $extra_conf);
// 記事一覧を月別振り分け
$month_doc_array = array();
if (!empty($doc_array)) {
foreach ($doc_array AS $did => $ddata) {
$ind = date('n', strtotime($ddata['public_date']));
$month_doc_array[$ind][$did] = $ddata;
}
}
krsort($month_doc_array);
$smarty->assign("MONTHLY_DOCUMENT_LIST", $month_doc_array);
// 記事月日
$wk = array('日', '月', '火', '水', '木', '金', '土', '日');
$mkt = strtotime($document_data['public_date_origin']);
list($yy, $mm, $dd, $ww, $tt) = explode('-', date('Y-m-d-w-t', $mkt));
$smarty->assign("DOCUMENT_YEAR", $yy);
$smarty->assign("DOCUMENT_MONTH", $mm);
$smarty->assign("DOCUMENT_DAY", $dd);
$smarty->assign("DOCUMENT_WEEKDAY", $wk[$ww]);
$smarty->assign("CURRENT_MONTH", (int)$mm);
break;
case 5:
// タイアップ
break;
default:
// 判別不可
$template_file = 'feature/common/error.tpl';
$err_str .= "・不明な特集です。";
break;
}
}
// カスタムテンプレートファイルの適用
if (!empty($feature_data['template_file'])) {
$template_file = 'feature/custom/' . $feature_data['template_file'];
}
// ぐっとタイプ
$smarty->assign("GOOD_TYPE_ARRAY", escapeHTML($good_type_array));
// プレビューモード用GET値
$smarty->assign("PV_MODE_GET_VALUE", (($page_is_enable)? 0: 1));
$smarty->assign("PV_MODE", $pv_mode);
$smarty->assign("PV_URL", $pv_url);
$smarty->assign("PREVIEW", $preview);
// イマココ
$imakoko = getTopicsPath('feature');
if ($err_str === "") {
if ($is_ichiuma) {
$imakoko[] = array(sprintf('/ichiuma/?t=%s', $feature_data['theme_key']), mb_strimwidth(strip_tags($feature_data['title_01']), 0, 30, '…'));
$imakoko[] = array(sprintf('/ichiuma/?t=%s&d=%d', $feature_data['theme_key'], date('j', strtotime($document_data['public_date_origin']))), mb_strimwidth(strip_tags($document_data['title_01']), 0, 30, '…'));
} else {
if ($feature_data['type_id'] != 5 || 1 < count($leftmenu_array)) {
$imakoko[] = array(sprintf('/feature/list.shtml?id=%d', $feature_data['id']), mb_strimwidth(strip_tags($feature_data['title_01']), 0, 30, '…'));
}
$imakoko[] = array(sprintf('/feature/home.shtml?id=%d', $document_data['id']), mb_strimwidth(strip_tags($document_data['title_01']), 0, 30, '…'));
}
}
$smarty->assign("IMAKOKO_ARRAY", $imakoko);
// 最新情報
include('common/whatsnew.inc');
/* AccessDailyクラスインスタンス生成 */
if ($err_str === "" && $page_is_enable) {
try {
$access = new AccessDaily($locomill->get_db());
$params = array("corner_type" => 3,
"terminal" => 1,
"corner_id" => $document_data['id'],
"page" => $_SERVER['PHP_SELF'],
"title" => "特集情報:" . $feature_data['title_01'] . ":" . $document_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());
}
}
/* 広告系 */
switch ($feature_data['type_id']) {
case 1:
$the_corner_id = 1;
break; // 大特集
case 2:
$the_corner_id = 2;
break; // 小特集
case 3:
$the_corner_id = 3;
break; // デイリー特集
case 4:
$the_corner_id = 4;
break; // マンスリー特集
case 5:
$the_corner_id = 0;
break; // タイアップ特集 // IDがない
default:
$the_corner_id = 27;
break; // 判別不能
}
$adver_param = array("terminal_type" => 1,
"corner_id" => $the_corner_id,
"feature_id" => $feature_data['id']);
$adver_b_type = ($feature_data['type_id'] == 5)? array(1, 7): array(1, 2, 7);
include('common/banners.inc');
// エラー文字列
$smarty->assign("ERR_STR", $err_str);
if (!empty($err_str)) {
header("HTTP/1.0 404 Not Found");
}
// Smarty Cache
if ($err_str === "" && $page_is_enable) {
// $smarty = getSmartyCache($smarty);
}
/* 出力 */
$smarty->display($template_file, getSmartyCacheId(array($document_id)));