[18370] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[18701] | 5 | * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. |
---|
[18370] | 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 | |
---|
[19805] | 24 | require_once(CLASS_REALDIR . "pages/admin/LC_Page_Admin.php"); |
---|
[18370] | 25 | |
---|
| 26 | /** |
---|
| 27 | * プラグイン管理のページクラス |
---|
| 28 | * |
---|
| 29 | * @package Page |
---|
| 30 | * @author Seasoft 塚田将久 |
---|
| 31 | * @version $Id:$ |
---|
| 32 | */ |
---|
[19661] | 33 | class LC_Page_Admin_Plugin extends LC_Page_Admin { |
---|
[18370] | 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() { |
---|
[19661] | 56 | $this->action(); |
---|
| 57 | $this->sendResponse(); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * Page のアクション. |
---|
| 62 | * |
---|
| 63 | * @return void |
---|
| 64 | */ |
---|
| 65 | function action() { |
---|
[18370] | 66 | $objSess = new SC_Session(); |
---|
| 67 | |
---|
| 68 | // 認証可否の判定 |
---|
| 69 | SC_Utils_Ex::sfIsSuccess($objSess); |
---|
| 70 | |
---|
| 71 | $this->loadPluginsList(); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * デストラクタ. |
---|
| 76 | * |
---|
| 77 | * @return void |
---|
| 78 | */ |
---|
| 79 | function destroy() { |
---|
| 80 | parent::destroy(); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * プラグインの一覧を読み込む |
---|
| 85 | * |
---|
| 86 | * @return void |
---|
| 87 | */ |
---|
| 88 | function loadPluginsList() { |
---|
| 89 | $plugins = array(); |
---|
| 90 | $this->arrInstalledPlugin = array(); |
---|
| 91 | $this->arrInstallablePlugin = array(); |
---|
| 92 | |
---|
| 93 | $d = dir(PLUGIN_PATH); |
---|
| 94 | while (false !== ($entry = $d->read())) { |
---|
| 95 | if ($entry == '.') continue; |
---|
| 96 | if ($entry == '..') continue; |
---|
| 97 | if (!is_dir($d->path . $entry)) continue; |
---|
| 98 | |
---|
| 99 | $plugins[$entry]['dir_exists'] = true; |
---|
| 100 | } |
---|
| 101 | $d->close(); |
---|
| 102 | |
---|
| 103 | $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); |
---|
| 104 | foreach ($pluginsXml->plugin as $plugin) { |
---|
| 105 | $plugins[(string)$plugin->path]['installed'] = true; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | foreach ($plugins as $path=>$plugin) { |
---|
| 109 | $plugin['info'] = SC_Utils_Ex::sfGetPluginInfoArray($path); |
---|
| 110 | $plugin['path'] = $path; |
---|
| 111 | if ($plugin['installed']) { |
---|
| 112 | $this->arrInstalledPlugin[] = $plugin; |
---|
| 113 | } else { |
---|
| 114 | $this->arrInstallablePlugin[] = $plugin; |
---|
| 115 | } |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | ?> |
---|