Galeries de photos

Click dans l'image pour agrandir

$val) { $_GET[$var] = htmlspecialchars(strip_tags($val)); } // Configuraci�n require ("config/galeriasetup.php"); require ("config/galeriaconfig.php"); require ("config/file_handling.php"); /*require ("../../".$carpet."/galeria/config/galeriasetup.php"); require ("../../".$carpet."/galeria/config/galeriaconfig.php"); require ("../../".$carpet."/galeria/config/file_handling.php"); */ // Tema de visualizacion require ("theme/plantilla/config.php"); // debug de errores //error_reporting($debug_mode); // ? if ($includemode == false) { session_start(); } // require("include/galleryfunctions.php"); require("admin/admin_funcs.php"); //$galleryfilesdir = $_SERVER['DOCUMENT_ROOT']."/".$carpet."/galeria"; //$galleryfilesdir = "../".$carpet."/galeria"; //$galleryfolder = $galleryfilesdir."/".$galleryfolder; //$galleryfolder = $_SERVER['DOCUMENT_ROOT']."/cn/docs/image"; $galleryfilesdir = "../".$carpet."/galeria"; $galleryfolder = "../cn/docs/galeries"; $gallery_code = ""; // // track de url => IIS fix if($use_modrewrite=="0") { require ("include/url_fix.php"); } // GET variables $gallerypage = 1; // pagina actual de la galeria if (isset($_GET[$get_page])) { $gallerypage = (get_magic_quotes_gpc()) ? $_GET[$get_page] : addslashes($_GET[$get_page]); } $getfolder = ""; // set folder to be opened if (isset($_GET[$get_folder])) { $getfolder = (get_magic_quotes_gpc()) ? $_GET[$get_folder] : addslashes($_GET[$get_folder]); } $getimage = ""; // get current image if (isset($_GET[$get_image])) { $getimage = (get_magic_quotes_gpc()) ? $_GET[$get_image] : addslashes($_GET[$get_image]); } $getslide = ""; // get folder for slideshow if (isset($_GET[$get_slideshow])){$getslide=(get_magic_quotes_gpc()) ? $_GET[$get_slideshow] : addslashes($_GET[$get_slideshow]);} if ($_SESSION['lang']==null) { $_SESSION['lang'] = $language ; } if (isset($_POST['lang'])) { $_SESSION['lang'] = (get_magic_quotes_gpc()) ? $_POST['lang'] : addslashes($_POST['lang']); } // Check passed location - refuse attempt to open parent folders $folder_array_check = explode("/",$getfolder); if( in_array("..",$folder_array_check) ) { die("\"..\" is not allowed in the url."); } $folder_array_check = explode("/",$getimage); if( in_array("..",$folder_array_check) ) { die("\"..\" is not allowed in the url."); } $lang_file = $galleryfilesdir."/config/lang/".$_SESSION['lang'].".php"; if (file_exists($lang_file)) { include ($lang_file); } else { include ($galleryfilesdir."/config/lang/english.php"); } if ($getimage != "") { $galleryconfig = dirname($getimage)."/galeriaconfig.php"; } else { $galleryconfig = $galleryfolder."/".$getfolder."/galeriaconfig.php"; } if (file_exists($galleryconfig)) { include ($galleryconfig); } $displaybreadcrumbs = "1"; if ($displaybreadcrumbs == "1") { if($use_modrewrite=="0") { include ($galleryfilesdir."/include/breadcrumbs.php"); } else { include ($galleryfilesdir."/include/breadcrumbs_modrewrite.php"); } } if ($getimage != "") { $path_parts = pathinfo($getimage); $file_ext = strtolower($path_parts['extension']); if( in_array( $file_ext , $accepted_img ) ) { // is image $gallery_code .= navlinks(); include ("include/view_large_img.php"); } if( in_array( $file_ext , $accepted_vid ) ) { // is video file $gallery_code .= navlinks(); include ("include/view_video.php"); } $commentsfile = getCommentsFileName($getimage); if (file_exists($commentsfile)) { $comments = getCommentsText($commentsfile); $gallery_code .= "
"; $gallery_code .= nl2br($comments); $gallery_code .= "
"; } if ($print_exif_info == 1 && in_array( $file_ext , $accepted_img ) ) { $gallery_code .= print_exif($getimage); } // end EXIF printing // slideshow ? } else if ($getslide != "") { include ("include/slideshow.php"); } else { // Mostrar galeria if ($tooltip_folder_descr || $tooltip_image_descr) { include ("include/js_tooltip.php"); } $folder = $galleryfolder."/".$getfolder; $galleryimg_dir = dir($folder); $images_displayed = 0; // read images in selected sub folder $img_array = array(); $folder_array = array(); while(($file = $galleryimg_dir->read()) !== false) { $file_ext = explode(".",$file); $file_ext = strtolower($file_ext[1]); if (is_dir($folder."/".$file) && $file!="." && $file!="..") { $folder_array[] = $file; } else { if( in_array( $file_ext , $ignore_files ) || $file=="." || $file==".." || $file==$defaultfolderimage ) { // ignore files } else { $img_array[] = $file; // else include } } } // Hay que ordenar segun FAVORITA, de manera que la primera imagen sea aleatoria entre las favoritas //for ($l=0;$l".$folder_array[$l]; //} // if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { // sort the files if ($filesort == "desc") { krsort($folder_array); krsort($img_array); } else { ksort($folder_array); ksort($img_array); } } else { // sort the files if ($filesort == "desc") { rsort($folder_array); rsort($img_array); } else { sort($folder_array); sort($img_array); } } $img_array = array_merge ($folder_array, $img_array); // figure out which images to display if(!$file_list_view) { $gallerypageimages = $columns * $rows; } else { $gallerypageimages = $file_list_files_per_page; } $start = ($gallerypage * $gallerypageimages) - $gallerypageimages; $end = $start + $gallerypageimages; $i=1; $x=1; if($file_list_view) { $displayimgname = "1"; } $gallery_code .= ""; foreach($img_array as $image) { // image = fichero o directorio actual if ($i > $start && $i <= $end) { if (is_dir($folder."/".$image)) { if(!$file_list_view) { $gallery_code .= ""; } // display the folder name $displayfoldername = RemoveOrderNumber($image); $langfile = $folder."/".$image."/".$_SESSION['lang'].".txt"; if( file_exists($langfile) ) { $fp = fopen($langfile, "r"); $displayfoldername = fread($fp, filesize($langfile)); fclose($fp); } $displayfoldername = str_replace("_"," ", $displayfoldername); // print folder name if(!$file_list_view) { // Obtener titulo en el idioma correspondiente // $leng me dar� el idioma a mostrar ... tabla TITULO_GALERIAS (ESTRUCTURA=TABLA GALERIAS) $filtro = $folder."/".$displayfoldername; $filtro = str_replace("//","/",$filtro); $sql = "select titulo_".$leng.",desc_".$leng." from titulo_galerias where ruta_im='".$filtro."'"; $kueri = data_query($sql,$_SESSION['enlace']); while ($row=mysql_fetch_array($kueri)) { $titulin = $row[0]; $descrip = $row[1]; } //$gallery_code .= "
".$displayfoldername; // MOSTRAR EL TITULO DE LA GALERIA /*if ($titulin=='') { $ttt = explode("/",$filtro); if (count($ttt)>=1) $titulin = $ttt[count($ttt)-1]; }*/ $gallery_code .= "
".$titulin; // show image and subfolder counts underneath folder if ($display_img_count=="1" && $num_imgs>0) { $gallery_code .= " (".$num_imgs.")"; } if ($display_sub_count=="1" && $num_subs>0) { $gallery_code .= "
(".$num_subs." ".$lbl_album.")"; } $gallery_code .= "
"; // displaying description for folder from text file if ($description > "" && !$tooltip_folder_descr) { $gallery_code .= "
"; $gallery_code .= nl2br($description); $gallery_code .= "
"; } $gallery_code .= ""; } else { $gallery_code .= "
"; } // additional table cells for info in list view if ($file_list_view) { $gallery_code .= ""; if($file_list_file_size) { $gallery_code .= ""; } if($file_list_file_type) { $gallery_code .= ""; } if($file_list_file_date) { $gallery_code .= ""; } } /////////////////////////////////////////////////////////////////////////////////////////////// // IMAGE // else displaying a normal image } else if ( (eregi(".*(\.jpg|\.gif|\.png|\.jpeg)", $image)) && (sizeof($folder_array) <= 0) ){ $sql = "select titulo_".$leng.",desc_".$leng." from galerias where ruta_im='".$folder."/".$image."'"; $kueri = data_query($sql,$_SESSION['enlace']); while ($row=mysql_fetch_array($kueri)) { $titulin = $row[0]; $descrip = $row[1]; } if(!$file_list_view) { $gallery_code .= ""; } } // display table cells for file list view if($file_list_view) { $gallery_code .= ""; if($file_list_file_size) { $gallery_code .= ""; } if($file_list_file_type) { $gallery_code .= ""; } if($file_list_file_date) { $gallery_code .= ""; } } // end download link $images_displayed++; //////////////////////////////////////////////////////////////////////////////// // FILE // displaying link to another type of file } else { if(!$file_list_view) { $gallery_code .= ""; } if(!$file_list_view) { $gallery_code .= ""; } else { $gallery_code .= ""; if($file_list_file_size) { $gallery_code .= ""; } if($file_list_file_type) { $gallery_code .= ""; } if($file_list_file_date) { $gallery_code .= ""; } } else { $gallery_code .= ""; } // OTHER FILES } /*else { //download $gallery_code .= ''; $gallery_code .= ""; } else { $gallery_code .= "' height='".$file_list_file_icon_height."' alt='' />"; } $gallery_code .= ""; if(!$file_list_view) { $gallery_code .= "".$image.""; } else { $path_parts = pathinfo($image); $imagename = substr($path_parts['basename'], 0, -(strlen($path_parts['extension']) + ($path_parts['extension'] == '' ? 0 : 1))); $imagename = str_replace("_"," ", $imagename); $gallery_code .= ""; } // display additional view and download link for file list view if($file_list_view) { $gallery_code .= ""; if($file_list_file_size) { $gallery_code .= ""; } if($file_list_file_type) { $gallery_code .= ""; } if($file_list_file_date) { $gallery_code .= ""; } } else { // end extra table cells for info $gallery_code .= ""; } }*/ } $gallery_code .= ""; if(!$file_list_view) { // start new table row if ($x % $columns == 0 && $x != $gallerypageimages) { $gallery_code .= ''; } $x++; } else { $gallery_code .= ''; } } $i++; } $total = $i - 1; // if no content in table, create empty TD for xhtml validation if ($total==0) {$gallery_code .= ''; } // close gallery table $gallery_code .= '
"; } else { $gallery_code .= ""; //$gallery_code .= "
"; } $subfolder = $folder."/".$image; if(!$file_list_view) { if ($display_img_count=="1" || $display_sub_count=="1") { $gallerysub_dir = dir($subfolder); $num_imgs=0; $num_subs=0; while (($count=$gallerysub_dir->read() ) !== false ) { $count_ext = pathinfo($count); $count_ext = strtolower($count_ext['extension']); if( in_array($count_ext,$ignore_files) || $count=="." || $count==".." || $count==$defaultfolderimage || is_dir($folder."/".$image."/".$count) ) { // } else { $num_imgs++; // } if(is_dir($folder."/".$image."/".$count) && $count!=="." && $count!=="..") { $num_subs++; } } } } $description=""; $langfile = $folder."/".$image."/folder_".$_SESSION['lang'].".txt"; if( file_exists($langfile) ) { $descr_file = $langfile; } else { $descr_file = $folder."/".$image."/folder.txt"; } if (file_exists($descr_file)) { $description = getCommentsText($descr_file,true); } $gallery_code .= " "") { $gallery_code .= "onmousemove=\"javascript:toolTip( this, '". str_replace("_"," ", RemoveOrderNumber($image) )."', '".$description."' );\" onmouseout=\"javascript: removeTip( this );\" "; } $gallery_code .= "href='"; if($use_modrewrite=="0") { $gallery_code .= $currenturl.$get_folder."="; } else { $gallery_code .= $rewrite_base.$get_folder."/"; } if (isset($_GET[$get_folder])) {$gallery_code .= $getfolder.'/';} $gallery_code .= $image."'>"; if (file_exists($subfolder."/".$defaultfolderimage)) { $displayimg = $subfolder."/".$defaultfolderimage; $gallery_code .= ""; } else { if (!$file_list_view) { if ($folderthumbnail) { if (file_exists($subfolder."/default.jpg")) { $folderimage = ".jpg"; $imagefile = file($subfolder."/defaultimg.txt"); $displayimg = $subfolder."/".rtrim($imagefile[0]); //$displayimg = $subfolder."/default.jpg"; } else { // Buscar favorita aleatoria $candidatos = array(); // $candidatos = candidatos($subfolder,$image,$folder); if (sizeof($candidatos) > 0) { // hay candidatos ... en $jj-1 est� la semilla del random $semilla = sizeof($candidatos)-1; $aleatorio = rand(0,$semilla); $displayimg = $candidatos[$aleatorio]; } else { // en $displayimg ya tendr� una imagen //$displayimg = BuscaCandidatos($subfolder $displayimg=$folder."/".$image."/".$folderimage; } //$displayimg = ""; //$displayimg = $galleryfilesdir."/theme/DEFAULT_ICONS/folder-full.gif"; //echo "
test: ". $displayimg; } if(!eregi(".*(\.jpg|\.gif|\.png|\.jpeg)", $displayimg)) { $gallery_code .= ""; } else { // thumbnail $size = getimagesize ($displayimg); $xratio = $maxthumbwidth/$size[0]; $yratio = $maxthumbheight/$size[1]; if($xratio < $yratio) { $thumbwidth = $maxthumbwidth; $thumbheight = floor($size[1]*$xratio); } else { $thumbheight = $maxthumbheight; $thumbwidth = floor($size[0]*$yratio); } $modifed = filemtime($displayimg); $filesize = filesize($displayimg); $imgpath = str_replace("//","/",substr($displayimg,(strlen($galleryfilesdir)+1)) ); $hash = md5($imgpath.$size[0].$size[1].$modifed.$filesize); $cacheimagename = $galleryfilesdir."/".$cachefolder."/thumb_".$hash.".jpg"; //$cacheimagename = "galeria/".$cachefolder."/thumb_".$hash.".jpg"; if (file_exists($cacheimagename)) { $gallery_code .= ""; } else { $gallery_code .= ""; } } // end if else for default icon or generated thumbnail } else { $gallery_code .= ""; } // end if else block for generating thumbnail // display folder icons in file list view } else { $gallery_code .= ""; } // end if else block for file list view } // end if else block for defaultfolder icon set $gallery_code .= "
"; if ($file_list_view) { $gallery_code .= "
".$displayfoldername."".$lbl_view.""; $gallery_code .= "  "; $gallery_code .= date ("d-m-Y H:i:s", filemtime($folder."/".$image) ); $gallery_code .= ""; } else { $gallery_code .= ""; } $image_descr = ""; if ($tooltip_image_descr) { $imagename = getImageName($folder,$image); $commentsfile = getCommentsFileName($folder."/".$image); if (file_exists($commentsfile)) { $comments = getCommentsText($commentsfile,true); $image_descr .= $comments; } } if ($tooltip_image_descr && $image_descr > "") { $image_descr = " onmousemove=\"javascript:toolTip( this, '".$imagename."', '".$image_descr."' );\" onmouseout=\"javascript: removeTip( this );\" "; } $size = getimagesize ($folder."/".$image); $path = str_replace($galleryfolder."/","",$folder)."/"; if ($popupimage == "2") { $gallery_code .= ""; } else if ($popupimage == "6") { $gallery_code .= ""; } else if ($popupimage == "5") { $gallery_code .= ""; } else if ($popupimage == "4") { // Highslide $gallery_code .= ''; // Consulta de datos a la BB.DD. $sql = "select titulo_".$leng.",desc_".$leng." from galerias where ruta_im like '".$folder."/".$image."'"; $kueri = data_query($sql, $_SESSION['enlace']); $titulin = ""; while ($row=mysql_fetch_array($kueri)) { $titulin = $row[0] . "
" . $row[1]; } $gallery_code .= $folder.'/'.$image.'" rel="lytebox[galeria]" title="'.$titulin.'">'; } else if ($popupimage == "7") { // Lightbox $imagetitle = ""; if ($displayimgname == true) { $imagetitle .= getImageName($folder,$image); } $commentsfile = getCommentsFileName($folder."/".$image); if (file_exists($commentsfile)) { if (!empty($imagetitle)) { $imagetitle .= " - "; } $comments = getCommentsText($commentsfile,true); $imagetitle .= $comments; } $gallery_code .= '
'; } else { if($use_modrewrite=="0") { $imageurl = $currenturl.$get_image; $gallery_code .= ""; } else { if($folder==$galleryfolder."/") {$path="";} $gallery_code .= ""; } } if(!$file_list_view) { $xratio = $maxthumbwidth/$size[0]; $yratio = $maxthumbheight/$size[1]; if($xratio < $yratio) { $thumbwidth = $maxthumbwidth; $thumbheight = floor($size[1]*$xratio); } else { $thumbheight = $maxthumbheight; $thumbwidth = floor($size[0]*$yratio); } $modifed = filemtime($folder."/".$image); $filesize = filesize($folder."/".$image); $imgpath = str_replace("//","/",substr($folder."/".$image,(strlen($galleryfilesdir)+1)) ); $hash = md5($imgpath.$size[0].$size[1].$modifed.$filesize); $cacheimagename = $galleryfilesdir."/".$cachefolder."/thumb_".$hash.".jpg"; if (file_exists($cacheimagename)) { $gallery_code .= ""; } else { $gallery_code .= ""; } } else { /*$gallery_code .= ""; } else { $gallery_code .= "' height='".$file_list_file_icon_height."'>"; } */ } $gallery_code .= ""; // ZONA MOSTRAR IMAGEN, TITULO Y DESCRIPCION // display image title if ($displayimgname == true) { $imagename = getImageName($folder,$image); if(!$file_list_view) { //$gallery_code .= "
".$imagename.""; $sql = "select desc_".$leng.", titulo_".$leng." from galerias where ruta_im='".$folder."/".$image."'"; //$sql = "select desc_".$leng.", titulo_".$leng." from galerias where id=1"; $kue_tits = data_query($sql,$_SESSION['enlace']); $numc = mysql_num_rows($kue_tits); while ($row=mysql_fetch_array($kue_tits)) { $descr = $row[0]; $titulin = $row[1]; } $gallery_code .= "
$titulin
$descr
"; //$gallery_code .= "
".$descr.""; $path = str_replace($galleryfolder."/","",$folder)."/"; if ($popupimage == "2") { $gallery_code .= ""; } else if ($popupimage == "4") { $gallery_code .= ''; } else { if($use_modrewrite=="0") { $imageurl = $currenturl.$get_image; $gallery_code .= ""; } else { if($folder==$galleryfolder."/") {$path="";} $gallery_code .= ""; } } $gallery_code .= "".$lbl_view." - "; $gallery_code .= ''; $gallery_code .= "".$lbl_download.""; $gallery_code .= ""; $gallery_code .= number_format(filesize($folder."/".$image)/1024,0)." KB"; $gallery_code .= "".strtolower($path_parts['extension']).""; $gallery_code .= date ("d-m-Y H:i:s", filemtime($folder."/".$image) ); $gallery_code .= "
"; } else { $gallery_code .= "
"; } $path_parts = pathinfo($image); $file_ext = strtolower($path_parts['extension']); // VIDEO if( in_array( $file_ext , $accepted_vid ) ) { // is video file $path = str_replace($galleryfolder."/","",$folder)."/"; if($use_modrewrite=="0") { $imageurl = $currenturl.$get_image; $gallery_code .= ""; } else { if($folder==$galleryfolder."/") {$path="";} $gallery_code .= ""; } $gallery_code .= ""; } else { $gallery_code .= "' height='".$file_list_file_icon_height."' alt='' />"; } $path_parts = pathinfo($image); $imagename = substr($path_parts['basename'], 0, -(strlen($path_parts['extension']) + ($path_parts['extension'] == '' ? 0 : 1))); $imagename = str_replace("_"," ", $imagename); if(!$file_list_view) { $gallery_code .= "".$imagename."
"; } else { $gallery_code .= "
".$imagename.""; } // display additional view and download link $path = str_replace($galleryfolder."/","",$folder)."/"; if($use_modrewrite=="0") { $imageurl = $currenturl.$get_image; $gallery_code .= ""; } else { if($folder==$galleryfolder."/") {$path="";} $gallery_code .= ""; } $gallery_code .= "".$lbl_view." - "; $gallery_code .= ''; $gallery_code .= "".$lbl_download.""; // end download link if($file_list_view) { $gallery_code .= ""; $gallery_code .= number_format(filesize($folder."/".$image)/1024,0)." KB"; $gallery_code .= "".strtolower($path_parts['extension']).""; $gallery_code .= date ("d-m-Y H:i:s", filemtime($folder."/".$image) ); $gallery_code .= "".$imagename.""; $gallery_code .= "".$lbl_view." - "; $gallery_code .= ''; $gallery_code .= $lbl_download.""; $gallery_code .= ""; $gallery_code .= number_format(filesize($folder."/".$image)/1024,0)." KB"; $gallery_code .= "".strtolower($path_parts['extension']).""; $gallery_code .= date ("d-m-Y H:i:s", filemtime($folder."/".$image) ); $gallery_code .= "
'; ////////////////////////////////////////////////////////////////////////////////////// // build navigation links below gallery if($use_modrewrite=="0") { include ($_SERVER['DOCUMENT_ROOT']."/".$carpet."/galeria/include/pagelinks.php"); } else { include ($_SERVER['DOCUMENT_ROOT']."/".$carpet."/galeria/include/pagelinks_modrewrite.php"); } // slideshow link if($display_slideshow_link) { if($images_displayed > 1) { $gallery_code .= ''; } } } // end else diplaying gallery (not image) ////////////////////////////////////////////////////////////////////////////////////// $gallery_code .= '
Galeria Vallsfusta
'; ////////////////////////////////////////////////////////////////////////////////////// include ($_SERVER['DOCUMENT_ROOT']."/".$carpet."/galeria/theme/plantilla/template.php"); ////////////////////////////////////////////////////////////////////////////////////// ?>