/**
  * ブロック情報を更新する.
  *
  * @param array $arrData 更新データ
  * @return integer 更新結果
  */
 function lfEntryPageData($arrData)
 {
     $objDBConn = new SC_DbConn();
     // DB操作オブジェクト
     $sql = "";
     // データ更新SQL生成用
     $ret = "";
     // データ更新結果格納用
     $arrUpdData = array();
     // 更新データ生成用
     $arrChk = array();
     // 排他チェック用
     // 更新データの変換
     $arrUpdData = $this->lfGetUpdData($arrData);
     // データが存在しているかチェックを行う
     if ($arrData['page_id'] !== '') {
         $arrChk = $this->objLayout->lfgetPageData("page_id = ?", array($arrData['page_id']));
     }
     // page_id が空 若しくは データが存在していない場合にはINSERTを行う
     if ($arrData['page_id'] === '' or !isset($arrChk[0])) {
         // SQL生成
         $sql = " INSERT INTO dtb_pagelayout ";
         $sql .= " ( ";
         $sql .= " \t  page_name";
         $sql .= "\t  ,url";
         $sql .= "\t  ,php_dir";
         $sql .= "\t  ,tpl_dir";
         $sql .= "\t  ,filename";
         $sql .= "\t  ,header_chk";
         $sql .= "\t  ,footer_chk";
         $sql .= "\t  ,update_url";
         $sql .= "\t  ,create_date";
         $sql .= "\t  ,update_date";
         $sql .= " ) VALUES ( ?,?,?,?,?,?,?,?,now(),now() )";
         $sql .= " ";
     } else {
         // データが存在してる場合にはアップデートを行う
         // SQL生成
         $sql = " UPDATE dtb_pagelayout ";
         $sql .= " SET";
         $sql .= "\t  page_name = ? ";
         $sql .= "\t  ,url = ? ";
         $sql .= "\t  ,php_dir = ? ";
         $sql .= "\t  ,tpl_dir = ? ";
         $sql .= "\t  ,filename = ? ";
         $sql .= "\t  ,header_chk = ? ";
         $sql .= "\t  ,footer_chk = ? ";
         $sql .= "\t  ,update_url = ? ";
         $sql .= "     ,update_date = now() ";
         $sql .= " WHERE page_id = ?";
         $sql .= " ";
         // 更新データにブロックIDを追加
         array_push($arrUpdData, $arrData['page_id']);
     }
     // SQL実行
     $ret = $objDBConn->query($sql, $arrUpdData);
     return $ret;
 }
