source: branches/dev/html/admin/basis/mail.php @ 14000

Revision 14000, 3.6 KB checked in by nakanishi, 19 years ago (diff)
RevLine 
[8]1<?php
2/*
[17]3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
[8]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() {
[13662]13        $this->tpl_mainpage = 'basis/mail.tpl';
[8]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();
[13510]22$objQuery = new SC_Query();
[8]23$objPage = new LC_Page();
24$objView = new SC_AdminView();
25$objSess = new SC_Session();
26
[13510]27//ǧ¾Ú²ÄÈݤÎȽÄê
[8]28sfIsSuccess($objSess);
29
30$objPage->arrMailTEMPLATE = $arrMAILTEMPLATE;
31
[13713]32$objPage->arrSendType = array("¥Ñ¥½¥³¥ó","·ÈÂÓ");
[13697]33
[13662]34if ( $_GET['mode'] == 'edit' && sfCheckNumLength($_GET['template_id'])===true ){
[8]35   
[13666]36    if ( sfCheckNumLength( $_GET['template_id']) ){
[8]37        $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?";
[13670]38        $result = $conn->getAll($sql, array($_GET['template_id']) );
[13700]39        //print_r($result);
[8]40        if ( $result ){
41            $objPage->arrForm = $result[0];
42        } else {
[13666]43            $objPage->arrForm['template_id'] = $_GET['template_id'];
[8]44        }
45    }
46   
[13840]47} elseif ( $_POST['mode'] == 'regist' && sfCheckNumLength( $_POST['template_id']) ){
[13725]48//    elseif ( $_GET['mode'] == 'regist' ){
[8]49    // POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
[13840]50    $objPage->arrForm = lfConvertParam($_POST);
[8]51    $objPage->arrErr = fnErrorCheck($objPage->arrForm);
52    if ( $objPage->arrErr ){
53        // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸
54        $objPage->tpl_msg = "¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿";
55       
56    } else {
57        // Àµ¾ï
58        lfRegist($conn, $objPage->arrForm);
59       
60        // ´°Î»¥á¥Ã¥»¡¼¥¸
61        $objPage->tpl_onload = "window.alert('¥á¡¼¥ëÀßÄ꤬´°Î»¤·¤Þ¤·¤¿¡£¥Æ¥ó¥×¥ì¡¼¥È¤òÁªÂò¤·¤ÆÆâÍÆ¤ò¤´³Îǧ¤¯¤À¤µ¤¤¡£');";
62        unset($objPage->arrForm);
63    }
64}
65
66$objView->assignobj($objPage);
67$objView->display(MAIN_FRAME);
68
69//-----------------------------------------------------------------------------------------------------------------------------------
70
71function lfRegist( $conn, $data ){
72   
73    $data['creator_id'] = $_SESSION['member_id'];
74   
[13758]75    $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ? AND del_flg = 0";
[8]76    $result = $conn->getAll($sql, array($_POST['template_id']) );
77    if ( $result ){
78        $sql_where = "template_id = ". addslashes($_POST['template_id']);
[13720]79        $conn->query("UPDATE dtb_mailtemplate SET send_type = ?,template_id = ?, template_name = ?,subject = ?,header = ?, footer = ?,creator_id = ?, update_date = now() WHERE ".$sql_where, $data);
[8]80    }else{
[13720]81        $conn->query("INSERT INTO dtb_mailtemplate (send_type,template_id,template_name,subject,header,footer,creator_id,update_date,create_date) values ( ?,?,?,?,?,?,?,now(),now() )", $data);
[8]82    }
83
84}
85
86
87function lfConvertParam($array) {
88   
[13746]89    $new_array["send_type"] = $array["send_type"];
[8]90    $new_array["template_id"] = $array["template_id"];
[13746]91    $new_array["template_name"] = mb_convert_kana($array["template_name"],"KV");
[8]92    $new_array["subject"] = mb_convert_kana($array["subject"] ,"KV");
93    $new_array["header"] = mb_convert_kana($array["header"] ,"KV");
94    $new_array["footer"] = mb_convert_kana($array["footer"] ,"KV");
95   
96    return $new_array;
97}
98
99/* ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯ */
100function fnErrorCheck($array) {
[13840]101   
[8]102    $objErr = new SC_CheckError($array);
[13719]103    $objErr->doFunc(array("¥á¡¼¥ë¤Î¼ïÎà",'send_type'), array("EXIST_CHECK"));
[8]104    $objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_id'), array("EXIST_CHECK"));
[13697]105    $objErr->doFunc(array("¥Æ¥ó¥×¥ì¡¼¥È",'template_name'), array("EXIST_CHECK"));
[8]106    $objErr->doFunc(array("¥á¡¼¥ë¥¿¥¤¥È¥ë",'subject',MTEXT_LEN,"BIG"), array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
107    $objErr->doFunc(array("¥Ø¥Ã¥À¡¼",'header',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
[14000]108    //$objErr->doFunc(array("¥Õ¥Ã¥¿¡¼",'footer',LTEXT_LEN,"BIG"), array("MAX_LENGTH_CHECK"));
[8]109
110    return $objErr->arrErr;
111}
112
113?>
Note: See TracBrowser for help on using the repository browser.