source: branches/version-2_13-dev/data/class/pages/upgrade/LC_Page_Upgrade_Base.php @ 23125

Revision 23125, 3.4 KB checked in by kimoto, 11 years ago (diff)

#2275 PEAR更新
不要なrequire_onceの削除
レガシーなPEARモジュールは使わない
SearchReplace?.phpのパスが間違っているので修正

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
3require_once CLASS_REALDIR . 'pages/upgrade/helper/LC_Upgrade_Helper_Log.php';
4require_once CLASS_REALDIR . 'pages/upgrade/helper/LC_Upgrade_Helper_Json.php';
5
6/**
7 * オーナーズストアページクラスの基底クラス.
8 *
9 * @package Page
10 * @author LOCKON CO.,LTD.
11 * @version $Id$
12 */
13class LC_Page_Upgrade_Base extends LC_Page_Ex
14{
15    /**
16     * Page を初期化する.
17     *
18     * @return void
19     */
20    public function init()
21    {
22        $this->skip_load_page_layout = true;
23        parent::init();
24    }
25
26    public function isValidIP()
27    {
28        $objLog  = new LC_Upgrade_Helper_Log;
29        $masterData = new SC_DB_MasterData_Ex();
30        $arrOstoreIPs = $masterData->getMasterData('mtb_ownersstore_ips');
31
32        if (isset($_SERVER['REMOTE_ADDR'])
33            && in_array($_SERVER['REMOTE_ADDR'], $arrOstoreIPs))
34        {
35            $objLog->log('* ip ok ' . $_SERVER['REMOTE_ADDR']);
36
37            return true;
38        }
39        $objLog->log('* refused ip ' . $_SERVER['REMOTE_ADDR']);
40
41        return false;
42    }
43
44    /**
45     * 自動アップデートが有効かどうかを判定する.
46     *
47     * @param  integer $product_id
48     * @return boolean
49     */
50    public function autoUpdateEnable($product_id)
51    {
52        $where = 'module_id = ?';
53        $objQuery =& SC_Query_Ex::getSingletonInstance();
54        $arrRet = $objQuery->select('auto_update_flg', 'dtb_module', $where, array($product_id));
55
56        if (isset($arrRet[0]['auto_update_flg'])
57        && $arrRet[0]['auto_update_flg'] === '1') {
58            return true;
59        }
60
61        return false;
62    }
63
64    /**
65     * 配信サーバーへリクエストを送信する.
66     *
67     * @param  string        $mode
68     * @param  array         $arrParams 追加パラメーター.連想配列で渡す.
69     * @return string|object レスポンスボディ|エラー時にはPEAR::Errorオブジェクトを返す.
70     */
71    public function request($mode, $arrParams = array(), $arrCookies = array())
72    {
73        $objReq = new HTTP_Request2();
74        $objReq->setUrl(OSTORE_URL . 'upgrade/index.php');
75        $objReq->setMethod('POST');
76        $objReq->addPostParameter('mode', $mode);
77        foreach ($arrParams as $key => $val) {
78            $objReq->addPostParameter($key, $val);
79        }
80
81        foreach ($arrCookies as $cookie) {
82            $objReq->addCookie($cookie['name'], $cookie['value']);
83        }
84
85        $e = $objReq->send();
86        if (PEAR::isError($e)) {
87            return $e;
88        } else {
89            return $objReq;
90        }
91    }
92
93    public function isLoggedInAdminPage()
94    {
95        $objSess = new SC_Session_Ex();
96
97        if ($objSess->isSuccess() === SUCCESS) {
98            return true;
99        }
100
101        return false;
102    }
103
104    /**
105     * 予測されにくいランダム値を生成する.
106     *
107     * @return string
108     */
109    public function createSeed()
110    {
111        return sha1(uniqid(rand(), true) . time());
112    }
113
114    public function getPublicKey()
115    {
116        $objQuery =& SC_Query_Ex::getSingletonInstance();
117        $arrRet = $objQuery->select('*', 'dtb_ownersstore_settings');
118
119        return isset($arrRet[0]['public_key'])
120            ? $arrRet[0]['public_key']
121            : null;
122    }
123
124    /**
125     * オーナーズストアからの POST のため, トークンチェックしない.
126     */
127    public function doValidToken()
128    {
129        // nothing.
130    }
131}
Note: See TracBrowser for help on using the repository browser.