[3681] | 1 | <?php |
---|
| 2 | |
---|
| 3 | if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } |
---|
| 4 | |
---|
| 5 | //ini_set('error_reporting', E_ALL); |
---|
| 6 | //ini_set('display_errors', true); |
---|
| 7 | |
---|
| 8 | defined('AMM_DIR') || define('AMM_DIR' , basename(dirname(__FILE__))); |
---|
| 9 | defined('AMM_PATH') || define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/'); |
---|
| 10 | @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php'); |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | global $gpc_installed, $lang; //needed for plugin manager compatibility |
---|
| 14 | |
---|
| 15 | /* ----------------------------------------------------------------------------- |
---|
| 16 | AMM needs the Grum Plugin Classe |
---|
| 17 | ----------------------------------------------------------------------------- */ |
---|
| 18 | $gpc_installed=false; |
---|
| 19 | if(file_exists(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php')) |
---|
| 20 | { |
---|
| 21 | @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/main.inc.php'); |
---|
[4395] | 22 | // need GPC release greater or equal than 2.0.4 |
---|
[3681] | 23 | |
---|
[4395] | 24 | if(checkGPCRelease(2,0,4)) |
---|
[3681] | 25 | { |
---|
| 26 | @include_once("amm_install.class.inc.php"); |
---|
| 27 | $gpc_installed=true; |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | function gpcMsgError(&$errors) |
---|
| 32 | { |
---|
[4395] | 33 | array_push($errors, sprintf(l10n('Grum Plugin Classes is not installed (release >= %s)'), "2.0.4")); |
---|
[3681] | 34 | } |
---|
| 35 | // ----------------------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | load_language('plugin.lang', AMM_PATH); |
---|
| 40 | |
---|
| 41 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 42 | { |
---|
| 43 | global $prefixeTable, $gpc_installed; |
---|
| 44 | if($gpc_installed) |
---|
| 45 | { |
---|
| 46 | //$menu->register('mbAMM_links', 'Links', 0, 'AMM'); |
---|
| 47 | //$menu->register('mbAMM_randompict', 'Random pictures', 0, 'AMM'); |
---|
| 48 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 49 | $result=$amm->install(); |
---|
| 50 | } |
---|
| 51 | else |
---|
| 52 | { |
---|
| 53 | gpcMsgError($errors); |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 58 | { |
---|
[4391] | 59 | global $prefixeTable; |
---|
| 60 | |
---|
| 61 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 62 | $result=$amm->activate(); |
---|
[3681] | 63 | } |
---|
| 64 | |
---|
| 65 | function plugin_deactivate($plugin_id) |
---|
| 66 | { |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | function plugin_uninstall($plugin_id) |
---|
| 70 | { |
---|
| 71 | global $prefixeTable; |
---|
| 72 | if($gpc_installed) |
---|
| 73 | { |
---|
| 74 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 75 | $result=$amm->uninstall(); |
---|
| 76 | } |
---|
| 77 | else |
---|
| 78 | { |
---|
| 79 | gpcMsgError($errors); |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | ?> |
---|