session->sess_data)) { $sess_data = $locomill->session->sess_data; } elseif (empty($locomill->session)) { // セッション生成 $locomill->session = new Session($locomill->get_db(), ""); $locomill->session->start(); $locomill->session->user_id = -1; } } catch (LocomillError $e) { $err_str .= $e->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(); } } /* Areaクラスインスタンス生成 */ if ($err_str === "") { try { $area = new Area($locomill->get_db3()); $area_top = $area->get_area_top(); } catch (AreaError $e) { $err_str .= $e->get_exception(); } } /* Categoryクラスインスタンス生成 */ if ($err_str === "") { try { $category = new Category($locomill->get_db3()); } catch (CategoryError $e) { $err_str .= $e->get_exception(); } } /* Serviceクラスインスタンス生成 */ if ($err_str === "") { try { $service = new Service($locomill->get_db3()); $temp = $service->get_data_array(true, true); foreach ($temp AS $v) { $service_array[$v['id']] = array('sort' => $v['sort'], 'id' => $v['id'], 'name_01' => $v['name_01'], 'category' => $v['category'], 'image_01' => $v['image_01']); } $sortkeys = array(); foreach ($service_array AS $k => $v) { $sortkeys[$k] = $v['sort']; } array_multisort($sortkeys, $service_array); unset($temp, $sortkeys); } catch (ServiceError $e) { $err_str .= $e->get_exception(); } } /* ServiceCategoryクラスインスタンス生成 */ if ($err_str === "") { try { $service_category = new ServiceCategory($locomill->get_db3()); $temp = $service_category->get_data_array(true); foreach ($temp AS $v) { $service_category_array[$v['id']] = array('sort' => $v['sort'], 'name_01' => $v['name_01'], 'icon_color' => $v['icon_color']); } unset($temp); } catch (ServiceCategoryError $e) { $err_str .= $e->get_exception(); } } /* Barrierfreeクラスインスタンス生成 */ if ($err_str === "") { try { $barrierfree = new Barrierfree($locomill->get_db3()); $temp = $barrierfree->get_data_array(true, true); foreach ($temp AS $v) { $barrier_array[$v['id']] = $v['name_01']; } } catch (ServiceError $e) { $err_str .= $e->get_exception(); } } /* Holidayクラスインスタンス生成 */ if ($err_str === "") { try { $holiday = new Holiday($locomill->get_db3()); $holiday_array = $holiday->get_term_data(date("Y-m-d", mktime(0, 0, 0, date("m"), 0, date("Y"))), date("Y-m-d"), true); } catch (HolidayError $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(); } } /* Stamprallyクラスインスタンス生成 */ if ($err_str === "") { try { $stamprally = new Stamprally($locomill->get_db3()); } catch (StamprallyError $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('・正しい手続きでアクセスしていません。
'); } $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 === "") { try { $spot_sub_array = $spot->get_sub_data_array($spot_id); $week_id = (date('w') == 0)? 7: date('w'); // 祝日かどうか if (!empty($holiday_array[date('Y-m-d')])) { $week_id = 8; } // 祝前日かどうか if (!empty($holiday_array[date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')))])) { $week_id = 9; } /* サービスアイコンとの連動(有効性判定) */ // ランチ(11) $service_error[11] = ($spot_data['srv_time_start'] == '00:00:00' || $spot_data['srv_time_end'] == '00:00:00')? 1: 0; if ($spot->get_sub_record_num($spot_id, $week_id) > 0) { // 只今営業中(15) ※終了時間orラストオーダー前まで $service_error[15] = ($spot->check_is_open('sub', $spot_id, null, $week_id) === false)? 1: 0; // 朝7時~(17) $service_error[17] = ($spot->check_is_open('sub', $spot_id, '07:00:00', $week_id) === false)? 1: 0; // 23時以降(18) $service_error[18] = ($spot->check_is_open('sub', $spot_id, '23:01:00', $week_id) === false)? 1: 0; // 20時以降(88) $service_error[88] = ($spot->check_is_open('sub', $spot_id, '20:01:00', $week_id) === false)? 1: 0; } else { // 只今営業中(15) ※終了時間orラストオーダー前まで $service_error[15] = ($spot->check_is_open(null, $spot_id) === false)? 1: 0; // 朝7時~(17) $service_error[17] = ($spot->check_is_open(null, $spot_id, '07:00:00') === false)? 1: 0; // 23時以降(18) $service_error[18] = ($spot->check_is_open(null, $spot_id, '23:01:00') === false)? 1: 0; // 20時以降(88) $service_error[88] = ($spot->check_is_open(null, $spot_id, '20:01:00') === false)? 1: 0; } // 通し営業(16) ※基本営業時間2に入力なし $service_error[16] = ($spot_data['open_start_02'] != '00:00:00' && $spot_data['open_end_02'] != '00:00:00')? 1: 0; // 24時間(19) $service_error[19] = ($spot_data['is_open'] != 3)? 1: 0; } catch (SpotError $e) { $err_str .= $e->get_exception(); } } /* コンテンツメニュー */ if ($err_str === "") { $feature_type = 'pc'; $page_type = 'home'; include('common/spotmenu.inc'); $temp2 = $temp3 = array(); if ($spot_data['is_open'] == 2) { } elseif ($spot_data['is_open'] == 3) { $temp2[] = '24時間営業'; } else { if (!empty($spot_data['open_time_01'])) $temp2[] = $spot_data['open_time_01']; if (!empty($spot_data['open_time_02'])) $temp2[] = $spot_data['open_time_02']; } $spot_data['search_open_time'] = str_replace('
', ' ', implode(' ', $temp2)); if (!empty($spot_data['open_detail']) || !empty($temp3)) { if (!empty($spot_data['search_open_time'])) { $spot_data['search_open_time'] .= '…'; } elseif (!empty($spot_data['open_detail'])) { $spot_data['search_open_time'] = mb_strimwidth($spot_data['open_detail'], 0, 30, '…'); } elseif (!empty($temp3)) { $spot_data['search_open_time'] = str_replace('
', ' ', implode(' ', $temp3)); } } $temp2 = array(); if (!empty($spot_data['close_info_str'])) $temp2[] = $spot_data['close_info_str']; $spot_data['search_close_info'] = str_replace('
', ' ', implode(' ', $temp2)); if (!empty($spot_data['close_info_caption'])) { if (empty($spot_data['search_close_info'])) { $spot_data['search_close_info'] .= mb_strimwidth($spot_data['close_info_caption'], 0, 30, '…'); } else { $spot_data['search_close_info'] .= '…'; } } $spot_data['search_parking_info'] = mb_strimwidth($spot_data['parking_info'], 0, 30, '…'); unset($temp2, $temp3); } /* ログイン処理 */ if ($err_str === "") { if (!empty($sess_data['sms_is_login'])) { if ($sess_data['sms_login_spot_id'] == $spot_id && strtotime('-6 hours') <= $sess_data['sms_login_timestamp']) { $sms_is_login = 1; } else { unset($sess_data['sms_is_login'], $sess_data['sms_login_spot_id'], $sess_data['sms_login_timestamp']); $locomill->session->sess_data = $sess_data; $locomill->session->store_data(); } } } /* クーポンデータ取得 */ if ($err_str === "") { try { $coupon = new Coupon($locomill->get_db3()); if ($preview == 1) { $coupon_array = $coupon->get_data_array_pre($spot_id, 0, 1); } else { $coupon_array = $coupon->get_data_array(true, true, $spot_id, 0, 1); } foreach ($coupon_array AS $k => $v) { $coupon_array[$k]['contents_01'] = htmlspecialchars_textarea($v['contents_01']); } if (empty($coupon_array)) { $service_error[10] = 1; } } catch (CouponError $e) { $err_str .= $e->get_exception(); } } //フォトギャラリーデータ取得 if ($err_str == "" && $is_photo == 1) { $aLine = array(); $sql = sprintf("SELECT id,title,up_name FROM plus_photo_tbl WHERE spot_id = %d ORDER BY id", $locomill->get_db3()->escape($spot_id)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $item_num = $locomill->get_db3()->num($result); if ($item_num > 0) { $count = 0; while ($row = $locomill->get_db3()->fetch_array($result)) { if (file_exists(WEB_ROOT_DIR . $row['up_name'])) { $plus_photo_array[] = $row; $count++; } if (10 <= $count) break; } } } else { $err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect()); } } /* PlusPickupクラスインスタンス生成 */ if ($err_str === "" && $is_pickup == 1) { try { $plus_pickup = new PlusPickup($locomill->get_db3()); $plus_pickup_num = $plus_pickup->get_record_num($spot_id, 1, ($preview == 1? false: true)); if ($plus_pickup_num > 0) { $temp = $plus_pickup->get_data($spot_id, 1); $dir = array( 1 => LOCOMILL_UPIMG_PLUS_PICKUP_01_PATH, 2 => LOCOMILL_UPIMG_PLUS_PICKUP_02_PATH, 3 => LOCOMILL_UPIMG_PLUS_PICKUP_03_PATH, 4 => LOCOMILL_UPIMG_PLUS_PICKUP_04_PATH, ); $old = array( 1 => $temp['rsv_txt_48'], 2 => $temp['rsv_txt_49'], 3 => $temp['rsv_txt_50'], 4 => '', ); for ($i = 1; $i <= 4; $i++) { $plus_pickup_data[$i]['title'] = $temp[sprintf('title_%02d', $i)]; $plus_pickup_data[$i]['comment'] = linkage_url($temp[sprintf('comment_%02d', $i)], '_blank'); $plus_pickup_image = $plus_pickup_thumnail = ''; $upimg_path = $plus_pickup->get_upimg_path($i); if (!empty($temp[sprintf('image_%02d', $i)]['up_name']) && file_exists($upimg_path . '/' . $temp[sprintf('image_%02d', $i)]['up_name'])) { $plus_pickup_image = '/img' . $dir[$i] . '/' . $temp[sprintf('image_%02d', $i)]['up_name']; } elseif (!empty($old[$i])) { $plus_pickup_image = '/old_images/' . $old[$i]; } elseif (!empty($temp[sprintf('comment_%02d', $i)])) { $plus_pickup_image = LOCOMILL_UPIMG_NOIMAGE_SMALL_PATH; } $upimg_path_thum = $plus_pickup->get_upimg_path($i, 'thum'); if (!empty($temp[sprintf('image_%02d', $i)]['up_name']) && file_exists($upimg_path_thum . '/' . $temp[sprintf('image_%02d', $i)]['up_name'])) { $plus_pickup_thumnail = '/img' . $dir[$i] . '_thum/' . $temp[sprintf('image_%02d', $i)]['up_name']; } else { $plus_pickup_thumnail = $plus_pickup_image; } $plus_pickup_data[$i]['image'] = $plus_pickup_image; $plus_pickup_data[$i]['thumnail'] = $plus_pickup_thumnail; } unset($temp, $dir, $old, $plus_pickup_image); } } catch (PlusPickupError $e) { $err_str .= $e->get_exception(); } } /* PlusNetshopクラスインスタンス生成 */ if ($err_str === "" && $is_netshop == 1) { try { $plus_netshop = new PlusNetshop($locomill->get_db3()); $temp = $plus_netshop->get_data($spot_id, 1, true, ($preview == 1? false: true)); if (!empty($temp)) { if (!empty($temp['url_01'])) { $plus_netshop_data['url'] = $temp['url_01']; if (!empty($temp['url_01_title'])) { $plus_netshop_data['url_title'] = $temp['url_01_title']; } } $upimg_path = $plus_netshop->get_upimg_path(); $upimg_url = str_replace(WEB_ROOT_DIR, '', $upimg_path); $block_data = $plus_netshop->get_block_data_array($temp['id'], ($preview == 1? false: true)); foreach ($block_data AS $k => $v) { $temp2 = array(); if (!empty($v['title_01'])) { $temp2['title'] = $v['title_01']; } if (!empty($v['comment_01'])) { $temp2['comment'] = linkage_url($v['comment_01'], '_blank'); } if (!empty($v['price_01'])) { $temp2['price'] = $v['price_01']; } if (!empty($v['url_01'])) { $temp2['url'] = $v['url_01']; } if (!empty($v['image_01']['up_name']) && file_exists($upimg_path . '/' . $v['image_01']['up_name'])) { $temp2['image'] = $upimg_url . '/' . $v['image_01']['up_name']; } elseif (!empty($temp2)) { $temp2['image'] = LOCOMILL_UPIMG_NOIMAGE_SMALL_PATH; } if (!empty($temp2)) { if (!isset($plus_netshop_data['items'])) { $plus_netshop_data['items'] = array(); } $plus_netshop_data['items'][] = $temp2; } if (20 <= count($plus_netshop_data['items'])) { break; } } unset($block_data); } unset($temp); } catch (PlusNetshopError $e) { $plus_netshop_data = array(); //$err_str .= $e->get_exception(); } } /* PlusNewsクラスインスタンス生成 */ if ($err_str === "" && $is_plusnews == 1) { try { $plus_news = new PlusNews($locomill->get_db3()); $cont_array = $plus_news->get_plus_news_type_array2(); $wlist = array(); $wlist[] = sprintf('spot_id = %d', $locomill->get_db3()->escape($spot_id)); $wlist[] = 'enable = 1'; $wlist[] = sprintf('%d <= end_stamp', $now); if ($preview != 1) { $wlist[] = sprintf('start_stamp <= %d', $now); } if ($is_lightnews == 1 && $is_plus != 1 && $is_pr != 1) { $light_news_type_id = array(); if (defined('LOCOMILL_PLUS_LIGHT_NEWS_TYPE_ID')) { // ライト店舗に開放中のニュースタイプID $light_news_type_id = LOCOMILL_PLUS_LIGHT_NEWS_TYPE_ID; } if (!empty($light_news_type_id)) { $wlist2 = array(); foreach ($light_news_type_id AS $v) { $wlist2[] = sprintf('`news_type` = %d', $locomill->get_db()->escape($v)); } $wlist[] = sprintf('(%s)', implode(' OR ', $wlist2)); } } $odlist = array(); $odlist[] = 'update_date DESC'; $odlist[] = 'update_time DESC'; $odlist[] = 'id'; $temp = array(); $sql = sprintf('SELECT id FROM plus_news_tbl WHERE %s ORDER BY %s', implode(' AND ', $wlist), implode(', ', $odlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $plus_news_num = $locomill->get_db3()->num($result); if ($plus_news_num > 0) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $temp[] = $row; $count++; if (3 < $count) break; } } } else { throw new PlusNewsError("・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect())); } if (!empty($temp)) { foreach ($temp AS $k => $v) { $v = $plus_news->get_data($v['id']); $temp2 = array(); $temp2['TITLE'] = htmlspecialchars($v['title_01']); $temp2['COMMENT'] = htmlspecialchars(mb_strimwidth($v['comment_01'], 0, 100, '…')); $temp2['TYPE'] = $cont_array[$v['news_type']]; $temp2['TYPE_ID'] = $v['news_type']; $temp2['IS_NEW'] = $temp2['IS_UPDATE'] = 0; if ($now - $v['entry_stamp'] < (60 * 60 * 24)) { $temp2['IS_NEW'] = 1; } elseif ($now - $v['update_stamp'] < (60 * 60 * 24)) { $temp2['IS_UPDATE'] = 1; } $temp2['MOVIE_ID'] = ($is_news_movie == 1)? get_movie_id($v['movie_url']): ''; $upimg_path = $plus_news->get_upimg_path(1); if (!empty($v['image_01']['up_name']) && file_exists($upimg_path . '/' . $v['image_01']['up_name'])) { $temp2['IS_IMAGE'] = 1; $temp2['IMAGE'] = '/img' . LOCOMILL_UPIMG_PLUS_NEWS_01_PATH . '/' . $v['image_01']['up_name']; } elseif (!empty($v['rsv_txt_50']) && file_exists(WEB_ROOT_DIR . '/old_images/' . $v['rsv_txt_50'])) { $temp2['IS_IMAGE'] = 1; $temp2['IMAGE'] = '/old_images/' . $v['rsv_txt_50']; } else { $temp2['IS_IMAGE'] = 0; $temp2['IMAGE'] = ''; } $upimg_path_thum = $plus_news->get_upimg_path(1, 'thum'); if (!empty($v['image_01']['up_name']) && file_exists($upimg_path_thum . '/' . $v['image_01']['up_name'])) { $temp2['THUMNAIL'] = '/img' . LOCOMILL_UPIMG_PLUS_NEWS_01_PATH . '_thum/' . $v['image_01']['up_name']; } else { $temp2['THUMNAIL'] = $temp2['IMAGE']; } $plus_news_array[$v['id']] = $temp2; } } unset($wlist, $odlist, $temp, $temp2); } catch (PlusNewsError $e) { $err_str .= $e->get_exception(); } } /* PresentItemクラスインスタンス生成 */ if ($err_str === "") { try { $present_item = new PresentItem($locomill->get_db3()); $wlist = array(); $wlist[] = sprintf('spot_id = %d', $locomill->get_db3()->escape($spot_id)); $wlist[] = 'enable = 1'; $wlist[] = sprintf('%d <= end_stamp', $now); if ($preview != 1) { $wlist[] = sprintf('start_stamp <= %d', $now); } $wlist2 = array(); $wlist2[] = 'enable = 1'; $wlist2[] = 'is_dispose != 2'; if ($preview != 1) { $wlist2[] = sprintf('display_01_stamp <= %d', $now); } $wlist[] = sprintf('present_id IN (SELECT id FROM present_tbl WHERE %s)', implode(' AND ', $wlist2)); $odlist = array(); $odlist[] = 'start_stamp DESC'; $odlist[] = 'id'; $temp = array(); $sql = sprintf('SELECT id FROM present_item_tbl WHERE %s ORDER BY %s', implode(' AND ', $wlist), implode(', ', $odlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $present_num = $locomill->get_db3()->num($result); if ($present_num > 0) { while ($row = $locomill->get_db3()->fetch_array($result)) { $temp[] = $row; } } } else { throw new PresentItemError("・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect())); } if (!empty($temp)) { foreach ($temp AS $k => $v) { $v = $present_item->get_data($v['id']); $temp2 = array(); $temp2['NAME'] = htmlspecialchars($v['name_01']); $temp2['NUM'] = (!empty($v['lottery_max_txt']))? htmlspecialchars($v['lottery_max_txt']): $v['lottery_max'] . '名'; $temp2['PRESENT_ID'] = $v['present_id']; if (!empty($v['image_01']['up_name']) && file_exists(UPIMG_BASE_PATH . LOCOMILL_UPIMG_PRESENT_ITEM_PATH . '/' . $v['image_01']['up_name'])) { $temp2['IS_IMAGE'] = 1; $temp2['IMAGE'] = '/img' . LOCOMILL_UPIMG_PRESENT_ITEM_PATH . '/' . $v['image_01']['up_name']; } else { $temp2['IS_IMAGE'] = 0; $temp2['IMAGE'] = ''; } $present_array[$v['id']] = $temp2; } } unset($wlist, $wlist2, $odlist, $temp, $temp2); } catch (PresentItemError $e) { $err_str .= $e->get_exception(); } } /* MemberMaster07クラスインスタンス生成 */ if ($err_str === "") { try { $member_master_07 = new MemberMaster07($locomill->get_db3()); if ($preview != 1) { $temp = $member_master_07->get_data_array_by_spot_id($spot_data['id']); } else { $temp = $member_master_07->get_data_array_by_spot_id($spot_data['id'], false); } } catch (MemberMaster07Error $e) { $temp = array(); } foreach ($temp AS $v) { $temp2 = array(); $temp2['id'] = htmlspecialchars($v['id']); $temp2['name'] = htmlspecialchars($v['name_01']); $temp2['point'] = htmlspecialchars($v['point']); $point_data[] = $temp2; } unset($temp, $temp2); } /* AreaFanクラスインスタンス生成 */ if ($err_str === "") { try { $area_fan = new AreaFan($locomill->get_db3(), 'nasu'); if ($preview != 1) { $nasu_point_data = $area_fan->get_item_data_by_spot_id($spot_data['id'], 0); } else { $nasu_point_data = $area_fan->get_item_data_by_spot_id($spot_data['id'], 0, false); } } catch (AreaFanError $e) { $nasu_point_data = array(); } foreach ($nasu_point_data AS &$v) { $v = $area_fan->item_adjust($v); } unset($v); } /* Featureクラスインスタンス生成 */ if ($err_str === "") { try { $feature = new Feature($locomill->get_db3()); } catch (FeatureError $e) { $err_str .= $e->get_exception(); } } if ($err_str === "") { $_feature_array = array(); $wlist = array(); $wlist2 = array(); $wlist2[] = sprintf('`shop_id` = %d', $spot_id); $wlist2[] = sprintf('`id` IN (SELECT `document_id` FROM `feature_document_block_tbl` WHERE `enable` = 1 AND `spot_id` = %d)', $spot_id); $wlist2[] = sprintf('`id` IN (SELECT `document_id` FROM `feature_document_block_tbl` WHERE `enable` = 1 AND FIND_IN_SET(%d, `kuchikomi_spot_id`))', $spot_id); $wlist[] = sprintf('(%s)', implode(' OR ', $wlist2)); $wlist[] = '`enable` = 1'; $wlist[] = '`enable_pc` = 1'; if ($preview != 1) { $wlist[] = sprintf("open_stamp <= '%s'", date('Y-m-d H:i:s', $now)); } $wlist[] = sprintf("'%s' <= close_stamp", date('Y-m-d H:i:s', $now)); $wlist2 = array(); $wlist2[] = '`enable` = 1'; $wlist2[] = '`enable_pc` = 1'; if ($preview != 1) { $wlist2[] = sprintf("open_stamp <= '%s'", date('Y-m-d H:i:s', $now)); } $wlist2[] = sprintf("'%s' <= close_stamp", date('Y-m-d H:i:s', $now)); $wlist[] = sprintf('`feature_id` IN (SELECT `id` FROM `feature_tbl` WHERE %s)', implode(' AND ', $wlist2)); $sql = sprintf('SELECT `id` FROM `feature_document_tbl` WHERE %s ORDER BY `open_stamp` DESC, `id` DESC', implode(' AND ', $wlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $feature_num = $locomill->get_db3()->num($result); if ($feature_num > 0) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $_feature_array[] = $row; $count++; if (3 < $count) { break; } } } } else { $err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect()); } if (!empty($_feature_array)) { foreach ($_feature_array AS $v) { try { $document_data = $feature->get_document($v['id']); $document_data = $feature->document_smarty_format($document_data); } catch (FeatureError $e) { continue; } try { $feature_data = $feature->get_data($document_data['feature_id']); $feature_data = $feature->feature_smarty_format($feature_data); } catch (FeatureError $e) { continue; } $temp = array(); $temp['id'] = $document_data['id']; $temp['title_01'] = strip_tags($document_data['title_01']); $temp['public_date'] = $document_data['public_date']; $temp['report_date'] = $document_data['report_date']; $temp['description'] = $document_data['description']; $temp['image_01_src'] = (!empty($document_data['image_01_src']))? $document_data['image_01_src']: $feature_data['image_17_src']; $temp['is_new'] = 0; if ($now - strtotime($document_data['public_date']) < (60 * 60 * 24)) { $temp['is_new'] = 1; } $temp['feature_id'] = $feature_data['id']; $temp['feature_title'] = strip_tags($feature_data['title_01']); $temp['type_id'] = $feature_data['type_id']; $feature_array[] = $temp; unset($document_data, $feature_data); } } unset($_feature_array); } /* Entryクラスインスタンス生成 */ if ($err_str === "") { try { $entry = new Entry($locomill->get_db3()); } catch (EntryError $e) { $err_str .= $e->get_exception(); } } if ($err_str === "") { $_entry_array = array(); $wlist = array(); $wlist[] = "`theme_key` != ''"; $wlist[] = '`enable` = 1'; $wlist[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); $wlist[] = sprintf('FIND_IN_SET(%d, `spot_ids`)', $spot_id); $sql = sprintf('SELECT `id` FROM `entry_tbl` WHERE %s ORDER BY `update_stamp` DESC', implode(' AND ', $wlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $entry_num = $locomill->get_db3()->num($result); if (0 < $entry_num) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $_entry_array[] = $row; $count++; if (3 < $count) { break; } } } } else { $err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect()); } if (!empty($_entry_array)) { $upimg_path_01 = $entry->get_upimg_path(); foreach ($_entry_array AS $v) { try { $entry_data = $entry->get_data($v['id']); } catch (EntryError $e) { continue; } $entry_data['update_date'] = date('Y/m/d', $entry_data['update_stamp']); if (!empty($entry_data['image_01']['up_name']) && file_exists($upimg_path_01 . '/' . $entry_data['image_01']['up_name'])) { $entry_data['image_01_src'] = '/img/entry/' . $entry_data['image_01']['up_name']; } else { $entry_data['image_01_src'] = ''; } $entry_data['is_new'] = $entry_data['is_up'] = 0; if ($now - $entry_data['start_stamp'] < (60 * 60 * 24)) { $entry_data['is_new'] = 1; } elseif ($now - $entry_data['update_stamp'] < (60 * 60 * 24)) { $entry_data['is_up'] = 1; } $entry_array[] = $entry_data; unset($entry_data); } } unset($_entry_array); } /* AreaGroupクラスインスタンス生成 */ if ($err_str === "") { try { $area_group = new AreaGroup($locomill->get_db3()); } catch (AreaGroupError $e) { $err_str .= $e->get_exception(); } } if ($err_str === "") { $_area_group_array = array(); $wlist = array(); $wlist[] = '`enable` = 1'; $wlist[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); $wlist[] = sprintf('FIND_IN_SET(%d, `spot_ids`)', $spot_id); $sql = sprintf('SELECT `id` FROM `area_group_tbl` WHERE %s ORDER BY `update_stamp` DESC', implode(' AND ', $wlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $area_group_num = $locomill->get_db3()->num($result); if (0 < $area_group_num) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $_area_group_array[] = $row; $count++; if (3 < $count) { break; } } } } else { $err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect()); } if (!empty($_area_group_array)) { $upimg_path_01 = $area_group->get_upimg_path(); foreach ($_area_group_array AS $v) { try { $area_group_data = $area_group->get_data($v['id']); } catch (area_groupError $e) { continue; } if (array_key_exists($area_group_data['area_03_id'], $area_top)) { $area_group_data['link'] = sprintf('/%s/group.shtml?id=%d', $area_top[$area_group_data['area_03_id']], $area_group_data['id']); } else { $area_group_data['link'] = sprintf('/area/group/?id=%d', $area_group_data['id']); } $area_group_data['update_date'] = date('Y/m/d', $area_group_data['update_stamp']); $area_group_data['caption_01'] = strip_tags($area_group_data['caption_01']); if (!empty($area_group_data['image_02']['up_name']) && file_exists($upimg_path_01 . '/' . $area_group_data['image_02']['up_name'])) { $area_group_data['image_02_src'] = str_replace(WEB_ROOT_DIR, '', $upimg_path_01) . '/' . $area_group_data['image_02']['up_name']; } else { $area_group_data['image_02_src'] = '/spot/home/images/areaguide.png'; } $area_group_data['is_new'] = $area_group_data['is_up'] = 0; if ($now - $area_group_data['start_stamp'] < (60 * 60 * 24)) { $area_group_data['is_new'] = 1; } elseif ($now - $area_group_data['update_stamp'] < (60 * 60 * 24)) { $area_group_data['is_up'] = 1; } $area_group_array[] = $area_group_data; unset($area_group_data); } } unset($_area_group_array); } /* Themeクラスインスタンス生成 */ if ($err_str === "") { try { $theme = new Theme($locomill->get_db3()); } catch (ThemeError $e) { $err_str .= $e->get_exception(); } } if ($err_str === "" && !empty($spot_data['theme_id'])) { $_theme_array = array(); $wlist = array(); $wlist[] = "`theme_key` != ''"; $wlist[] = '`enable` = 1'; $wlist[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); $wlist[] = sprintf('`id` IN (%s)', $spot_data['theme_id']); $sql = sprintf('SELECT `id` FROM `theme_tbl` WHERE %s ORDER BY `update_stamp` DESC', implode(' AND ', $wlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $theme_num = $locomill->get_db3()->num($result); if (0 < $theme_num) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $_theme_array[] = $row; $count++; if (3 < $count) { break; } } } } else { $err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect()); } if (!empty($_theme_array)) { $upimg_path_01 = $theme->get_upimg_path(); foreach ($_theme_array AS $v) { try { $theme_data = $theme->get_data($v['id']); } catch (ThemeError $e) { continue; } $theme_data['update_date'] = date('Y/m/d', $theme_data['update_stamp']); if (!empty($theme_data['image_02']['up_name']) && file_exists($upimg_path_01 . '/' . $theme_data['image_02']['up_name'])) { $theme_data['image_02_src'] = '/img/theme/' . $theme_data['image_02']['up_name']; } else { $theme_data['image_02_src'] = ''; } $theme_data['is_new'] = $theme_data['is_up'] = 0; if ($now - $theme_data['start_stamp'] < (60 * 60 * 24)) { $theme_data['is_new'] = 1; } elseif ($now - $theme_data['update_stamp'] < (60 * 60 * 24)) { $theme_data['is_up'] = 1; } $theme_array[] = $theme_data; unset($theme_data); } } unset($_theme_array); } /* Flowerクラスインスタンス生成 */ if ($err_str === "") { try { $flower = new Flower($locomill->get_db3()); } catch (FlowerError $e) { $err_str .= $e->get_exception(); } } /* FlowerSpotクラスインスタンス生成 */ if ($err_str === "") { try { $flower_spot = new FlowerSpot($locomill->get_db3()); } catch (FlowerSpotError $e) { $err_str .= $e->get_exception(); } } if ($err_str === "") { $_flower_array = array(); $wlist = array(); $wlist[] = sprintf('s.`spot_id` = %d', $spot_id); $wlist[] = 's.`enable` = 1'; $wlist[] = 'f.`enable` = 1'; $sql = sprintf('SELECT s.`id` FROM `flower_spot_tbl` s LEFT JOIN `flower_tbl` f ON s.`flower_id` = f.`id` WHERE %s ORDER BY f.`update_stamp` DESC', implode(' AND ', $wlist)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $flower_num = $locomill->get_db3()->num($result); if (0 < $flower_num) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $_flower_array[] = $row; $count++; if (3 < $count) { break; } } } } else { $err_str .= "・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect()); } if (!empty($_flower_array)) { $upimg_path = $flower->get_upimg_path(); $upimg_src = str_replace(WEB_ROOT_DIR, '', $upimg_path); foreach ($_flower_array AS $v) { try { $v = $flower_spot->get_data($v['id']); } catch (FlowerSpotError $e) { continue; } try { $flower_data = $flower->get_data($v['flower_id']); } catch (FlowerError $e) { continue; } $temp = array(); $temp['flower_id'] = $flower_data['id']; $temp['name_01'] = $flower_data['name_01']; if (!empty($flower_data['image_01']['up_name']) && file_exists($upimg_path . '/' . $flower_data['image_01']['up_name'])) { $temp['image_src'] = $upimg_src . '/' . $flower_data['image_01']['up_name']; } else { $temp['image_src'] = LOCOMILL_UPIMG_NOIMAGE_PATH; } $temp['comment_01'] = strip_tags($flower_data['comment_01']); $flower_array[] = $temp; unset($v, $flower_data); } } unset($_flower_array); } /* Kuchikomiクラスインスタンス生成 */ if ($err_str === "") { try { $kuchikomi = new Kuchikomi($locomill->get_db3()); $sql = $kuchikomi->get_id_query(1, $spot_id, ($preview == 1? 'pre': true), array('is_comment' => 1)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $kuchikomi_num = $locomill->get_db3()->num($result); } else { throw new KuchikomiError("・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect())); } if (0 < $kuchikomi_num) { $sql = $kuchikomi->get_id_query(1, $spot_id, ($preview == 1? 'pre': true), array('is_comment' => 1, 'limit' => 3)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { while ($row = $locomill->get_db3()->fetch_array($result)) { $kuchikomi_array[$row['id']] = $kuchikomi->adjust($row['id'], $login_user_id, false, $spot_data); } } else { throw new KuchikomiError("・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect())); } } $sql = $kuchikomi->get_id_query(1, $spot_id, ($preview == 1? 'pre': true), array('is_img' => 1)); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $kuchikomi_img_num = $locomill->get_db3()->num($result); if ($kuchikomi_img_num > 0) { $count = 1; while ($row = $locomill->get_db3()->fetch_array($result)) { $kuchikomi_img_array[$row['id']] = $kuchikomi->adjust($row['id'], $login_user_id); $count++; if (4 < $count) { break; } } } } else { throw new KuchikomiError("・データの参照に失敗しました。
" . mysqli_error($locomill->get_db3()->get_db_connect())); } $cond = array(); $cond['is_comment'] = 1; $cond['is_reply'] = 1; $sql = $kuchikomi->get_id_query(1, $spot_id, true, $cond); $result = $locomill->get_db3()->query($sql); if ($result !== false) { $kuchikomi_reply_num = $locomill->get_db3()->num($result); } } catch (KuchikomiError $e) { $err_str .= $e->get_exception(); } } /* KuchikomiTagクラスインスタンス生成 */ if ($err_str === "") { try { $kuchikomi_tag = new KuchikomiTag($locomill->get_db3()); $cat_03 = array(); for ($i = 1; $i <= 5; $i++) { $cat_03[] = $spot_data[sprintf('category_%02d_03_id', $i)]; } $temp = $kuchikomi_tag->get_data_array(true, 1, $cat_03, $spot_id, true); foreach ($temp AS $v) { $kuchikomi_tag_array[$v['id']] = $v['name']; } } catch (KuchikomiTagError $e) { $err_str .= $e->get_exception(); } } /* KuchikomiMasterクラスインスタンス生成 */ if ($err_str === "") { try { $kuchikomi_master = new KuchikomiMaster($locomill->get_db3()); $temp = $kuchikomi_master->get_data_array(0, $spot_id, 4); foreach ($temp AS $v) { try { $master_member_data = $member->get_data($v['member_id']); } catch (MemberError $e) { continue; } try { $myimage_data = $avatar_image->get_data($master_member_data['avatar_icon']); } catch(MemberMaster04Error $e) { $myimage_data = array(); } $temp = array(); $temp['member_name'] = $master_member_data['avatar_nickname']; $temp['member_id'] = $master_member_data['id']; if (!empty($myimage_data['image_02']['up_name']) && file_exists(UPIMG_BASE_PATH . LOCOMILL_UPIMG_MEMBER_MASTER_04_02_PATH . '/' . $myimage_data['image_02']['up_name'])) { $temp['member_image'] = '/img' . LOCOMILL_UPIMG_MEMBER_MASTER_04_02_PATH . '/' . $myimage_data['image_02']['up_name']; } elseif (!empty($myimage_data['image_01']['up_name']) && file_exists(UPIMG_BASE_PATH . LOCOMILL_UPIMG_MEMBER_MASTER_04_01_PATH . '/' . $myimage_data['image_01']['up_name'])) { $temp['member_image'] = '/img' . LOCOMILL_UPIMG_MEMBER_MASTER_04_01_PATH . '/' . $myimage_data['image_01']['up_name']; } else { $temp['member_image'] = '/common/img/toto.gif'; } if ($v['year'] == date('Y') && $v['month'] == date('n')) { $temp['is_new'] = 1; } else { $temp['is_new'] = 0; } $kuchikomi_master_array[] = $temp; unset($master_member_data, $myimage_data); } unset($temp); } catch (KuchikomiMasterError $e) { $err_str .= $e->get_exception(); } } // キーワードランキング if ($err_str === "" && $spot_data['kuchikomi_keyword_flg'] != 2) { try { $kuchikomi_keyword_array = $kuchikomi->get_keyword_rank($spot_id); } catch (KuchikomiError $e) { $kuchikomi_keyword_array = array(); } } $smarty->assign("KUCHIKOMI_KEYWORD_ARRAY", $kuchikomi_keyword_array); /* テイクアウト連携 */ $takeout_user_id = 0; $takeout_menu_num = 0; $takeout_menu_data = array(); if ($err_str === "" && $is_takeout == 1) { try { // ユーザー確認 $wlist = array(); $wlist[] = sprintf('`outside_id` = %d', $locomill->get_db3()->escape($spot_id)); if ($preview != 1) { $wlist[] = "`enable` = 'Y'"; } $wlist[] = "`id` IN (SELECT `user_id` FROM `takeout_commons` WHERE `site_public` = 'Y')"; $sql = sprintf("SELECT `id` FROM `takeout_users` WHERE %s LIMIT 1", implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db3()->query($sql); if ($result !== false) { if (0 < $locomill->get_db3()->num($result)) { $temp = $locomill->get_db3()->fetch_array($result); $takeout_user_id = $temp['id']; unset($temp); } } if (!empty($takeout_user_id)) { // メニュー取得 $wlist = array(); $wlist[] = sprintf('`user_id`= %d', $locomill->get_db3()->escape($takeout_user_id)); $wlist[] = "`trash` = 'N'"; $wlist[] = "`enable` = 'Y'"; $wlist[] = sprintf("('%s' BETWEEN `start_date` AND `end_date`)", date('Y-m-d')); $sql = sprintf("SELECT * FROM `takeout_menus` WHERE %s ORDER BY `range` ASC", implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db3()->query($sql); if ($result !== false) { $takeout_menu_num = $locomill->get_db3()->num($result); if (0 < $takeout_menu_num) { while ($row = $locomill->get_db3()->fetch_array($result)) { $temp = array(); $temp['name'] = $row['name']; $temp['price'] = $row['price']; if (!empty($row['img1']) && file_exists(WEB_ROOT_DIR . '/takeout/common/sysfile/menus/' . $row['img1'])) { $temp['image_src'] = '/takeout/common/sysfile/menus/' . $row['img1']; } else { $temp['image_src'] = ''; } $takeout_menu_data[] = $temp; unset($temp); if (3 <= count($takeout_menu_data)) { break; } } } } } } catch (LocomillError $e) { $err_str .= $e->get_exception(); } } /* スタンプラリー */ $stamprally_array = array(); if ($err_str === "") { try { $temp = $stamprally->get_data_array($spot_data, true); foreach ($temp AS $v) { $stamprally_array[] = $stamprally->get_data($v['id']); } unset($temp); } catch (StamprallyError $e) { $this->err_str = $e->get_exception(); } } // 予約システムカレンダー if ($err_str === "" && $is_reserve == 1) { try { $reserve_calendar = $spot->get_reserve_calendar($spot_id); } catch (SpotError $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); // サービス内容 $service_01 = $spot_data['service_01_id'] . '_10_11_15_16_17_18_19_88'; $disp_array = $payment_array = $seat_array = $child_array = $delivery_array = $facility_array = $smoking_array = array(); $temp_array = array_diff(array_unique(explode('_', $service_01)), array('')); if (!empty($temp_array)) { foreach ($service_array AS $v) { // サービスの有効性チェック追加 if (in_array($v['id'], $temp_array)) { $tmp = array('NAME' => $v['name_01'], 'COLOR' => $service_category_array[$v['category']]['icon_color'], 'IMG' => (isset($v['image_01']['up_name'])? "/img" . LOCOMILL_UPIMG_SERVICE_PATH . "/" . $v['image_01']['up_name']: '')); if (isset($service_error[$v['id']]) && $service_error[$v['id']] == 1) { } elseif ($v['category'] == 12) { $facility_array[] = $tmp; // 12:設備 } elseif ($v['category'] == 16) { $child_array[] = $tmp; // 16:お子様 } elseif ($v['category'] == 17) { $payment_array[] = $tmp; // 17:決済 } elseif ($v['category'] == 18) { $delivery_array[] = $tmp; // 18:宅配・発送 } elseif ($v['category'] == 19) { $smoking_array[] = $tmp; // 19:喫煙・禁煙 } elseif ($v['category'] == 20) { $seat_array[] = $tmp; // 20:席 } else { $disp_array[] = $tmp; } } } } $smarty->assign_ex("SERVICE_01_ARRAY", $disp_array); $smarty->assign_ex("PAYMENT_ARRAY", $payment_array); $smarty->assign_ex("SEAT_ARRAY", $seat_array); $smarty->assign_ex("CHILD_ARRAY", $child_array); $smarty->assign_ex("DELIVERY_ARRAY", $delivery_array); $smarty->assign_ex("FACILITY_ARRAY", $facility_array); $smarty->assign_ex("SMOKING_ARRAY", $smoking_array); $smarty->assign_ex("SERVICE_CATEGORY_ARRAY", $service_category_array); // バリアフリー $disp_array = array(); $temp_array = array_diff(array_unique(explode('_', $spot_data['barrier_01_id'])), array('')); if (!empty($temp_array)) { foreach ($temp_array AS $v) { $disp_array[] = array("NAME" => $barrier_array[$v]); } } $smarty->assign_ex("BARRIER_01_ARRAY", $disp_array); // クーポン情報 $smarty->assign_ex("COUPON", $coupon_array, ""); // フォトギャラリー $smarty->assign_ex("PHOTO_DATA", $plus_photo_array); // プラス・ピックアップ $smarty->assign_ex("PICKUP_NUM", $plus_pickup_num); $smarty->assign_ex("PICKUP_DATA", $plus_pickup_data); // ネットショップ $smarty->assign_ex("NETSHOP_DATA", $plus_netshop_data); // プラス・ニュース $smarty->assign_ex("NEWS_NUM", $plus_news_num); $smarty->assign_ex("NEWS_ARRAY", $plus_news_array); // プレゼント $smarty->assign_ex("PRESENT_ARRAY", $present_array); // ポイント交換プレゼントデータ $smarty->assign_ex("POINT_DATA", $point_data); $smarty->assign_ex("NASU_POINT_DATA", $nasu_point_data); // 特集 $smarty->assign_ex("FEATURE_NUM", $feature_num); $smarty->assign_ex("FEATURE_ARRAY", $feature_array); $smarty->assign_ex("ENTRY_NUM", $entry_num); $smarty->assign_ex("ENTRY_ARRAY", $entry_array); $smarty->assign_ex("AREA_GROUP_NUM", $area_group_num); $smarty->assign_ex("AREA_GROUP_ARRAY", $area_group_array); $smarty->assign_ex("THEME_NUM", $theme_num); $smarty->assign_ex("THEME_ARRAY", $theme_array); $smarty->assign_ex("FLOWER_NUM", $flower_num); $smarty->assign_ex("FLOWER_ARRAY", escapeHTML($flower_array)); // クチコミデータ $smarty->assign_ex("KUCHIKOMI_NUM", $kuchikomi_num, "0"); $smarty->assign("KUCHIKOMI_ARRAY", $kuchikomi_array); $smarty->assign("KUCHIKOMI_REPLY_NUM", $kuchikomi_reply_num); $smarty->assign("KUCHIKOMI_IMG_ARRAY", $kuchikomi_img_array); $smarty->assign("KUCHIKOMI_IMG_NUM", $kuchikomi_img_num); // 常連 $smarty->assign("KUCHIKOMI_MASTER_NUM", count($kuchikomi_master_array)); $smarty->assign("KUCHIKOMI_MASTER_ARRAY", $kuchikomi_master_array); // ぐっとタイプ $smarty->assign("GOOD_TYPE_ARRAY", escapeHTML($good_type_array)); // テイクアウトメニュー $smarty->assign_ex("TAKEOUT_MENU_NUM", $takeout_menu_num); $smarty->assign_ex("TAKEOUT_MENU_DATA", $takeout_menu_data); // スタンプラリー $smarty->assign_ex("STAMPRALLY_ARRAY", escapeHTML($stamprally_array)); // 予約システムカレンダー $smarty->assign("RESERVE_CALENDAR", $reserve_calendar); // 閲覧履歴 $tmp_area = $tmp_category = array(); $recent_spot_array = array(); if ($err_str === "") { try { if (empty($locomill->session)) { // セッション生成 $locomill->session = new Session($locomill->get_db(), ""); $locomill->session->start(); $locomill->session->user_id = -1; } $recent_spots = array(); $recent_spot_ids = array(); $recent_spot_ids[] = $spot_data['id']; if (!empty($locomill->session->sess_data['recent_spots'])) { $recent_spots = $locomill->session->sess_data['recent_spots']; foreach ($recent_spots AS $v) { try { $tmp = $spot->get_data((int)$v); if ($tmp['enable'] == 1 && $tmp['is_closed'] != 1 && $tmp['start_stamp'] <= $now && $now <= $tmp['end_stamp']) { if (!isset($tmp_area[$tmp['area_03_id']])) { $tmp_area[$tmp['area_03_id']] = (!empty($tmp['area_03_id']))? $area->get_name('area_master_03_tbl', $tmp['area_03_id']): ''; } if (!isset($tmp_category[$tmp['category_01_03_id']])) { $tmp_category[$tmp['category_01_03_id']] = (!empty($tmp['category_01_03_id']))? $category->get_name(3, $tmp['category_01_03_id']): ''; } $tmp['area_03_name'] = $tmp_area[$tmp['area_03_id']]; $tmp['category_01_03_name'] = $tmp_category[$tmp['category_01_03_id']]; $upimg_path_01 = $spot->get_upimg_path(1); if (!empty($tmp['image_01']['up_name']) && file_exists($upimg_path_01.'/'.$tmp['image_01']['up_name'])) { $tmp['image_01_src'] = '/img' . LOCOMILL_UPIMG_SPOT_01_PATH . '/' . $tmp['image_01']['up_name']; } elseif (!empty($tmp['rsv_txt_06']) && file_exists(WEB_ROOT_DIR.'/old_images/'.$tmp['rsv_txt_06'])) { $tmp['image_01_src'] = '/old_images/'.$tmp['rsv_txt_06']; } else { $tmp['image_01_src'] = '/common/img/s_img.jpg'; } $recent_spot_array[] = $tmp; if ($spot_data['id'] != $tmp['id'] && count($recent_spot_ids) < 20) { $recent_spot_ids[] = $v; } unset($tmp); } } catch (SpotError $e) { continue; } catch (AreaError $e) { continue; } catch (CategoryError $e) { continue; } } } $locomill->session->sess_data['recent_spots'] = $recent_spot_ids; $locomill->session->store_data(); unset($recent_spots, $recent_spot_ids); } catch (LocomillError $e) { $err_str .= $e->get_exception(); } } $smarty->assign("RECENT_SPOT_ARRAY", $recent_spot_array); // 同じジャンルのお気に入り $recommend_array = array(); if ($err_str === "" && $is_login == 1) { try { for ($i = 1; $i <= 3; $i++) { $recommend_array[$i] = array(); $wlist = array(); $wlist[] = sprintf('`member_id` = %d', $locomill->get_db7()->escape($login_user_id)); $wlist[] = '`type` = 1'; $wlist[] = '`folder_id` = 0'; $wlist2 = array(); $wlist2[] = sprintf('`id` != %d', $spot_data['id']); $wlist2[] = '`enable` = 1'; $wlist2[] = '`is_closed` != 1'; $wlist2[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); if ($i == 1 || $i == 2) { $tmp = array(); for ($j = 1; $j <= 5; $j++) { $tmp[] = sprintf('`category_%02d_03_id` = %d', $j, $spot_data['category_01_03_id']); } $wlist2[] = sprintf('(%s)', implode(' OR ', $tmp)); } if ($i == 1 || $i == 3) { $wlist2[] = sprintf('`area_03_id` = %d', $spot_data['area_03_id']); } $wlist[] = sprintf('`spot_id` IN (SELECT `id` FROM `spot_tbl` WHERE %s)', implode(' AND ', $wlist2)); $sql = sprintf('SELECT `id`,`spot_id` FROM `member_wishlist_tbl` WHERE %s ORDER BY rand() LIMIT 20', implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db7()->query($sql); if ($result !== false) { if (0 < $locomill->get_db7()->num($result)) { while($row = $locomill->get_db7()->fetch_array($result)) { $recommend_array[$i][] = $row; } } } else { throw new LocomillError('・データの参照に失敗しました。
' . mysqli_error($locomill->get_db7()->get_db_connect())); } } foreach ($recommend_array AS $i => $list) { foreach ($list AS $k => $v) { try { $tmp = $spot->get_data($v['spot_id']); if (!isset($tmp_area[$tmp['area_03_id']])) { $tmp_area[$tmp['area_03_id']] = (!empty($tmp['area_03_id']))? $area->get_name('area_master_03_tbl', $tmp['area_03_id']): ''; } if (!isset($tmp_category[$tmp['category_01_03_id']])) { $tmp_category[$tmp['category_01_03_id']] = (!empty($tmp['category_01_03_id']))? $category->get_name(3, $tmp['category_01_03_id']): ''; } $tmp['area_03_name'] = $tmp_area[$tmp['area_03_id']]; $tmp['category_01_03_name'] = $tmp_category[$tmp['category_01_03_id']]; $upimg_path_01 = $spot->get_upimg_path(1); if (!empty($tmp['image_01']['up_name']) && file_exists($upimg_path_01.'/'.$tmp['image_01']['up_name'])) { $tmp['image_01_src'] = '/img' . LOCOMILL_UPIMG_SPOT_01_PATH . '/' . $tmp['image_01']['up_name']; } elseif (!empty($tmp['rsv_txt_06']) && file_exists(WEB_ROOT_DIR.'/old_images/'.$tmp['rsv_txt_06'])) { $tmp['image_01_src'] = '/old_images/'.$tmp['rsv_txt_06']; } else { $tmp['image_01_src'] = '/common/img/s_img.jpg'; } $recommend_array[$i][$k] = $tmp; unset($tmp); } catch (SpotError $e) { continue; } catch (AreaError $e) { continue; } catch (CategoryError $e) { continue; } } } } catch (LocomillError $e) { $err_str .= $e->get_exception(); } } $smarty->assign("RECOMMEND_ARRAY", $recommend_array); // 関連スポット $relation_spot_array = array(); if ($err_str === "") { try { require_once('admin/locomill_client.inc'); require_once('admin/locomill_client_group.inc'); $lc_data = $lcg_data = array(); $lcg_id = $lcg_name = ''; try { $lc = new LocomillClient($locomill->get_db7()); $lcg = new LocomillClientGroup($locomill->get_db7()); $lc_data = $lc->get_data($spot_data['client_id']); $lcg_data = $lcg->get_data($lc_data['group_id']); $lcg_id = $lcg_data['id']; $lcg_name = $lcg_data['name_01_name']; } catch (LocomillClientError $e) { } catch (LocomillClientGroupError $e) { } unset($lc_data, $lcg_data); if (!empty($lcg_id)) { $_relation_spot_array = array(); $lcg_sql = sprintf("SELECT `id` FROM `locomill_client_group_tbl` WHERE (`id` = %d OR `name_01_name` = '%s')", $lcg_id, $locomill->get_db7()->escape($lcg_name)); $lc_sql = sprintf('SELECT `id` FROM `locomill_client_tbl` WHERE `group_id` IN (%s)', $lcg_sql); $wlist2 = array(); $wlist2[] = sprintf('`client_id` IN (%s)', $lc_sql); $wlist2[] = sprintf("(`area_03_id` = %d AND `area_id` = %d AND `address_01` = '%s')", $spot_data['area_03_id'], $spot_data['area_id'], $spot_data['address_01']); $wlist = array(); $wlist[] = sprintf('`id` != %d', $spot_data['id']); $wlist[] = '`enable` = 1'; $wlist[] = '`is_closed` != 1'; $wlist[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); $wlist[] = sprintf('(%s)', implode(' OR ', $wlist2)); $sql = sprintf('SELECT `id` FROM `spot_tbl` WHERE %s ORDER BY rand() LIMIT 20', implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db7()->query($sql); if ($result !== false) { if (0 < $locomill->get_db7()->num($result)) { while($row = $locomill->get_db7()->fetch_array($result)) { $_relation_spot_array[] = $row; } } } else { throw new LocomillError('・データの参照に失敗しました。
' . mysqli_error($locomill->get_db7()->get_db_connect())); } if (!empty($_relation_spot_array)) { foreach ($_relation_spot_array AS $k => $v) { try { $tmp = $spot->get_data((int)$v['id']); if (!isset($tmp_area[$tmp['area_03_id']])) { $tmp_area[$tmp['area_03_id']] = (!empty($tmp['area_03_id']))? $area->get_name('area_master_03_tbl', $tmp['area_03_id']): ''; } if (!isset($tmp_category[$tmp['category_01_03_id']])) { $tmp_category[$tmp['category_01_03_id']] = (!empty($tmp['category_01_03_id']))? $category->get_name(3, $tmp['category_01_03_id']): ''; } $tmp['area_03_name'] = $tmp_area[$tmp['area_03_id']]; $tmp['category_01_03_name'] = $tmp_category[$tmp['category_01_03_id']]; $upimg_path_01 = $spot->get_upimg_path(1); if (!empty($tmp['image_01']['up_name']) && file_exists($upimg_path_01.'/'.$tmp['image_01']['up_name'])) { $tmp['image_01_src'] = '/img' . LOCOMILL_UPIMG_SPOT_01_PATH . '/' . $tmp['image_01']['up_name']; } elseif (!empty($tmp['rsv_txt_06']) && file_exists(WEB_ROOT_DIR.'/old_images/'.$tmp['rsv_txt_06'])) { $tmp['image_01_src'] = '/old_images/'.$tmp['rsv_txt_06']; } else { $tmp['image_01_src'] = '/common/img/s_img.jpg'; } $relation_spot_array[$k] = $tmp; unset($tmp); } catch (SpotError $e) { continue; } catch (AreaError $e) { continue; } catch (CategoryError $e) { continue; } } } unset($_relation_spot_array); } } catch (LocomillError $e) { $err_str .= $e->get_exception(); } } $smarty->assign("RELATION_SPOT_ARRAY", $relation_spot_array); //SMSログイン $smarty->assign("SMS_IS_LOGIN", $sms_is_login); // イマココ $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']); } $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'], "page" => $_SERVER['PHP_SELF'], "title" => '基本情報', "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, 2, 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 = ''; } if (!empty($spot_data['orig_sky'])) { $sky_out = htmlspecialchars_decode($spot_data['orig_sky']); } else { // 代替スカイスクレイパー $sky_out = ''; } $smarty->assign("ADVER_01", $billboard_out); $smarty->assign("ADVER_02", $sky_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($spot_data, array('id', 'update_stamp', 'isSP')); } /* 出 力 */ $smarty->display('spot/home/index.tpl', $cache_id);