Changeset 9445
- Timestamp:
- Mar 1, 2011, 11:40:34 AM (13 years ago)
- Location:
- extensions/edit_gmaps
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/edit_gmaps/admin/admin.php
r9412 r9445 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 3 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 4 5 $colonnes = cl_get_columns_of(IMAGES_TABLE);6 7 $key = array_search('lon', $colonnes[IMAGES_TABLE]);8 if (!$key){9 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(9,6)';10 pwg_query($q);11 }12 $key = array_search('lat', $colonnes[IMAGES_TABLE]);13 if (!$key){14 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(9,6)';15 pwg_query($q);16 }17 $key = array_search('alt', $colonnes[IMAGES_TABLE]);18 if (!$key){19 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';20 pwg_query($q);21 }22 23 24 /**25 * list all columns of each given table26 *27 * @return array of array28 */29 function cl_get_columns_of($table)30 {31 $columns_of = array();32 $query = 'DESC '.$table.';';33 $result = mysql_query($query);34 $columns_of[$table] = array();35 36 if ($result)37 while ($row = mysql_fetch_row($result))38 array_push($columns_of[$table], $row[0]);39 40 return $columns_of;41 }42 4 43 5 -
extensions/edit_gmaps/admin/header_2_2.tpl
r9412 r9445 1 {combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery. js"}1 {combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery.min.js "} 2 2 {combine_script id="jquery.cluetip" path = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js" require="jquery" } 3 {combine_script id="jquery.ui" path=$ROOT_URL|@cat:"themes/default/js/ui/ jquery.ui.core.js" require="jquery"}4 {combine_script id="jquery.ui.resizable" path=$ROOT_URL|@cat:"themes/default/js/ui/ jquery.ui.resizable.js" require="jquery,jquery.ui"}5 {combine_script id="jquery.ui.slider" path=$ROOT_URL|@cat:"themes/default/js/ui/ jquery.ui.slider.js" require="jquery,jquery.ui"}6 {combine_script id="jquery.ui.draggable" path=$ROOT_URL|@cat:"themes/default/js/ui/ jquery.ui.draggable.js" require="jquery,jquery.ui"}3 {combine_script id="jquery.ui" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.core.min.js " require="jquery"} 4 {combine_script id="jquery.ui.resizable" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.resizable.min.js " require="jquery,jquery.ui"} 5 {combine_script id="jquery.ui.slider" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.slider.min.js " require="jquery,jquery.ui"} 6 {combine_script id="jquery.ui.draggable" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.draggable.min.js " require="jquery,jquery.ui"} 7 7 8 8 -
extensions/edit_gmaps/edit_gmaps.inc.php
r9412 r9445 34 34 ); 35 35 36 class cl_edit_functions { 37 static public function Memo_vars($variables) { 38 ob_start(); 39 echo '<pre>'; 40 print_r($variables); 41 echo '</pre>'; 42 $m= ob_get_contents(); 43 ob_end_clean(); 44 return $m; 45 } 36 46 47 /** 48 * list all columns of each given table 49 * 50 * @return array of array 51 */ 52 static public function Get_columns_of($table){ 53 $columns_of = array(); 54 $query = 'DESC '.$table.';'; 55 $result = mysql_query($query); 56 $columns_of[$table] = array(); 37 57 58 if ($result) 59 while ($row = mysql_fetch_row($result)) 60 array_push($columns_of[$table], $row[0]); 61 62 return $columns_of; 63 } 64 } 38 65 39 66 class cl_edit_controler { … … 112 139 } 113 140 114 function Memo_vars($variables)115 {116 ob_start();117 echo '<pre>';118 print_r($variables);119 echo '</pre>';120 $m= ob_get_contents();121 141 122 ob_end_clean();123 return $m;124 125 }126 } // class127 142 143 } // class 128 144 145 global $conf ; 146 $colonnes = cl_edit_functions::Get_columns_of(IMAGES_TABLE); 147 $key = array_search('lon', $colonnes[IMAGES_TABLE]); 148 if (!$key){ 149 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(8,6)'; 150 pwg_query($q); 151 } 152 $key = array_search('lat', $colonnes[IMAGES_TABLE]); 153 if (!$key){ 154 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(9,6)'; 155 pwg_query($q); 156 } 157 158 $key = array_search('alt', $colonnes[IMAGES_TABLE]); 159 if (!$key){ 160 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)'; 161 pwg_query($q); 162 } 163 164 165 129 166 130 167 ?> -
extensions/edit_gmaps/main.inc.php
r9413 r9445 14 14 include_once(EDIT_CL_PATH.'edit_gmaps.inc.php'); 15 15 16 $cl_edit_functions = new cl_edit_functions(); 16 17 $cl_edit_controler = new cl_edit_controler(); 17 18 add_event_handler('get_admin_plugin_menu_links', array(&$cl_edit_controler,'cl_edit_admin_menu') ); -
extensions/edit_gmaps/maintain.inc.php
r9377 r9445 1 1 <?php 2 function plugin_install() 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 if (!defined('EDIT_CL_PATH')) 4 define( '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 9 function plugin_install($plugin_id,$plugin_version,&$errors) 3 10 { 4 $q = ' 5 ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)'; 6 pwg_query($q); 11 global $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]); 25 if (!$key){ 26 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)'; 27 pwg_query($q); 28 } 7 29 } 8 30 … … 21 43 function plugin_uninstall() 22 44 { 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`'; 25 52 pwg_query( $q ); 53 $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`'; 54 pwg_query( $q ); 55 } 26 56 } 27 57 ?>
Note: See TracChangeset
for help on using the changeset viewer.