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

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

First commit

  • Property svn:executable set to *
File size: 2.8 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 3.2.0
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)
43{
44  global $gpcNeeded;
45  $msg=sprintf(l10n('To install this plugin, you need to install Grum Plugin Classes %s before'), GMAPS_GPC_NEEDED);
46  if(is_array($errors))
47  {
48    array_push($errors, $msg);
49  }
50  else
51  {
52    $errors=Array($msg);
53  }
54}
55// -----------------------------------------------------------------------------
56
57
58
59
60load_language('plugin.lang', GMAPS_PATH);
61
62
63function plugin_install($plugin_id, $plugin_version, &$errors)
64{
65  global $prefixeTable, $gpcInstalled;
66  if($gpcInstalled)
67  {
68    $gmaps=new GMaps_Install($prefixeTable, __FILE__);
69    $result=$gmaps->install();
70  }
71  else
72  {
73    gpcMsgError($errors);
74  }
75}
76
77function plugin_activate($plugin_id, $plugin_version, &$errors)
78{
79  global $prefixeTable, $gpcInstalled;
80  if($gpcInstalled)
81  {
82    $gmaps = new GMaps_Install($prefixeTable, __FILE__);
83    $result=$gmaps->activate();
84  }
85}
86
87function plugin_deactivate($plugin_id)
88{
89  global $prefixeTable, $gpcInstalled;
90
91  if($gpcInstalled)
92  {
93    $gmaps=new GMaps_Install($prefixeTable, __FILE__);
94    $gmaps->deactivate();
95  }
96
97}
98
99function plugin_uninstall($plugin_id)
100{
101  global $prefixeTable, $gpcInstalled;
102  if($gpcInstalled)
103  {
104    $gmaps=new GMaps_Install($prefixeTable, __FILE__);
105    $result=$gmaps->uninstall();
106  }
107  else
108  {
109    gpcMsgError($errors);
110  }
111}
112
113
114?>
Note: See TracBrowser for help on using the repository browser.