- Timestamp:
- 2007/08/17 19:27:45 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update/html/admin/basis/mail.php
r15080 r15308 5 5 * http://www.lockon.co.jp/ 6 6 */ 7 // {{{ requires 7 8 require_once("../require.php"); 9 require_once(CLASS_PATH . "page_extends/admin/basis/LC_Page_Admin_Basis_Mail_Ex.php"); 8 10 9 class LC_Page { 10 var $arrSession; 11 var $tpl_mode; 12 function LC_Page() { 13 $this->tpl_mainpage = 'basis/mail.tpl'; 14 $this->tpl_subnavi = 'basis/subnavi.tpl'; 15 $this->tpl_mainno = 'basis'; 16 $this->tpl_subno = 'mail'; 17 $this->tpl_subtitle = 'メール設定'; 18 } 19 } 11 // }}} 12 // {{{ generate page 20 13 21 $conn = new SC_DBConn(); 22 $objPage = new LC_Page(); 23 $objView = new SC_AdminView(); 24 $objSess = new SC_Session(); 25 26 // 認証可否の判定 27 sfIsSuccess($objSess); 28 29 $objPage->arrMailTEMPLATE = $arrMAILTEMPLATE; 30 31 if ( $_POST['mode'] == 'id_set'){ 32 // テンプレートプルダウン変更時 33 34 if ( sfCheckNumLength( $_POST['template_id']) ){ 35 $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?"; 36 $result = $conn->getAll($sql, array($_POST['template_id']) ); 37 if ( $result ){ 38 $objPage->arrForm = $result[0]; 39 } else { 40 $objPage->arrForm['template_id'] = $_POST['template_id']; 41 } 42 } 43 44 } elseif ( $_POST['mode'] == 'regist' && sfCheckNumLength( $_POST['template_id']) ){ 45 46 // POSTデータの引き継ぎ 47 $objPage->arrForm = lfConvertParam($_POST); 48 $objPage->arrErr = fnErrorCheck($objPage->arrForm); 49 50 if ( $objPage->arrErr ){ 51 // エラーメッセージ 52 $objPage->tpl_msg = "エラーが発生しました"; 53 54 } else { 55 // 正常 56 lfRegist($conn, $objPage->arrForm); 57 58 // 完了メッセージ 59 $objPage->tpl_onload = "window.alert('メール設定が完了しました。テンプレートを選択して内容をご確認ください。');"; 60 unset($objPage->arrForm); 61 } 62 63 } 64 65 $objView->assignobj($objPage); 66 $objView->display(MAIN_FRAME); 67 68 //----------------------------------------------------------------------------------------------------------------------------------- 69 70 function lfRegist( $conn, $data ){ 71 72 $data['creator_id'] = $_SESSION['member_id']; 73 74 $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?"; 75 $result = $conn->getAll($sql, array($_POST['template_id']) ); 76 if ( $result ){ 77 $sql_where = "template_id = ". addslashes($_POST['template_id']); 78 $conn->query("UPDATE dtb_mailtemplate SET template_id = ?, subject = ?,header = ?, footer = ?,creator_id = ?, update_date = now() WHERE ".$sql_where, $data); 79 }else{ 80 $conn->query("INSERT INTO dtb_mailtemplate (template_id,subject,header,footer,creator_id,update_date,create_date) values ( ?,?,?,?,?,now(),now() )", $data); 81 } 82 83 } 84 85 86 function lfConvertParam($array) { 87 88 $new_array["template_id"] = $array["template_id"]; 89 $new_array["subject"] = mb_convert_kana($array["subject"] ,"KV"); 90 $new_array["header"] = mb_convert_kana($array["header"] ,"KV"); 91 $new_array["footer"] = mb_convert_kana($array["footer"] ,"KV"); 92 93 return $new_array; 94 } 95 96 /* 入力エラーのチェック */ 97 function fnErrorCheck($array) { 98 99 $objErr = new SC_CheckError($array); 100 101 $objErr->doFunc(array("テンプレート",'template_id'), array("EXIST_CHECK")); 102 $objErr->doFunc(array("メールタイトル",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 103 $objErr->doFunc(array("ヘッダー",'header',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK")); 104 $objErr->doFunc(array("フッター",'footer',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK")); 105 106 return $objErr->arrErr; 107 } 108 14 $objPage = new LC_Page_Admin_Basis_Mail_Ex(); 15 $objPage->init(); 16 $objPage->process(); 17 register_shutdown_function(array($objPage, "destroy")); 109 18 ?>
Note: See TracChangeset
for help on using the changeset viewer.