This commit is contained in:
Tom Canac 2014-11-11 10:43:18 +01:00
parent 9d31ffd7c8
commit 17322c981c
2 changed files with 39 additions and 51 deletions

View file

@ -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 = "39"; //Number of thumbnails on a single page $thumbs_pr_page = "39"; // Number of thumbnails on a single page
$gallery_width = "80%"; //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 = "board"; //Template filename (must be placed in 'templates' folder) $templatefile = "board"; // Template filename (must be placed in 'templates' folder)
$title = "MiniGal Nano"; // Text to be displayed in browser titlebar $title = "MiniGal Nano"; // Text to be displayed in browser titlebar
$author = "John Doe"; $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
@ -27,22 +27,23 @@ $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]
$sortdir_folders = "ASC"; // Sort direction of folders: [ASC][DESC] $sortdir_folders = "ASC"; // Sort direction of folders: [ASC][DESC]
$sortdir_files = "ASC"; // Sort direction of files: [ASC][DESC] $sortdir_files = "ASC"; // Sort direction of files: [ASC][DESC]
$lazyload = 1; // 0 = pagination, 1 = display all pictures on one page $lazyload = 1; // 0 is pagination, 1 is display all pictures on one page
$SkipObjects = array('aFolder', 'IMG_1612.JPG'); //Those files and folders will not be displayed (affects the page and the RSS feed)
//LANGUAGE STRINGS //LANGUAGE STRINGS
$label_home = "Home"; //Name of home link in breadcrumb navigation $label_home = "Home"; // Name of home link in breadcrumb navigation
$label_new = "New"; //Text to display for new images. Use with $display_new variable $label_new = "New"; // Text to display for new images. Use with $display_new variable
$label_page = "Page"; //Text used for page navigation $label_page = "Page"; // Text used for page navigation
$label_all = "All"; //Text used for link to display all images in one page $label_all = "All"; // Text used for link to display all images in one page
$label_noimages = "No images"; //Empty folder text $label_noimages = "No images"; // Empty folder text
$label_loading = "Loading..."; //Thumbnail loading text $label_loading = "Loading..."; // Thumbnail loading text
//RSS SETTINGS //RSS SETTINGS
$description = "MiniGal Nano"; $description = "MiniGal Nano";
$nb_items_rss = 25; //number ef elements to display in the feed. If you add a lot of pictures at the time, consider increasing this number $nb_items_rss = 25; // Number of elements to display in the feed. If you add a lot of pictures at the time, consider increasing this number
$rss_refresh_interval = 60;//time, in seconds, between two RSS refresh. for example, 3600 = 1update max per hour, 86400 = 1/day. $rss_refresh_interval = 60;// Time, in seconds, between two RSS refresh. for example, 3600 = 1update max per hour, 86400 = 1/day.
$SkipExts = array('html', 'txt', 'php', "gitignore"); //Files with one of this extension will not be displayed on the RSS feed $SkipExts = array('html', 'txt', 'php', "gitignore"); //Files with one of this extension will not be displayed on the RSS feed
$SkipObjects = array('UnDossier', 'UnFichier'); //Those files and folders will not be displayed on the RSS feed
//ADVANCED SETTINGS //ADVANCED SETTINGS
$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! $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 = 40; //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

View file

