[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 | * FIXME インストール直後のレンダリング時点では、上部ナビに反映されない |
---|
| 30 | * TODO Transaction Token を使用する |
---|
| 31 | * |
---|
| 32 | * @package Page |
---|
| 33 | * @author Seasoft 塚田将久 |
---|
| 34 | * @version $Id:$ |
---|
| 35 | */ |
---|
[19661] | 36 | class LC_Page_Admin_Plugin_Uninstall extends LC_Page_Admin { |
---|
[18370] | 37 | |
---|
| 38 | /** |
---|
| 39 | * Page を初期化する. |
---|
| 40 | * |
---|
| 41 | * @return void |
---|
| 42 | */ |
---|
| 43 | function init() { |
---|
| 44 | if (DEBUG_LOAD_PLUGIN !== true) SC_Utils_Ex::sfDispException('プラグインは有効化されていない'); // XXX 開発途上対応 |
---|
| 45 | parent::init(); |
---|
| 46 | |
---|
| 47 | $this->tpl_mainpage = 'plugin/uninstall.tpl'; |
---|
| 48 | $this->tpl_mainno = 'plugin'; |
---|
| 49 | $this->tpl_subno = 'uninstall'; |
---|
| 50 | $this->tpl_subtitle = 'プラグインのアンインストール'; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * Page のプロセス. |
---|
| 55 | * |
---|
| 56 | * @return void |
---|
| 57 | */ |
---|
| 58 | function process() { |
---|
[19661] | 59 | $this->action(); |
---|
| 60 | $this->sendResponse(); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | * Page のアクション. |
---|
| 65 | * |
---|
| 66 | * @return void |
---|
| 67 | */ |
---|
| 68 | function action() { |
---|
[18370] | 69 | $objSess = new SC_Session(); |
---|
| 70 | |
---|
| 71 | // 認証可否の判定 |
---|
| 72 | SC_Utils_Ex::sfIsSuccess($objSess); |
---|
| 73 | |
---|
| 74 | // パラメータ管理クラス |
---|
| 75 | $this->objFormParam = new SC_FormParam(); |
---|
| 76 | // パラメータ情報の初期化 |
---|
| 77 | $this->lfInitParam(); |
---|
| 78 | // POST値の取得 |
---|
| 79 | $this->objFormParam->setParam($_REQUEST); |
---|
| 80 | // 入力情報を渡す |
---|
| 81 | $this->arrForm = $this->objFormParam->getHashArray(); |
---|
| 82 | $this->arrErr = $this->objFormParam->checkError(); |
---|
| 83 | if (count($this->arrErr) == 0) { |
---|
| 84 | // アンインストール |
---|
| 85 | $this->lfUninstall($this->arrForm['path']); |
---|
| 86 | $this->tpl_result = '完了しました。'; |
---|
| 87 | } else { |
---|
| 88 | SC_Utils_Ex::sfDispException(); |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | /** |
---|
| 93 | * デストラクタ. |
---|
| 94 | * |
---|
| 95 | * @return void |
---|
| 96 | */ |
---|
| 97 | function destroy() { |
---|
| 98 | parent::destroy(); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * アンインストール |
---|
| 103 | * |
---|
| 104 | * @return void |
---|
| 105 | */ |
---|
| 106 | function lfUninstall($path) { |
---|
| 107 | $objQuery = new SC_Query(); |
---|
| 108 | |
---|
[18380] | 109 | // アンインストール SQL を実行 |
---|
[20001] | 110 | SC_Helper_DB_Ex::sfExecSqlByFile(PLUGIN_REALDIR . "$path/sql/uninstall.sql"); |
---|
[18370] | 111 | |
---|
| 112 | // プラグイン XML から削除 |
---|
| 113 | $this->lfRemoveFromPluginsXml($path); |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | /** |
---|
| 117 | * プラグイン XML から削除 |
---|
| 118 | * |
---|
| 119 | * @return void |
---|
| 120 | */ |
---|
| 121 | function lfRemoveFromPluginsXml($path) { |
---|
| 122 | $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); |
---|
| 123 | for ($i = 0; $i <= count($pluginsXml->plugin) - 1; $i++) { |
---|
| 124 | if ((string)$pluginsXml->plugin[$i]->path == $path) { |
---|
| 125 | unset($pluginsXml->plugin[$i]); |
---|
| 126 | } |
---|
| 127 | } |
---|
| 128 | SC_Utils_Ex::sfPutPluginsXml($pluginsXml); |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | /** |
---|
| 132 | * パラメータ情報の初期化 |
---|
| 133 | * |
---|
| 134 | * @return void |
---|
| 135 | */ |
---|
| 136 | function lfInitParam() { |
---|
| 137 | $this->objFormParam->addParam('プラグインのパス', 'path', STEXT_LEN, '', array('EXIST_CHECK', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | ?> |
---|