From fa252911776c950cb4813e852b3d0e5ff4afa616 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 25 Sep 2024 01:29:21 -0400 Subject: New upstream version 4.12.0. --- index.php | 547 +++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 341 insertions(+), 206 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 3f8b038..78ec739 100644 --- a/index.php +++ b/index.php @@ -2,12 +2,12 @@ /* - Single File PHP Gallery 4.11.0 (SFPG) + Single File PHP Gallery 4.12.0 (SFPG) See EULA in readme.txt for commercial use See readme.txt for configuration - Released: 6-october-2022 + Released: 2024-Sep-07 https://sye.dk/sfpg/ by Kenny Svalgaard @@ -20,7 +20,7 @@ option('GALLERY_ROOT', './'); option('DATA_ROOT', './_sfpg_data/'); option('PASSWORD', ''); - option('ADMIN', FALSE); // WARNING - See description in readme.txt before setting to TRUE + option('ADMIN', FALSE); // WARNING - See description in readme.txt before setting to TRUE. option('DIR_NAME_FILE', '_name.txt'); option('DIR_THUMB_FILE', '_image.jpg'); @@ -36,6 +36,7 @@ option('DIR_EXCLUDE_REGEX', ''); option('SHOW_IMAGE_EXT', FALSE); + option('SHOW_IMAGE_NAME_BELOW_FULL', FALSE); option('IMAGE_SORT_REVERSE', FALSE); option('IMAGE_SORT_BY_TIME', FALSE); option('IMAGE_EXIF_TIME', FALSE); @@ -59,7 +60,7 @@ option('CHARSET', 'utf-8'); option('DATE_FORMAT', 'Day Date Month Year Hour:Min:Sec'); option('DESC_EXT', '.txt'); - option('HTML_DESCRIPTIONS', FALSE); // WARNING - See description in readme.txt before configuring this option + option('HTML_DESCRIPTIONS', FALSE); // WARNING - See description in readme.txt before configuring this option. option('DESC_NL_TO_BR', FALSE); option('SORT_DIVIDER', '--'); option('SORT_ALL_NATURAL', TRUE); @@ -68,6 +69,14 @@ option('SHOW_EXIF_INFO', TRUE); option('SHOW_IPTC_INFO', TRUE); option('PNG_TEXT_CHUNKS', TRUE); // Use only lower case when set to an array. + option('SPIDER_PASSWORD', ''); // WARNING - See description in readme.txt before setting this option. + + option('WEBP_EXIF', [ + 'COMPUTED'=>['ApertureFNumber', 'UserComment'], + 'IFD0'=>['Make', 'Model'], + 'EXIF'=>['ExposureTime', 'FNumber', 'ISOSpeedRatings', 'DateTimeOriginal', 'FocalLength'] + ]); + option('SHOW_INFO_BY_DEFAULT', FALSE); option('ROUND_CORNERS', 3); @@ -89,7 +98,7 @@ option('THUMB_SQUARE', FALSE); option('THUMB_ENLARGE', FALSE); option('THUMB_JPEG_QUALITY', 75); - option('THUMB_PNG_ALPHA', TRUE); + option('THUMB_TRANSPARENCY', TRUE); option('LOW_IMAGE_RESAMPLE_QUALITY', FALSE); option('KEYBOARD_NAVIGATION', TRUE); @@ -118,7 +127,6 @@ option('NAVI_CHARS_MAX', 100); option('OVERLAY_OPACITY', 0.9); - option('FADE_DURATION_MS', 300); option('SLIDESHOW_DELAY_SEC', 5); option('SHOW_MAX_IMAGES', FALSE); @@ -154,7 +162,7 @@ option('TEXT_ACTUAL_SIZE', 'Actual Size'); option('TEXT_PREVIOUS', '◄︎ Previous'); option('TEXT_NEXT', 'Next ►︎'); - option('TEXT_INFO', 'Info panel'); + option('TEXT_INFO', 'Info'); option('TEXT_INFO_LABEL', 'Information'); option('TEXT_DOWNLOAD', 'Download image'); option('TEXT_SLIDESHOW', 'Slideshow'); @@ -220,6 +228,7 @@ option('EXIF_MAP_EMBED_LINK', 'https://maps.google.com/maps?q=[lat],[long]&output=embed'); option('TEXT_PNG_CHUNKS', 'PNG text chunks'); + option('TEXT_WEBP_EXIF', 'WebP EXIF'); option('TEXT_IPTC', 'IPTC'); option('IPTC', [ @@ -374,9 +383,13 @@ function sfpg_base64url_decode($base64url) { - $base64 = strtr($base64url, '-_', '+/'); - $plain = base64_decode($base64); - return ($plain); + if($base64url) + { + $base64 = strtr($base64url, '-_', '+/'); + $plain = base64_decode($base64); + return ($plain); + } + return ''; } @@ -389,15 +402,15 @@ function sfpg_url_decode($string) { - $get = explode('*', sfpg_base64url_decode($string)); - if (is_array($get) and (count($get)==3) and (hash('sha256', $get[0].'*'.$get[1].'*'.SECURITY_PHRASE) === $get[2]) and (strpos(GALLERY_ROOT.$get[0].$get[1], '/../') === FALSE) and (strpos($get[0].$get[1], '\\') === FALSE)) - { - return [$get[0], $get[1]]; - } - else + if(is_string($string) and (strlen($string)>65)) // sha256 is 64 plus the two * { - return FALSE; + $get = explode('*', sfpg_base64url_decode($string)); + if (is_array($get) and (count($get)==3) and (hash('sha256', $get[0].'*'.$get[1].'*'.SECURITY_PHRASE) === $get[2]) and (strpos(GALLERY_ROOT.$get[0].$get[1], '/../') === FALSE) and (strpos($get[0].$get[1], '\\') === FALSE)) + { + return [$get[0], $get[1]]; + } } + return FALSE; } @@ -480,6 +493,10 @@ { return 'gif'; } + elseif ($type == '.webp') + { + return 'webp'; + } return FALSE; } @@ -562,7 +579,7 @@ for($x=0; $x<$mpo_full_width; $x++) { $left_color = imagecolorat($tmp_left, $x, $y); - $r = (int)(($left_color >> 16) & 255) * 0.299 + (($left_color >> 8) & 255) * 0.587 + (($left_color) & 255) * 0.114; + $r = (int)((($left_color >> 16) & 255) * 0.299 + (($left_color >> 8) & 255) * 0.587 + (($left_color) & 255) * 0.114); if ($r > 255) { $r = 255; @@ -643,7 +660,7 @@ } - function sfpg_get_dir($dir, $for_dir_info=FALSE, $for_zip=FALSE) + function sfpg_get_dir($dir, $for_dir_info=FALSE, $for_zip=FALSE, $for_spider=FALSE) { $dirs = []; $dirs_time = []; @@ -724,30 +741,33 @@ $misc[] = $var; } } + closedir($directory_handle); if ($for_dir_info) { $misc = 0; } - if (SHOW_FILES and !($for_zip and ZIP_FILES and ZIP_FILE_THUMBS)) // removes thumbnail images from being listed as images. Unless needed for zip. + if (!$for_spider) // never remove images when for spider { - foreach ($files as $val) + if (SHOW_FILES and !($for_zip and ZIP_FILES and ZIP_FILE_THUMBS)) // removes thumbnail images from being listed as images. Unless needed for zip. { - $fti = array_search($val.FILE_THUMB_EXT, $images); - if ($fti !== FALSE) + foreach ($files as $val) { - if ($for_dir_info) + $fti = array_search($val.FILE_THUMB_EXT, $images); + if ($fti !== FALSE) { - $misc++; - } - else - { - array_splice($images, $fti, 1); - array_splice($images_time, $fti, 1); + if ($for_dir_info) + { + $misc++; + } + else + { + array_splice($images, $fti, 1); + array_splice($images_time, $fti, 1); + } } } } } - closedir($directory_handle); sfpg_array_sort($dirs, $dirs_time, DIR_SORT_BY_TIME, DIR_SORT_REVERSE); sfpg_array_sort($images, $images_time, IMAGE_SORT_BY_TIME, IMAGE_SORT_REVERSE); sfpg_array_sort($files, $files_time, FILE_SORT_BY_TIME, FILE_SORT_REVERSE); @@ -757,7 +777,7 @@ { if ($dir=='') { - exit('GALLERY_ROOT is not is not accessible.'); + exit('GALLERY_ROOT is not accessible.'); } else { @@ -872,7 +892,32 @@ } - function sfpg_image($image_dir, $image_file, $func, $download=FALSE) + function data_as_str($data) + { + if(is_array($data)) + { + $res=''; + foreach($data as $d) + { + $res.=($res!=''?', ':'').data_as_str($d); + } + return $res; + } + else + { + if(isset($data)) + { + return trim((string)$data); + } + else + { + return ''; + } + } + } + + + function sfpg_image($image_dir, $image_file, $func, $download=FALSE, $spider=FALSE) { $image_path_file = DATA_ROOT.$func.'/'.$image_dir.$image_file; $image_type = sfpg_image_type($image_file); @@ -893,16 +938,19 @@ header('Content-Disposition: filename="'.$image_file.'"'); } readfile($image_path_file); - exit; + return; } if ($func == 'thumb') { if (file_exists($image_path_file)) { - header('Content-Type: image/'.$image_type); - header('Content-Disposition: filename="'.$func.'_'.$image_file.'"'); - readfile($image_path_file); - exit; + if (!$spider) + { + header('Content-Type: image/'.$image_type); + header('Content-Disposition: filename="'.$func.'_'.$image_file.'"'); + readfile($image_path_file); + } + return; } else { @@ -912,27 +960,34 @@ $jpeg_quality = THUMB_JPEG_QUALITY; $source_img = GALLERY_ROOT.$image_dir.$image_file; $image_changed = FALSE; + if ($image_type=='webp') // the imagecreatefromstring function can't handle animated WebP images. So check for this and return/skip if found. When it gets fixed by PHP, this 'if' can be removed. + { + if (stripos(file_get_contents($source_img, false, null, 0, 40),'ANIM')!==FALSE) + { + return; + } + } if ((MPO_FULL_IMAGE or MPO_STEREO_IMAGE) and (sfpg_ext($image_file)=='.mpo')) { if (!$image = sfpg_mpo_image($source_img)) { - exit; + return; } $image_changed = TRUE; } elseif (!$image = imagecreatefromstring(file_get_contents($source_img))) { - exit; + return; } if (($func == 'thumb') and ($image_dir != ICONS_DIR)) { sfpg_mkdir(DATA_ROOT.'info/'.$image_dir); $image_info = []; - if (function_exists('exif_read_data')) + if ((SHOW_EXIF_INFO or ROTATE_IMAGES) and function_exists('exif_read_data') and ($image_type!='webp')) // exif_read_data do not yet support the WebP format. { + $exif_data = @exif_read_data(GALLERY_ROOT.$image_dir.$image_file, 'IFD0'); if (SHOW_EXIF_INFO) { - $exif_data = @exif_read_data(GALLERY_ROOT.$image_dir.$image_file, 'IFD0'); if ($exif_data !== FALSE) { if(isset($exif_data['DateTimeOriginal'])) @@ -960,7 +1015,22 @@ } else { - $image_info['exifExposureTime'] = block_html($exif_data['ExposureTime'].'s'); + $tmp = explode('/', $exif_data['ExposureTime']); + if (count($tmp)==2) // if input contains one /, like: "1/250" + { + $as=(string)($tmp[0]); + $bs=(string)($tmp[1]); + while ((substr($as,-1)=='0') and (substr($bs,-1)=='0') and (strlen($as)>1) and (strlen($bs)>1)) // removed tailing 0 if both sides have them, like 10/10000 + { + $as=substr($as,0,-1); + $bs=substr($bs,0,-1); + } + $image_info['exifExposureTime'] = block_html($as.'/'.$bs.'s'); + } + else + { + $image_info['exifExposureTime'] = block_html($exif_data['ExposureTime'].'s'); + } } } if(isset($exif_data['FNumber'])) @@ -991,97 +1061,23 @@ $orientation = (int)$exif_data['Orientation']; if (($orientation>1) and ($orientation<9)) { - $image_width = imagesx($image); - $image_height = imagesy($image); - switch ($orientation) + if (($orientation==3) or ($orientation==4)) { - case 2: - { - $rotate = @imagecreatetruecolor($image_width, $image_height); - if (LOW_IMAGE_RESAMPLE_QUALITY) - { - imagecopyresized($rotate, $image, 0, 0, $image_width-1, 0, $image_width, $image_height, -$image_width, $image_height); - } - else - { - imagecopyresampled($rotate, $image, 0, 0, $image_width-1, 0, $image_width, $image_height, -$image_width, $image_height); - } - imagedestroy($image); - $image_changed = TRUE; - break; - } - case 3: - { - $rotate = imagerotate($image, 180, 0); - imagedestroy($image); - $image_changed = TRUE; - break; - } - case 4: - { - $rotate = @imagecreatetruecolor($image_width, $image_height); - if (LOW_IMAGE_RESAMPLE_QUALITY) - { - imagecopyresized($rotate, $image, 0, 0, 0, $image_height-1, $image_width, $image_height, $image_width, -$image_height); - } - else - { - imagecopyresampled($rotate, $image, 0, 0, 0, $image_height-1, $image_width, $image_height, $image_width, -$image_height); - } - imagedestroy($image); - $image_changed = TRUE; - break; - } - case 5: - { - $rotate = imagerotate($image, 270, 0); - imagedestroy($image); - $image = $rotate; - $rotate = @imagecreatetruecolor($image_height, $image_width); - if (LOW_IMAGE_RESAMPLE_QUALITY) - { - imagecopyresized($rotate, $image, 0, 0, 0, $image_width-1, $image_height, $image_width, $image_height, -$image_width); - } - else - { - imagecopyresampled($rotate, $image, 0, 0, 0, $image_width-1, $image_height, $image_width, $image_height, -$image_width); - } - $image_changed = TRUE; - break; - } - case 6: - { - $rotate = imagerotate($image, 270, 0); - imagedestroy($image); - $image_changed = TRUE; - break; - } - case 7: - { - $rotate = imagerotate($image, 90, 0); - imagedestroy($image); - $image = $rotate; - $rotate = @imagecreatetruecolor($image_height, $image_width); - if (LOW_IMAGE_RESAMPLE_QUALITY) - { - imagecopyresized($rotate, $image, 0, 0, 0, $image_width-1, $image_height, $image_width, $image_height, -$image_width); - } - else - { - imagecopyresampled($rotate, $image, 0, 0, 0, $image_width-1, $image_height, $image_width, $image_height, -$image_width); - } - $image_changed = TRUE; - break; - } - case 8: - { - $rotate = imagerotate($image, 90, 0); - imagedestroy($image); - $image_changed = TRUE; - break; - } + $image = imagerotate($image, 180, 0); + } + elseif (($orientation==5) or ($orientation==6)) + { + $image = imagerotate($image, -90, 0); + } + elseif (($orientation==7) or ($orientation==8)) + { + $image = imagerotate($image, 90, 0); + } + if (($orientation==2) or ($orientation==4) or ($orientation==5) or ($orientation==7)) + { + imageflip($image, IMG_FLIP_HORIZONTAL); } - $image = $rotate; + $image_changed = TRUE; } } } @@ -1100,7 +1096,7 @@ } } } - if (PNG_TEXT_CHUNKS and (sfpg_ext($image_file)=='.png')) + if (PNG_TEXT_CHUNKS and ($image_type=='png')) { if ($png_fp = @fopen(GALLERY_ROOT.$image_dir.$image_file, 'rb')) { @@ -1123,14 +1119,14 @@ list($keyword, $value) = explode("\0", $chunk_data); if((PNG_TEXT_CHUNKS === TRUE) or ((is_array(PNG_TEXT_CHUNKS)) and (in_array(strtolower($keyword), PNG_TEXT_CHUNKS)))) { - $png_text_chunks[]=$keyword; - $png_text_chunks[]=$value; + $png_text_chunks[]=block_html($keyword); + $png_text_chunks[]=block_html($value); } } } else { - fseek($png_fp, $chunk_info['length']+4, SEEK_CUR); // skipping the chunk + crc + fseek($png_fp, $chunk_info['length']+4, SEEK_CUR); // skip the chunk + crc } } fclose($png_fp); @@ -1141,6 +1137,63 @@ } } } + if (WEBP_EXIF and ($image_type=='webp')) + { + if ($webp_fp = @fopen(GALLERY_ROOT.$image_dir.$image_file, 'rb')) + { + $webp_exif=[]; + $webp_header = @unpack('a4riff/I1size/a4webp', fread($webp_fp, 12)); + if (($webp_header['riff']=='RIFF') and ($webp_header['webp']=='WEBP')) // required WebP header + { + while(!feof($webp_fp)) + { + $chunk_info = @unpack('a4type/I1size', fread($webp_fp, 8)); + if(!$chunk_info) + { + break; + } + if($chunk_info['type'] == 'EXIF') + { + $chunk_data = fread($webp_fp, $chunk_info['size']); // read EXIF chunk from image + $php_mem = fopen('php://memory', 'w+'); // create php memory stream + fputs($php_mem, $chunk_data); + rewind($php_mem); + $exif=@exif_read_data($php_mem, null, true); + fclose($php_mem); + foreach(WEBP_EXIF as $key=>$data) + { + foreach($data as $id) + { + if(isset($exif[$key][$id])) + { + $exif_data_str=data_as_str($exif[$key][$id]); + if($exif_data_str!='') + { + $webp_exif[]=block_html($id); + $webp_exif[]=block_html($exif_data_str); + } + } + } + } + break; // stop searching as only one EXIF section is allowed + } + else + { + fseek($webp_fp, $chunk_info['size'], SEEK_CUR); // skip the chunk + } + if ($chunk_info['size'] & 1) // if chunk size is odd, skip the padding byte + { + fseek($webp_fp, 1, SEEK_CUR); + } + } + fclose($webp_fp); + if(count($webp_exif)>0) + { + $image_info['webpExif'] = $webp_exif; + } + } + } + } if (WATERMARK) { $wm_file = GALLERY_ROOT.ICONS_DIR.WATERMARK; @@ -1191,6 +1244,10 @@ { imagegif($image, $new_full_img); } + elseif ($image_type == 'webp') + { + imagewebp($image, $new_full_img); + } } $image_info['fileMTime'] = filemtime(GALLERY_ROOT.$image_dir.$image_file); // also used for deleting data if time have changed $image_info['fileSize'] = sfpg_file_size(filesize(GALLERY_ROOT.$image_dir.$image_file)); @@ -1205,7 +1262,7 @@ $new_img_height = $max_width; } $new_image = imagecreatetruecolor($new_img_width, $new_img_height); - if(THUMB_PNG_ALPHA and ($image_type == 'png')) + if(THUMB_TRANSPARENCY and (($image_type == 'png') or ($image_type == 'webp'))) { imagealphablending($new_image, false); imagesavealpha($new_image,true); @@ -1236,23 +1293,43 @@ } imagedestroy($image); sfpg_mkdir(DATA_ROOT.$func.'/'.$image_dir); - header('Content-type: image/'.$image_type); - header('Content-Disposition: filename="'.$func.'_'.$image_file.'"'); + if (!$spider) + { + header('Content-type: image/'.$image_type); + header('Content-Disposition: filename="'.$func.'_'.$image_file.'"'); + } if ($image_type == 'jpeg') { - imagejpeg($new_image, NULL, $jpeg_quality); + if (!$spider) + { + imagejpeg($new_image, null, $jpeg_quality); + } imagejpeg($new_image, $image_path_file, $jpeg_quality); } elseif ($image_type == 'png') { - imagepng($new_image); + if (!$spider) + { + imagepng($new_image); + } imagepng($new_image, $image_path_file); } elseif ($image_type == 'gif') { - imagegif($new_image); + if (!$spider) + { + imagegif($new_image); + } imagegif($new_image, $image_path_file); } + elseif ($image_type == 'webp') + { + if (!$spider) + { + imagewebp($new_image); + } + imagewebp($new_image, $image_path_file); + } imagedestroy($new_image); } } @@ -1610,25 +1687,26 @@ menu += '".sts(TEXT_INFO)."'; }"; } - echo " - if (index) + if(TEXT_ACTUAL_SIZE) { - if (actualSize) + echo " + if (index) { - menu += '".sts(TEXT_ACTUAL_SIZE)."'; + if (actualSize) + { + menu += '".sts(TEXT_ACTUAL_SIZE)."'; + } + else + { + menu += '".sts(TEXT_ACTUAL_SIZE)."'; + } } else { - menu += '".sts(TEXT_ACTUAL_SIZE)."'; + menu += '".sts(TEXT_ACTUAL_SIZE)."'; } + "; } - else - { - menu += '".sts(TEXT_ACTUAL_SIZE)."'; - } - - - "; if (LINK_BACK) { echo "menu += '".sts(TEXT_LINK_BACK)."'; @@ -1783,6 +1861,10 @@ info += ''; info += '".sts(TEXT_IMAGE_NAME)."
'+imgInfo[id]['imageName'] + '

'; "; + if(SHOW_IMAGE_NAME_BELOW_FULL) + { + echo "gebi('box_image_full_name').innerHTML = imgInfo[id]['imageName'];"; + } if(PAYPAL_ENABLED) { echo" @@ -1898,6 +1980,22 @@ } "; } + if (WEBP_EXIF) + { + echo" + if (isDef(imgInfo[id]['webpExif'])) + { + info += '".sts(TEXT_WEBP_EXIF)."
'; + var brsep=''; + for (i=0; i'+imgInfo[id]['webpExif'][i]+'
'+imgInfo[id]['webpExif'][i+1]; + brsep='

'; + } + info += '

'; + } + "; + } echo" } else @@ -2800,12 +2898,17 @@ if (PAYPAL_ENABLED) { + $sfpg_cancel=''; + if(isset($_GET['sfpg']) and sfpg_url_decode($_GET['sfpg'])) + { + $sfpg_cancel='&sfpg='.$_GET['sfpg']; + } echo " function paypal(id) { var SelfUrl = '".RETURN_PROTOCOL."://".@$_SERVER['DOMAIN_NAME'].$_SERVER['PHP_SELF']."'; gebi('paypalReturn').value = SelfUrl+'?sold=1'; - gebi('paypalCancelReturn').value = SelfUrl+'?sfpg=".(sfpg_url_decode(@$_GET['sfpg'])!=FALSE?$_GET['sfpg']:'')."&info=1'; + gebi('paypalCancelReturn').value = SelfUrl+'?info=1".$sfpg_cancel."'; gebi('paypalAmount').value = imgInfo[id]['sellPrice']; gebi('paypalItemName').value = imgInfo[id]['imageName']; if(isDef(imgInfo[id]['sellID'])) @@ -2910,7 +3013,7 @@ } if (DELETE_EMPTY_DIRS and ($filed['dirDirs']===0) and ($filed['dirImages']===0) and ($filed['dirFiles']===0)) { - sfpg_delete(GALLERY.$val.'/'); + sfpg_delete(GALLERY_ROOT.GALLERY.$val.'/'); } else { @@ -3029,7 +3132,7 @@ { $image_info['sellPrice'] = $sell[0]; $image_info['sellStatus'] = $sell[1]; - if (trim(@$sell[2])!='') + if (isset($sell[2]) and (trim($sell[2])!='')) { $image_info['sellID'] = $sell[2]; } @@ -3089,6 +3192,24 @@ "; } + + function spider($dir) + { + list($dirs, $images, $files, $misc) = sfpg_get_dir($dir,FALSE,FALSE,TRUE); + unset($files); + unset($misc); + foreach($images as $image) + { + sfpg_image($dir, $image, 'thumb', FALSE, TRUE); + } + unset($images); + foreach($dirs as $sub_dir) + { + spider($dir.$sub_dir.'/'); + } + } + + @include(DATA_ROOT.'sp.php'); if (!defined('SECURITY_PHRASE')) { @@ -3236,50 +3357,59 @@ } } - if (isset($_GET['cmd']) and $get_set) + if ($get_set) { - if ($_GET['cmd'] == 'thumb') + if (isset($_GET['cmd'])) { - sfpg_image(GALLERY, IMAGE, 'thumb'); - exit; - } + if ($_GET['cmd'] == 'thumb') + { + sfpg_image(GALLERY, IMAGE, 'thumb'); + exit; + } - if ($_GET['cmd'] == 'image') - { - sfpg_image(GALLERY, IMAGE, 'image'); - exit; - } + if ($_GET['cmd'] == 'image') + { + sfpg_image(GALLERY, IMAGE, 'image'); + exit; + } - if (($_GET['cmd'] == 'dl') and TEXT_DOWNLOAD!='') - { - sfpg_image(GALLERY, IMAGE, 'image', TRUE); - exit; - } + if (($_GET['cmd'] == 'dl') and TEXT_DOWNLOAD!='') + { + sfpg_image(GALLERY, IMAGE, 'image', TRUE); + exit; + } - if (SHOW_FILES and ($_GET['cmd'] == 'file')) - { - if (preg_match("#^(/|([A-Z]:)?(\\\\|/))#i", GALLERY_ROOT)) // if GALLERY_ROOT is an absolute path + if (SHOW_FILES and ($_GET['cmd'] == 'file')) { - $download_path='./_sfpg_download'; - if (is_link($download_path)) + if (preg_match("#^(/|([A-Z]:)?(\\\\|/))#i", GALLERY_ROOT)) // if GALLERY_ROOT is an absolute path { - $prefix = $download_path.'/'; - } - elseif (symlink(rtrim(GALLERY_ROOT, '/'), $download_path)) - { - $prefix = $download_path.'/'; + $download_path='./_sfpg_download'; + if (is_link($download_path)) + { + $prefix = $download_path.'/'; + } + elseif (symlink(rtrim(GALLERY_ROOT, '/'), $download_path)) + { + $prefix = $download_path.'/'; + } + else + { + echo 'Unable to access file.'; + exit; + } } else { - echo 'Unable to access file.'; - exit; + $prefix = GALLERY_ROOT; } + header('Location: '.$prefix.GALLERY.IMAGE); + exit; } - else - { - $prefix = GALLERY_ROOT; - } - header('Location: '.$prefix.GALLERY.IMAGE); + } + elseif ((SPIDER_PASSWORD != '') and isset($_GET['spider']) and ($_GET['spider'] === SPIDER_PASSWORD)) + { + spider(GALLERY); + echo 'spider_done'; exit; } } @@ -3563,6 +3693,7 @@ body.sfpg { + overflow-wrap:break-word; background:'.COLOR_BODY_BACK.'; color:'.COLOR_BODY_TEXT.'; font-family:Arial, Helvetica, sans-serif; @@ -3604,7 +3735,6 @@ { text-align:center; padding:0px; - cellspacing:0px; } table.sfpg_disp td.menu @@ -3800,18 +3930,18 @@ { cursor:pointer; border:'.FULLIMG_BORDER_WIDTH.'px solid '.COLOR_FULLIMG_BORDER.'; - width: auto; - height : auto; - max-height: 100%; - max-width: 100%; - opacity: 0; - transition: opacity 0.5s; + width:auto; + height:auto; + max-height:100%; + max-width:100%; + opacity:0; + transition:opacity 0.5s; } .full_image_no_resize { - max-height: none; - max-width: none; + max-height:none; + max-width:none; } .banner @@ -3829,6 +3959,7 @@ .box_image, .box_wait { padding:30px; + '.(SHOW_IMAGE_NAME_BELOW_FULL?'padding-bottom:40px;':'').' position:absolute; top:0px; bottom:'.MENU_BOX_HEIGHT.'px; @@ -3855,19 +3986,18 @@ width:100%; height:250px; border:0; - scrolling:no; margin:0; '.(ROUND_CORNERS?'border-radius:'.ROUND_CORNERS.'px;':'').' } .wait { - margin: 0; - position: absolute; - top: 50%; - left: 50%; - -ms-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); + margin:0; + position:absolute; + top:50%; + left:50%; + -ms-transform:translate(-50%, -50%); + transform:translate(-50%, -50%); } .box_hud @@ -4003,7 +4133,12 @@ ''. ''. '
'. - ''. + ''; + if(SHOW_IMAGE_NAME_BELOW_FULL) + { + echo '
'; + } + echo '
'. '
'. '
'. -- cgit v1.2.3