Example #2
0
 /**
  * ブロック情報を取得する.
  *
  * @param string $where WHERE句
  * @param array  $arrVal WHERE句の値を格納した配列
  * @return ブロック情報
  */
 function getPageData($where = '', $arrVal = '')
 {
     $objDBConn = new SC_DbConn();
     // DB操作オブジェクト
     $sql = "";
     // データ取得SQL生成用
     $arrRet = array();
     // データ取得用
     // SQL生成(url と update_date 以外は不要?)
     $sql .= " SELECT";
     $sql .= " page_id";
     // ページID
     $sql .= " ,page_name";
     // 名称
     $sql .= " ,url";
     // URL
     $sql .= " ,php_dir";
     // php保存先ディレクトリ
     $sql .= " ,tpl_dir";
     // tpl保存先ディdレクトリ
     $sql .= " ,filename";
     // ファイル名称
     $sql .= " ,header_chk ";
     // ヘッダー使用FLG
     $sql .= " ,footer_chk ";
     // フッター使用FLG
     $sql .= " ,author";
     // authorタグ
     $sql .= " ,description";
     // descriptionタグ
     $sql .= " ,keyword";
     // keywordタグ
     $sql .= " ,update_url";
     // 更新URL
     $sql .= " ,create_date";
     // データ作成日
     $sql .= " ,update_date";
     // データ更新日
     $sql .= " FROM ";
     $sql .= "     dtb_pagelayout";
     // where句の指定があれば追加
     if ($where != '') {
         $sql .= " WHERE " . $where;
     }
     $sql .= " ORDER BY \tpage_id";
     return $objDBConn->getAll($sql, $arrVal);
 }
 /**
  * プレビューするデータを DB に保存する.
  *
  * @param array $arrPageData ページ情報の配列
  * @return void
  */
 function lfSetPreData($arrPageData, &$objLayout)
 {
     $objDBConn = new SC_DbConn();
     // DB操作オブジェクト
     $sql = "";
     // データ更新SQL生成用
     $ret = "";
     // データ更新結果格納用
     $arrUpdData = array();
     // 更新データ生成用
     $filename = $arrPageData[0]['filename'];
     $arrPreData = $objLayout->lfgetPageData(" page_id = ? ", array("0"));
     // XXX tplファイルの削除
     $del_tpl = USER_PATH . "templates/" . $filename . '.tpl';
     if (file_exists($del_tpl)) {
         unlink($del_tpl);
     }
     $tplfile = TEMPLATE_DIR . $filename;
     // filename が空の場合にはMYページと判断
     if ($filename == "") {
         $tplfile = TEMPLATE_DIR . "mypage/index";
         $filename = 'mypage';
     }
     // プレビュー用tplファイルのコピー
     $copyTo = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/" . $filename . ".tpl";
     if (!is_dir(dirname($copyTo))) {
         mkdir(dirname($copyTo));
     }
     copy($tplfile . ".tpl", $copyTo);
     // 更新データの取得
     $sql = "select page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ?";
     $ret = $objDBConn->getAll($sql, array($arrPageData[0]['page_id']));
     // dbデータのコピー
     $sql = " update dtb_pagelayout set ";
     $sql .= "     page_name = ?";
     $sql .= "     ,header_chk = ?";
     $sql .= "     ,footer_chk = ?";
     $sql .= "     ,url = ?";
     $sql .= "     ,tpl_dir = ?";
     $sql .= "     ,filename = ?";
     $sql .= " where page_id = 0";
     $arrUpdData = array($ret[0]['page_id'], $ret[0]['page_id'], $ret[0]['page_id'], USER_DIR . "templates/" . TEMPLATE_NAME . "/", USER_DIR . "templates/" . TEMPLATE_NAME . "/", $filename);
     $objDBConn->query($sql, $arrUpdData);
 }
Example #4
0
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *		check.php 稼働・非稼働の切替
 */
