assign( array( 'EDIT_CL_PATH' => EDIT_CL_PATH, 'path_js' => $path_js, 'VERSION'=> $version, 'EDIT_CL_PATH_ABS' => dirname(__FILE__).'/', 'GLOBAL_TPL' => $global_tpl ) ); /****************************************************************/ $info_message="" ; $erreur_message=""; /****************************************************************/ if ( !isset($_GET['mode']) ) $_GET['mode'] = 'global'; // if(!isset($_GET['cat'])) $_GET['cat']=" " ; if(isset($_POST['filter_prefilter'])){ $_GET['cat'] = $_POST['filter_prefilter']; } if (!isset($page['title'])) $page['title']=""; if(!isset($_POST['selectAction'])) $_POST['selectAction']="" ; //========== Mode GLOBAL ================================ check_input_parameter('selection', $_POST, true, PATTERN_ID); include (PHPWG_ROOT_PATH.'admin/batch_manager.php'); $tabsheet = new tabsheet(); $tabsheet->assign(); if(isset($page['cat_elements_id'])) $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']); if(isset($_POST)){ // $info_message .= cl_print_var($_POST); //=============================================================== $collection = array(); if(isset($_POST['selection'])) $collection = $_POST['selection']; //=============================================================== $images=array(); if (!empty($_GET['display'])){ if ('all' == $_GET['display']) $page['nb_images'] = count($page['cat_elements_id']); else $page['nb_images'] = intval($_GET['display']); } else $page['nb_images'] = 20; if ( !empty($page['cat_elements_id']) ){ $query=' SELECT * FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',',$page['cat_elements_id']).') '.$conf['order_by'].' LIMIT '.$page['start'].', '. $page['nb_images'] .' ;'; $result = pwg_query($query); while ( $row=pwg_db_fetch_assoc($result) ) $images[] = $row; } //=============================================================== global $lang_info; if (date_default_timezone_get()) { $adresse = date_default_timezone_get() ; }else{ } $adresse = $lang_info['country']; ; $adresse=str_replace("/",", ",$adresse); global $EDIT_CL_parametres ; $EDIT_CL_parametres = cl_edit_controler::cl_edit_Get_Options(); $template->assign( 'coordinates', array( 'FILE' => '', 'LAT' => ($EDIT_CL_parametres->lat =='')?'100': $EDIT_CL_parametres->lat, 'LON' => ($EDIT_CL_parametres->lon =='')?'100': $EDIT_CL_parametres->lon , 'ADRESSE' => ($EDIT_CL_parametres->adress =='')?$adresse: $EDIT_CL_parametres->adress , 'ZOOM' => 18, 'ALT' => $EDIT_CL_parametres->alt =='' ?0: $EDIT_CL_parametres->alt ) ); if (count($collection)>0 ) if ( isset($_POST['update']) && ( $_POST['update']==l10n('update_exif') || $_POST['update'] == l10n('update_all') )){ /*********************************** * Mise à jour des meta données ************************************/ // error_reporting ( 0 ); // Hide any unknown EXIF tags $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE; include $Toolkit_Dir.'Toolkit_Version.php'; // Change: added as of version 1.11 // Include the required files for reading and writing Photoshop File Info include $Toolkit_Dir.'JPEG.php'; include $Toolkit_Dir.'XMP.php'; include $Toolkit_Dir.'Photoshop_IRB.php'; include $Toolkit_Dir.'EXIF.php'; include $Toolkit_Dir.'GPS_File_Info.php'; $GLOBALS['HTTP_POST_VARS']=$_POST ; // Copy all of the HTML Posted variables into an array $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS']; // Some characters are escaped with backslashes in HTML Posted variable // Cycle through each of the HTML Posted variables, and strip out the slashes ' foreach( $new_ps_file_info_array as $var_key => $var_val ){ if ($var_key !="selection") $new_ps_file_info_array[ $var_key ] = stripslashes( $var_val ); } $init_info =true; $first_image=""; foreach ($collection as $id_0){ foreach ($images as $image) { if (array_search($id_0,$image)) { //================================================================= // Meta donnée //================================================================= $lat =(isset($_POST['lat']) && $_POST['lat'] )!='' ?trim($_POST['lat']):$image['lat']; $lon = (isset($_POST['lon']) && $_POST['lon'] )!='' ?trim($_POST['lon']):$image['lon']; $alt =(isset($_POST['alt']) && $_POST['alt'] )!=''?trim($_POST['alt']):$image['alt']; //========== Mise à jour $image ============= $image['lat']=$lat; $image['lon']=$lon; $image['alt']=$alt; //==== lecture info gps ==== $infos_gps = array(); if ( isset($_POST['lat']) && $_POST['lat'] !=''){ } else{ $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,true) ; if($infos_gps['lat']!=0){ $image['lat']=$infos_gps['lat']; $image['lon']=$infos_gps['lon']; } } $new_ps_file_info_array = base_to_meta($image); $new_ps_file_info_array['filename'] = $image['path']; $new_ps_file_info_array['selection'] = explode(";",$new_ps_file_info_array['filename']); if( $image['lat']=="" ){ $image['lat']= $new_ps_file_info_array['lat'] ; $image['lon']= $new_ps_file_info_array['lon'] ; $image['alt']= $new_ps_file_info_array['alt'] ; } if( cl_edit_controler::add_meta_gps($new_ps_file_info_array,$image)){ $exif = @read_exif_data( $image['path']); $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,true) ; $info_message .=l10n('update_exif') . " : " . $image['path'] . " : " . $image['file'] . " : ok
"; } }else{ } // fin search } // fin id_0 } // fin collection if($_POST['update']==l10n('update_exif')) { unset($_POST['submit']); } if ($_POST['update']==l10n('update_all')){ $_POST['submit'] = l10n('update_database') ; } $_POST['update'] ="ok"; } //====================================================================== if ( isset($_POST['submit']) ) { if ( $_POST['submit'] == l10n('update_database') ){ /************************************************** * Uniquement Mise à jour de la base de données **************************************************/ if ( count($collection)>0 ){ $lat = trim($_POST['lat']); $lon = trim($_POST['lon']); $alt = trim($_POST['alt']); //=============================================================== if($lat !="") cl_edit_controler::add_data_base($collection,$lat,$lon,$alt) ; $_POST['submit'] = l10n('selectAction') ; unset($_POST['submit']); foreach ($collection as $id_0){ foreach ($images as $image) { if (array_search($id_0,$image)) { $image['lat'] = $lat ; $image['lon']= $lon ; $image['alt'] = $alt ; } } } } $_POST['submit'] = l10n('selectAction') ; unset($_POST['submit']); } } /****************************************/ $query = ' SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.' ;'; $result = pwg_query($query); $categories = array(); $selecteds = array(); if(!isset($_GET['cat'])) $_GET['cat']="tag-no"; if (!empty($result)){ while ($row = pwg_db_fetch_assoc($result)) { $url = $admin_url.get_query_string_diff(array('start','cat')).'&cat='.$row['id']; if ( $row['id']==$_GET['cat'] ) $selecteds[] = $url; $row['id']=$url; array_push($categories, $row); } } usort($categories, 'global_rank_compare'); display_select_categories($categories, $selecteds, 'categories', false); if ( !empty($page['cat_elements_id']) ){ $nav_bar = create_navigation_bar( $admin_url.get_query_string_diff(array('start')), count($page['cat_elements_id']), $page['start'], $page['nb_images'] ); $template->assign('navbar', $nav_bar); } //======================================================================== $v_exif=""; $current = $template->get_template_vars('thumbnails'); $j=0; $thumbnails= array(); /************************************* * AFFICHAGE MODE GLOBAL *************************************/ foreach ($images as $image){ $infos_gps = array(); $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ; $v_exif=$infos_gps['is_exif']?"EXIF":"NO" ; $v_db=false ; $v_db=$image['lat']!=0 && $image['lon']!=0; $v_db=$v_db?"BD":"NO"; //==== GPS infos -> image infos ==== if( $infos_gps['lat'] !=0 || $infos_gps['lon'] !=0 ) { $new= ( !isset($image['lat'])? true: $image['lat']!=$infos_gps['lat'] ) ; $image['lat']=$infos_gps['lat']; $image['lon']=$infos_gps['lon']; $image['alt']=$infos_gps['alt']; $sel_img= array($image['id']); if ($new){ cl_edit_controler::add_data_base( $sel_img,$image['lat'],$image['lon'],$image['alt']) ; } } //================================================= $name = render_element_name($image); $desc = render_element_description($image); if (!in_array($image['id'],$current[$j])) { $j =0; foreach($current as $rK => $rV){ if (!in_array($image['id'],$rV)) { $j++ ; } else{ // $info_message .= cl_print_var($current[$j]); break ; } } } //================================================= $TN_SRC= $current[$j]['thumb']; $TITLE=$current[$j]['TITLE'] ; $tpl_var = array( 'id' =>$image['id'], 'TN_SRC' => $TN_SRC, 'file' => $current[$j]['FILE'], 'TITLE' => $TITLE, 'LEVEL' => $current[$j]['LEVEL'], 'FILE_SRC' => $current[$j]['FILE_SRC'], 'U_EDIT' => $current[$j]['U_EDIT'], 'lat' => $image['lat'] , 'lon' => $image['lon'] , 'alt' => $image['alt'] , 'U_EXIF' => $v_exif , 'U_BD' => $v_db , 'thumb' =>$current[$j]['thumb'] ); $thumbnails[]=$tpl_var; $j++; } $template->assign('thumbnails', $thumbnails); $template->assign( array( 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')) ) ); //================================================================================== $match=""; if ( isset($_POST['submit']) ) { if ( isset($_POST['match']) && $_POST['match']!='' ){ cl_edit_controler::cl_edit_Set_Options(); cl_edit_controler::cl_edit_sauve_options_inf(); } if ($_POST['submit']==l10n('selection') ) { $collection =$_POST['selection']; } if ($_POST['submit']==l10n('add') ) { $_POST['selection']=array(); $collection =array(); unset($collection); } if ($_POST['submit']==l10n('reset' ) ) { $_POST['selection']=array(); $collection =array(); unset($collection); } } //================================================================================= $src=""; //====================================================================== if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' )){ $collection=$_POST['selection'] ; if (isset($collection)) { /********************************* * Affichage de la selection *********************************/ $init_info =true; $first_image=""; $_POST['selection'] = $collection ; foreach ($collection as $id_0) { foreach ($images as $image) { if (array_search($id_0,$image)) { $infos_gps = array(); $infos_gps =array(); $infos_gps = cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ; if( ($image['lat']=='' || $image['lon']=='')|| $EDIT_CL_parametres->check_exif=='on' ) { if(isset($infos_gps['lat']) && $infos_gps['is_exif']){ $image['lat']=$infos_gps['lat']; $image['lon']=$infos_gps['lon']; $image['alt']=$infos_gps['alt']; } } if($image['lat'] <> ''){ $lon=$image['lon']; $lat=$image['lat']; $alt=$image['alt']; } //========================================== if ( $init_info && $image['lat'] <> '' ) { $init_info = false ; //===================================================== $template->assign( 'coordinates', array( 'FILE' => $image['path'], 'LAT' => $lat , 'LON' => $lon , 'ADRESSE' => $adresse , 'ZOOM' => 4, 'ALT' => $alt , ) ); } //===================================================== $lonDMS= dec2dms($lon) ; $latDMS= dec2dms($lat) ; $v_db=false ; $v_db=$lon!=0 && $lat!=0; $tpl_var = array_merge( $image, array( 'filename' => $image['path'], 'exif' => '"'.$infos_gps['is_exif'].'"' , 'lat' => $image['lat'] , 'lon' => $image['lon'] , 'alt' => $image['alt'] , 'latDMS' => $latDMS[3] , 'lonDMS' => $lonDMS[3] , 'adresse' => $adresse , 'TN_SRC' => DerivativeImage::thumb_url($image), 'TITLE' => render_element_name($image), 'U_EXIF' => $infos_gps['is_exif'] , 'U_BD' => $v_db , 'U_MAP' => cl_make_map_picture_url( array( 'image_id'=>$image['id'], 'image_file'=>$image['file'], ) ), ) ); $template->append('Selectthumbnails', $tpl_var); } } } } } //============================================================ if ( !empty($first_image)) { $erreur_message .= cl_print_var($first_image); if (isset($_POST['update'])) { // document.Envoie.latDMS.value $image= first_image ; $filename=$image['path'] ; $Val_exif=""; $Val_XMP=""; /* */ if (!empty($infos_gps)) $Position = $infos_gps ; else $Position = cl_edit_controler::Get_exif_gps($filename,$image,false,true) ; $jpeg_header_data = get_jpeg_header_data($filename ); $template->assign( array( 'filename_abs' => $filename , 'filename' => $filename, 'datas' => array( /* 'Val_JPEG_APP'=> Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ), 'Val_intrinsic'=> Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ), 'Val_Comment'=> Interpret_Comment_to_HTML( $jpeg_header_data ), 'Val_JFIF'=> Interpret_JFIF_to_HTML( get_JFIF( $jpeg_header_data ), $filename ), 'Val_JFXX'=>Interpret_JFXX_to_HTML( get_JFXX( $jpeg_header_data ), $filename ), 'Val_App12' => Interpret_App12_Pic_Info_to_HTML( $jpeg_header_data ), 'Val_IRB' => Interpret_IRB_to_HTML( get_Photoshop_IRB( $jpeg_header_data ), $filename ), 'Val_exif'=> Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename), 'Val_XMP' => Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data) ) ), */ // ), 'Datadase' => ($Position) , ) ); } } //======================================================================= $v1=0; } if ($info_message!="") $template->assign('infos',$info_message); if ($erreur_message!="") $template->assign('errors',$erreur_message); function cl_make_map_picture_url($params) { global $conf; /*if ( empty($conf['gmaps_api_key']) and $_SERVER['SERVER_ADDR']!='127.0.0.1' ) return "";*/ $map_url = make_picture_url($params); return add_url_params($map_url, array('map'=>null) ); } ?>