[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 | |
---|
[5545] | 11 | include_once('amm_version.inc.php'); // => Don't forget to update this file !! |
---|
[3681] | 12 | |
---|
| 13 | |
---|
[8962] | 14 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
[5545] | 15 | |
---|
[3681] | 16 | /* ----------------------------------------------------------------------------- |
---|
| 17 | AMM needs the Grum Plugin Classe |
---|
| 18 | ----------------------------------------------------------------------------- */ |
---|
[8962] | 19 | $gpcInstalled=false; |
---|
[5545] | 20 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
[3681] | 21 | { |
---|
[5545] | 22 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
[8994] | 23 | // need GPC release greater or equal than 3.4.0 |
---|
| 24 | if(CommonPlugin::checkGPCRelease(3,4,0)) |
---|
[3681] | 25 | { |
---|
[8994] | 26 | include_once("amm_install.class.inc.php"); |
---|
[8962] | 27 | $gpcInstalled=true; |
---|
[3681] | 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | function gpcMsgError(&$errors) |
---|
| 32 | { |
---|
[8962] | 33 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), AMM_GPC_NEEDED); |
---|
[5545] | 34 | if(is_array($errors)) |
---|
| 35 | { |
---|
| 36 | array_push($errors, $msg); |
---|
| 37 | } |
---|
| 38 | else |
---|
| 39 | { |
---|
| 40 | $errors=Array($msg); |
---|
| 41 | } |
---|
[3681] | 42 | } |
---|
| 43 | // ----------------------------------------------------------------------------- |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | load_language('plugin.lang', AMM_PATH); |
---|
| 48 | |
---|
[8962] | 49 | |
---|
| 50 | |
---|
[3681] | 51 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 52 | { |
---|
[8962] | 53 | global $prefixeTable, $gpcInstalled; |
---|
| 54 | if($gpcInstalled) |
---|
[3681] | 55 | { |
---|
| 56 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 57 | $result=$amm->install(); |
---|
| 58 | } |
---|
| 59 | else |
---|
| 60 | { |
---|
| 61 | gpcMsgError($errors); |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 66 | { |
---|
[8962] | 67 | global $prefixeTable, $gpcInstalled; |
---|
| 68 | if($gpcInstalled) |
---|
| 69 | { |
---|
| 70 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 71 | $result=$amm->activate(); |
---|
| 72 | } |
---|
[3681] | 73 | } |
---|
| 74 | |
---|
| 75 | function plugin_deactivate($plugin_id) |
---|
| 76 | { |
---|
[8962] | 77 | global $prefixeTable, $gpcInstalled; |
---|
| 78 | |
---|
| 79 | if($gpcInstalled) |
---|
| 80 | { |
---|
| 81 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 82 | $amm->deactivate(); |
---|
| 83 | } |
---|
[3681] | 84 | } |
---|
| 85 | |
---|
| 86 | function plugin_uninstall($plugin_id) |
---|
| 87 | { |
---|
[8962] | 88 | global $prefixeTable, $gpcInstalled; |
---|
| 89 | if($gpcInstalled) |
---|
[3681] | 90 | { |
---|
| 91 | $amm=new AMM_install($prefixeTable, __FILE__); |
---|
| 92 | $result=$amm->uninstall(); |
---|
| 93 | } |
---|
| 94 | else |
---|
| 95 | { |
---|
| 96 | gpcMsgError($errors); |
---|
| 97 | } |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | ?> |
---|