require_once "../require.php";
$conn = new SC_DbConn();
// 認証可否の判定
$objSess = new SC_Session();
SC_Utils_Ex::sfIsSuccess($objSess);
// GET値の正当性を判定する
if (SC_Utils_Ex::sfIsInt($_GET['id']) && ($_GET['no'] == 1 || $_GET['no'] == 0)) {
    $sqlup = "UPDATE dtb_member SET work = ? WHERE member_id = ?";
    $conn->query($sqlup, array($_GET['no'], $_GET['id']));
} else {
    // エラー処理
    gfPrintLog("error id=" . $_GET['id']);
}
// ページの表示
$location = "Location: " . URL_SYSTEM_TOP . "?pageno=" . $_GET['pageno'];
header($location);
 /**
  * ブロック情報を更新する.
  *
  * @param array $arrData 更新データ
  * @return integer 更新結果
  */
 function lfEntryBlocData($arrData)
 {
     $objDBConn = new SC_DbConn();
     // DB操作オブジェクト
     $sql = "";
     // データ更新SQL生成用
     $ret = "";
     // データ更新結果格納用
     $arrUpdData = array();
     // 更新データ生成用
     $arrChk = array();
     // 排他チェック用
     // 更新データ生成
     $arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
     // データが存在しているかチェックを行う
     if ($arrData['bloc_id'] !== '') {
         $arrChk = $this->lfgetBlocData("bloc_id = ?", array($arrData['bloc_id']));
     }
     // bloc_id が空 若しくは データが存在していない場合にはINSERTを行う
     if ($arrData['bloc_id'] === '' or !isset($arrChk[0])) {
         // SQL生成
         $sql = " INSERT INTO dtb_bloc";
         $sql .= " ( ";
         $sql .= "     bloc_name ";
         // ブロック名称
         $sql .= "     ,tpl_path ";
         // テンプレート保存先
         $sql .= "     ,filename ";
         // ファイル名称
         $sql .= "     ,create_date ";
         // 作成日
         $sql .= "     ,update_date ";
         // 更新日
         $sql .= " ) VALUES ( ?,?,?,now(),now() )";
         $sql .= " ";
     } else {
         // データが存在してる場合にはアップデートを行う
         // SQL生成
         $sql = " UPDATE dtb_bloc";
         $sql .= " SET";
         $sql .= "     bloc_name = ? ";
         // ブロック名称
         $sql .= "     ,tpl_path = ? ";
         // テンプレート保存先
         $sql .= "     ,filename = ? ";
         // テンプレートファイル名
         $sql .= "     ,update_date = now()";
         $sql .= " WHERE bloc_id = ?";
         $sql .= " ";
         // 更新データにブロックIDを追加
         array_push($arrUpdData, $arrData['bloc_id']);
     }
     // SQL実行
     $ret = $objDBConn->query($sql, $arrUpdData);
     return $ret;
 }
 function lfRegistFavoriteProduct($customer_id, $product_id)
 {
     $objQuery = new SC_Query();
     $objConn = new SC_DbConn();
     $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id));
     if ($count == 0) {
         $sqlval['customer_id'] = $customer_id;
         $sqlval['product_id'] = $product_id;
         $sqlval['update_date'] = "now()";
         $sqlval['create_date'] = "now()";
         $objQuery->begin();
         $objQuery->insert('dtb_customer_favorite_products', $sqlval);
         $objQuery->commit();
     }
 }
 function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn)
 {
     $objConn = new SC_DbConn();
     // 仮登録
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     // 誕生日が入力されている場合
     if (strlen($array["year"]) > 0) {
         $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00";
     }
     // パスワードの暗号化
     $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
     $count = 1;
     while ($count != 0) {
         $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
         $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
     }
     $arrRegist["secret_key"] = $uniqid;
     // 仮登録ID発行
     $arrRegist["create_date"] = "now()";
     // 作成日
     $arrRegist["update_date"] = "now()";
     // 更新日
     $arrRegist["first_buy_date"] = "";
     // 最初の購入日
     //-- 仮登録実行
     $objConn->query("BEGIN");
     $objQuery = new SC_Query();
     $objQuery->insert("dtb_customer", $arrRegist);
     /* メルマガ会員機能は現在停止中 2007/03/07
     
             //-- 非会員でメルマガ登録しているかの判定
             $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
             $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
     
             //-- メルマガ仮登録実行
             $arrRegistMail["email"] = $arrRegist["email"];
             if ($array["mailmaga_flg"] == 1) {
     		$arrRegistMail["mailmaga_flg"] = 4;
             } elseif ($array["mailmaga_flg"] == 2) {
     		$arrRegistMail["mailmaga_flg"] = 5;
             } else {
     		$arrRegistMail["mailmaga_flg"] = 6;
             }
             $arrRegistMail["update_date"] = "now()";
     
             // 非会員でメルマガ登録している場合
             if ($mailResult == 1) {
     		$objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
             } else {				// 新規登録の場合
     		$arrRegistMail["create_date"] = "now()";
     		$objQuery->insert("dtb_customer_mail", $arrRegistMail);
             }
             */
     $objConn->query("COMMIT");
     return $uniqid;
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $conn = new SC_DbConn();
     $objSite = new SC_SiteInfo($conn);
     if (MELMAGA_SEND != true) {
         exit;
     }
     //リアルタイム配信モードがオンのとき
     if ($_GET['mode'] == 'now') {
         //---- 未送信データを取得する
         $time_data = $conn->getAll("SELECT send_id FROM dtb_send_history  WHERE complete_count = 0 AND del_flg = 0 AND end_date IS NULL ORDER BY send_id ASC, start_date ASC");
     } else {
         // postgresql と mysql とでSQLをわける
         if (DB_TYPE == "pgsql") {
             $sql = "SELECT send_id FROM dtb_send_history  ";
             $sql .= "WHERE start_date  BETWEEN current_timestamp + '- 5 minutes' AND current_timestamp + '5 minutes' AND del_flg = 0  AND end_date IS NULL ORDER BY send_id ASC, start_date ASC";
         } else {
             if (DB_TYPE == "mysql") {
                 $sql = "SELECT send_id FROM dtb_send_history  ";
                 $sql .= "WHERE start_date  BETWEEN date_add(now(),INTERVAL -5 minute) AND date_add(now(),INTERVAL 5 minute) AND del_flg = 0  AND end_date IS NULL ORDER BY send_id ASC, start_date ASC";
             }
         }
         //---- 30分毎にCronが送信時間データ確認
         $time_data = $conn->getAll($sql);
     }
     //未送信メルマガの数
     $count = count($time_data);
     //未送信メルマガがあれば送信処理を続ける。なければ中断する。
     if ($count > 0) {
         print "start sending <br />\n";
     } else {
         print "not found <br />\n";
         exit;
     }
     //---- メール送信準備
     for ($i = 0; $i < $count; $i++) {
         // 送信先リストの取得
         $sql = "SELECT * FROM dtb_send_customer WHERE send_id = ? AND (send_flag = 2 OR send_flag IS NULL)";
         $list_data[] = $conn->getAll($sql, array($time_data[$i]["send_id"]));
         // 送信先データの取得
         $sql = "SELECT * FROM dtb_send_history WHERE send_id = ?";
         $mail_data[] = $conn->getAll($sql, array($time_data[$i]["send_id"]));
     }
     //---- 送信結果フラグ用SQL
     $sql_flag = "UPDATE dtb_send_customer SET send_flag = ? WHERE send_id = ? AND customer_id = ?";
     //---- メール生成と送信
     for ($i = 0; $i < $count; $i++) {
         for ($j = 0; $j < count($list_data[$i]); $j++) {
             $customerName = "";
             $mailBody = "";
             $sendFlag = "";
             //-- 顧客名の変換
             $name = trim($list_data[$i][$j]["name"]);
             if ($name == "") {
                 $name = "お客";
             }
             $customerName = htmlspecialchars($name);
             $subjectBody = ereg_replace("{name}", $customerName, $mail_data[$i][0]["subject"]);
             $mailBody = ereg_replace("{name}", $customerName, $mail_data[$i][0]["body"]);
             $this->objMail->setItem($list_data[$i][$j]["email"], $subjectBody, $mailBody, $objSite->data["email03"], $objSite->data["company_name"], $objSite->data["email03"], $objSite->data["email04"], $objSite->data["email04"]);
             //-- テキストメール配信の場合
             if ($mail_data[$i][0]["mail_method"] == 2) {
                 $sendResut = $this->objMail->sendMail();
                 //--  HTMLメール配信の場合
             } else {
                 $sendResut = $this->objMail->sendHtmlMail();
             }
             //-- 送信完了なら1、失敗なら-1をメール送信結果フラグとしてDBに挿入
             if (!$sendResut) {
                 $sendFlag = "-1";
             } else {
                 $sendFlag = "1";
                 // 完了を 1 増やす
                 $sql = "UPDATE dtb_send_history SET complete_count = complete_count + 1 WHERE send_id = ?";
                 $conn->query($sql, array($mail_data[$i][0]["send_id"]));
             }
             $conn->query($sql_flag, array($sendFlag, $mail_data[$i][0]["send_id"], $list_data[$i][$j]["customer_id"]));
         }
         //--- メール全件送信完了後の処理
         $completeSql = "UPDATE dtb_send_history SET end_date = now() WHERE send_id = ?";
         $conn->query($completeSql, array($time_data[$i]["send_id"]));
         //--- 送信完了 報告メール
         $compSubject = date("Y年m月d日H時i分" . "  下記メールの配信が完了しました。");
         // 管理者宛に変更
         $this->objMail->setTo($objSite->data["email03"]);
         $this->objMail->setSubject($compSubject);
         //-- テキストメール配信の場合
         if ($mail_data[$i][0]["mail_method"] == 2) {
             $sendResut = $this->objMail->sendMail();
             //--  HTMLメール配信の場合
         } else {
             $sendResut = $this->objMail->sendHtmlMail();
         }
     }
     if ($_GET['mode'] = "now") {
         header("Location: " . URL_DIR . "admin/mail/history.php");
     }
     echo "complete\n";
 }
