Ignore:
Timestamp:
Mar 1, 2011, 11:40:34 AM (10 years ago)
Author:
cljosse
Message:

[edit_gmaps] set conformity with rv_gmaps install.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/maintain.inc.php

    r9377 r9445  
    11<?php
    2 function plugin_install()
     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)
    310{
    4   $q = '
    5 ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
    6   pwg_query($q);
     11global $conf,$lang ;
     12
     13   if (!isset($conf['gmaps_api_key']))
     14
     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);  }
     18  else  {    $errors=Array( "CANNOT INSTALL - $plugin_id <BR />".$msg);  }
     19   return  ;
     20}
     21 $colonnes=cl_edit_functions::Get_columns_of(IMAGES_TABLE);
     22
     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    }
    729}
    830
     
    2143function plugin_uninstall()
    2244{
    23   $q = '
    24 ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `alt`';
     45  global $conf ;
     46     $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `alt`';
     47    pwg_query( $q ); 
     48
     49  if (!isset($conf['gmaps_api_key']))
     50
     51    $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lon`';
    2552  pwg_query( $q );
     53    $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`';
     54  pwg_query( $q );
     55  }
    2656}
    2757?>
Note: See TracChangeset for help on using the changeset viewer.