1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2009 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 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
25 | |
---|
26 | /** |
---|
27 | * プラグイン管理のページクラス |
---|
28 | * |
---|
29 | * @package Page |
---|
30 | * @author Seasoft 塚田将久 |
---|
31 | * @version $Id:$ |
---|
32 | */ |
---|
33 | class LC_Page_Admin_Plugin extends LC_Page { |
---|
34 | |
---|
35 | /** |
---|
36 | * Page を初期化する. |
---|
37 | * |
---|
38 | * @return void |
---|
39 | */ |
---|
40 | function init() { |
---|
41 | if (DEBUG_LOAD_PLUGIN !== true) SC_Utils_Ex::sfDispException('プラグインは有効化されていない'); // XXX 開発途上対応 |
---|
42 | parent::init(); |
---|
43 | |
---|
44 | $this->tpl_mainpage = 'plugin/index.tpl'; |
---|
45 | $this->tpl_mainno = 'plugin'; |
---|
46 | $this->tpl_subno = 'index'; |
---|
47 | $this->tpl_subtitle = 'プラグイン管理'; |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | * Page のプロセス. |
---|
52 | * |
---|
53 | * @return void |
---|
54 | */ |
---|
55 | function process() { |
---|
56 | $objView = new SC_AdminView(); |
---|
57 | $objSess = new SC_Session(); |
---|
58 | |
---|
59 | // 認証可否の判定 |
---|
60 | SC_Utils_Ex::sfIsSuccess($objSess); |
---|
61 | |
---|
62 | $this->loadPluginsList(); |
---|
63 | |
---|
64 | $objView->assignobj($this); |
---|
65 | $objView->display(MAIN_FRAME); |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * デストラクタ. |
---|
70 | * |
---|
71 | * @return void |
---|
72 | */ |
---|
73 | function destroy() { |
---|
74 | parent::destroy(); |
---|
75 | } |
---|
76 | |
---|
77 | /** |
---|
78 | * プラグインの一覧を読み込む |
---|
79 | * |
---|
80 | * @return void |
---|
81 | */ |
---|
82 | function loadPluginsList() { |
---|
83 | $plugins = array(); |
---|
84 | $this->arrInstalledPlugin = array(); |
---|
85 | $this->arrInstallablePlugin = array(); |
---|
86 | |
---|
87 | $d = dir(PLUGIN_PATH); |
---|
88 | while (false !== ($entry = $d->read())) { |
---|
89 | if ($entry == '.') continue; |
---|
90 | if ($entry == '..') continue; |
---|
91 | if (!is_dir($d->path . $entry)) continue; |
---|
92 | |
---|
93 | $plugins[$entry]['dir_exists'] = true; |
---|
94 | } |
---|
95 | $d->close(); |
---|
96 | |
---|
97 | $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); |
---|
98 | foreach ($pluginsXml->plugin as $plugin) { |
---|
99 | $plugins[(string)$plugin->path]['installed'] = true; |
---|
100 | } |
---|
101 | |
---|
102 | foreach ($plugins as $path=>$plugin) { |
---|
103 | $plugin['info'] = SC_Utils_Ex::sfGetPluginInfoArray($path); |
---|
104 | $plugin['path'] = $path; |
---|
105 | if ($plugin['installed']) { |
---|
106 | $this->arrInstalledPlugin[] = $plugin; |
---|
107 | } else { |
---|
108 | $this->arrInstallablePlugin[] = $plugin; |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | } |
---|
113 | } |
---|
114 | ?> |
---|