source: extensions/edit_gmaps/maintain.inc.php @ 22950

Last change on this file since 22950 was 20034, checked in by cljosse, 11 years ago

[extensions] edit_gmaps Minor corrections

File size: 1.8 KB
RevLine 
[4548]1<?php
[9445]2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3if (!defined('EDIT_CL_PATH')) 
4define(  'EDIT_CL_PATH',   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' );
5        include_once(EDIT_CL_PATH.'edit_gmaps.inc.php');
6
7$cl_edit_functions = new cl_edit_functions();
8
9function plugin_install($plugin_id,$plugin_version,&$errors)
[4548]10{
[9445]11global $conf,$lang ;
12
13   if (!isset($conf['gmaps_api_key'])) 
14{ 
[20034]15$msg = sprintf(l10n('To install this plugin, you need to install %s before'),"RV Maps&Earth" );
16  if(is_array($errors))
17  {    array_push($errors,  "CANNOT INSTALL - $plugin_id <BR />".$msg);  }
[9445]18  else  {    $errors=Array( "CANNOT INSTALL - $plugin_id <BR />".$msg);  } 
19   return  ;
[4548]20}
[9445]21 $colonnes=cl_edit_functions::Get_columns_of(IMAGES_TABLE);
[4548]22
[9445]23 $colonnes=cl_edit_functions::Get_columns_of(IMAGES_TABLE);
24 $key = array_search('alt', $colonnes[IMAGES_TABLE]); 
25if (!$key){
26 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
27    pwg_query($q);     
28    }
29}
30
[4548]31function plugin_activate()
32{
33  $dir_name = basename( dirname(__FILE__) );
[20034]34  if (!isset($conf['edit_gmaps'])){   
35  $q = '
36    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
37    VALUES ("edit_gmaps","","Parametres du plugin edit_gmaps")
38  ;';
39  pwg_query($q);
40  }
[4548]41}
42
[20034]43function plugin_deactivate(){ 
[9377]44  cl_meta_invalidate_cache();
[20034]45  global $conf; 
46  if (isset($conf['edit_gmaps']))  {
47    $q = '
48      DELETE FROM '.CONFIG_TABLE.'
49      WHERE param="edit_gmaps"
50    ;';
51    pwg_query($q);
52    }
[4548]53}
54
[20034]55function plugin_uninstall(){
[9445]56  global $conf ;
57     $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `alt`';
58    pwg_query( $q ); 
59
60  if (!isset($conf['gmaps_api_key'])) 
61{ 
62    $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lon`';
[9377]63  pwg_query( $q );
[9445]64    $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`';
65  pwg_query( $q );
66  }
[20034]67
[4548]68}
69?>
Note: See TracBrowser for help on using the repository browser.