/**
  * 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();
     $objDate = new SC_Date();
     // 認証可否の判定
     SC_Utils_Ex::sfIsSuccess($objSess);
     if (!isset($_GET['send_id'])) {
         $_GET['send_id'] = "";
     }
     if (!isset($_GET['mode'])) {
         $_GET['mode'] = "";
     }
     if (!isset($_POST['search_pageno'])) {
         $_POST['search_pageno'] = "";
     }
     // 削除時
     if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) && $_GET['mode'] == 'delete') {
         $sql = "UPDATE dtb_send_history SET del_flg = 1 WHERE send_id = ?";
         $conn->query($sql, array($_GET['send_id']));
         $_SERVER['QUERY_STRING'] = "";
         $this->reload();
     }
     $col = "*";
     $from = "dtb_send_history";
     $where = " del_flg = ?";
     $arrval[] = "0";
     $objQuery = new SC_Query();
     // 行数の取得
     $linemax = $objQuery->count($from, $where, $arrval);
     $this->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの取得
     $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, SEARCH_PMAX, "fnNaviSearchPage", NAVI_PMAX);
     $this->tpl_strnavi = $objNavi->strnavi;
     // 表示文字列
     $startno = $objNavi->start_row;
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setlimitoffset(SEARCH_PMAX, $startno);
     // 表示順序
     $order = "start_date DESC, send_id DESC";
     $objQuery->setorder($order);
     // 検索結果の取得
     $this->arrDataList = $objQuery->select($col, $from, $where, $arrval);
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
Example #3
0
 /**
  * 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);
 }
 function lfRegistData($array, $arrRegistColumn, &$objCustomer)
 {
     $objConn = new SC_DBConn();
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     $arrRegist['customer_id'] = $objCustomer->getvalue('customer_id');
     //-- 編集登録実行
     $objConn->query("BEGIN");
     if ($array['other_deliv_id'] != "") {
         $objConn->autoExecute("dtb_other_deliv", $arrRegist, "other_deliv_id = " . SC_Utils_Ex::sfQuoteSmart($array["other_deliv_id"]));
     } else {
         $objConn->autoExecute("dtb_other_deliv", $arrRegist);
     }
     $objConn->query("COMMIT");
 }
 /**
  * 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);
 }
Example #6
0
 function sfRegistTmpMailData($mail_flag, $email)
 {
     $objQuery = new SC_Query();
     $objConn = new SC_DBConn();
     $objPage = new LC_Page();
     $random_id = sfGetUniqRandomId();
     $arrRegistMailMagazine["mail_flag"] = $mail_flag;
     $arrRegistMailMagazine["email"] = $email;
     $arrRegistMailMagazine["temp_id"] = $random_id;
     $arrRegistMailMagazine["end_flag"] = '0';
     $arrRegistMailMagazine["update_date"] = 'now()';
     //メルマガ仮登録用フラグ
     $flag = $objQuery->count("dtb_customer_mail_temp", "email=?", array($email));
     $objConn->query("BEGIN");
     switch ($flag) {
         case '0':
             $objConn->autoExecute("dtb_customer_mail_temp", $arrRegistMailMagazine);
             break;
         case '1':
             $objConn->autoExecute("dtb_customer_mail_temp", $arrRegistMailMagazine, "email = " . SC_Utils::sfQuoteSmart($email));
             break;
     }
     $objConn->query("COMMIT");
     $subject = sfMakeSubject('メルマガ仮登録が完了しました。');
     $objPage->tpl_url = SSL_URL . "mailmagazine/regist.php?temp_id=" . $arrRegistMailMagazine['temp_id'];
     switch ($mail_flag) {
         case '1':
             $objPage->tpl_name = "登録";
             $objPage->tpl_kindname = "HTML";
             break;
         case '2':
             $objPage->tpl_name = "登録";
             $objPage->tpl_kindname = "テキスト";
             break;
         case '3':
             $objPage->tpl_name = "解除";
             break;
     }
     $objPage->tpl_email = $email;
     sfSendTplMail($email, $subject, 'mail_templates/mailmagazine_temp.tpl', $objPage);
 }