1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : UserStat |
---|
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 | //ini_set('error_reporting', E_ALL); |
---|
14 | //ini_set('display_errors', true); |
---|
15 | |
---|
16 | include_once('userstat_version.inc.php'); // => Don't forget to update this file !! |
---|
17 | |
---|
18 | defined('USERSTAT_DIR') || define('USERSTAT_DIR' , basename(dirname(__FILE__))); |
---|
19 | defined('USERSTAT_PATH') || define('USERSTAT_PATH' , PHPWG_PLUGINS_PATH . USERSTAT_DIR . '/'); |
---|
20 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); |
---|
21 | |
---|
22 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
23 | |
---|
24 | /* ----------------------------------------------------------------------------- |
---|
25 | * UserStat needs the Grum Plugin Classes |
---|
26 | * -------------------------------------------------------------------------- */ |
---|
27 | $gpcInstalled=false; |
---|
28 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
29 | { |
---|
30 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
31 | // need GPC release greater or equal than USERSTAT_GPC_NEEDED |
---|
32 | if(CommonPlugin::checkGPCRelease(USERSTAT_GPC_NEEDED)) |
---|
33 | { |
---|
34 | @include_once("userstat_install.class.inc.php"); |
---|
35 | $gpcInstalled=true; |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | function gpcMsgError(&$errors) |
---|
40 | { |
---|
41 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), USERSTAT_GPC_NEEDED); |
---|
42 | if(is_array($errors)) |
---|
43 | { |
---|
44 | array_push($errors, $msg); |
---|
45 | } |
---|
46 | else |
---|
47 | { |
---|
48 | $errors=Array($msg); |
---|
49 | } |
---|
50 | } |
---|
51 | // ----------------------------------------------------------------------------- |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | load_language('plugin.lang', USERSTAT_PATH); |
---|
56 | |
---|
57 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
58 | { |
---|
59 | global $prefixeTable, $gpcInstalled; |
---|
60 | if($gpcInstalled) |
---|
61 | { |
---|
62 | $obj=new UserStat_install($prefixeTable, __FILE__); |
---|
63 | $result=$obj->install(); |
---|
64 | } |
---|
65 | else |
---|
66 | { |
---|
67 | gpcMsgError($errors); |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
72 | { |
---|
73 | global $prefixeTable, $gpcInstalled; |
---|
74 | if($gpcInstalled) |
---|
75 | { |
---|
76 | $obj=new UserStat_install($prefixeTable, __FILE__); |
---|
77 | $result=$obj->activate(); |
---|
78 | } |
---|
79 | } |
---|
80 | |
---|
81 | function plugin_deactivate($plugin_id) |
---|
82 | { |
---|
83 | global $prefixeTable, $gpcInstalled; |
---|
84 | |
---|
85 | if($gpcInstalled) |
---|
86 | { |
---|
87 | $obj=new UserStat_install($prefixeTable, __FILE__); |
---|
88 | $obj->deactivate(); |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | function plugin_uninstall($plugin_id) |
---|
93 | { |
---|
94 | global $prefixeTable, $gpcInstalled; |
---|
95 | if($gpcInstalled) |
---|
96 | { |
---|
97 | $obj=new UserStat_install($prefixeTable, __FILE__); |
---|
98 | $result=$obj->uninstall(); |
---|
99 | } |
---|
100 | else |
---|
101 | { |
---|
102 | gpcMsgError($errors); |
---|
103 | } |
---|
104 | } |
---|
105 | |
---|
106 | |
---|
107 | ?> |
---|