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