[8509] | 1 | <?php |
---|
| 2 | /* ----------------------------------------------------------------------------- |
---|
| 3 | Plugin : Histogram |
---|
| 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('HGRAM_DIR')) define('HGRAM_DIR' , basename(dirname(__FILE__))); |
---|
| 17 | if(!defined('HGRAM_PATH')) define('HGRAM_PATH' , PHPWG_PLUGINS_PATH . HGRAM_DIR . '/'); |
---|
| 18 | |
---|
| 19 | //ini_set('error_reporting', E_ALL); |
---|
| 20 | //ini_set('display_errors', true); |
---|
| 21 | |
---|
| 22 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
| 23 | |
---|
| 24 | /* |
---|
| 25 | * ----------------------------------------------------------------------------- |
---|
| 26 | * Histogram needs the Grum Plugin Classes |
---|
| 27 | * ----------------------------------------------------------------------------- |
---|
| 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 3.2.0 |
---|
| 34 | if(CommonPlugin::checkGPCRelease(3,2,0)) |
---|
| 35 | { |
---|
| 36 | include_once('hgram_install.class.inc.php'); |
---|
| 37 | $gpcInstalled=true; |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | function gpcMsgError(&$errors) |
---|
| 42 | { |
---|
| 43 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), HGRAM_GPC_NEEDED); |
---|
| 44 | if(is_array($errors)) |
---|
| 45 | { |
---|
| 46 | array_push($errors, $msg); |
---|
| 47 | } |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | $errors=Array($msg); |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | // ----------------------------------------------------------------------------- |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | load_language('plugin.lang', HGRAM_PATH); |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 62 | { |
---|
| 63 | global $prefixeTable, $gpcInstalled; |
---|
| 64 | |
---|
| 65 | if($gpcInstalled) |
---|
| 66 | { |
---|
| 67 | $hgram = new HGram_Install($prefixeTable, __FILE__); |
---|
| 68 | if(!$hgram->install()) |
---|
| 69 | { |
---|
| 70 | array_push($errors, "error"); |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | else |
---|
| 74 | { |
---|
| 75 | gpcMsgError($errors); |
---|
| 76 | } |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 80 | { |
---|
| 81 | global $prefixeTable, $gpcInstalled; |
---|
| 82 | |
---|
| 83 | if($gpcInstalled) |
---|
| 84 | { |
---|
| 85 | $hgram = new HGram_Install($prefixeTable, __FILE__); |
---|
| 86 | $result=$hgram->activate(); |
---|
| 87 | if($result===false or $result!='') |
---|
| 88 | { |
---|
| 89 | if(is_string($result)) |
---|
| 90 | { |
---|
| 91 | array_push($errors, $result); |
---|
| 92 | } |
---|
| 93 | else |
---|
| 94 | { |
---|
| 95 | array_push($errors, ""); |
---|
| 96 | } |
---|
| 97 | } |
---|
| 98 | } |
---|
| 99 | else |
---|
| 100 | { |
---|
| 101 | gpcMsgError($errors); |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | function plugin_deactivate($plugin_id) |
---|
| 106 | { |
---|
| 107 | global $prefixeTable, $gpcInstalled; |
---|
| 108 | |
---|
| 109 | if($gpcInstalled) |
---|
| 110 | { |
---|
| 111 | $hgram = new HGram_Install($prefixeTable, __FILE__); |
---|
| 112 | $hgram->deactivate(); |
---|
| 113 | } |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | function plugin_uninstall($plugin_id) |
---|
| 117 | { |
---|
| 118 | global $prefixeTable, $gpcInstalled; |
---|
| 119 | |
---|
| 120 | if($gpcInstalled) |
---|
| 121 | { |
---|
| 122 | $hgram = new HGram_Install($prefixeTable, __FILE__); |
---|
| 123 | $hgram->uninstall(); |
---|
| 124 | } |
---|
| 125 | else |
---|
| 126 | { |
---|
| 127 | gpcMsgError($errors); |
---|
| 128 | } |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | ?> |
---|