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