[7054] | 1 | <?php |
---|
| 2 | /* ----------------------------------------------------------------------------- |
---|
| 3 | Plugin : GMaps |
---|
| 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 | include_once('gmaps_version.inc.php'); // => Don't forget to update this file !! |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | if(!defined('GMAPS_DIR')) define('GMAPS_DIR' , basename(dirname(__FILE__))); |
---|
| 20 | if(!defined('GMAPS_PATH')) define('GMAPS_PATH' , PHPWG_PLUGINS_PATH . GMAPS_DIR . '/'); |
---|
| 21 | |
---|
| 22 | //ini_set('error_reporting', E_ALL); |
---|
| 23 | //ini_set('display_errors', true); |
---|
| 24 | |
---|
| 25 | global $gpcInstalled, $lang; //needed for plugin manager compatibility |
---|
| 26 | |
---|
| 27 | /* ----------------------------------------------------------------------------- |
---|
| 28 | GMaps needs the Grum Plugin Classes |
---|
| 29 | ----------------------------------------------------------------------------- */ |
---|
| 30 | $gpcInstalled=false; |
---|
| 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'); |
---|
[7398] | 34 | // need GPC release greater or equal than ... |
---|
[7054] | 35 | if(CommonPlugin::checkGPCRelease(GMAPS_GPC_NEEDED)) |
---|
| 36 | { |
---|
[7616] | 37 | include_once('gmaps_install.class.inc.php'); |
---|
[7054] | 38 | $gpcInstalled=true; |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | |
---|
[7125] | 42 | function gpcMsgError(&$errors, $errorMessage) |
---|
[7054] | 43 | { |
---|
[7125] | 44 | switch($errorMessage) |
---|
| 45 | { |
---|
| 46 | case 'gpc': |
---|
| 47 | $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), GMAPS_GPC_NEEDED); |
---|
| 48 | break; |
---|
| 49 | case 'amd': |
---|
| 50 | $msg=sprintf(l10n('To install this plugin, you need to install Advanced Metadata %s before'), GMAPS_AMD_NEEDED); |
---|
| 51 | break; |
---|
| 52 | } |
---|
| 53 | |
---|
[7054] | 54 | if(is_array($errors)) |
---|
| 55 | { |
---|
| 56 | array_push($errors, $msg); |
---|
| 57 | } |
---|
| 58 | else |
---|
| 59 | { |
---|
| 60 | $errors=Array($msg); |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | // ----------------------------------------------------------------------------- |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | load_language('plugin.lang', GMAPS_PATH); |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | function plugin_install($plugin_id, $plugin_version, &$errors) |
---|
| 72 | { |
---|
| 73 | global $prefixeTable, $gpcInstalled; |
---|
[7125] | 74 | if(!$gpcInstalled) |
---|
[7054] | 75 | { |
---|
[7125] | 76 | gpcMsgError($errors, 'gpc'); |
---|
| 77 | return(false); |
---|
[7054] | 78 | } |
---|
[7125] | 79 | if(GMaps_root::checkAMDActivated()=='none') |
---|
[7054] | 80 | { |
---|
[7177] | 81 | gpcMsgError($errors, 'amd'); |
---|
[7125] | 82 | return(false); |
---|
[7054] | 83 | } |
---|
[7125] | 84 | |
---|
| 85 | $gmaps=new GMaps_Install($prefixeTable, __FILE__); |
---|
| 86 | $result=$gmaps->install(); |
---|
[7054] | 87 | } |
---|
| 88 | |
---|
| 89 | function plugin_activate($plugin_id, $plugin_version, &$errors) |
---|
| 90 | { |
---|
| 91 | global $prefixeTable, $gpcInstalled; |
---|
| 92 | if($gpcInstalled) |
---|
| 93 | { |
---|
| 94 | $gmaps = new GMaps_Install($prefixeTable, __FILE__); |
---|
| 95 | $result=$gmaps->activate(); |
---|
| 96 | } |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | function plugin_deactivate($plugin_id) |
---|
| 100 | { |
---|
| 101 | global $prefixeTable, $gpcInstalled; |
---|
| 102 | |
---|
| 103 | if($gpcInstalled) |
---|
| 104 | { |
---|
| 105 | $gmaps=new GMaps_Install($prefixeTable, __FILE__); |
---|
| 106 | $gmaps->deactivate(); |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | function plugin_uninstall($plugin_id) |
---|
| 112 | { |
---|
| 113 | global $prefixeTable, $gpcInstalled; |
---|
| 114 | if($gpcInstalled) |
---|
| 115 | { |
---|
| 116 | $gmaps=new GMaps_Install($prefixeTable, __FILE__); |
---|
| 117 | $result=$gmaps->uninstall(); |
---|
| 118 | } |
---|
| 119 | else |
---|
| 120 | { |
---|
[7125] | 121 | gpcMsgError($errors, 'gpc'); |
---|
[7054] | 122 | } |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | ?> |
---|