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