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