[6547] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!'); |
---|
| 4 | |
---|
| 5 | if (!defined('CF_PATH')) { |
---|
| 6 | define('CF_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
| 7 | } |
---|
| 8 | if (!defined('CF_ROOT')) { |
---|
| 9 | define('CF_ROOT', dirname(__FILE__).'/'); |
---|
| 10 | } |
---|
| 11 | |
---|
| 12 | function plugin_install($plugin_id, $version, &$errors) { |
---|
| 13 | include_once(CF_PATH . 'include/cf_common.inc.php'); |
---|
| 14 | // Include language advices |
---|
| 15 | load_language('plugin.lang', CF_PATH); |
---|
| 16 | update_config($plugin_id, CF_CFG_DB_FACTORY); |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | function plugin_activate($plugin_id, $version, &$errors) { |
---|
| 20 | update_config($plugin_id); |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | function plugin_deactivate($plugin_id) { |
---|
| 24 | // Nothing special |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | function plugin_uninstall($plugin_id) { |
---|
| 28 | include_once(CF_PATH . 'include/cf_common.inc.php'); |
---|
| 29 | $uninstall = CF_Config::uninstall($plugin_id); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | function update_config($plugin_id, $db_comment=null) { |
---|
| 33 | include_once(CF_PATH . 'include/cf_common.inc.php'); |
---|
| 34 | $clean = cf_clean_obsolete_files(CF_OBSOLETE); |
---|
| 35 | if (null != $db_comment) { |
---|
| 36 | $cf_config_default[CF_CFG_COMMENT] = $db_comment; |
---|
| 37 | } |
---|
| 38 | $install = CF_Config::install($plugin_id); |
---|
| 39 | } |
---|
| 40 | ?> |
---|