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

Revision 1328, 2.8 KB checked in by naka, 20 years ago (diff)

* empty log message *

  • 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
27
28if ( $_POST['mode'] == 'id_set'){
29    // ¥Æ¥ó¥×¥ì¡¼¥È¥×¥ë¥À¥¦¥óÊѹ¹»þ
30   
31    if ( sfCheckNumLength( $_POST['template_id']) ){
32        $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
33        $result = $conn->getAll($sql, array($_POST['template_id']) );
34        if ( $result ){
35            $objPage->arrForm = $result[0];
36        } else {
37            $objPage->arrForm['template_id'] = $_POST['template_id'];
38        }
39    }
40   
41} elseif ( $_POST['mode'] == 'regist' && sfCheckNumLength( $_POST['template_id']) ){
42
43    // POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
44    $objPage->arrForm = lfConvertParam($_POST);
45    $objPage->arrErr = fnErrorCheck($objPage->arrForm);
46   
47    if ( $objPage->arrErr ){
48        // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
49        $objPage->tpl_msg = "¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿";
50       
51    } else {
52        // Àµ¾ï
53        lfRegist($conn, $objPage->arrForm);
54       
55        // ´°Î»¥á¥Ã¥»¡¼¥¸
56        $objPage->tpl_onload = "window.alert('¥á¡¼¥ëÀßÄ꤬´°Î»¤·¤Þ¤·¤¿¡£¥Æ¥ó¥×¥ì¡¼¥È¤òÁªÂò¤·¤ÆÆâÍÆ¤ò¤´³Îǧ¤¯¤À¤µ¤¤¡£');";
57        unset($objPage->arrForm);
58    }
59
60}
61
62$objView->assignobj($objPage);
63$objView->display(MAIN_FRAME);
64
65//-----------------------------------------------------------------------------------------------------------------------------------
66
67function lfRegist( $conn, $data ){
68   
69    $data['creator_id'] = $_SESSION['member_id'];
70    $data["update_date"] = "now()";
71   
72    $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
73    $result = $conn->getAll($sql, array($_POST['template_id']) );
74    if ( $result ){
75        $sql_where = "template_id = ". addslashes($_POST['template_id']);
76    }
77    $conn->autoExecute("dtb_mailtemplate", $data, $sql_where); 
78}
79
80
81function lfConvertParam($array) {
82   
83    $new_array["template_id"] = $array["template_id"];
84    $new_array["subject"] = mb_convert_kana($array["subject"] ,"KV");
85    $new_array["header"] = mb_convert_kana($array["header"] ,"KV");
86    $new_array["footer"] = mb_convert_kana($array["footer"] ,"KV");
87   
88    return $new_array;
89}
90
91/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
92function fnErrorCheck($array) {
93   
94    $objErr = new SC_CheckError($array);
95   
96    $objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_id'), array("EXIST_CHECK"));
97    $objErr->doFunc(array("¥á¡¼¥ë¥¿¥¤¥È¥ë",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
98    $objErr->doFunc(array("¥Ø¥Ã¥À¡¼",'header',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
99    $objErr->doFunc(array("¥Õ¥Ã¥¿¡¼",'footer',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
100
101    return $objErr->arrErr;
102}
103
104?>
Note: See TracBrowser for help on using the repository browser.