source: branches/comu/html/admin/basis/mail.php @ 11730

Revision 11730, 3.1 KB checked in by nanasess, 17 years ago (diff)

r11729 の変更を取消

Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9class 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}
20
21$conn = new SC_DBConn();
22$objPage = new LC_Page();
23$objView = new SC_AdminView();
24$objSess = new SC_Session();
25
26// ǧ¾Ú²ÄÈݤÎȽÄê
27sfIsSuccess($objSess);
28
29$objPage->arrMailTEMPLATE = $arrMAILTEMPLATE;
30
31if ( $_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
70function 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
86function 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/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
97function 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
109?>
Note: See TracBrowser for help on using the repository browser.