[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 | |
---|
[6977] | 31 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
[4905] | 32 | |
---|
| 33 | /* ----------------------------------------------------------------------------- |
---|
[5935] | 34 | * AMD needs the Grum Plugin Classe |
---|
| 35 | * -------------------------------------------------------------------------- */ |
---|
[6977] | 36 | $gpcInstalled=false; |
---|
[5935] | 37 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
[4905] | 38 | { |
---|
[5935] | 39 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
[6722] | 40 | // need GPC release greater or equal than 3.2.0 |
---|
| 41 | if(CommonPlugin::checkGPCRelease(3,2,0)) |
---|
[4905] | 42 | { |
---|
| 43 | @include_once("amd_install.class.inc.php"); |
---|
[6977] | 44 | $gpcInstalled=true; |
---|
[4905] | 45 | } |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | function gpcMsgError(&$errors) |
---|
| 49 | { |
---|
[6977] | 50 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), AMD_GPC_NEEDED); |
---|
[5935] | 51 | if(is_array($errors)) |
---|
| 52 | { |
---|
| 53 | array_push($errors, $msg); |
---|
| 54 | } |
---|
| 55 | else |
---|
| 56 | { |
---|
| 57 | $errors=Array($msg); |
---|
| 58 | } |
---|
[4905] | 59 | } |
---|
| 60 | // ----------------------------------------------------------------------------- |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | load_language('plugin.lang', AMD_PATH); |
---|
| 65 | |
---|
| 66 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 67 | { |
---|
[6977] | 68 | global $prefixeTable, $gpcInstalled; |
---|
| 69 | if($gpcInstalled) |
---|
[4905] | 70 | { |
---|
| 71 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 72 | $result=$amd->install(); |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
| 76 | gpcMsgError($errors); |
---|
| 77 | } |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 81 | { |
---|
[6977] | 82 | global $prefixeTable, $gpcInstalled; |
---|
| 83 | if($gpcInstalled) |
---|
| 84 | { |
---|
| 85 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 86 | $result=$amd->activate(); |
---|
| 87 | } |
---|
[4905] | 88 | } |
---|
| 89 | |
---|
| 90 | function plugin_deactivate($plugin_id) |
---|
| 91 | { |
---|
[6977] | 92 | global $prefixeTable, $gpcInstalled; |
---|
[6891] | 93 | |
---|
[6977] | 94 | if($gpcInstalled) |
---|
| 95 | { |
---|
| 96 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 97 | $amd->deactivate(); |
---|
| 98 | } |
---|
[4905] | 99 | } |
---|
| 100 | |
---|
| 101 | function plugin_uninstall($plugin_id) |
---|
| 102 | { |
---|
[6977] | 103 | global $prefixeTable, $gpcInstalled; |
---|
| 104 | if($gpcInstalled) |
---|
[4905] | 105 | { |
---|
| 106 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
| 107 | $result=$amd->uninstall(); |
---|
| 108 | } |
---|
| 109 | else |
---|
| 110 | { |
---|
| 111 | gpcMsgError($errors); |
---|
| 112 | } |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | ?> |
---|