'spot', 2 => 'event', 4 => 'feature', 5 => 'area'); $sort = 2; $vect = 'D'; $preview = (isset($preview))? $preview: 0; $pv_mode = ($preview == 1)? '_pre': ''; $pv_url = ($preview == 1)? 'index_pre.shtml': ''; $template_file = 'corner/present/form/index.tpl'; $upimg_tmp_dir = UPIMG_BASE_PATH . '/present_entry/tmp'; /* 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'); /* Presentクラスインスタンス生成 */ if ($err_str === "") { try { $present = new Present($locomill->get_db()); } catch (PresentError $e) { $err_str .= $e->get_exception(); } } /* PresentItemクラスインスタンス生成 */ if ($err_str === "") { try { $present_item = new PresentItem($locomill->get_db()); } catch (PresentItemError $e) { $err_str .= $e->get_exception(); } } /* PresentEntryクラスインスタンス生成 */ if ($err_str === "") { try { $present_entry = new PresentEntry($locomill->get_db()); } catch (PresentEntryError $e) { $err_str .= $e->get_exception(); } } /* Spotクラスインスタンス生成 */ if ($err_str === "") { try { $spot = new Spot($locomill->get_db()); } catch (SpotError $e) { $err_str .= $e->get_exception(); } } /* Eventクラスインスタンス生成 */ if ($err_str === "") { try { $event = new Event($locomill->get_db()); } catch (EventError $e) { $err_str .= $e->get_exception(); } } /* Featureクラスインスタンス生成 */ if ($err_str === "") { try { $feature = new Feature($locomill->get_db()); } catch (FeatureError $e) { $err_str .= $e->get_exception(); } } /* Areaクラスインスタンス生成 */ if ($err_str === "") { try { $area = new Area($locomill->get_db()); $area_top = $area->get_area_top(); } catch (AreaError $e) { $err_str .= $e->get_exception(); } } /* Memberクラスインスタンス生成 */ if ($err_str === "") { try { $member = new Member($locomill->get_db()); } catch (MemberError $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; } $rq = trim_text4byte_recursive($rq); $rq = trim_exclude_str($rq); $present_id = (!empty($rq['id']))? $rq['id']: 0; $present_item_id = (!empty($rq['item']))? $rq['item']: 0; $sort = (isset($rq['sort']) && preg_match("/^[0-9]+$/", $rq['sort']))? $rq['sort']: $sort; $vect = (isset($rq['vect']) && ($rq['vect'] == 'A' || $rq['vect'] == 'D'))? $rq['vect']: $vect; if (!empty($rq['action'])) { $action = $rq['action']; unset($rq['action']); } } if ($is_login != 1) { header("location: /login/?is_keep=1&rdr=/corner/present/form/" . $pv_url . "?id=" . $present_id . "&item=" . $present_item_id . "&cat=" . $rq['cat']); exit; } elseif (!$member->check_member_data(1, $member_data)) { header("location: /mypage/email/form/?rdr=/corner/present/form/" . $pv_url . "?id=" . $present_id . "&item=" . $present_item_id . "&cat=" . $rq['cat']); exit; } elseif (!$member->check_member_data(3, $member_data)) { header("location: /mypage/myprofile/form/?rdr=/corner/present/form/" . $pv_url . "?id=" . $present_id . "&item=" . $present_item_id . "&cat=" . $rq['cat']); exit; } elseif (!$member->check_member_data(2, $member_data)) { header("location: /mypage/proof/form/?rdr=/corner/present/form/" . $pv_url . "?id=" . $present_id . "&item=" . $present_item_id . "&cat=" . $rq['cat']); exit; } /* プレゼントデータ取得 */ if ($err_str === "") { try { $present_data = $present->get_data($present_id); if ($preview == 0 && ($present_data['enable'] == 2 || $now < $present_data['start_stamp'] || $present_data['end_stamp'] < $now)) { throw new PresentError("・指定のデータに整合性がありません。
"); } // 応募重複チェック(プレゼント) if ($present_data['is_check_dup'] == 1 && $present_entry->check_entry_dup($login_user_id, $present_id)) { throw new PresentError("・" . $login_user_name . "さんは既に応募完了しています。
"); } // 応募条件・プレゼント if ($preview == 0 && $present_data['conditions_flg'] == 2) { $flg = false; if ($is_login == 1) { foreach ($conditions_array AS $type_id => $type_name) { if (!$flg && !empty($present_data['conditions_' . $type_name . '_ids'])) { foreach ($present_data['conditions_' . $type_name . '_ids'] AS $parent_id) { if (!empty($parent_id)) { // 掲載前でもOK $wlist = array(); $wlist[] = sprintf('`member_id` = %d', $login_user_id); $wlist[] = sprintf('`parent_id` = %d', $parent_id); $wlist[] = sprintf('`type` = %d', $type_id); $wlist[] = sprintf('(`entry_stamp` BETWEEN %d AND %d)', $present_data['conditions_start_stamp'], $present_data['conditions_end_stamp']); $sql = sprintf('SELECT `id` FROM `kuchikomi_tbl` WHERE %s LIMIT 1', implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { if (0 < $locomill->get_db()->num($result)) { $flg = true; } $locomill->get_db()->free($result); } } } } } } if (!$flg) { $conditions_text = array(); foreach ($conditions_array AS $type_id => $type_name) { if (!empty($present_data['conditions_' . $type_name . '_ids'])) { foreach ($present_data['conditions_' . $type_name . '_ids'] AS $parent_id) { if (!empty($parent_id)) { if ($type_id == 1) { try { $spot_data = $spot->get_data($parent_id); if ($spot_data['enable'] == 1 && $spot_data['is_closed'] != 1 && $spot_data['start_stamp'] <= $now && $now <= $spot_data['end_stamp']) { $conditions_text[] = sprintf('%s', $spot_data['id'], htmlspecialchars($spot_data['name_01'])); } unset($spot_data); } catch (SpotError $e) { } } elseif ($type_id == 2) { try { $event_data = $event->get_data($parent_id); if ($event_data['enable'] == 1 && $event_data['rsv_int_03'] != 3 && $event_data['start_stamp'] <= $now && $now <= $event_data['end_stamp']) { $conditions_text[] = sprintf('%s', $event_data['id'], htmlspecialchars($event_data['name_01'])); } unset($event_data); } catch (EventError $e) { } } elseif ($type_id == 4) { try { $document_data = $feature->get_document($parent_id); $feature_data = $feature->get_data($document_data['feature_id']); if ($document_data['enable'] == 1 && $document_data['open_stamp'] <= $now_date && $now_date <= $document_data['close_stamp'] && $feature_data['enable'] == 1 && $feature_data['open_stamp'] <= $now_date && $now_date <= $feature_data['close_stamp']) { $conditions_text[] = sprintf('%s', $document_data['id'], htmlspecialchars($document_data['title_01'])); } unset($document_data, $feature_data); } catch (FeatureError $e) { } } elseif ($type_id == 5) { try { $area_03_data = $area->get_data('area_master_03_tbl', $parent_id); if ($area_03_data['enable'] == 1) { $conditions_text[] = sprintf('%s', (isset($area_top[$area_03_data['id']])? sprintf('/%s/', $area_top[$area_03_data['id']]): sprintf('/area/list/index_medium.shtml?t=A3&id=%d', $area_03_data['id'])), htmlspecialchars($area_03_data['name'])); } unset($area_03_data); } catch (AreaError $e) { } } } } } } if (!empty($conditions_text)) { throw new PresentError(sprintf('%s ~ %sに %s にクチコミを投稿すると応募可能になります。', date('Y/n/j H:i', $present_data['conditions_start_stamp']), date('Y/n/j H:i', $present_data['conditions_end_stamp']), implode(' または ', $conditions_text))); } } } if ($preview == 0 && $present_data['conditions2_flg'] == 2) { $flg = false; if ($is_login == 1) { if (!$flg && !empty($present_data['conditions2_research_ids'])) { foreach ($present_data['conditions2_research_ids'] AS $parent_id) { if (!empty($parent_id)) { $wlist = array(); $wlist[] = sprintf('`a_customer_id` = %d', $login_user_id); $wlist[] = sprintf('`a_r_id` = %d', $parent_id); $wlist[] = "`del_datetime` = '0000-00-00 00:00:00'"; $sql = sprintf('SELECT `a_id` FROM `research_answer_data` WHERE %s LIMIT 1', implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { if (0 < $locomill->get_db()->num($result)) { $flg = true; } $locomill->get_db()->free($result); } } } } } if (!$flg) { $conditions_text = array(); if (!empty($present_data['conditions2_research_ids'])) { foreach ($present_data['conditions2_research_ids'] AS $parent_id) { if (!empty($parent_id)) { $sql = sprintf('SELECT `r_id`,`r_name` FROM `research_basis_data` WHERE `r_id` = %d LIMIT 1', $parent_id); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { if (0 < $locomill->get_db()->num($result)) { $row = $locomill->get_db()->fetch_array($result); $conditions_text[] = sprintf('%s', $row['r_id'], CriptPW('rid'.$row['r_id']), htmlspecialchars($row['r_name'])); } $locomill->get_db()->free($result); } } } } if (!empty($conditions_text)) { throw new PresentError(sprintf('%s アンケートに回答すると応募可能になります。
', implode(' または ', $conditions_text))); } } } if (!empty($present_data['category'])) { $temp = explode(',', $present_data['category']); foreach ($temp AS $k => $v) { $category_array[$k + 1] = $v; } } $week_array = array('日', '月', '火', '水', '木', '金', '土'); if ($present_data['end_stamp'] == mktime(0, 0, 0, 12, 31, 2037)) { $present_data['end_date'] = 'なし'; } else { $present_data['end_date'] = sprintf('%s(%s) %s', date("Y年 m月 d日", $present_data['end_stamp']), $week_array[date("w", $present_data['end_stamp'])], date("H:i", $present_data['end_stamp'])); } $present_data['comment'] = href_branch($present_data['comment']); $present_data['is_keyword'] = ($present_data['keyword'])? 1: 0; } catch (PresentError $e) { $err_str .= $e->get_exception(); } } /* プレゼント賞品データ取得 */ if ($err_str === "") { try { $count_wlist = array(); $count_wlist[] = sprintf('`present_id` = %d', $locomill->get_db()->escape($present_id)); if ($preview == 0) { $count_wlist[] = '`enable` = 1'; $count_wlist[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); } $count_sql = sprintf('SELECT `id` FROM `present_item_tbl` WHERE %s', implode(' AND ', $count_wlist)); $count_result = $locomill->get_db()->query($count_sql); $item_count = $locomill->get_db()->num($count_result); $wlist = array(); if (!empty($present_item_id)) { $wlist[] = sprintf('`id` = %d', $locomill->get_db()->escape($present_item_id)); } else { $wlist[] = sprintf('`present_id` = %d', $locomill->get_db()->escape($present_id)); } if ($preview == 0) { $wlist[] = '`enable` = 1'; $wlist[] = sprintf('(%d BETWEEN `start_stamp` AND `end_stamp`)', $now); } if (!empty($rq['cat'])) { $wlist[] = sprintf("`category_01` = '%s'", $locomill->get_db()->escape($category_array[$rq['cat']])); } $vecter = ($vect == 'D')? ' DESC': ' ASC'; $odlist = array(); if ($sort == 2) { $odlist[] = sprintf('`start_stamp` %s', $vecter); $odlist[] = sprintf('`entry_stamp` %s', $vecter); } else { $odlist[] = sprintf('`name_01` %s', $vecter); $odlist[] = sprintf('`update_stamp` %s', $vecter); } $sql = sprintf('SELECT `id` FROM `present_item_tbl` WHERE %s ORDER BY %s', implode(' AND ', $wlist), implode(', ', $odlist)); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { $present_item_num = $locomill->get_db()->num($result); if ($present_item_num > 0) { while ($row = $locomill->get_db()->fetch_array($result)) { $present_item_array[$row['id']] = $row; } } } $locomill->get_db()->free($result); } catch (PresentItemError $e) { $present_item_array = array(); } if (!empty($present_item_array)) { try { $num = 0; foreach ($present_item_array AS $v) { try { $v = $present_item->get_data($v['id']); } catch (PresentItemError $e) { continue; } if ($present_item_num == 1 && empty($rq['item']) && empty($rq['cat'])) { $rq['item'] = $v['id']; } $temp = array(); $temp['id'] = $v['id']; $temp['name'] = $v['name_01']; if (!empty($v['image_01']['up_name'])) { $temp['image'] = '/img' . LOCOMILL_UPIMG_PRESENT_ITEM_PATH . '/' . $v['image_01']['up_name']; } else { $temp['image'] = ''; //LOCOMILL_UPIMG_NOIMAGE_PATH; } if (empty($og_image)) { $og_image = $temp['image']; } $temp['spot_name'] = ''; $temp['url'] = ''; try { $spot_data = $spot->get_data($v['spot_id']); $temp['spot_name'] = $spot_data['name_01']; $temp['url'] = '/spot/home/?id=' . $spot_data['id']; } catch (SpotError $e) { $spot_data = array(); } $temp['num'] = $v['lottery_max']; $temp['num_txt'] = $v['lottery_max_txt']; $temp['comment'] = href_branch($v['comment']); $temp['exchange_memo'] = $v['exchange_memo']; if ($is_login == 1 && $present_data['is_check_dup'] != 0 && $present_entry->check_entry_dup($login_user_id, 0, $v['id'])) { $temp['entry_flag'] = 1; } else { $temp['entry_flag'] = 0; } // 応募条件・賞品 $temp['conditions_text'] = ''; if ($v['conditions_flg'] == 2) { $flg = false; if ($is_login == 1) { foreach ($conditions_array AS $type_id => $type_name) { if (!$flg && !empty($v['conditions_' . $type_name . '_ids'])) { foreach ($v['conditions_' . $type_name . '_ids'] AS $parent_id) { if (!empty($parent_id)) { // 掲載前でもOK $wlist = array(); $wlist[] = sprintf('`member_id` = %d', $login_user_id); $wlist[] = sprintf('`parent_id` = %d', $parent_id); $wlist[] = sprintf('`type` = %d', $type_id); $wlist[] = sprintf('(`entry_stamp` BETWEEN %d AND %d)', $v['conditions_start_stamp'], $v['conditions_end_stamp']); $sql = sprintf('SELECT `id` FROM `kuchikomi_tbl` WHERE %s LIMIT 1', implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { if (0 < $locomill->get_db()->num($result)) { $flg = true; } $locomill->get_db()->free($result); } } } } } } if (!$flg) { $conditions_text = array(); foreach ($conditions_array AS $type_id => $type_name) { if (!empty($v['conditions_' . $type_name . '_ids'])) { foreach ($v['conditions_' . $type_name . '_ids'] AS $parent_id) { if (!empty($parent_id)) { if ($type_id == 1) { try { $spot_data = $spot->get_data($parent_id); if ($spot_data['enable'] == 1 && $spot_data['is_closed'] != 1 && $spot_data['start_stamp'] <= $now && $now <= $spot_data['end_stamp']) { $conditions_text[] = sprintf('%s', $spot_data['id'], htmlspecialchars($spot_data['name_01'])); } unset($spot_data); } catch (SpotError $e) { } } elseif ($type_id == 2) { try { $event_data = $event->get_data($parent_id); if ($event_data['enable'] == 1 && $event_data['rsv_int_03'] != 3 && $event_data['start_stamp'] <= $now && $now <= $event_data['end_stamp']) { $conditions_text[] = sprintf('%s', $event_data['id'], htmlspecialchars($event_data['name_01'])); } unset($event_data); } catch (EventError $e) { } } elseif ($type_id == 4) { try { $document_data = $feature->get_document($parent_id); $feature_data = $feature->get_data($document_data['feature_id']); if ($document_data['enable'] == 1 && $document_data['open_stamp'] <= $now_date && $now_date <= $document_data['close_stamp'] && $feature_data['enable'] == 1 && $feature_data['open_stamp'] <= $now_date && $now_date <= $feature_data['close_stamp']) { $conditions_text[] = sprintf('%s', $document_data['id'], htmlspecialchars($document_data['title_01'])); } unset($document_data, $feature_data); } catch (FeatureError $e) { } } elseif ($type_id == 5) { try { $area_03_data = $area->get_data('area_master_03_tbl', $parent_id); if ($area_03_data['enable'] == 1) { $conditions_text[] = sprintf('%s', (isset($area_top[$area_03_data['id']])? sprintf('/%s/', $area_top[$area_03_data['id']]): sprintf('/area/list/index_medium.shtml?t=A3&id=%d', $area_03_data['id'])), htmlspecialchars($area_03_data['name'])); } unset($area_03_data); } catch (AreaError $e) { } } } } } } if (!empty($conditions_text)) { $temp['conditions_text'] .= sprintf('%s ~ %sに %s にクチコミを投稿すると応募可能になります。', date('Y/n/j H:i', $v['conditions_start_stamp']), date('Y/n/j H:i', $v['conditions_end_stamp']), implode(' または ', $conditions_text)); } } } if ($v['conditions2_flg'] == 2) { $flg = false; if ($is_login == 1) { if (!$flg && !empty($v['conditions2_research_ids'])) { foreach ($v['conditions2_research_ids'] AS $parent_id) { if (!empty($parent_id)) { $wlist = array(); $wlist[] = sprintf('`a_customer_id` = %d', $login_user_id); $wlist[] = sprintf('`a_r_id` = %d', $parent_id); $wlist[] = "`del_datetime` = '0000-00-00 00:00:00'"; $sql = sprintf('SELECT `a_id` FROM `research_answer_data` WHERE %s LIMIT 1', implode(' AND ', $wlist)); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { if (0 < $locomill->get_db()->num($result)) { $flg = true; } $locomill->get_db()->free($result); } } } } } if (!$flg) { $conditions_text = array(); if (!empty($v['conditions2_research_ids'])) { foreach ($v['conditions2_research_ids'] AS $parent_id) { if (!empty($parent_id)) { $sql = sprintf('SELECT `r_id`,`r_name` FROM `research_basis_data` WHERE `r_id` = %d LIMIT 1', $parent_id); // echo $sql; $result = $locomill->get_db()->query($sql); if ($result !== false) { if (0 < $locomill->get_db()->num($result)) { $row = $locomill->get_db()->fetch_array($result); $conditions_text[] = sprintf('%s', $row['r_id'], CriptPW('rid'.$row['r_id']), htmlspecialchars($row['r_name'])); } $locomill->get_db()->free($result); } } } } if (!empty($conditions_text)) { $temp['conditions_text'] .= sprintf('%s アンケートに回答すると応募可能になります。
', implode(' または ', $conditions_text)); } } } $present_01_array[$v['id']] = $temp; $num++; if (empty($lottery_type_01) && ($v['lottery_type'] == 1 || $v['lottery_type'] == 2)) { $lottery_type_01 = 1; } if (empty($lottery_type_02) && ($v['lottery_type'] == 3 || $v['lottery_type'] == 4)) { $lottery_type_02 = 1; } } } catch (PresentItemError $e) { $err_str .= $e->get_exception(); } } try { for ($i = 1; $i <= 10; $i++) { if (!empty($present_data[sprintf('question_%02d_type', $i)])) { $ptemp = explode(',', $present_data[sprintf('question_%02d_list', $i)]); if ($present_data[sprintf('question_%02d_type', $i)] == 1) { if (!empty($ptemp)) { $answer = array(); $k = 0; foreach ($ptemp AS $q) { $k++; $answer[] = array( 'num' => $k, 'item' => $q, 'checked' => ((isset($rq[sprintf('answer_%02d', $i)]) && $rq[sprintf('answer_%02d', $i)] == $k)? 1: 0), ); } } } elseif ($present_data[sprintf('question_%02d_type', $i)] == 2) { if (!empty($ptemp)) { $answer = array(); $k = 0; foreach ($ptemp AS $q) { $k++; $answer[] = array( 'num' => $k, 'item' => $q, 'checked' => ((isset($rq[sprintf('answer_%02d_%d', $i, $k)]) && $rq[sprintf('answer_%02d_%d', $i, $k)] == 1)? 1: 0), ); } } } elseif ($present_data[sprintf('question_%02d_type', $i)] == 4) { if (!empty($locomill->session->sess_data['present_entry_image'][sprintf('image_%02d', $i)])) { if (!empty($rq[sprintf('image_%02d_del', $i)])) { unset($rq[sprintf('image_%02d_src', $i)]); unset($locomill->session->sess_data['present_entry_image'][sprintf('image_%02d', $i)]); $locomill->session->store_data(); } else { $answer = $locomill->session->sess_data['present_entry_image'][sprintf('image_%02d', $i)]; } } } else { $answer = (!empty($rq[sprintf('answer_%02d', $i)]))? $rq[sprintf('answer_%02d', $i)]: ''; } $temp = array(); $temp['question'] = $present_data[sprintf('question_%02d', $i)]; $temp['question_type'] = $present_data[sprintf('question_%02d_type', $i)]; $temp['question_require'] = $present_data[sprintf('question_%02d_require', $i)]; $temp['answer'] = $answer; $temp['a_num'] = sprintf('%02d', $i); $present_02_array[$i] = $temp; } } } catch (PresentError $e) { $err_str .= $e->get_exception(); } } /* Request値の検証 */ if ($err_str === "") { if ($action == 'check' || $action == 'return') { if (!empty($present_data['keyword']) && $present->check_keyword($present_id, $rq['keyword']) === false) { $error['keyword'] = "キーワードの入力が正しくありません
"; } try { if (!empty($rq['present_item_id'])) { $present_item_data = $present_item->get_data($rq['present_item_id']); } else { $error['present_item'] = "プレゼント賞品が選択されていません。
"; } } catch (PresentItemError $e) { $error['present_item'] = "プレゼント賞品が選択されていません。
"; } if (!empty($present_item_data)) { if ($present_item_data['lottery_type'] == 3 || $present_item_data['lottery_type'] == 4) { if (empty($rq['email_01']) && empty($rq['email_02'])) { $error['email'] = "メール送信先が正しくありません。
"; } } } $error_num = count($error); foreach ($present_02_array AS $k => $v) { if ($v['question_type'] == 3) { $rq[sprintf('answer_%02d', $k)] = str_replace(array("\n", "\r"), '', $rq[sprintf('answer_%02d', $k)]); } if ($v['question_require'] == 1) { if ($v['question_type'] == 1) { if (empty($rq[sprintf('answer_%02d', $k)])) { $present_02_array[$k]['error'] = "項目が選択されていません。
"; $error_num++; } } elseif ($v['question_type'] == 2) { $flg = false; foreach ($rq AS $key => $val) { if (strstr($key, sprintf('answer_%02d_', $k)) && $val == 1) { $flg = true; break; } } if (!$flg) { $present_02_array[$k]['error'] = "項目が選択されていません。
"; $error_num++; } } elseif ($v['question_type'] == 4) { $image = array(); if (!empty($locomill->session->sess_data['present_entry_image'][sprintf('image_%02d', $k)])) { $image = $locomill->session->sess_data['present_entry_image'][sprintf('image_%02d', $k)]; } if (!empty($image['up_name']) && file_exists($upimg_tmp_dir . '/' . $image['up_name'])) { } else { $present_02_array[$k]['error'] = "正しい画像が選択されていません。
"; $error_num++; } } else { if (empty($rq[sprintf('answer_%02d', $k)]) || $present->check_tarea($rq[sprintf('answer_%02d', $k)], 1000) == false) { $present_02_array[$k]['error'] = "テキスト項目の入力が正しくありません。
"; $error_num++; } } } } if (empty($error_num)) { if ($action == 'check') { if ($present_item_data['lottery_type'] == 3 || $present_item_data['lottery_type'] == 4) { $lottery_type_01 = 0; $lottery_type_02 = 1; } else { $lottery_type_01 = 1; $lottery_type_02 = 0; } $template_file = 'corner/present/form/confirm.tpl'; } elseif ($action == 'return') { } } $item = $rq; } else { $item = $member_data; if (!empty($rq['item'])) { $item['item'] = $rq['item']; $item['present_item_id'] = $rq['item']; } if (!empty($locomill->session->sess_data['present_entry_image'])) { unset($locomill->session->sess_data['present_entry_image']); $locomill->session->store_data(); } for ($i = 1; $i <= 10; $i++) { foreach (array('jpg', 'jpeg', 'gif', 'png') AS $v) { $image_01_temp = sprintf('tmpImage%d_image_%02d.%s', $member_data['id'], $i, $v); if (file_exists($upimg_tmp_dir . '/' . $image_01_temp)) { unlink($upimg_tmp_dir . '/' . $image_01_temp); } } } } $item['area_name'] = ''; try { $item['area_name'] .= $area->get_name('area_master_01_tbl', $member_data['prefect']); $item['area_name'] .= $area->get_name('area_master_03_tbl', $member_data['city']); $item['area_name'] .= $area->get_name('area_tbl', $member_data['town']); } catch (AreaError $e) { $item['area_name'] = ''; } foreach ($item AS $k => $v) { $item[$k] = htmlspecialchars($v); } } /* 変数の準備 */ // 入力エラー情報 $smarty->assign_ex("ERROR_NUM", count($error)); $smarty->assign_ex("ERROR", $error); // 登録情報 $smarty->assign("PRESENT_DATA", $present_data); $smarty->assign("PRESENT_ITEM_DATA", (!empty($item['present_item_id'])? $present_01_array[$item['present_item_id']]: array())); $smarty->assign_ex("PRESENT_NAME", $present_data['name_01']); $smarty->assign_ex("PRESENT_ID", $present_id); $smarty->assign_ex("ITEM_COUNT", $item_count); // プレゼントデータ配列 $smarty->assign("PRESENT_01_ARRAY", $present_01_array); $smarty->assign("PRESENT_02_ARRAY", $present_02_array); $smarty->assign("LOTTERY_TYPE_01", $lottery_type_01); $smarty->assign("LOTTERY_TYPE_02", $lottery_type_02); if (empty($og_image)) { $og_image = '/common/images/ogimg.png'; } $smarty->assign_ex("OG_IMAGE", $og_image); // 入力値 $values = $item; $element_array = array('email_01'); for ($i = 1; $i <= 5; $i++) { $element_array[] = sprintf('image_%02d_src', $i); } foreach ($element_array AS $v) { if (!isset($values[$v])) { $values[$v] = null; } } unset($element_array); $smarty->assign_ex("VALUES", $values); $smarty->assign("TIMESTAMP", time()); $smarty->assign_ex("CAT", (!empty($rq['cat'])? $rq['cat']: '')); $smarty->assign_ex("SORT", $sort); $smarty->assign_ex("VECT", $vect); if (!empty($item['present_item_id'])) { $category_array = array(); } $smarty->assign_ex("CATEGORY_ARRAY", $category_array); // プレビュー $smarty->assign("PREVIEW", $preview); $smarty->assign("PV_MODE", $pv_mode); // プレビューモード $smarty->assign("PV_MODE_GET_VALUE", $preview); // イマココ $imakoko = getTopicsPath('corner'); $imakoko[] = array('/corner/present/list/', 'プレゼントマニア'); if ($err_str === "") { $imakoko[] = array(sprintf('/corner/present/home/?id=%d', $present_id), $present_data['name_01']); $imakoko[] = array(sprintf('/corner/present/form/?id=%d', $present_id), '応募フォーム'); } $smarty->assign("IMAKOKO_ARRAY", $imakoko); // 最新情報 include('common/whatsnew.inc'); /* 広告系 */ $the_corner_id = 43; // プレゼントマニア:43 $adver_param = array("terminal_type" => 1, "corner_id" => $the_corner_id); $adver_b_type = array(1, 7); include('common/banners.inc'); // エラー文字列 $smarty->assign("ERR_STR", $err_str); /* 出 力 */ $smarty->display($template_file);