[4905] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * ----------------------------------------------------------------------------- |
---|
| 4 | * Plugin Name: Advanced MetaData |
---|
| 5 | * ----------------------------------------------------------------------------- |
---|
| 6 | * Author : Grum |
---|
| 7 | * email : grum@piwigo.org |
---|
| 8 | * website : http://photos.grum.fr |
---|
| 9 | * PWG user : http://forum.piwigo.org/profile.php?id=3706 |
---|
| 10 | * |
---|
| 11 | * << May the Little SpaceFrog be with you ! >> |
---|
| 12 | * |
---|
| 13 | * ----------------------------------------------------------------------------- |
---|
| 14 | * |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } |
---|
| 18 | |
---|
| 19 | //ini_set('error_reporting', E_ALL); |
---|
| 20 | //ini_set('display_errors', true); |
---|
| 21 | |
---|
[5935] | 22 | include_once('amd_version.inc.php'); // => Don't forget to update this file !! |
---|
| 23 | |
---|
| 24 | |
---|
[4905] | 25 | defined('AMD_DIR') || define('AMD_DIR' , basename(dirname(__FILE__))); |
---|
| 26 | defined('AMD_PATH') || define('AMD_PATH' , PHPWG_PLUGINS_PATH . AMD_DIR . '/'); |
---|
[5935] | 27 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); |
---|
| 28 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); |
---|
[4905] | 29 | |
---|
| 30 | |
---|
[5935] | 31 | global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility |
---|
[4905] | 32 | |
---|
| 33 | /* ----------------------------------------------------------------------------- |
---|
[5935] | 34 | * AMD needs the Grum Plugin Classe |
---|
| 35 | * -------------------------------------------------------------------------- */ |
---|
[4905] | 36 | $gpc_installed=false; |
---|
[6722] | 37 | $gpcNeeded="3.2.0"; |
---|
[5935] | 38 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
[4905] | 39 | { |
---|
[5935] | 40 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
[6722] | 41 | // need GPC release greater or equal than 3.2.0 |
---|
| 42 | if(CommonPlugin::checkGPCRelease(3,2,0)) |
---|
[4905] | 43 | { |
---|
| 44 | @include_once("amd_install.class.inc.php"); |
---|
| 45 | $gpc_installed=true; |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | function gpcMsgError(&$errors) |
---|
| 50 | { |
---|
[5935] | 51 | global $gpcNeeded; |
---|
| 52 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), $gpcNeeded); |
---|
| 53 | if(is_array($errors)) |
---|
| 54 | { |
---|
| 55 | array_push($errors, $msg); |
---|
| 56 | } |
---|
| 57 | else |
---|
| 58 | { |
---|
| 59 | $errors=Array($msg); |
---|
| 60 | } |
---|
[4905] | 61 | } |
---|
| 62 | // ----------------------------------------------------------------------------- |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | load_language('plugin.lang', AMD_PATH); |
---|
| 67 | |
---|
| 68 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 69 | { |
---|
[5935] | 70 | global $prefixeTable, $gpc_installed, $gpcNeeded; |
---|
[4905] | 71 | if($gpc_installed) |
---|
| 72 | { |
---|
| 73 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 74 | $result=$amd->install(); |
---|
[5935] | 75 | GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded); |
---|
[4905] | 76 | } |
---|
| 77 | else |
---|
| 78 | { |
---|
| 79 | gpcMsgError($errors); |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 84 | { |
---|
[6729] | 85 | global $prefixeTable, $gpcNeeded; |
---|
[4905] | 86 | |
---|
| 87 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 88 | $result=$amd->activate(); |
---|
[6722] | 89 | GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded); |
---|
[4905] | 90 | } |
---|
| 91 | |
---|
| 92 | function plugin_deactivate($plugin_id) |
---|
| 93 | { |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | function plugin_uninstall($plugin_id) |
---|
| 97 | { |
---|
[5935] | 98 | global $prefixeTable, $gpc_installed, $gpcNeeded; |
---|
[4905] | 99 | if($gpc_installed) |
---|
| 100 | { |
---|
| 101 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 102 | $result=$amd->uninstall(); |
---|
[5935] | 103 | GPCCore::unregister($amd->getPluginName()); |
---|
[4905] | 104 | } |
---|
| 105 | else |
---|
| 106 | { |
---|
| 107 | gpcMsgError($errors); |
---|
| 108 | } |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | ?> |
---|