Changeset 22117
- Timestamp:
- Apr 10, 2013, 10:57:30 AM (11 years ago)
- Location:
- extensions/edit_gmaps
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/edit_gmaps/admin/admin_edit.php
r20034 r22117 17 17 $path = EDIT_CL_PATH; 18 18 $plg_data = implode( '', file($path.'main.inc.php') ); 19 if (preg_match("|Version: (.*)|", $plg_data, $val)) { 20 $EDIT_CL_PATH_plugin['version'] = trim($val[1]); 19 if (preg_match("|Version: (.*)|", $plg_data, $val)) { 20 $EDIT_CL_PATH_plugin['version'] = trim($val[1]); 21 21 } 22 22 $EDIT_CL_PATH_plugin = array_map('htmlspecialchars', $EDIT_CL_PATH_plugin); … … 24 24 $icon_path = 'themes/default/icon/help.png'; 25 25 $path_js= 'themes/default/js/' ; 26 27 26 27 28 28 $global_tpl=realpath(PHPWG_ROOT_PATH).'\\admin\\themes\\default\\template\\batch_manager_global.tpl' ; 29 29 30 30 $template->assign( 31 32 33 34 35 36 37 31 array( 'EDIT_CL_PATH' => EDIT_CL_PATH, 32 'path_js' => $path_js, 33 'VERSION'=> $version, 34 'EDIT_CL_PATH_ABS' => dirname(__FILE__).'/', 35 'GLOBAL_TPL' => $global_tpl 36 ) 37 ); 38 38 39 39 /****************************************************************/ 40 40 $info_message="" ; 41 $erreur_message=""; 41 $erreur_message=""; 42 42 /****************************************************************/ 43 43 if ( !isset($_GET['mode']) ) $_GET['mode'] = 'global'; … … 45 45 // if(!isset($_GET['cat'])) $_GET['cat']=" " ; 46 46 if(isset($_POST['filter_prefilter'])){ 47 $_GET['cat'] = $_POST['filter_prefilter']; 47 $_GET['cat'] = $_POST['filter_prefilter']; 48 48 } 49 49 50 50 if (!isset($page['title'])) $page['title']=""; 51 51 if(!isset($_POST['selectAction'])) $_POST['selectAction']="" ; … … 55 55 56 56 check_input_parameter('selection', $_POST, true, PATTERN_ID); 57 include (PHPWG_ROOT_PATH.'admin/batch_manager.php'); 58 $tabsheet = new tabsheet(); 59 $tabsheet->assign(); 60 61 if(isset($page['cat_elements_id'])) 62 $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']); 63 64 65 if(isset($_POST)){ 66 // $info_message .= cl_print_var($_POST); 67 //=============================================================== 68 $collection = array(); 69 if(isset($_POST['selection'])) 70 $collection = $_POST['selection']; 71 //=============================================================== 72 $images=array(); 73 if (!empty($_GET['display'])){ 74 if ('all' == $_GET['display']) 75 $page['nb_images'] = count($page['cat_elements_id']); 76 else 77 $page['nb_images'] = intval($_GET['display']); 57 include (PHPWG_ROOT_PATH.'admin/batch_manager.php'); 58 $tabsheet = new tabsheet(); 59 $tabsheet->assign(); 60 61 if(isset($page['cat_elements_id'])) 62 $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']); 63 64 65 if(isset($_POST)){ 66 // $info_message .= cl_print_var($_POST); 67 //=============================================================== 68 $collection = array(); 69 if(isset($_POST['selection'])) 70 $collection = $_POST['selection']; 71 //=============================================================== 72 $images=array(); 73 if (!empty($_GET['display'])){ 74 if ('all' == $_GET['display']) 75 $page['nb_images'] = count($page['cat_elements_id']); 76 else 77 $page['nb_images'] = intval($_GET['display']); 78 } 79 else 80 $page['nb_images'] = 20; 81 82 if ( !empty($page['cat_elements_id']) ){ 83 $query=' 84 SELECT * FROM '.IMAGES_TABLE.' 85 WHERE id IN ('.implode(',',$page['cat_elements_id']).') 86 '.$conf['order_by'].' 87 LIMIT '.$page['start'].', '. $page['nb_images'] .' 88 ;'; 89 $result = pwg_query($query); 90 while ( $row=mysqli_fetch_assoc($result) ) 91 $images[] = $row; 92 93 } 94 //=============================================================== 95 global $lang_info; 96 if (date_default_timezone_get()) { 97 $adresse = date_default_timezone_get() ; 98 }else{ 99 100 } 101 $adresse = $lang_info['country']; ; 102 $adresse=str_replace("/",", ",$adresse); 103 global $EDIT_CL_parametres ; 104 105 $EDIT_CL_parametres = cl_edit_controler::cl_edit_Get_Options(); 106 107 108 $template->assign( 'coordinates', 109 array( 'FILE' => '', 110 'LAT' => ($EDIT_CL_parametres->lat =='')?'100': $EDIT_CL_parametres->lat, 111 'LON' => ($EDIT_CL_parametres->lon =='')?'100': $EDIT_CL_parametres->lon , 112 'ADRESSE' => ($EDIT_CL_parametres->adress =='')?$adresse: $EDIT_CL_parametres->adress , 113 'ZOOM' => 18, 114 'ALT' => $EDIT_CL_parametres->alt =='' ?0: $EDIT_CL_parametres->alt 115 ) 116 ); 117 118 if (count($collection)>0 ) 119 if ( isset($_POST['update']) && ( $_POST['update']==l10n('update_exif') || $_POST['update'] == l10n('update_all') )){ 120 /*********************************** 121 * Mise à jour des meta données 122 ************************************/ 123 // error_reporting ( 0 ); 124 // Hide any unknown EXIF tags 125 $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE; 126 include $Toolkit_Dir.'Toolkit_Version.php'; // Change: added as of version 1.11 127 // Include the required files for reading and writing Photoshop File Info 128 include $Toolkit_Dir.'JPEG.php'; 129 include $Toolkit_Dir.'XMP.php'; 130 include $Toolkit_Dir.'Photoshop_IRB.php'; 131 include $Toolkit_Dir.'EXIF.php'; 132 include $Toolkit_Dir.'GPS_File_Info.php'; 133 134 $GLOBALS['HTTP_POST_VARS']=$_POST ; 135 // Copy all of the HTML Posted variables into an array 136 $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; 137 138 // Some characters are escaped with backslashes in HTML Posted variable 139 // Cycle through each of the HTML Posted variables, and strip out the slashes ' 140 141 foreach( $new_ps_file_info_array as $var_key => $var_val ){ 142 if ($var_key !="selection") 143 $new_ps_file_info_array[ $var_key ] = stripslashes( $var_val ); 144 } 145 146 $init_info =true; 147 $first_image=""; 148 149 foreach ($collection as $id_0){ 150 foreach ($images as $image) { 151 if (array_search($id_0,$image)) { 152 //================================================================= 153 // Meta donnée 154 //================================================================= 155 156 $lat =(isset($_POST['lat']) && $_POST['lat'] )!='' ?trim($_POST['lat']):$image['lat']; 157 $lon = (isset($_POST['lon']) && $_POST['lon'] )!='' ?trim($_POST['lon']):$image['lon']; 158 $alt =(isset($_POST['alt']) && $_POST['alt'] )!=''?trim($_POST['alt']):$image['alt']; 159 160 //========== Mise à jour $image ============= 161 $image['lat']=$lat; 162 $image['lon']=$lon; 163 $image['alt']=$alt; 164 //==== lecture info gps ==== 165 $infos_gps = array(); 166 if ( isset($_POST['lat']) && $_POST['lat'] !=''){ 167 } else{ 168 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,true) ; 169 if($infos_gps['lat']!=0){ 170 $image['lat']=$infos_gps['lat']; 171 $image['lon']=$infos_gps['lon']; 172 } 173 } 174 $new_ps_file_info_array = base_to_meta($image); 175 176 $new_ps_file_info_array['filename'] = $image['path']; 177 $new_ps_file_info_array['selection'] = explode(";",$new_ps_file_info_array['filename']); 178 179 if( $image['lat']=="" ){ 180 $image['lat']= $new_ps_file_info_array['lat'] ; 181 $image['lon']= $new_ps_file_info_array['lon'] ; 182 $image['alt']= $new_ps_file_info_array['alt'] ; 183 } 184 185 186 187 188 if( cl_edit_controler::add_meta_gps($new_ps_file_info_array,$image)){ 189 $exif = @read_exif_data( $image['path']); 190 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,true) ; 191 $info_message .=l10n('update_exif') . " : " . $image['path'] . " : " . $image['file'] . " : ok<BR />"; 192 } 193 194 }else{ 195 196 } // fin search 197 198 } // fin id_0 199 200 201 202 } // fin collection 203 204 if($_POST['update']==l10n('update_exif')) { 205 unset($_POST['submit']); 206 } 207 if ($_POST['update']==l10n('update_all')){ 208 $_POST['submit'] = l10n('update_database') ; 209 210 } 211 212 $_POST['update'] ="ok"; 213 214 } 215 //====================================================================== 216 if ( isset($_POST['submit']) ) { 217 if ( $_POST['submit'] == l10n('update_database') ){ 218 /************************************************** 219 * Uniquement Mise à jour de la base de données 220 **************************************************/ 221 if ( count($collection)>0 ){ 222 $lat = trim($_POST['lat']); 223 $lon = trim($_POST['lon']); 224 $alt = trim($_POST['alt']); 225 //=============================================================== 226 if($lat !="") cl_edit_controler::add_data_base($collection,$lat,$lon,$alt) ; 227 $_POST['submit'] = l10n('selectAction') ; 228 unset($_POST['submit']); 229 foreach ($collection as $id_0){ 230 foreach ($images as $image) { 231 if (array_search($id_0,$image)) { 232 $image['lat'] = $lat ; 233 $image['lon']= $lon ; 234 $image['alt'] = $alt ; 235 } 236 } 237 } 238 } 239 $_POST['submit'] = l10n('selectAction') ; 240 unset($_POST['submit']); 241 } 242 } 243 /****************************************/ 244 $query = ' 245 SELECT id,name,uppercats,global_rank 246 FROM '.CATEGORIES_TABLE.' 247 ;'; 248 $result = pwg_query($query); 249 $categories = array(); 250 $selecteds = array(); 251 if(!isset($_GET['cat'])) $_GET['cat']="tag-no"; 252 if (!empty($result)){ 253 while ($row = mysqli_fetch_assoc($result)) { 254 $url = $admin_url.get_query_string_diff(array('start','cat')).'&cat='.$row['id']; 255 256 if ( $row['id']==$_GET['cat'] ) $selecteds[] = $url; 257 $row['id']=$url; 258 259 array_push($categories, $row); 260 } 261 } 262 263 usort($categories, 'global_rank_compare'); 264 display_select_categories($categories, $selecteds, 'categories', false); 265 266 267 if ( !empty($page['cat_elements_id']) ){ 268 $nav_bar = create_navigation_bar( 269 $admin_url.get_query_string_diff(array('start')), 270 count($page['cat_elements_id']), 271 $page['start'], 272 $page['nb_images'] 273 ); 274 $template->assign('navbar', $nav_bar); 275 } 276 //======================================================================== 277 $v_exif=""; 278 $current = $template->get_template_vars('thumbnails'); 279 $j=0; 280 $thumbnails= array(); 281 /************************************* 282 * AFFICHAGE MODE GLOBAL 283 *************************************/ 284 285 foreach ($images as $image){ 286 $infos_gps = array(); 287 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ; 288 289 $v_exif=$infos_gps['is_exif']?"EXIF":"NO" ; 290 $v_db=false ; 291 $v_db=$image['lat']!=0 && $image['lon']!=0; 292 $v_db=$v_db?"BD":"NO"; 293 //==== GPS infos -> image infos ==== 294 if( $infos_gps['lat'] !=0 || $infos_gps['lon'] !=0 ) { 295 $new= ( !isset($image['lat'])? true: $image['lat']!=$infos_gps['lat'] ) ; 296 $image['lat']=$infos_gps['lat']; 297 $image['lon']=$infos_gps['lon']; 298 $image['alt']=$infos_gps['alt']; 299 $sel_img= array($image['id']); 300 if ($new){ 301 cl_edit_controler::add_data_base( $sel_img,$image['lat'],$image['lon'],$image['alt']) ; 302 } 303 } 304 //================================================= 305 $name = render_element_name($image); 306 $desc = render_element_description($image); 307 if (!in_array($image['id'],$current[$j])) { 308 $j =0; 309 foreach($current as $rK => $rV){ 310 if (!in_array($image['id'],$rV)) { 311 $j++ ; 312 } else{ 313 // $info_message .= cl_print_var($current[$j]); 314 break ; 315 } 316 } 317 } 318 //================================================= 319 320 $TN_SRC= $current[$j]['thumb']; 321 $TITLE=$current[$j]['TITLE'] ; 322 323 $tpl_var = array( 324 'id' =>$image['id'], 325 'TN_SRC' => $TN_SRC, 326 'file' => $current[$j]['FILE'], 327 'TITLE' => $TITLE, 328 'LEVEL' => $current[$j]['LEVEL'], 329 'FILE_SRC' => $current[$j]['FILE_SRC'], 330 'U_EDIT' => $current[$j]['U_EDIT'], 331 'lat' => $image['lat'] , 332 'lon' => $image['lon'] , 333 'alt' => $image['alt'] , 334 'U_EXIF' => $v_exif , 335 'U_BD' => $v_db , 336 'thumb' =>$current[$j]['thumb'] 337 ); 338 339 340 $thumbnails[]=$tpl_var; 341 $j++; 342 } 343 344 $template->assign('thumbnails', $thumbnails); 345 346 347 $template->assign( 348 array( 349 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')) 350 ) 351 ); 352 353 //================================================================================== 354 $match=""; 355 if ( isset($_POST['submit']) ) { 356 if ( isset($_POST['match']) && $_POST['match']!='' ){ 357 cl_edit_controler::cl_edit_Set_Options(); 358 cl_edit_controler::cl_edit_sauve_options_inf(); 359 } 360 if ($_POST['submit']==l10n('selection') ) { 361 $collection =$_POST['selection']; 362 } 363 364 if ($_POST['submit']==l10n('add') ) { 365 $_POST['selection']=array(); 366 $collection =array(); 367 unset($collection); 368 } 369 if ($_POST['submit']==l10n('reset' ) ) { 370 $_POST['selection']=array(); 371 $collection =array(); 372 unset($collection); 373 } 374 } 375 //================================================================================= 376 $src=""; 377 378 //====================================================================== 379 if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' )){ 380 $collection=$_POST['selection'] ; 381 382 if (isset($collection)) { 383 /********************************* 384 * Affichage de la selection 385 *********************************/ 386 $init_info =true; 387 $first_image=""; 388 $_POST['selection'] = $collection ; 389 foreach ($collection as $id_0) { 390 foreach ($images as $image) { 391 if (array_search($id_0,$image)) { 392 393 $infos_gps = array(); 394 $infos_gps =array(); 395 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ; 396 397 398 399 400 if( ($image['lat']=='' || $image['lon']=='')|| $EDIT_CL_parametres->check_exif=='on' ) { 401 if(isset($infos_gps['lat']) && $infos_gps['is_exif']){ 402 $image['lat']=$infos_gps['lat']; 403 $image['lon']=$infos_gps['lon']; 404 $image['alt']=$infos_gps['alt']; 405 } 406 } 407 if($image['lat'] <> ''){ 408 $lon=$image['lon']; 409 $lat=$image['lat']; 410 $alt=$image['alt']; 411 } 412 //========================================== 413 if ( $init_info && $image['lat'] <> '' ) { 414 $init_info = false ; 415 //===================================================== 416 $template->assign( 'coordinates', 417 array( 418 'FILE' => $image['path'], 419 'LAT' => $lat , 420 'LON' => $lon , 421 'ADRESSE' => $adresse , 422 'ZOOM' => 4, 423 'ALT' => $alt , 424 ) 425 ); 426 } 427 //===================================================== 428 $lonDMS= dec2dms($lon) ; 429 $latDMS= dec2dms($lat) ; 430 $v_db=false ; 431 $v_db=$lon!=0 && $lat!=0; 432 433 $tpl_var = array_merge( 434 $image, 435 array( 436 'filename' => $image['path'], 437 'exif' => '"'.$infos_gps['is_exif'].'"' , 438 'lat' => $image['lat'] , 439 'lon' => $image['lon'] , 440 'alt' => $image['alt'] , 441 'latDMS' => $latDMS[3] , 442 'lonDMS' => $lonDMS[3] , 443 'adresse' => $adresse , 444 'TN_SRC' => DerivativeImage::thumb_url($image), 445 'TITLE' => render_element_name($image), 446 'U_EXIF' => $infos_gps['is_exif'] , 447 'U_BD' => $v_db , 448 'U_MAP' => cl_make_map_picture_url( 449 array( 450 'image_id'=>$image['id'], 451 'image_file'=>$image['file'], 452 ) 453 ), 454 ) 455 ); 456 $template->append('Selectthumbnails', $tpl_var); 457 } 458 } 459 } 460 } 461 } 462 463 //============================================================ 464 if ( !empty($first_image)) { 465 $erreur_message .= cl_print_var($first_image); 466 467 if (isset($_POST['update'])) { 468 // document.Envoie.latDMS.value 469 $image= first_image ; 470 $filename=$image['path'] ; 471 $Val_exif=""; 472 $Val_XMP=""; 473 /* */ 474 if (!empty($infos_gps)) 475 $Position = $infos_gps ; 476 else 477 $Position = cl_edit_controler::Get_exif_gps($filename,$image,false,true) ; 478 479 $jpeg_header_data = get_jpeg_header_data($filename ); 480 $template->assign( array( 481 'filename_abs' => $filename , 482 'filename' => $filename, 483 'datas' => array( 484 /* 485 'Val_JPEG_APP'=> Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ), 486 'Val_intrinsic'=> Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ), 487 'Val_Comment'=> Interpret_Comment_to_HTML( $jpeg_header_data ), 488 'Val_JFIF'=> Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ), 489 'Val_JFXX'=>Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ), 490 'Val_App12' => Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ), 491 'Val_IRB' => Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ), 492 493 'Val_exif'=> Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename), 494 'Val_XMP' => Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data) ) ), 495 */ 496 // 497 ), 498 'Datadase' => ($Position) , 499 ) ); 500 } 501 } 502 503 504 //======================================================================= 505 506 $v1=0; 507 508 78 509 } 79 else80 $page['nb_images'] = 20;81 82 if ( !empty($page['cat_elements_id']) ){83 $query='84 SELECT * FROM '.IMAGES_TABLE.'85 WHERE id IN ('.implode(',',$page['cat_elements_id']).')86 '.$conf['order_by'].'87 LIMIT '.$page['start'].', '. $page['nb_images'] .'88 ;';89 $result = pwg_query($query);90 while ( $row=mysql_fetch_assoc($result) )91 $images[] = $row;92 93 }94 //===============================================================95 global $lang_info;96 if (date_default_timezone_get()) {97 $adresse = date_default_timezone_get() ;98 }else{99 100 }101 $adresse = $lang_info['country']; ;102 $adresse=str_replace("/",", ",$adresse);103 global $EDIT_CL_parametres ;104 105 $EDIT_CL_parametres = cl_edit_controler::cl_edit_Get_Options();106 107 108 $template->assign( 'coordinates',109 array( 'FILE' => '',110 'LAT' => ($EDIT_CL_parametres->lat =='')?'100': $EDIT_CL_parametres->lat,111 'LON' => ($EDIT_CL_parametres->lon =='')?'100': $EDIT_CL_parametres->lon ,112 'ADRESSE' => ($EDIT_CL_parametres->adress =='')?$adresse: $EDIT_CL_parametres->adress ,113 'ZOOM' => 18,114 'ALT' => $EDIT_CL_parametres->alt =='' ?0: $EDIT_CL_parametres->alt115 )116 );117 118 if (count($collection)>0 )119 if ( isset($_POST['update']) && ( $_POST['update']==l10n('update_exif') || $_POST['update'] == l10n('update_all') )){120 /***********************************121 * Mise à jour des meta données122 ************************************/123 // error_reporting ( 0 );124 // Hide any unknown EXIF tags125 $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE;126 include $Toolkit_Dir.'Toolkit_Version.php'; // Change: added as of version 1.11127 // Include the required files for reading and writing Photoshop File Info128 include $Toolkit_Dir.'JPEG.php';129 include $Toolkit_Dir.'XMP.php';130 include $Toolkit_Dir.'Photoshop_IRB.php';131 include $Toolkit_Dir.'EXIF.php';132 include $Toolkit_Dir.'GPS_File_Info.php';133 134 $GLOBALS['HTTP_POST_VARS']=$_POST ;135 // Copy all of the HTML Posted variables into an array136 $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS'];137 138 // Some characters are escaped with backslashes in HTML Posted variable139 // Cycle through each of the HTML Posted variables, and strip out the slashes '140 141 foreach( $new_ps_file_info_array as $var_key => $var_val ){142 if ($var_key !="selection")143 $new_ps_file_info_array[ $var_key ] = stripslashes( $var_val );144 }145 146 $init_info =true;147 $first_image="";148 149 foreach ($collection as $id_0){150 foreach ($images as $image) {151 if (array_search($id_0,$image)) {152 //=================================================================153 // Meta donnée154 //=================================================================155 156 $lat =(isset($_POST['lat']) && $_POST['lat'] )!='' ?trim($_POST['lat']):$image['lat'];157 $lon = (isset($_POST['lon']) && $_POST['lon'] )!='' ?trim($_POST['lon']):$image['lon'];158 $alt =(isset($_POST['alt']) && $_POST['alt'] )!=''?trim($_POST['alt']):$image['alt'];159 160 //========== Mise à jour $image =============161 $image['lat']=$lat;162 $image['lon']=$lon;163 $image['alt']=$alt;164 //==== lecture info gps ====165 $infos_gps = array();166 if ( isset($_POST['lat']) && $_POST['lat'] !=''){167 } else{168 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,true) ;169 if($infos_gps['lat']!=0){170 $image['lat']=$infos_gps['lat'];171 $image['lon']=$infos_gps['lon'];172 }173 }174 $new_ps_file_info_array = base_to_meta($image);175 176 $new_ps_file_info_array['filename'] = $image['path'];177 $new_ps_file_info_array['selection'] = explode(";",$new_ps_file_info_array['filename']);178 179 if( $image['lat']=="" ){180 $image['lat']= $new_ps_file_info_array['lat'] ;181 $image['lon']= $new_ps_file_info_array['lon'] ;182 $image['alt']= $new_ps_file_info_array['alt'] ;183 }184 185 186 187 188 if( cl_edit_controler::add_meta_gps($new_ps_file_info_array,$image)){189 $exif = @read_exif_data( $image['path']);190 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,true) ;191 $info_message .=l10n('update_exif') . " : " . $image['path'] . " : " . $image['file'] . " : ok<BR />";192 }193 194 }else{195 196 } // fin search197 198 } // fin id_0199 200 201 202 } // fin collection203 204 if($_POST['update']==l10n('update_exif')) {205 unset($_POST['submit']);206 }207 if ($_POST['update']==l10n('update_all')){208 $_POST['submit'] = l10n('update_database') ;209 210 }211 212 $_POST['update'] ="ok";213 214 }215 //======================================================================216 if ( isset($_POST['submit']) ) {217 if ( $_POST['submit'] == l10n('update_database') ){218 /**************************************************219 * Uniquement Mise à jour de la base de données220 **************************************************/221 if ( count($collection)>0 ){222 $lat = trim($_POST['lat']);223 $lon = trim($_POST['lon']);224 $alt = trim($_POST['alt']);225 //===============================================================226 if($lat !="") cl_edit_controler::add_data_base($collection,$lat,$lon,$alt) ;227 $_POST['submit'] = l10n('selectAction') ;228 unset($_POST['submit']);229 foreach ($collection as $id_0){230 foreach ($images as $image) {231 if (array_search($id_0,$image)) {232 $image['lat'] = $lat ;233 $image['lon']= $lon ;234 $image['alt'] = $alt ;235 }236 }237 }238 }239 $_POST['submit'] = l10n('selectAction') ;240 unset($_POST['submit']);241 }242 }243 /****************************************/244 $query = '245 SELECT id,name,uppercats,global_rank246 FROM '.CATEGORIES_TABLE.'247 ;';248 $result = pwg_query($query);249 $categories = array();250 $selecteds = array();251 if(!isset($_GET['cat'])) $_GET['cat']="tag-no";252 if (!empty($result)){253 while ($row = mysql_fetch_assoc($result)) {254 $url = $admin_url.get_query_string_diff(array('start','cat')).'&cat='.$row['id'];255 256 if ( $row['id']==$_GET['cat'] ) $selecteds[] = $url;257 $row['id']=$url;258 259 array_push($categories, $row);260 }261 }262 263 usort($categories, 'global_rank_compare');264 display_select_categories($categories, $selecteds, 'categories', false);265 266 267 if ( !empty($page['cat_elements_id']) ){268 $nav_bar = create_navigation_bar(269 $admin_url.get_query_string_diff(array('start')),270 count($page['cat_elements_id']),271 $page['start'],272 $page['nb_images']273 );274 $template->assign('navbar', $nav_bar);275 }276 //========================================================================277 $v_exif="";278 $current = $template->get_template_vars('thumbnails');279 $j=0;280 $thumbnails= array();281 /*************************************282 * AFFICHAGE MODE GLOBAL283 *************************************/284 285 foreach ($images as $image){286 $infos_gps = array();287 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ;288 289 $v_exif=$infos_gps['is_exif']?"EXIF":"NO" ;290 $v_db=false ;291 $v_db=$image['lat']!=0 && $image['lon']!=0;292 $v_db=$v_db?"BD":"NO";293 //==== GPS infos -> image infos ====294 if( $infos_gps['lat'] !=0 || $infos_gps['lon'] !=0 ) {295 $new= ( !isset($image['lat'])? true: $image['lat']!=$infos_gps['lat'] ) ;296 $image['lat']=$infos_gps['lat'];297 $image['lon']=$infos_gps['lon'];298 $image['alt']=$infos_gps['alt'];299 $sel_img= array($image['id']);300 if ($new){301 cl_edit_controler::add_data_base( $sel_img,$image['lat'],$image['lon'],$image['alt']) ;302 }303 }304 //=================================================305 $name = render_element_name($image);306 $desc = render_element_description($image);307 if (!in_array($image['id'],$current[$j])) {308 $j =0;309 foreach($current as $rK => $rV){310 if (!in_array($image['id'],$rV)) {311 $j++ ;312 } else{313 // $info_message .= cl_print_var($current[$j]);314 break ;315 }316 }317 }318 //=================================================319 320 $TN_SRC= $current[$j]['thumb'];321 $TITLE=$current[$j]['TITLE'] ;322 323 $tpl_var = array(324 'id' =>$image['id'],325 'TN_SRC' => $TN_SRC,326 'file' => $current[$j]['FILE'],327 'TITLE' => $TITLE,328 'LEVEL' => $current[$j]['LEVEL'],329 'FILE_SRC' => $current[$j]['FILE_SRC'],330 'U_EDIT' => $current[$j]['U_EDIT'],331 'lat' => $image['lat'] ,332 'lon' => $image['lon'] ,333 'alt' => $image['alt'] ,334 'U_EXIF' => $v_exif ,335 'U_BD' => $v_db ,336 'thumb' =>$current[$j]['thumb']337 );338 339 340 $thumbnails[]=$tpl_var;341 $j++;342 }343 344 $template->assign('thumbnails', $thumbnails);345 346 347 $template->assign(348 array(349 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display'))350 )351 );352 353 //==================================================================================354 $match="";355 if ( isset($_POST['submit']) ) {356 if ( isset($_POST['match']) && $_POST['match']!='' ){357 cl_edit_controler::cl_edit_Set_Options();358 cl_edit_controler::cl_edit_sauve_options_inf();359 }360 if ($_POST['submit']==l10n('selection') ) {361 $collection =$_POST['selection'];362 }363 364 if ($_POST['submit']==l10n('add') ) {365 $_POST['selection']=array();366 $collection =array();367 unset($collection);368 }369 if ($_POST['submit']==l10n('reset' ) ) {370 $_POST['selection']=array();371 $collection =array();372 unset($collection);373 }374 }375 //=================================================================================376 $src="";377 378 //======================================================================379 if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' )){380 $collection=$_POST['selection'] ;381 382 if (isset($collection)) {383 /*********************************384 * Affichage de la selection385 *********************************/386 $init_info =true;387 $first_image="";388 $_POST['selection'] = $collection ;389 foreach ($collection as $id_0) {390 foreach ($images as $image) {391 if (array_search($id_0,$image)) {392 393 $infos_gps = array();394 $infos_gps =array();395 $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ;396 397 398 399 400 if( ($image['lat']=='' || $image['lon']=='')|| $EDIT_CL_parametres->check_exif=='on' ) {401 if(isset($infos_gps['lat']) && $infos_gps['is_exif']){402 $image['lat']=$infos_gps['lat'];403 $image['lon']=$infos_gps['lon'];404 $image['alt']=$infos_gps['alt'];405 }406 }407 if($image['lat'] <> ''){408 $lon=$image['lon'];409 $lat=$image['lat'];410 $alt=$image['alt'];411 }412 //==========================================413 if ( $init_info && $image['lat'] <> '' ) {414 $init_info = false ;415 //=====================================================416 $template->assign( 'coordinates',417 array(418 'FILE' => $image['path'],419 'LAT' => $lat ,420 'LON' => $lon ,421 'ADRESSE' => $adresse ,422 'ZOOM' => 4,423 'ALT' => $alt ,424 )425 );426 }427 //=====================================================428 429 430 431 432 433 $lonDMS= dec2dms($lon) ;434 $latDMS= dec2dms($lat) ;435 $v_db=false ;436 $v_db=$lon!=0 && $lat!=0;437 438 $tpl_var = array_merge(439 $image,440 array(441 'filename' => $image['path'],442 'exif' => '"'.$infos_gps['is_exif'].'"' ,443 'lat' => $image['lat'] ,444 'lon' => $image['lon'] ,445 'alt' => $image['alt'] ,446 'latDMS' => $latDMS[3] ,447 'lonDMS' => $lonDMS[3] ,448 'adresse' => $adresse ,449 'TN_SRC' => get_thumbnail_url($image),450 'TITLE' => get_thumbnail_title($image),451 'U_EXIF' => $infos_gps['is_exif'] ,452 'U_BD' => $v_db ,453 'U_MAP' => cl_make_map_picture_url(454 array(455 'image_id'=>$image['id'],456 'image_file'=>$image['file'],457 )458 ),459 )460 );461 $template->append('Selectthumbnails', $tpl_var);462 }463 }464 }465 }466 }467 468 //============================================================469 if ( !empty($first_image)) {470 $erreur_message .= cl_print_var($first_image);471 472 if (isset($_POST['update'])) {473 // document.Envoie.latDMS.value474 $image= first_image ;475 $filename=$image['path'] ;476 $Val_exif="";477 $Val_XMP="";478 /* */479 if (!empty($infos_gps))480 $Position = $infos_gps ;481 else482 $Position = cl_edit_controler::Get_exif_gps($filename,$image,false,true) ;483 484 $jpeg_header_data = get_jpeg_header_data($filename );485 $template->assign( array(486 'filename_abs' => $filename ,487 'filename' => $filename,488 'datas' => array(489 /*490 'Val_JPEG_APP'=> Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ),491 'Val_intrinsic'=> Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ),492 'Val_Comment'=> Interpret_Comment_to_HTML( $jpeg_header_data ),493 'Val_JFIF'=> Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ),494 'Val_JFXX'=>Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ),495 'Val_App12' => Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ),496 'Val_IRB' => Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ),497 498 'Val_exif'=> Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename),499 'Val_XMP' => Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data) ) ),500 */501 //502 ),503 'Datadase' => ($Position) ,504 ) );505 }506 }507 508 509 //=======================================================================510 511 $v1=0;512 513 514 }515 510 516 511 if ($info_message!="") 517 $template->assign('infos',$info_message);512 $template->assign('infos',$info_message); 518 513 if ($erreur_message!="") 519 $template->assign('errors',$erreur_message);514 $template->assign('errors',$erreur_message); 520 515 521 516 function cl_make_map_picture_url($params) 522 517 { 523 524 525 526 527 518 global $conf; 519 /*if ( empty($conf['gmaps_api_key']) and $_SERVER['SERVER_ADDR']!='127.0.0.1' ) 520 return "";*/ 521 $map_url = make_picture_url($params); 522 return add_url_params($map_url, array('map'=>null) ); 528 523 } 529 524 ?> -
extensions/edit_gmaps/edit_gmaps.inc.php
r20034 r22117 44 44 $columns_of = array(); 45 45 $query = 'DESC '.$table.';'; 46 $result = mysql _query($query);46 $result = mysqli_fetch($query); 47 47 $columns_of[$table] = array(); 48 48 49 49 if ($result) 50 while ($row = mysql _fetch_row($result))50 while ($row = mysqli_fetch_row($result)) 51 51 array_push($columns_of[$table], $row[0]); 52 52 -
extensions/edit_gmaps/main.inc.php
r20034 r22117 2 2 /* 3 3 Plugin Name: Edit Maps&Earth 4 Version: 2.2. 74 Version: 2.2.8 5 5 Description: Editor for rv gmaps 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=330
Note: See TracChangeset
for help on using the changeset viewer.