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