source: temp/trunk/html/admin/basis/mail.php @ 5172

Revision 5172, 3.0 KB checked in by kakinaka, 20 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3require_once("../require.php");
4
5class LC_Page {
6    var $arrSession;
7    var $tpl_mode;
8    function LC_Page() {
9        $this->tpl_mainpage = 'basis/mail.tpl';
10        $this->tpl_subnavi = 'basis/subnavi.tpl';
11        $this->tpl_mainno = 'basis';
12        $this->tpl_subno = 'mail';
13        $this->tpl_subtitle = '¥á¡¼¥ëÀßÄê';
14    }
15}
16
17$conn = new SC_DBConn();
18$objPage = new LC_Page();
19$objView = new SC_AdminView();
20$objSess = new SC_Session();
21
22// ǧ¾Ú²ÄÈݤÎȽÄê
23sfIsSuccess($objSess);
24
25$objPage->arrMailTEMPLATE = $arrMAILTEMPLATE;
26
27if ( $_POST['mode'] == 'id_set'){
28    // ¥Æ¥ó¥×¥ì¡¼¥È¥×¥ë¥À¥¦¥óÊѹ¹»þ
29   
30    if ( sfCheckNumLength( $_POST['template_id']) ){
31        $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
32        $result = $conn->getAll($sql, array($_POST['template_id']) );
33        if ( $result ){
34            $objPage->arrForm = $result[0];
35        } else {
36            $objPage->arrForm['template_id'] = $_POST['template_id'];
37        }
38    }
39   
40} elseif ( $_POST['mode'] == 'regist' && sfCheckNumLength( $_POST['template_id']) ){
41
42    // POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
43    $objPage->arrForm = lfConvertParam($_POST);
44    $objPage->arrErr = fnErrorCheck($objPage->arrForm);
45   
46    if ( $objPage->arrErr ){
47        // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
48        $objPage->tpl_msg = "¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿";
49       
50    } else {
51        // Àµ¾ï
52        lfRegist($conn, $objPage->arrForm);
53       
54        // ´°Î»¥á¥Ã¥»¡¼¥¸
55        $objPage->tpl_onload = "window.alert('¥á¡¼¥ëÀßÄ꤬´°Î»¤·¤Þ¤·¤¿¡£¥Æ¥ó¥×¥ì¡¼¥È¤òÁªÂò¤·¤ÆÆâÍÆ¤ò¤´³Îǧ¤¯¤À¤µ¤¤¡£');";
56        unset($objPage->arrForm);
57    }
58
59}
60
61$objView->assignobj($objPage);
62$objView->display(MAIN_FRAME);
63
64//-----------------------------------------------------------------------------------------------------------------------------------
65
66function lfRegist( $conn, $data ){
67   
68    $data['creator_id'] = $_SESSION['member_id'];
69   
70    $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
71    $result = $conn->getAll($sql, array($_POST['template_id']) );
72    if ( $result ){
73        $sql_where = "template_id = ". addslashes($_POST['template_id']);
74        $conn->query("UPDATE dtb_mailtemplate SET template_id = ?, subject = ?,header = ?, footer = ?,creator_id = ?, update_date = now() WHERE ".$sql_where, $data);
75    }else{
76        $conn->query("INSERT INTO dtb_mailtemplate (template_id,subject,header,footer,creator_id,update_date,create_date) values ( ?,?,?,?,?,now(),now() )", $data);
77    }
78
79}
80
81
82function lfConvertParam($array) {
83   
84    $new_array["template_id"] = $array["template_id"];
85    $new_array["subject"] = mb_convert_kana($array["subject"] ,"KV");
86    $new_array["header"] = mb_convert_kana($array["header"] ,"KV");
87    $new_array["footer"] = mb_convert_kana($array["footer"] ,"KV");
88   
89    return $new_array;
90}
91
92/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
93function fnErrorCheck($array) {
94   
95    $objErr = new SC_CheckError($array);
96   
97    $objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_id'), array("EXIST_CHECK"));
98    $objErr->doFunc(array("¥á¡¼¥ë¥¿¥¤¥È¥ë",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
99    $objErr->doFunc(array("¥Ø¥Ã¥À¡¼",'header',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
100    $objErr->doFunc(array("¥Õ¥Ã¥¿¡¼",'footer',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
101
102    return $objErr->arrErr;
103}
104
105?>
Note: See TracBrowser for help on using the repository browser.