/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objSess = new SC_Session(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); if (!isset($_GET['mode'])) { $_GET['mode'] = ""; } if (!isset($_GET['id'])) { $_GET['id'] = ""; } if ($_GET['mode'] == "delete" && SC_Utils_Ex::sfCheckNumLength($_GET['id']) === true) { // メール担当の画像があれば削除しておく $sql = "SELECT charge_image FROM dtb_mailmaga_template WHERE template_id = ?"; $result = $conn->getOne($sql, array($_GET["id"])); if (strlen($result) > 0) { @unlink(IMAGE_SAVE_DIR . $result); } // 登録削除 $sql = "UPDATE dtb_mailmaga_template SET del_flg = 1 WHERE template_id = ?"; $conn->query($sql, array($_GET['id'])); $this->reload(null, true); } $sql = "SELECT *, create_date as disp_date FROM dtb_mailmaga_template WHERE del_flg = 0 ORDER BY create_date DESC"; $this->list_data = $conn->getAll($sql); $this->list_data['disp_date'] = substr($this->list_data['disp_date'], 0, 19); $objView->assignobj($this); $objView->display(MAIN_FRAME); }
/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objSess = new SC_Session(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); $this->mode = "regist"; // idが指定されているときは「編集」表示 if (!isset($_REQUEST['template_id'])) { $_REQUEST['template_id'] = ""; } if ($_REQUEST['template_id']) { $this->title = "編集"; } else { $this->title = "新規登録"; } if (!isset($_GET['mode'])) { $_GET['mode'] = ""; } if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // モードによる処理分岐 if ($_GET['mode'] == 'edit' && SC_Utils_Ex::sfCheckNumLength($_GET['template_id']) === true) { // 編集 $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ? AND del_flg = 0"; $result = $conn->getAll($sql, array($_GET['template_id'])); $this->arrForm = $result[0]; } elseif ($_POST['mode'] == 'regist') { // 新規登録 $this->arrForm = $this->lfConvData($_POST); $this->arrErr = $this->lfErrorCheck($this->arrForm); if (!$this->arrErr) { // エラーが無いときは登録・編集 $this->lfRegistData($this->arrForm, $_POST['template_id']); // 自分を再読込して、完了画面へ遷移 $this->reload(array("mode" => "complete")); } } elseif ($_GET['mode'] == 'complete') { // 完了画面表示 $this->tpl_mainpage = 'mail/template_complete.tpl'; } $objView->assignobj($this); $objView->display(MAIN_FRAME); }
/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objSess = new SC_Session(); $masterData = new SC_DB_MasterData_Ex(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); $this->arrMailTEMPLATE = $masterData->getMasterData("mtb_mail_template"); if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } if ($_POST['mode'] == 'id_set') { // テンプレートプルダウン変更時 if (SC_Utils_Ex::sfCheckNumLength($_POST['template_id'])) { $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?"; $result = $conn->getAll($sql, array($_POST['template_id'])); if ($result) { $this->arrForm = $result[0]; } else { $this->arrForm['template_id'] = $_POST['template_id']; } } } elseif ($_POST['mode'] == 'regist' && SC_Utils_Ex::sfCheckNumLength($_POST['template_id'])) { // POSTデータの引き継ぎ $this->arrForm = $this->lfConvertParam($_POST); $this->arrErr = $this->fnErrorCheck($this->arrForm); if ($this->arrErr) { // エラーメッセージ $this->tpl_msg = "エラーが発生しました"; } else { // 正常 $this->lfRegist($conn, $this->arrForm); // 完了メッセージ $this->tpl_onload = "window.alert('メール設定が完了しました。テンプレートを選択して内容をご確認ください。');"; unset($this->arrForm); } } $objView->assignobj($this); $objView->display(MAIN_FRAME); }
/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objView = null; if (defined("MOBILE_SITE") && MOBILE_SITE) { $objView = new SC_MobileView(); } else { $objView = new SC_SiteView(); } $objSess = new SC_Session(); // 店舗基本情報を取得 $objDb = new SC_Helper_DB_Ex(); $CONF = $objDb->sf_getBasisData(); $masterData = new SC_DB_MasterData_Ex(); $arrReminder = $masterData->getMasterData("mtb_reminder"); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } if (!isset($_POST['email'])) { $_POST['email'] = ""; } if ($_POST['mode'] == 'mail_check') { //メアド入力時 $_POST['email'] = strtolower($_POST['email']); // FIXME DBチェックの前に妥当性チェックするべき $sql = "SELECT * FROM dtb_customer WHERE (email = ? OR email_mobile = ?) AND status = 2 AND del_flg = 0"; $result = $conn->getAll($sql, array($_POST['email'], $_POST['email'])); // 本会員登録済みの場合 if (isset($result[0]['reminder']) && $result[0]['reminder']) { // 入力emailが存在する $_SESSION['forgot']['email'] = $_POST['email']; $_SESSION['forgot']['reminder'] = $result[0]['reminder']; // ヒミツの答え入力画面 $this->Reminder = $arrReminder[$_SESSION['forgot']['reminder']]; $this->tpl_mainpage = 'forgot/secret.tpl'; } else { $sql = "SELECT customer_id FROM dtb_customer WHERE (email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; //仮登録中の確認 $result = $conn->getAll($sql, array($_POST['email'], $_POST['email'])); if ($result) { $this->errmsg = "ご入力のemailアドレスは現在仮登録中です。<br>登録の際にお送りしたメールのURLにアクセスし、<br>本会員登録をお願いします。"; } else { // 登録していない場合 $this->errmsg = "ご入力のemailアドレスは登録されていません"; } } } elseif ($_POST['mode'] == 'secret_check') { //ヒミツの答え入力時 if ($_SESSION['forgot']['email']) { // ヒミツの答えの回答が正しいかチェック $sql = "SELECT * FROM dtb_customer WHERE (email = ? OR email_mobile = ?) AND del_flg = 0"; $result = $conn->getAll($sql, array($_SESSION['forgot']['email'], $_SESSION['forgot']['email'])); $data = $result[0]; if ($data['reminder_answer'] === $_POST['input_reminder']) { // ヒミツの答えが正しい // 新しいパスワードを設定する $this->temp_password = GC_Utils_Ex::gfMakePassword(8); if (FORGOT_MAIL == 1) { // メールで変更通知をする $this->lfSendMail($CONF, $_SESSION['forgot']['email'], $data['name01'], $this->temp_password); } // DBを書き換える $sql = "UPDATE dtb_customer SET password = ?, update_date = now() WHERE customer_id = ?"; $conn->query($sql, array(sha1($this->temp_password . ":" . AUTH_MAGIC), $data['customer_id'])); // 完了画面の表示 $this->tpl_mainpage = 'forgot/complete.tpl'; // セッション変数の解放 $_SESSION['forgot'] = array(); unset($_SESSION['forgot']); } else { // ヒミツの答えが正しくない $this->Reminder = $arrReminder[$_SESSION['forgot']['reminder']]; $this->errmsg = "パスワードを忘れたときの質問に対する回答が正しくありません"; $this->tpl_mainpage = 'forgot/secret.tpl'; } } else { // アクセス元が不正または、セッション保持期間が切れている $this->errmsg = "emailアドレスを再度登録してください。<br />前回の入力から時間が経っていますと、本メッセージが表示される可能性があります。"; } } // デフォルト入力 if ($_POST['email'] != "") { // POST値を入力 $this->tpl_login_email = $_POST['email']; } else { // クッキー値を入力 $this->tpl_login_email = $objCookie->getCookie('login_email'); } // モバイルサイトの場合はトークン生成 if (defined("MOBILE_SITE") && MOBILE_SITE) { $this->createMobileToken(); } //---- ページ表示 $objView->assignobj($this); $objView->display($this->tpl_mainpage); }
/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objPage = new LC_Page(); $objView = new SC_SiteView(); $objSess = new SC_Session(); // 都道府県プルダウン用配列 $masterData = new SC_DB_MasterData_Ex(); $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); // CSV保存項目 //---- 登録用カラム配列 オプション以外 $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "email", "convert" => "a"), array("column" => "email02", "convert" => "a"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n")); if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } if (!$_POST['mode'] == 'confirm' && !is_numeric($_REQUEST['question_id'])) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); } // テンプレート登録項目取得 $sql = "SELECT question_id, question FROM dtb_question WHERE question_id = ?"; $result = $conn->getAll($sql, array($_REQUEST['question_id'])); if (count($result) <= 0) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); } $this->QUESTION = $this->lfGetArrInput(unserialize($result[0]['question'])); $this->question_id = $_REQUEST['question_id']; $this->arrHidden = SC_Utils_Ex::sfMakeHiddenArray($_POST); unset($this->arrHidden['mode']); if (isset($this->QUESTION["delete"]) && (int) $this->QUESTION["delete"] !== 0) { $objPage->tpl_mainpage = "inquiry/closed.tpl"; } elseif ($_POST['mode'] == "confirm") { //-- 入力エラーチェック $this->arrForm = $_POST; $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn); $this->arrErr = $this->lfErrorCheck($this->arrForm); $this->arrErr = $this->lfGetArrInput($this->arrErr); if (!$this->arrErr) { $this->tpl_mainpage = "inquiry/confirm.tpl"; } } elseif ($_POST['mode'] == "return") { $this->arrForm = $_POST; } elseif ($_POST['mode'] == "regist") { //-- 入力文字・変換&エラーチェック $this->arrForm = $_POST; $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn); $this->arrErr = $this->lfErrorCheck($this->arrForm); $this->arrErr = $this->lfGetArrInput($this->arrErr); if (!$this->arrErr) { //完了画面 $this->tpl_mainpage = "inquiry/complete.tpl"; //--------- ▼ SQL ---------// // テーブルに入れるように整形する $arrOption = $this->arrForm['option']; unset($this->arrForm['email02']); $this->arrForm['mail01'] = $this->arrForm['email']; unset($this->arrForm['email']); unset($this->arrForm['option']); $this->arrForm['question_id'] = $this->question_id; $this->arrForm['question_name'] = $this->QUESTION['title']; for ($i = 0; $i < count($arrOption); $i++) { $tmp = ""; if (is_array($arrOption[$i])) { for ($j = 0; $j < count($arrOption[$i]); $j++) { if ($j > 0) { $tmp .= ","; } $tmp .= $arrOption[$i][$j]; } $this->arrForm['question0' . ($i + 1)] = $tmp; } else { $this->arrForm['question0' . ($i + 1)] = $arrOption[$i]; } } $this->arrForm['create_date'] = "now()"; // DB登録 $objQuery = new SC_Query(); $objQuery->insert("dtb_question_result", $this->arrForm); //--------- ▲ SQL ---------// } } $this->cnt_question = 6; $this->arrActive = isset($arrActive) ? $arrActive : ""; $this->arrQuestion = isset($arrQuestion) ? $arrQuestion : ""; //---- ページ表示 $objView->_smarty->register_function("lfArray_Search_key_Smarty", array("LC_Page_Inquiry", "lfArray_Search_key_Smarty")); $objView->assignobj($this); $objView->display($this->tpl_mainpage); }
function lfGetNews() { $conn = new SC_DBConn(); $sql = "SELECT *, cast(news_date as date) as news_date_disp FROM dtb_news WHERE del_flg = '0' ORDER BY rank DESC"; $list_data = $conn->getAll($sql); return $list_data; }
/** * すべての商品詳細ページを取得する. * * @param boolean $isMobile モバイルページを取得する場合 true * @return array 検索エンジンからアクセス可能な商品詳細ページの情報 */ function getAllDetail($isMobile = false) { $conn = new SC_DBConn(); $sql = "SELECT product_id, update_date FROM dtb_products WHERE del_flg = 0 AND status = 1"; $result = $conn->getAll($sql); $mobile = ""; if ($isMobile) { $mobile = "mobile/"; } $arrRet = array(); for ($i = 0; $i < count($result); $i++) { $page = array("url" => SITE_URL . sprintf("%sproducts/detail.php?product_id=%d", $mobile, $result[$i]['product_id']), "update_date" => $result[$i]['update_date']); $arrRet[$i] = $page; } return $arrRet; }
function lfGetNews() { $conn = new SC_DBConn(); $sql = "SELECT *, cast(news_start_date as date) as news_start_date_disp FROM dtb_news WHERE del_flg = '0' AND news_start_date <= current_date AND(current_date <= news_end_date OR news_end_date is NULL) ORDER BY rank DESC"; $list_data = $conn->getAll($sql); return $list_data; }
/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objSess = new SC_Session(); $objDate = new SC_Date(); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); if (!isset($_POST['body'])) { $_POST['body'] = ""; } if (!isset($_REQUEST['method'])) { $_REQUEST['method'] = ""; } if (!isset($_REQUEST['id'])) { $_REQUEST['id'] = ""; } if (!isset($_GET['send_id'])) { $_GET['send_id'] = ""; } if ($_POST['body']) { $this->body = $_POST['body']; // HTMLメールテンプレートのプレビュー } elseif ($_REQUEST["method"] == "template" && SC_Utils_Ex::sfCheckNumLength($_REQUEST['id'])) { $sql = "SELECT * FROM dtb_mailmaga_template WHERE template_id = ?"; $result = $conn->getAll($sql, array($_REQUEST["id"])); $this->list_data = $result[0]; //メール担当写真の表示 $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL); $objUpFile->addFile("メール担当写真", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $objUpFile->setDBFileList($this->list_data); // Form用配列を渡す。 $this->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL); // メイン商品の情報取得 $sql = "SELECT name, main_image, point_rate, deliv_fee, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass AS allcls WHERE product_id = ?"; $main = $conn->getAll($sql, array($this->list_data["main_product_id"])); $this->list_data["main"] = $main[0]; // サブ商品の情報取得 $sql = "SELECT product_id, name, main_list_image, price01_min, price01_max, price02_min, price02_max FROM vw_products_allclass WHERE product_id = ?"; $k = 0; $l = 0; for ($i = 1; $i <= 12; $i++) { if ($l == 4) { $l = 0; $k++; } $result = ""; $j = sprintf("%02d", $i); if ($i > 0 && $i < 5) { $k = 0; } if ($i > 4 && $i < 9) { $k = 1; } if ($i > 8 && $i < 13) { $k = 2; } if (is_numeric($this->list_data["sub_product_id" . $j])) { $result = $conn->getAll($sql, array($this->list_data["sub_product_id" . $j])); $this->list_data["sub"][$k][$l] = $result[0]; $this->list_data["sub"][$k]["data_exists"] = "OK"; //当該段にデータが1つ以上存在するフラグ } $l++; } $this->tpl_mainpage = 'mail/html_template.tpl'; } elseif (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) || SC_Utils_Ex::sfCheckNumLength($_GET['id'])) { if (is_numeric($_GET["send_id"])) { $id = $_GET["send_id"]; $sql = "SELECT body, mail_method FROM dtb_send_history WHERE send_id = ?"; } else { $sql = "SELECT body, mail_method FROM dtb_mailmaga_template WHERE template_id = ?"; $id = $_GET['id']; } $result = $conn->getAll($sql, array($id)); if ($result) { if ($result[0]["mail_method"] == 2) { // テキスト形式の時はタグ文字をエスケープ $this->escape_flag = 1; } $this->body = $result[0]["body"]; } } $objView->assignobj($this); $objView->display($this->tpl_mainpage); }
/** * Page のプロセス. * * @return void */ function process() { $conn = new SC_DBConn(); $objView = new SC_AdminView(); $objSess = new SC_Session(); $arrRegistColumn = array(array("column" => "product_id", "convert" => "n"), array("column" => "category_id", "convert" => "n"), array("column" => "rank", "convert" => "n"), array("column" => "title", "convert" => "aKV"), array("column" => "comment", "convert" => "aKV")); // 認証可否の判定 SC_Utils_Ex::sfIsSuccess($objSess); //最大登録数の表示 $this->tpl_disp_max = RECOMMEND_NUM; if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } if (!isset($_POST['category_id'])) { $_POST['category_id'] = ""; } // 登録時 if ($_POST['mode'] == 'regist') { // 入力文字の強制変換 $this->arrForm = $_POST; $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn); // エラーチェック $this->arrErr[$this->arrForm['rank']] = $this->lfErrorCheck(); if (!$this->arrErr[$this->arrForm['rank']]) { // 古いのを消す $sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?"; $conn->query($sql, array($this->arrForm['category_id'], $this->arrForm['rank'])); // DB登録 $this->arrForm['creator_id'] = $_SESSION['member_id']; $this->arrForm['update_date'] = "NOW()"; $this->arrForm['create_date'] = "NOW()"; $objQuery = new SC_Query(); $objQuery->insert("dtb_best_products", $this->arrForm); // $conn->autoExecute("dtb_best_products", $this->arrForm ); } } elseif ($_POST['mode'] == 'delete') { // 削除時 $sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?"; $conn->query($sql, array($_POST['category_id'], $_POST['rank'])); } // カテゴリID取得 無いときはトップページ if (SC_Utils_Ex::sfCheckNumLength($_POST['category_id'])) { $this->category_id = $_POST['category_id']; } else { $this->category_id = 0; } // 既に登録されている内容を取得する $sql = "SELECT B.name, B.main_list_image, A.* FROM dtb_best_products as A INNER JOIN dtb_products as B USING (product_id)\n\t\t WHERE A.del_flg = 0 ORDER BY rank"; $arrItems = $conn->getAll($sql); foreach ($arrItems as $data) { $this->arrItems[$data['rank']] = $data; } // 商品変更時は、選択された商品に一時的に置き換える if ($_POST['mode'] == 'set_item') { $sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND del_flg = 0"; $result = $conn->getAll($sql, array($_POST['product_id'])); if ($result) { $data = $result[0]; foreach ($data as $key => $val) { $this->arrItems[$_POST['rank']][$key] = $val; } $this->arrItems[$_POST['rank']]['rank'] = $_POST['rank']; } $this->checkRank = $_POST['rank']; } //各ページ共通 $this->cnt_question = 6; $this->arrActive = isset($arrActive) ? $arrActive : ""; $this->arrQuestion = isset($arrQuestion) ? $arrQuestion : ""; // カテゴリ取得 $objDb = new SC_Helper_DB_Ex(); $this->arrCatList = $objDb->sfGetCategoryList("level = 1"); //---- ページ表示 $objView->assignobj($this); $objView->display(MAIN_FRAME); }