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 | |
---|
22 | include_once('amd_version.inc.php'); // => Don't forget to update this file !! |
---|
23 | |
---|
24 | |
---|
25 | defined('AMD_DIR') || define('AMD_DIR' , basename(dirname(__FILE__))); |
---|
26 | defined('AMD_PATH') || define('AMD_PATH' , PHPWG_PLUGINS_PATH . AMD_DIR . '/'); |
---|
27 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); |
---|
28 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); |
---|
29 | |
---|
30 | |
---|
31 | global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility |
---|
32 | |
---|
33 | /* ----------------------------------------------------------------------------- |
---|
34 | * AMD needs the Grum Plugin Classe |
---|
35 | * -------------------------------------------------------------------------- */ |
---|
36 | $gpc_installed=false; |
---|
37 | $gpcNeeded="3.2.0"; |
---|
38 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
39 | { |
---|
40 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
41 | // need GPC release greater or equal than 3.2.0 |
---|
42 | if(CommonPlugin::checkGPCRelease(3,2,0)) |
---|
43 | { |
---|
44 | @include_once("amd_install.class.inc.php"); |
---|
45 | $gpc_installed=true; |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | function gpcMsgError(&$errors) |
---|
50 | { |
---|
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 | } |
---|
61 | } |
---|
62 | // ----------------------------------------------------------------------------- |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | load_language('plugin.lang', AMD_PATH); |
---|
67 | |
---|
68 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
69 | { |
---|
70 | global $prefixeTable, $gpc_installed, $gpcNeeded; |
---|
71 | if($gpc_installed) |
---|
72 | { |
---|
73 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
74 | $result=$amd->install(); |
---|
75 | GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded); |
---|
76 | } |
---|
77 | else |
---|
78 | { |
---|
79 | gpcMsgError($errors); |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
84 | { |
---|
85 | global $prefixeTable; |
---|
86 | |
---|
87 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
88 | $result=$amd->activate(); |
---|
89 | GPCCore::register($amd->getPluginName(), AMD_VERSION, $gpcNeeded); |
---|
90 | } |
---|
91 | |
---|
92 | function plugin_deactivate($plugin_id) |
---|
93 | { |
---|
94 | } |
---|
95 | |
---|
96 | function plugin_uninstall($plugin_id) |
---|
97 | { |
---|
98 | global $prefixeTable, $gpc_installed, $gpcNeeded; |
---|
99 | if($gpc_installed) |
---|
100 | { |
---|
101 | $amd=new AMD_install($prefixeTable, __FILE__); |
---|
102 | $result=$amd->uninstall(); |
---|
103 | GPCCore::unregister($amd->getPluginName()); |
---|
104 | } |
---|
105 | else |
---|
106 | { |
---|
107 | gpcMsgError($errors); |
---|
108 | } |
---|
109 | } |
---|
110 | |
---|
111 | |
---|
112 | |
---|
113 | ?> |
---|