source: extensions/GMaps/maintain.inc.php @ 26950

Last change on this file since 26950 was 7616, checked in by grum, 14 years ago

fix bug:2004 - Cache table becomes very huge
fix bug:2005 - Category map is not displayed when a [gmaps] map is inserted in category description

  • Property svn:executable set to *
File size: 3.1 KB
Line 
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
14if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
15
16include_once('gmaps_version.inc.php'); // => Don't forget to update this file !!
17
18
19if(!defined('GMAPS_DIR')) define('GMAPS_DIR' , basename(dirname(__FILE__)));
20if(!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
25global $gpcInstalled, $lang; //needed for plugin manager compatibility
26
27/* -----------------------------------------------------------------------------
28GMaps needs the Grum Plugin Classes
29----------------------------------------------------------------------------- */
30$gpcInstalled=false;
31if(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 ...
35  if(CommonPlugin::checkGPCRelease(GMAPS_GPC_NEEDED))
36  {
37    include_once('gmaps_install.class.inc.php');
38    $gpcInstalled=true;
39  }
40}
41
42function gpcMsgError(&$errors, $errorMessage)
43{
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
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
68load_language('plugin.lang', GMAPS_PATH);
69
70
71function plugin_install($plugin_id, $plugin_version, &$errors)
72{
73  global $prefixeTable, $gpcInstalled;
74  if(!$gpcInstalled)
75  {
76    gpcMsgError($errors, 'gpc');
77    return(false);
78  }
79  if(GMaps_root::checkAMDActivated()=='none')
80  {
81    gpcMsgError($errors, 'amd');
82    return(false);
83  }
84
85  $gmaps=new GMaps_Install($prefixeTable, __FILE__);
86  $result=$gmaps->install();
87}
88
89function 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
99function 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
111function 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  {
121    gpcMsgError($errors, 'gpc');
122  }
123}
124
125
126?>
Note: See TracBrowser for help on using the repository browser.