1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : AStat.2 |
---|
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 | if(!defined('ASTAT_DIR')) define('ASTAT_DIR' , basename(dirname(__FILE__))); |
---|
17 | if(!defined('ASTAT_PATH')) define('ASTAT_PATH' , PHPWG_PLUGINS_PATH . ASTAT_DIR . '/'); |
---|
18 | |
---|
19 | include_once('astat_version.inc.php'); |
---|
20 | |
---|
21 | //ini_set('error_reporting', E_ALL); |
---|
22 | //ini_set('display_errors', true); |
---|
23 | |
---|
24 | global $gpc_installed, $gpcNeeded, $lang; //needed for plugin manager compatibility |
---|
25 | |
---|
26 | /* ----------------------------------------------------------------------------- |
---|
27 | AStat-2 needs the Grum Plugin Classe |
---|
28 | ----------------------------------------------------------------------------- */ |
---|
29 | $gpc_installed=false; |
---|
30 | $gpcNeeded="3.0.0"; |
---|
31 | if(file_exists(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php')) |
---|
32 | { |
---|
33 | @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
34 | // need GPC release greater or equal than 3.0.0 |
---|
35 | if(CommonPlugin::checkGPCRelease(3,0,0)) |
---|
36 | { |
---|
37 | @include_once("astat_aim.class.inc.php"); |
---|
38 | $gpc_installed=true; |
---|
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 | load_language('plugin.lang', ASTAT_PATH); |
---|
59 | |
---|
60 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
61 | { |
---|
62 | global $prefixeTable, $gpc_installed, $gpcNeeded; |
---|
63 | if($gpc_installed) |
---|
64 | { |
---|
65 | $obj = new AStat_AIM($prefixeTable, __FILE__); |
---|
66 | $obj->deleteConfig(); |
---|
67 | $obj->initConfig(); |
---|
68 | $obj->my_config['installed']=ASTAT_VERSION2; |
---|
69 | $obj->saveConfig(); |
---|
70 | GPCCore::register($obj->getPluginName(), ASTAT_VERSION, $gpcNeeded); |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | gpcMsgError($errors); |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
79 | { |
---|
80 | global $prefixeTable, $gpc_installed; |
---|
81 | if($gpc_installed) |
---|
82 | { |
---|
83 | $obj = new AStat_AIM($prefixeTable, __FILE__); |
---|
84 | $obj->initConfig(); |
---|
85 | $obj->loadConfig(); |
---|
86 | $obj->my_config['installed']=ASTAT_VERSION2; |
---|
87 | $obj->saveConfig(); |
---|
88 | $obj->alter_history_section_enum('deleted_cat'); |
---|
89 | } |
---|
90 | else |
---|
91 | { |
---|
92 | gpcMsgError($errors); |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | function plugin_deactivate($plugin_id) |
---|
97 | { |
---|
98 | } |
---|
99 | |
---|
100 | function plugin_uninstall($plugin_id) |
---|
101 | { |
---|
102 | global $prefixeTable, $gpc_installed; |
---|
103 | if($gpc_installed) |
---|
104 | { |
---|
105 | $obj = new AStat_AIM($prefixeTable, __FILE__); |
---|
106 | $obj->deleteConfig(); |
---|
107 | GPCCore::unregister($obj->getPluginName()); |
---|
108 | } |
---|
109 | else |
---|
110 | { |
---|
111 | gpcMsgError($errors); |
---|
112 | } |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | ?> |
---|