Version 0.3.7
* Version number now starts at 0.3.7 * Added thumbnail cache. * Added optional folder comment and image title/caption * darkgold2 theme from version 0.2.3 adapted to this version. * darkgold2 is now the default theme. * Increased thumbnail size. * Increased number of images per page. * Page is now in UTF-8 by default to support international characters. * Removed many warnings. * Corrected XSS vulnerability. * Added htaccess to prevent raw browsing of images folder. * Removed version check against original author's website.
This commit is contained in:
parent
aa895a124b
commit
c6b911cc29
9 changed files with 347 additions and 39 deletions
1
.htaccess
Normal file
1
.htaccess
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Options -Indexes
|
16
config.php
16
config.php
|
@ -16,12 +16,12 @@ Please enjoy this free script!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
|
// EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
|
||||||
$thumbs_pr_page = "28"; //Number of thumbnails on a single page
|
$thumbs_pr_page = "39"; //Number of thumbnails on a single page
|
||||||
$gallery_width = "900px"; //Gallery width. Eg: "500px" or "70%"
|
$gallery_width = "80%"; //Gallery width. Eg: "500px" or "70%"
|
||||||
$backgroundcolor = "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
|
$backgroundcolor = "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
|
||||||
$templatefile = "mano"; //Template filename (must be placed in 'templates' folder)
|
$templatefile = "darkgold2"; //Template filename (must be placed in 'templates' folder)
|
||||||
$title = "MiniGal Nano Testsite"; // Text to be displayed in browser titlebar
|
$title = "MiniGal Nano test gallery"; // Text to be displayed in browser titlebar
|
||||||
$author = "Rybber";
|
$author = "John Doe";
|
||||||
$folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey
|
$folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey
|
||||||
$sorting_folders = "name"; // Sort folders by: [name][date]
|
$sorting_folders = "name"; // Sort folders by: [name][date]
|
||||||
$sorting_files = "name"; // Sort files by: [name][date][size]
|
$sorting_files = "name"; // Sort files by: [name][date][size]
|
||||||
|
@ -37,7 +37,7 @@ $label_noimages = "No images"; //Empty folder text
|
||||||
$label_loading = "Loading..."; //Thumbnail loading text
|
$label_loading = "Loading..."; //Thumbnail loading text
|
||||||
|
|
||||||
//ADVANCED SETTINGS
|
//ADVANCED SETTINGS
|
||||||
$thumb_size = 120; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly!
|
$thumb_size = 320; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly!
|
||||||
$label_max_length = 30; //Maximum chars of a folder name that will be displayed on the folder thumbnail
|
$label_max_length = 40; //Maximum chars of a folder name that will be displayed on the folder thumbnail
|
||||||
$display_exif = 1;
|
$display_exif = 0;
|
||||||
?>
|
?>
|
|
@ -16,10 +16,10 @@ Please enjoy this free script!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
|
// EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
|
||||||
$thumbs_pr_page = "18"; //Number of thumbnails on a single page
|
$thumbs_pr_page = "21"; //Number of thumbnails on a single page
|
||||||
$gallery_width = "900px"; //Gallery width. Eg: "500px" or "70%"
|
$gallery_width = "900px"; //Gallery width. Eg: "500px" or "70%"
|
||||||
$backgroundcolor = "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
|
$backgroundcolor = "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
|
||||||
$templatefile = "mano"; //Template filename (must be placed in 'templates' folder)
|
$templatefile = "darkgold2"; //Template filename (must be placed in 'templates' folder)
|
||||||
$title = "My Gallery"; // Text to be displayed in browser titlebar
|
$title = "My Gallery"; // Text to be displayed in browser titlebar
|
||||||
$author = "Me :)";
|
$author = "Me :)";
|
||||||
$folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey
|
$folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey
|
||||||
|
|
|
@ -14,16 +14,62 @@ Community: www.minigal.dk/forum
|
||||||
|
|
||||||
Please enjoy this free script!
|
Please enjoy this free script!
|
||||||
|
|
||||||
|
Version 0.3.5 modified by Sebastien SAUVAGE (sebsauvage.net):
|
||||||
|
- Added thumbnail cache (reduces server CPU load, server bandwith and speeds up client page display).
|
||||||
|
- Thumbnails are now always in JPEG even if the source image is PNG or GIF.
|
||||||
|
|
||||||
USAGE EXAMPLE:
|
USAGE EXAMPLE:
|
||||||
File: createthumb.php
|
File: createthumb.php
|
||||||
Example: <img src="createthumb.php?filename=photo.jpg&width=100&height=100">
|
Example: <img src="createthumb.php?filename=photo.jpg&width=100&height=100">
|
||||||
*/
|
*/
|
||||||
// error_reporting(E_ALL);
|
// error_reporting(E_ALL);
|
||||||
|
error_reporting(0);
|
||||||
|
/*
|
||||||
if (preg_match("/.jpg$|.jpeg$/i", $_GET['filename'])) header('Content-type: image/jpeg');
|
if (preg_match("/.jpg$|.jpeg$/i", $_GET['filename'])) header('Content-type: image/jpeg');
|
||||||
if (preg_match("/.gif$/i", $_GET['filename'])) header('Content-type: image/gif');
|
if (preg_match("/.gif$/i", $_GET['filename'])) header('Content-type: image/gif');
|
||||||
if (preg_match("/.png$/i", $_GET['filename'])) header('Content-type: image/png');
|
if (preg_match("/.png$/i", $_GET['filename'])) header('Content-type: image/png');
|
||||||
|
*/
|
||||||
|
|
||||||
|
function str_split_php4( $text, $split = 1 ) {
|
||||||
|
// place each character of the string into and array
|
||||||
|
$array = array();
|
||||||
|
for ( $i=0; $i < strlen( $text ); ){
|
||||||
|
$key = NULL;
|
||||||
|
for ( $j = 0; $j < $split; $j++, $i++ ) {
|
||||||
|
$key .= $text[$i];
|
||||||
|
}
|
||||||
|
array_push( $array, $key );
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitize($name)
|
||||||
|
{
|
||||||
|
// Sanitize image filename (taken from http://iamcam.wordpress.com/2007/03/20/clean-file-names-using-php-preg_replace/ )
|
||||||
|
$fname=$name;
|
||||||
|
$replace="_";
|
||||||
|
$pattern="/([[:alnum:]_\.-]*)/";
|
||||||
|
$fname=str_replace(str_split_php4(preg_replace($pattern,$replace,$fname)),$replace,$fname);
|
||||||
|
return $fname;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the "thumbs" directory exists.
|
||||||
|
if (!is_dir('thumbs')) { mkdir('thumbs',0700); }
|
||||||
|
|
||||||
|
// Thumbnail file name and path.
|
||||||
|
// (We always put thumbnails in jpg for simplification)
|
||||||
|
$thumbname = 'thumbs/'.sanitize($_GET['filename']).'.jpg';
|
||||||
|
|
||||||
|
if (file_exists($thumbname)) // If thumbnail exists, serve it.
|
||||||
|
{
|
||||||
|
$fd = fopen($thumbname, "r");
|
||||||
|
$cacheContent = fread($fd,filesize ($thumbname));
|
||||||
|
fclose($fd);
|
||||||
|
header('Content-type: image/jpeg');
|
||||||
|
echo($cacheContent);
|
||||||
|
}
|
||||||
|
else // otherwise, generate thumbnail, send it and save it to file.
|
||||||
|
{
|
||||||
|
|
||||||
// Display error image if file isn't found
|
// Display error image if file isn't found
|
||||||
if (!is_file($_GET['filename'])) {
|
if (!is_file($_GET['filename'])) {
|
||||||
|
@ -82,11 +128,19 @@ if (preg_match("/.png$/i", $_GET['filename'])) header('Content-type: image/png')
|
||||||
imagecopyresampled($target,$source,0,0,$xoord,$yoord,$_GET['size'],$_GET['size'],$width,$height);
|
imagecopyresampled($target,$source,0,0,$xoord,$yoord,$_GET['size'],$_GET['size'],$width,$height);
|
||||||
imagedestroy($source);
|
imagedestroy($source);
|
||||||
|
|
||||||
if (preg_match("/.jpg$/i", $_GET['filename'])) ImageJPEG($target,null,90);
|
//if (preg_match("/.jpg$/i", $_GET['filename'])) ImageJPEG($target,null,90);
|
||||||
if (preg_match("/.gif$/i", $_GET['filename'])) ImageGIF($target,null,90);
|
//if (preg_match("/.gif$/i", $_GET['filename'])) ImageGIF($target,null,90);
|
||||||
if (preg_match("/.png$/i", $_GET['filename'])) ImageJPEG($target,null,90); // Using ImageJPEG on purpose
|
//if (preg_match("/.png$/i", $_GET['filename'])) ImageJPEG($target,null,90); // Using ImageJPEG on purpose
|
||||||
|
ob_start(); // Start output buffering.
|
||||||
|
header('Content-type: image/jpeg'); // We always render the thumbnail in JPEG even if the source is GIF or PNG.
|
||||||
|
ImageJPEG($target,null,80);
|
||||||
imagedestroy($target);
|
imagedestroy($target);
|
||||||
|
|
||||||
|
$cachedImage = ob_get_contents(); // Get the buffer content.
|
||||||
|
ob_end_flush();// End buffering
|
||||||
|
$fd = fopen($thumbname, "w"); // Save buffer to disk
|
||||||
|
if ($fd) { fwrite($fd,$cachedImage); fclose($fd); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
70
index.php
70
index.php
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
MINIGAL NANO
|
MINIGAL NANO
|
||||||
- A PHP/HTML/CSS based image gallery script
|
- A PHP/HTML/CSS based image gallery script
|
||||||
|
@ -13,6 +14,11 @@ Support: www.minigal.dk
|
||||||
Community: www.minigal.dk/forum
|
Community: www.minigal.dk/forum
|
||||||
|
|
||||||
Please enjoy this free script!
|
Please enjoy this free script!
|
||||||
|
|
||||||
|
|
||||||
|
Upgraded to https://github.com/sebsauvage/MinigalNano
|
||||||
|
by Sébastien SAUVAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Do not edit below this section unless you know what you are doing!
|
// Do not edit below this section unless you know what you are doing!
|
||||||
|
@ -21,9 +27,9 @@ Please enjoy this free script!
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// Debug stuff
|
// Debug stuff
|
||||||
//-----------------------
|
//-----------------------
|
||||||
error_reporting(E_ERROR);
|
// error_reporting(E_ERROR);
|
||||||
// error_reporting(E_ALL);
|
// error_reporting(E_ALL);
|
||||||
// error_reporting(0);
|
error_reporting(-1);
|
||||||
/*
|
/*
|
||||||
$mtime = microtime();
|
$mtime = microtime();
|
||||||
$mtime = explode(" ",$mtime);
|
$mtime = explode(" ",$mtime);
|
||||||
|
@ -31,11 +37,11 @@ Please enjoy this free script!
|
||||||
$starttime = $mtime;
|
$starttime = $mtime;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$version = "0.3.5";
|
header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling.
|
||||||
|
$version = "0.3.7";
|
||||||
ini_set("memory_limit","256M");
|
ini_set("memory_limit","256M");
|
||||||
|
|
||||||
require("config_default.php");
|
require("config.php");
|
||||||
include("config.php");
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// DEFINE VARIABLES
|
// DEFINE VARIABLES
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
@ -46,6 +52,7 @@ $new = "";
|
||||||
$images = "";
|
$images = "";
|
||||||
$exif_data = "";
|
$exif_data = "";
|
||||||
$messages = "";
|
$messages = "";
|
||||||
|
$comment = "";
|
||||||
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// PHP ENVIRONMENT CHECK
|
// PHP ENVIRONMENT CHECK
|
||||||
|
@ -126,6 +133,8 @@ function checkpermissions($file) {
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// CHECK FOR NEW VERSION
|
// CHECK FOR NEW VERSION
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
// New version check disabled because original author does not update it software anymore.
|
||||||
|
/*
|
||||||
if (ini_get('allow_url_fopen') == "1") {
|
if (ini_get('allow_url_fopen') == "1") {
|
||||||
$file = @fopen ("http://www.minigal.dk/minigalnano_version.php", "r");
|
$file = @fopen ("http://www.minigal.dk/minigalnano_version.php", "r");
|
||||||
$server_version = fgets ($file, 1024);
|
$server_version = fgets ($file, 1024);
|
||||||
|
@ -134,10 +143,14 @@ if (ini_get('allow_url_fopen') == "1") {
|
||||||
}
|
}
|
||||||
fclose($file);
|
fclose($file);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", "");
|
if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", "");
|
||||||
$thumbdir = rtrim('photos' . "/" .$_REQUEST["dir"],"/");
|
$requestedDir = '';
|
||||||
$thumbdir = str_replace("/..", "", $thumbdir); // Prevent looking at any up-level folders
|
if (!empty($_GET['dir'])) $requestedDir = $_GET['dir'];
|
||||||
|
$thumbdir = rtrim('photos/'.$requestedDir,'/');
|
||||||
|
|
||||||
|
$thumbdir = str_replace('/..', '', $thumbdir); // Prevent directory traversal attacks.
|
||||||
$currentdir = GALLERY_ROOT . $thumbdir;
|
$currentdir = GALLERY_ROOT . $thumbdir;
|
||||||
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
@ -156,12 +169,12 @@ $dirs = array();
|
||||||
{
|
{
|
||||||
checkpermissions($currentdir . "/" . $file); // Check for correct file permission
|
checkpermissions($currentdir . "/" . $file); // Check for correct file permission
|
||||||
// Set thumbnail to folder.jpg if found:
|
// Set thumbnail to folder.jpg if found:
|
||||||
if (file_exists("$currentdir/" . $file . "/folder.jpg"))
|
if (file_exists($currentdir. '/' . $file . '/folder.jpg'))
|
||||||
{
|
{
|
||||||
$dirs[] = array(
|
$dirs[] = array(
|
||||||
"name" => $file,
|
"name" => $file,
|
||||||
"date" => filemtime($currentdir . "/" . $file . "/folder.jpg"),
|
"date" => filemtime($currentdir . "/" . $file . "/folder.jpg"),
|
||||||
"html" => "<li><a href='?dir=" .ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=$currentdir/" . $file . "/folder.jpg&size=$thumb_size' alt='$label_loading' /></a></li>");
|
"html" => "<li><a href='?dir=" .ltrim($requestedDir . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=$currentdir/" . $file . "/folder.jpg&size=$thumb_size' alt='$label_loading' /></a></li>");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Set thumbnail to first image found (if any):
|
// Set thumbnail to first image found (if any):
|
||||||
|
@ -171,19 +184,20 @@ $dirs = array();
|
||||||
$dirs[] = array(
|
$dirs[] = array(
|
||||||
"name" => $file,
|
"name" => $file,
|
||||||
"date" => filemtime($currentdir . "/" . $file),
|
"date" => filemtime($currentdir . "/" . $file),
|
||||||
"html" => "<li><a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=$thumbdir/" . $file . "/" . $firstimage . "&size=$thumb_size' alt='$label_loading' /></a></li>");
|
"html" => "<li><a href='?dir=" . ltrim($requestedDir . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=$thumbdir/" . $file . "/" . $firstimage . "&size=$thumb_size' alt='$label_loading' /></a></li>");
|
||||||
} else {
|
} else {
|
||||||
// If no folder.jpg or image is found, then display default icon:
|
// If no folder.jpg or image is found, then display default icon:
|
||||||
$dirs[] = array(
|
$dirs[] = array(
|
||||||
"name" => $file,
|
"name" => $file,
|
||||||
"date" => filemtime($currentdir . "/" . $file),
|
"date" => filemtime($currentdir . "/" . $file),
|
||||||
"html" => "<li><a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file) . "</em><span></span><img src='" . GALLERY_ROOT . "images/folder_" . strtolower($folder_color) . ".png' width='$thumb_size' height='$thumb_size' alt='$label_loading' /></a></li>");
|
"html" => "<li><a href='?dir=" . ltrim($requestedDir . "/" . $file, "/") . "'><em>" . padstring($file) . "</em><span></span><img src='" . GALLERY_ROOT . "images/folder_" . strtolower($folder_color) . ".png' width='$thumb_size' height='$thumb_size' alt='$label_loading' /></a></li>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. LOAD CAPTIONS
|
// 2. LOAD CAPTIONS
|
||||||
|
$img_captions['']='';
|
||||||
if (file_exists($currentdir ."/captions.txt"))
|
if (file_exists($currentdir ."/captions.txt"))
|
||||||
{
|
{
|
||||||
$file_handle = fopen($currentdir ."/captions.txt", "rb");
|
$file_handle = fopen($currentdir ."/captions.txt", "rb");
|
||||||
|
@ -209,12 +223,20 @@ if (file_exists($currentdir ."/captions.txt"))
|
||||||
//Read EXIF
|
//Read EXIF
|
||||||
if ($display_exif == 1) $img_captions[$file] .= readEXIF($currentdir . "/" . $file);
|
if ($display_exif == 1) $img_captions[$file] .= readEXIF($currentdir . "/" . $file);
|
||||||
|
|
||||||
|
// Read the optionnal image title and caption in html file (image.jpg --> image.jpg.html)
|
||||||
|
// Format: title::caption
|
||||||
|
// Example: My cat::My cat like to <i>roll</i> on the floor.
|
||||||
|
// If file is not provided, image filename will be used instead.
|
||||||
checkpermissions($currentdir . "/" . $file);
|
checkpermissions($currentdir . "/" . $file);
|
||||||
|
|
||||||
|
$img_captions[$file] = $file;
|
||||||
|
if (is_file($currentdir.'/'.$file.'.html')) { $img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES); }
|
||||||
|
|
||||||
$files[] = array (
|
$files[] = array (
|
||||||
"name" => $file,
|
"name" => $file,
|
||||||
"date" => filemtime($currentdir . "/" . $file),
|
"date" => filemtime($currentdir . "/" . $file),
|
||||||
"size" => filesize($currentdir . "/" . $file),
|
"size" => filesize($currentdir . "/" . $file),
|
||||||
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title='$img_captions[$file]'><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&size=$thumb_size' alt='$label_loading' /></a></li>");
|
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title='".$img_captions[$file]."'><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&size=$thumb_size' alt='$label_loading' /></a></li>");
|
||||||
}
|
}
|
||||||
// Other filetypes
|
// Other filetypes
|
||||||
$extension = "";
|
$extension = "";
|
||||||
|
@ -238,7 +260,7 @@ if (file_exists($currentdir ."/captions.txt"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
} else die("ERROR: Could not open $currentdir for reading!");
|
} else die("ERROR: Could not open ".htmlspecialchars(stripslashes($currentdir))." for reading!");
|
||||||
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// SORT FILES AND FOLDERS
|
// SORT FILES AND FOLDERS
|
||||||
|
@ -270,6 +292,7 @@ if (sizeof($files) > 0)
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// OFFSET DETERMINATION
|
// OFFSET DETERMINATION
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
if (!isset($_GET["page"])) $_GET["page"] = 1;
|
||||||
$offset_start = ($_GET["page"] * $thumbs_pr_page) - $thumbs_pr_page;
|
$offset_start = ($_GET["page"] * $thumbs_pr_page) - $thumbs_pr_page;
|
||||||
if (!isset($_GET["page"])) $offset_start = 0;
|
if (!isset($_GET["page"])) $offset_start = 0;
|
||||||
$offset_end = $offset_start + $thumbs_pr_page;
|
$offset_end = $offset_start + $thumbs_pr_page;
|
||||||
|
@ -284,7 +307,6 @@ if (sizeof($files) > 0)
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// PAGE NAVIGATION
|
// PAGE NAVIGATION
|
||||||
//-----------------------
|
//-----------------------
|
||||||
if (!isset($_GET["page"])) $_GET["page"] = 1;
|
|
||||||
if (sizeof($dirs) + sizeof($files) > $thumbs_pr_page)
|
if (sizeof($dirs) + sizeof($files) > $thumbs_pr_page)
|
||||||
{
|
{
|
||||||
$page_navigation .= "$label_page ";
|
$page_navigation .= "$label_page ";
|
||||||
|
@ -293,18 +315,18 @@ if (sizeof($dirs) + sizeof($files) > $thumbs_pr_page)
|
||||||
if ($_GET["page"] == $i)
|
if ($_GET["page"] == $i)
|
||||||
$page_navigation .= "$i";
|
$page_navigation .= "$i";
|
||||||
else
|
else
|
||||||
$page_navigation .= "<a href='?dir=" . $_GET["dir"] . "&page=" . ($i) . "'>" . $i . "</a>";
|
$page_navigation .= "<a href='?dir=" . $requestedDir . "&page=" . ($i) . "'>" . $i . "</a>";
|
||||||
if ($i != ceil((sizeof($files) + sizeof($dirs)) / $thumbs_pr_page)) $page_navigation .= " | ";
|
if ($i != ceil((sizeof($files) + sizeof($dirs)) / $thumbs_pr_page)) $page_navigation .= " | ";
|
||||||
}
|
}
|
||||||
//Insert link to view all images
|
//Insert link to view all images
|
||||||
if ($_GET["page"] == "all") $page_navigation .= " | $label_all";
|
if ($_GET["page"] == "all") $page_navigation .= " | $label_all";
|
||||||
else $page_navigation .= " | <a href='?dir=" . $_GET["dir"] . "&page=all'>$label_all</a>";
|
else $page_navigation .= " | <a href='?dir=" . $requestedDir . "&page=all'>$label_all</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
// BREADCRUMB NAVIGATION
|
// BREADCRUMB NAVIGATION
|
||||||
//-----------------------
|
//-----------------------
|
||||||
if ($_GET['dir'] != "")
|
if ($requestedDir != "")
|
||||||
{
|
{
|
||||||
$breadcrumb_navigation .= "<a href='?dir='>" . $label_home . "</a> > ";
|
$breadcrumb_navigation .= "<a href='?dir='>" . $label_home . "</a> > ";
|
||||||
$navitems = explode("/", $_REQUEST['dir']);
|
$navitems = explode("/", $_REQUEST['dir']);
|
||||||
|
@ -357,6 +379,7 @@ for ($i = $offset_start - sizeof($dirs); $i < $offset_end && $offset_current < $
|
||||||
}
|
}
|
||||||
|
|
||||||
//Include hidden links for all images AFTER current page so lightbox is able to browse images on different pages
|
//Include hidden links for all images AFTER current page so lightbox is able to browse images on different pages
|
||||||
|
if ($i<0) $i=1;
|
||||||
for ($y = $i; $y < sizeof($files); $y++)
|
for ($y = $i; $y < sizeof($files); $y++)
|
||||||
{
|
{
|
||||||
$page_navigation .= "<a href='" . $currentdir . "/" . $files[$y]["name"] . "' rel='lightbox[billeder]' class='hidden' title='" . $img_captions[$files[$y]["name"]] . "'></a>";
|
$page_navigation .= "<a href='" . $currentdir . "/" . $files[$y]["name"] . "' rel='lightbox[billeder]' class='hidden' title='" . $img_captions[$files[$y]["name"]] . "'></a>";
|
||||||
|
@ -369,12 +392,20 @@ if ($messages != "") {
|
||||||
$messages = "<div id=\"topbar\">" . $messages . " <a href=\"#\" onclick=\"document.getElementById('topbar').style.display = 'none';\";><img src=\"images/close.png\" /></a></div>";
|
$messages = "<div id=\"topbar\">" . $messages . " <a href=\"#\" onclick=\"document.getElementById('topbar').style.display = 'none';\";><img src=\"images/close.png\" /></a></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read folder comment.
|
||||||
|
$comment_filepath = $currentdir . $file . "/comment.html";
|
||||||
|
if (file_exists($comment_filepath))
|
||||||
|
{
|
||||||
|
$fd = fopen($comment_filepath, "r");
|
||||||
|
$comment = utf8_encode(fread($fd,filesize ($comment_filepath))); // utf8_encode to convert from iso-8859 to UTF-8
|
||||||
|
fclose($fd);
|
||||||
|
}
|
||||||
//PROCESS TEMPLATE FILE
|
//PROCESS TEMPLATE FILE
|
||||||
if(GALLERY_ROOT != "") $templatefile = GALLERY_ROOT . "templates/integrate.html";
|
if(GALLERY_ROOT != "") $templatefile = GALLERY_ROOT . "templates/integrate.html";
|
||||||
else $templatefile = "templates/" . $templatefile . ".html";
|
else $templatefile = "templates/" . $templatefile . ".html";
|
||||||
if(!$fd = fopen($templatefile, "r"))
|
if(!$fd = fopen($templatefile, "r"))
|
||||||
{
|
{
|
||||||
echo "Template $templatefile not found!";
|
echo "Template ".htmlspecialchars(stripslashes($templatefile))." not found!";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -390,6 +421,7 @@ $messages = "<div id=\"topbar\">" . $messages . " <a href=\"#\" onclick=\"docume
|
||||||
$template = preg_replace("/<% thumbnails %>/", "$thumbnails", $template);
|
$template = preg_replace("/<% thumbnails %>/", "$thumbnails", $template);
|
||||||
$template = preg_replace("/<% breadcrumb_navigation %>/", "$breadcrumb_navigation", $template);
|
$template = preg_replace("/<% breadcrumb_navigation %>/", "$breadcrumb_navigation", $template);
|
||||||
$template = preg_replace("/<% page_navigation %>/", "$page_navigation", $template);
|
$template = preg_replace("/<% page_navigation %>/", "$page_navigation", $template);
|
||||||
|
$template = preg_replace("/<% folder_comment %>/", "$comment", $template);
|
||||||
$template = preg_replace("/<% bgcolor %>/", "$backgroundcolor", $template);
|
$template = preg_replace("/<% bgcolor %>/", "$backgroundcolor", $template);
|
||||||
$template = preg_replace("/<% gallery_width %>/", "$gallery_width", $template);
|
$template = preg_replace("/<% gallery_width %>/", "$gallery_width", $template);
|
||||||
$template = preg_replace("/<% version %>/", "$version", $template);
|
$template = preg_replace("/<% version %>/", "$version", $template);
|
||||||
|
|
202
templates/darkgold2.html
Normal file
202
templates/darkgold2.html
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title><% title %></title>
|
||||||
|
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxAdvBlack21.css" type="text/css" media="screen" />
|
||||||
|
<link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss/" /><link>
|
||||||
|
<script src="<% gallery_root %>js/mootools.js" type="text/javascript"></script>
|
||||||
|
<script src="<% gallery_root %>js/mediaboxAdv-1.3.4b.js" type="text/javascript"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
width: <% gallery_width %>;
|
||||||
|
font: 12px Tahoma,Verdana,Arial,Helvetica, sans-serif;
|
||||||
|
background: #272727;
|
||||||
|
color: #BDBDBD;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font: normal 250%/100% "Trebuchet MS",Tahoma,Verdana,Arial,Helvetica, sans-serif;
|
||||||
|
margin: 20px 0 5px 0;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
color: #FFCC11;
|
||||||
|
text-shadow: #000000 2px 2px 2px;
|
||||||
|
}
|
||||||
|
.credits {
|
||||||
|
border-bottom: solid 1px #434343;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
color: #CF8D26;
|
||||||
|
font: 100% "Trebuchet MS",Tahoma,Verdana,Arial,Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
.credits em {
|
||||||
|
color: #BDBDBD;
|
||||||
|
font-style: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
.backlink a {
|
||||||
|
font-size: 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.backlink a:hover,
|
||||||
|
.backlink a:visited:hover {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
#page_nav {
|
||||||
|
color: #BDBDBD;
|
||||||
|
clear:both;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#page_nav a:link, #page_nav a:visited, #page_nav a:hover, #page_nav a:visited:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #FFCC11;
|
||||||
|
}
|
||||||
|
#breadcrumb_nav {
|
||||||
|
color: #BDBDBD;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
#breadcrumb_nav a:link, #breadcrumb_nav a:visited, #breadcrumb_nav a:hover, #breadcrumb_nav a:visited:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #FFCC11;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #FFCC11;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
overflow: auto;
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
.hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
position:absolute;
|
||||||
|
top:0;
|
||||||
|
left:0;
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
#topbar {
|
||||||
|
border-bottom-color: #afafaf;
|
||||||
|
border-style: none;
|
||||||
|
color: black;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding-top: 5px;
|
||||||
|
float: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 25px;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #FFFF99;
|
||||||
|
border-bottom: 1px solid;
|
||||||
|
}
|
||||||
|
#topbar a:link, #topbar a:visited, #topbar a:hover, #topbar a:visited:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
#topbar img{
|
||||||
|
position: absolute;
|
||||||
|
right: 6;
|
||||||
|
top: 6;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#folder_comment
|
||||||
|
{
|
||||||
|
margin-bottom:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#folder_comment a {
|
||||||
|
color: #FFCC11;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* ---------- gallery styles start here ----------------------- */
|
||||||
|
.gallery {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.gallery li {
|
||||||
|
padding: 1px;
|
||||||
|
margin: 0;
|
||||||
|
float: left;
|
||||||
|
position: relative;
|
||||||
|
width: 320px;
|
||||||
|
height: 240px;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
.gallery li:hover img {
|
||||||
|
background: #ddd;
|
||||||
|
filter: alpha(opacity=70);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
|
||||||
|
-moz-opacity: 0.70;
|
||||||
|
opacity:0.7;
|
||||||
|
}
|
||||||
|
.gallery img {
|
||||||
|
background: #000;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.gallery em {
|
||||||
|
background: #000;
|
||||||
|
color: #FFCC11;
|
||||||
|
font-family: "Trebuchet MS",Tahoma,Verdana,Arial,Helvetica, sans-serif;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 8px 2px;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
/* top: 90px; */
|
||||||
|
bottom:20px;
|
||||||
|
left: 0px;
|
||||||
|
width: 320px;
|
||||||
|
/* height: 40px; */
|
||||||
|
filter: alpha(opacity=60);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=60);
|
||||||
|
-moz-opacity: 0.60;
|
||||||
|
opacity:0.6;
|
||||||
|
}
|
||||||
|
.gallery em-pdf {
|
||||||
|
color: #666;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 10px;
|
||||||
|
padding: 3px 7px;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 100px;
|
||||||
|
left: 0px;
|
||||||
|
}
|
||||||
|
.gallery a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.gallery a:hover em {
|
||||||
|
background: grey;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1><% title %></h1>
|
||||||
|
<% messages %>
|
||||||
|
<p class="credits"><!--em>by: </em><% author %--></p>
|
||||||
|
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
||||||
|
<br /><br />
|
||||||
|
<div id="container">
|
||||||
|
<div id="folder_comment"><% folder_comment %></div>
|
||||||
|
<ul class="gallery">
|
||||||
|
<% thumbnails %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div id="page_nav"><% page_navigation %></div>
|
||||||
|
<br />
|
||||||
|
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
||||||
|
<div class="backlink" align="center"><a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
||||||
|
<br /><br />
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -98,6 +98,10 @@ a {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#folder_comment
|
||||||
|
{
|
||||||
|
margin-bottom:10px;
|
||||||
|
}
|
||||||
/* ---------- gallery styles start here ----------------------- */
|
/* ---------- gallery styles start here ----------------------- */
|
||||||
.gallery {
|
.gallery {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@ -167,6 +171,7 @@ a {
|
||||||
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
<div id="folder_comment"><% folder_comment %></div>
|
||||||
<ul class="gallery">
|
<ul class="gallery">
|
||||||
<% thumbnails %>
|
<% thumbnails %>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -175,7 +180,7 @@ a {
|
||||||
<div id="page_nav"><% page_navigation %></div>
|
<div id="page_nav"><% page_navigation %></div>
|
||||||
<br />
|
<br />
|
||||||
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
||||||
<div class="backlink" align="center"><a href="http://www.minigal.dk" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
<div class="backlink" align="center"><a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -70,6 +70,12 @@ a {
|
||||||
display:inline;
|
display:inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#folder_comment
|
||||||
|
{
|
||||||
|
margin-top:10px;
|
||||||
|
margin-left:10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------- gallery styles start here ----------------------- */
|
/* ---------- gallery styles start here ----------------------- */
|
||||||
.gallery {
|
.gallery {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@ -135,6 +141,7 @@ a {
|
||||||
<p class="credits"><em>by:</em> <% author %></p>
|
<p class="credits"><em>by:</em> <% author %></p>
|
||||||
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
<div id="folder_comment"><% folder_comment %></div>
|
||||||
<ul class="gallery">
|
<ul class="gallery">
|
||||||
<% thumbnails %>
|
<% thumbnails %>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -143,7 +150,7 @@ a {
|
||||||
<div id="page_nav"><% page_navigation %></div>
|
<div id="page_nav"><% page_navigation %></div>
|
||||||
<br />
|
<br />
|
||||||
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
||||||
<div class="backlink" align="center"><a href="http://www.minigal.dk" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
<div class="backlink" align="center"><a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -96,6 +96,12 @@ a {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#folder_comment
|
||||||
|
{
|
||||||
|
margin-top:10px;
|
||||||
|
margin-left:10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------- gallery styles start here ----------------------- */
|
/* ---------- gallery styles start here ----------------------- */
|
||||||
.gallery {
|
.gallery {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@ -152,6 +158,7 @@ a {
|
||||||
<p class="credits"><em>by: </em><% author %></p>
|
<p class="credits"><em>by: </em><% author %></p>
|
||||||
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
<div id="folder_comment"><% folder_comment %></div>
|
||||||
<ul class="gallery">
|
<ul class="gallery">
|
||||||
<% thumbnails %>
|
<% thumbnails %>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -161,7 +168,7 @@ a {
|
||||||
<br />
|
<br />
|
||||||
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
|
||||||
<hr id="bottom" />
|
<hr id="bottom" />
|
||||||
<div class="backlink" align="center"><a href="http://www.minigal.dk" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
<div class="backlink" align="center"><a href="https://github.com/sebsauvage/MinigalNano" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue