source: branches/feature-module-update/data/downloads/module2/mdl_speedmail/LC_Page_Mdl_SpeedMail.php @ 16582

Revision 16582, 4.4 KB checked in by nanasess, 16 years ago (diff)

ライセンス表記変更

Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/LC_Page.php");
26require_once(realpath(dirname( __FILE__)) . "/include.php");
27
28/**
29 * メルマガ管理 のページクラス.
30 *
31 * @package Page
32 * @author LOCKON CO.,LTD.
33 * @version $Id$
34 */
35class LC_Page_MDL_SPEEDMAIL extends LC_Page {
36     var $objFormParam;
37     var $arrErr;
38     var $objQuery;
39
40    /**
41     * Page を初期化する.
42     *
43     * @return void
44     */
45    function init() {
46        parent::init();
47        $this->tpl_mainpage = MODULE2_PATH . THIS_MODULE_NAME . "/config.tpl";
48        $this->objFormParam = new SC_FormParam();
49        $this->intiParam();
50           $this->arrErr = array();
51           $this->objQuery = new SC_Query();
52           $this->loadData();
53    }
54
55    /**
56     * Page のプロセス.
57     *
58     * @return void
59     */
60    function process() {
61           $objView = new SC_AdminView();
62        $objSess = new SC_Session();
63
64        // 認証可否の判定
65        //SC_Utils_Ex::sfIsSuccess($objSess);
66        $this->objFormParam->setParam($_POST);
67
68        switch($_POST['mode']) {
69            case 'regist':
70                // エラーチェック
71                $this->arrErr = $this->checkError();
72                if(count($objPage->arrErr) <= 0) {
73                    $this->registData();
74                }
75            break;
76        }
77        $this->arrForm = $this->objFormParam->getFormParamList();
78        $objView->assignobj($this);
79        $objView->display($this->tpl_mainpage);
80    }
81
82    /**
83     * デストラクタ.
84     *
85     * @return void
86     */
87    function destroy() {
88        parent::destroy();
89    }
90
91    /**
92     * 値の初期化
93     *
94     * @return void なし
95     */
96    function intiParam() {
97        $this->objFormParam->addParam("IPアドレス1", "ip01", 3, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
98        $this->objFormParam->addParam("IPアドレス2", "ip02", 3, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
99        $this->objFormParam->addParam("IPアドレス3", "ip03", 3, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
100           $this->objFormParam->addParam("IPアドレス4", "ip04", 3, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
101    }
102
103    /**
104     * エラーチェック
105     *
106     * @return array $arr->arrErr
107     */
108    function checkError() {
109        $arrErr = $this->objFormParam->checkError();
110        $arrParam = $this->objFormParam->getHashArray();
111
112        foreach($arrParam as $key => $val) {
113            if(!(($val >= 0) && ($val <= 255))) {
114                $arrErr[$key] = "※ 不正なIPアドレスです。<br>";
115                break;
116            }
117        }
118        return $arrErr;
119    }
120
121    // 登録データを読み込む
122    function loadData(){
123        // 設定されているSMTP_HOSTを取得する
124        $arrRet = $this->objQuery->select("id, name", "mtb_constants", "id = ?", array('SMTP_HOST'));
125        $name = ereg_replace("\"", "", $arrRet[0]['name']);
126        list($arrParam['ip01'], $arrParam['ip02'], $arrParam['ip03'], $arrParam['ip04']) = split("\.", $name);
127        $this->objFormParam->setParam($arrParam);
128    }
129
130    // データの更新処理
131    function registData(){
132        $arrParam = $this->objFormParam->getHashArray();
133        $strIP = "\"" . $arrParam['ip01'] . "." .  $arrParam['ip02'] . "." . $arrParam['ip03'] . "." . $arrParam['ip04'] . "\"";
134        $sqlval['name'] = $strIP;
135        $this->objQuery->update("mtb_constants", $sqlval, "id = ?", array('SMTP_HOST'));
136    }
137}
138?>
Note: See TracBrowser for help on using the repository browser.