@ -132,21 +132,6 @@ function checkpermissions($file) {
if (substr(decoct(fileperms($file)), -1, strlen(fileperms($file))) < 4 OR substr(decoct(fileperms($file)), -3,1) < 4) $messages = "At least one file or folder has wrong permissions. Learn how to <a href='http://minigal.dk/faq-reader/items/how-do-i-change-file-permissions-chmod.html' target='_blank'>set file permissions</a>"; if (substr(decoct(fileperms($file)), -1, strlen(fileperms($file))) < 4 OR substr(decoct(fileperms($file)), -3,1) < 4) $messages = "At least one file or folder has wrong permissions. Learn how to <a href='http://minigal.dk/faq-reader/items/how-do-i-change-file-permissions-chmod.html' target='_blank'>set file permissions</a>";
} }
//-----------------------
// CHECK FOR NEW VERSION
//-----------------------
// New version check disabled because original author does not update it software anymore.
/*
if (ini_get('allow_url_fopen') == "1") {
$file = @fopen ("http://www.minigal.dk/minigalnano_version.php", "r");
$server_version = fgets ($file, 1024);
if (strlen($server_version) == 5 ) { //If string retrieved is exactly 5 chars then continue
if (version_compare($server_version, $version, '>')) $messages = "MiniGal Nano $server_version is available! <a href='http://www.minigal.dk/minigal-nano.html' target='_blank'>Get it now</a>";
}
fclose($file);
}
*/
if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", ""); if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", "");
$requestedDir = ''; $requestedDir = '';
if (!empty($_GET['dir'])) $requestedDir = $_GET['dir']; if (!empty($_GET['dir'])) $requestedDir = $_GET['dir'];
@ -167,9 +152,9 @@ $files = array();
$dirs = array(); $dirs = array();
if (is_directory($currentdir) && $handle = opendir($currentdir)) if (is_directory($currentdir) && $handle = opendir($currentdir))
{ {
while (false !== ($file = readdir($handle))) while (false !== ($file = readdir($handle)) && !in_array($file, $SkipObjects))
{ {
// 1. LOAD FOLDERS // 1. LOAD FOLDERS
if (is_directory($currentdir . "/" . $file)) if (is_directory($currentdir . "/" . $file))
{ {
if ($file != "." && $file != ".." ) if ($file != "." && $file != ".." )
@ -248,28 +233,28 @@ $dirs = array();
} }
} }
// 2. LOAD CAPTIONS // 2. LOAD CAPTIONS
$img_captions['']=''; $img_captions['']='';
if (file_exists($currentdir ."/captions.txt")) if (file_exists($currentdir ."/captions.txt"))
{
$file_handle = fopen($currentdir ."/captions.txt", "rb");
while (!feof($file_handle) )
{
$line_of_text = fgets($file_handle);
if (empty($line_of_text)) {
continue;
}
$parts = explode('/n', $line_of_text);
foreach($parts as $img_capts)
{ {
list($img_filename, $img_caption) = explode('|', $img_capts); $file_handle = fopen($currentdir ."/captions.txt", "rb");
$img_captions[$img_filename] = $img_caption; while (!feof($file_handle) )
{
$line_of_text = fgets($file_handle);
if (empty($line_of_text)) {
continue;
}
$parts = explode('/n', $line_of_text);
foreach($parts as $img_capts)
{
list($img_filename, $img_caption) = explode('|', $img_capts);
$img_captions[$img_filename] = $img_caption;
}
}
fclose($file_handle);
} }
}
fclose($file_handle);
}
// 3. LOAD FILES // 3. LOAD FILES
if ($file != "." && $file != ".." && $file != "folder.jpg") if ($file != "." && $file != ".." && $file != "folder.jpg")
{ {
if($display_filename) { if($display_filename) {
@ -301,7 +286,9 @@ if (file_exists($currentdir ."/captions.txt"))
// If file is not provided, image filename will be used instead. // If file is not provided, image filename will be used instead.
checkpermissions($currentdir . "/" . $file); checkpermissions($currentdir . "/" . $file);
if (is_file($currentdir.'/'.$file.'.html')) { $img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES); } if (is_file($currentdir.'/'.$file.'.html')) {
$img_captions[$file] = $file.'::'.htmlspecialchars(file_get_contents($currentdir.'/'.$file.'.html'),ENT_QUOTES);
}
if ($lazyload) { if ($lazyload) {
$linkUrl = urlencode("$currentdir/$file"); $linkUrl = urlencode("$currentdir/$file");
$imgParams = http_build_query( $imgParams = http_build_query(