[3432] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
[3462] | 3 | if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!'); |
---|
[3432] | 4 | |
---|
[3462] | 5 | if (!defined('CE_PATH')) { |
---|
| 6 | define('CE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
[3432] | 7 | } |
---|
[3462] | 8 | if (!defined('CE_ROOT')) { |
---|
| 9 | define('CE_ROOT', dirname(__FILE__).'/'); |
---|
| 10 | } |
---|
[3432] | 11 | |
---|
[3473] | 12 | function plugin_install($plugin_id, $version, &$errors) { |
---|
[3480] | 13 | include_once(CE_PATH . 'include/ce_common.inc.php'); |
---|
| 14 | // Include language advices |
---|
| 15 | load_language('plugin.lang', CE_PATH); |
---|
| 16 | if ($version != CE_VERSION) { |
---|
| 17 | array_push($errors, sprintf(l10n('ce_inconsistent_version'), $plugin_id)); |
---|
| 18 | return; |
---|
| 19 | } |
---|
[3481] | 20 | update_config($plugin_id, CE_CFG_DB_FACTORY); |
---|
[3432] | 21 | } |
---|
| 22 | |
---|
[3473] | 23 | function plugin_activate($plugin_id, $version, &$errors) { |
---|
[3481] | 24 | update_config($plugin_id); |
---|
[3462] | 25 | } |
---|
| 26 | |
---|
[3473] | 27 | function plugin_deactivate($plugin_id) { |
---|
| 28 | // Nothing special |
---|
| 29 | } |
---|
| 30 | |
---|
[3432] | 31 | function plugin_uninstall($plugin_id) { |
---|
[3462] | 32 | include_once(CE_PATH . 'include/ce_common.inc.php'); |
---|
| 33 | $uninstall = CE_Config::uninstall($plugin_id); |
---|
[3432] | 34 | } |
---|
[3473] | 35 | |
---|
[3481] | 36 | function update_config($plugin_id, $db_comment=null) { |
---|
[3476] | 37 | include_once(CE_PATH . 'include/ce_common.inc.php'); |
---|
| 38 | $clean = ce_clean_obsolete_files(CE_OBSOLETE); |
---|
[3480] | 39 | $ce_config_default[CE_CFG_VERSION] = CE_VERSION; |
---|
[3481] | 40 | if (null != $db_comment) { |
---|
| 41 | $ce_config_default[CE_CFG_COMMENT] = $db_comment; |
---|
| 42 | } |
---|
[3476] | 43 | $install = CE_Config::install($plugin_id, $ce_config_default); |
---|
| 44 | } |
---|
[3432] | 45 | ?> |
---|