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