Example #9
0
 function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn, $confirm_flg, $isMobile = false, $email_mobile = "")
 {
     $objConn = new SC_DbConn();
     // 登録データの生成
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     // 誕生日が入力されている場合
     if (strlen($array["year"]) > 0) {
         $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00";
     }
     // パスワードの暗号化
     $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
     // 仮会員登録の場合
     if ($confirm_flg == true) {
         // 重複しない会員登録キーを発行する。
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
         }
         switch ($array["mailmaga_flg"]) {
             case 1:
                 $arrRegist["mailmaga_flg"] = 4;
                 break;
             case 2:
                 $arrRegist["mailmaga_flg"] = 5;
                 break;
             default:
                 $arrRegist["mailmaga_flg"] = 6;
                 break;
         }
         $arrRegist["status"] = "1";
         // 仮会員
     } else {
         // 重複しない会員登録キーを発行する。
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
         }
         $arrRegist["status"] = "2";
         // 本会員
     }
     /*
       secret_keyは、テーブルで重複許可されていない場合があるので、
       本会員登録では利用されないがセットしておく。
     */
     $arrRegist["secret_key"] = $uniqid;
     // 会員登録キー
     $arrRegist["create_date"] = "now()";
     // 作成日
     $arrRegist["update_date"] = "now()";
     // 更新日
     $arrRegist["first_buy_date"] = "";
     // 最初の購入日
     $arrRegist["point"] = $this->CONF["welcome_point"];
     // 入会時ポイント
     if ($isMobile) {
         // 携帯メールアドレス
         $arrRegist['email_mobile'] = $arrRegist['email'];
         //PHONE_IDを取り出す
         $phoneId = SC_MobileUserAgent::getId();
         $arrRegist['mobile_phone_id'] = $phoneId;
     }
     //-- 仮登録実行
     $objConn->query("BEGIN");
     $objQuery = new SC_Query();
     $objQuery->insert("dtb_customer", $arrRegist);
     /* メルマガ会員機能は現在停止中 2007/03/07
     
     
             //-- 非会員でメルマガ登録しているかの判定
             $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
             $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
     
             //-- メルマガ仮登録実行
             $arrRegistMail["email"] = $arrRegist["email"];
             if ($array["mailmaga_flg"] == 1) {
                 $arrRegistMail["mailmaga_flg"] = 4;
             } elseif ($array["mailmaga_flg"] == 2) {
                 $arrRegistMail["mailmaga_flg"] = 5;
             } else {
                 $arrRegistMail["mailmaga_flg"] = 6;
             }
             $arrRegistMail["update_date"] = "now()";
     
             // 非会員でメルマガ登録している場合
             if ($mailResult == 1) {
                 $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
             } else {				// 新規登録の場合
                 $arrRegistMail["create_date"] = "now()";
                 $objQuery->insert("dtb_customer_mail", $arrRegistMail);
             }
         */
     $objConn->query("COMMIT");
     return $uniqid;
 }
 function lfDeleteFavoriteProduct($customer_id, $product_id)
 {
     $objQuery = new SC_Query();
     $objConn = new SC_DbConn();
     $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id));
     if ($count > 0) {
         $where = "customer_id = ? AND product_id = ?";
         $sqlval['customer_id'] = $customer_id;
         $sqlval['product_id'] = $product_id;
         $objQuery->begin();
         $objQuery->delete('dtb_customer_favorite_products', $where, $sqlval);
         $objQuery->commit();
     }
 }