diff --git a/config.php b/config.php index d10c1ce..926e926 100755 --- a/config.php +++ b/config.php @@ -16,10 +16,10 @@ Please enjoy this free script! */ // EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY -$thumbs_pr_page = "39"; //Number of thumbnails on a single page -$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" -$templatefile = "board"; //Template filename (must be placed in 'templates' folder) +$thumbs_pr_page = "39"; // Number of thumbnails on a single page +$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" +$templatefile = "board"; // Template filename (must be placed in 'templates' folder) $title = "MiniGal Nano"; // Text to be displayed in browser titlebar $author = "John Doe"; $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] $sortdir_folders = "ASC"; // Sort direction of folders: [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 -$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_page = "Page"; //Text used for page navigation -$label_all = "All"; //Text used for link to display all images in one page -$label_noimages = "No images"; //Empty folder text -$label_loading = "Loading..."; //Thumbnail loading text +$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_page = "Page"; // Text used for page navigation +$label_all = "All"; // Text used for link to display all images in one page +$label_noimages = "No images"; // Empty folder text +$label_loading = "Loading..."; // Thumbnail loading text //RSS SETTINGS $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 -$rss_refresh_interval = 60;//time, in seconds, between two RSS refresh. for example, 3600 = 1update max per hour, 86400 = 1/day. +$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. $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 $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 diff --git a/index.php b/index.php index b7e3d22..317c383 100644 --- a/index.php +++ b/index.php @@ -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 set file permissions"; } -//----------------------- -// 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! Get it now"; - } - fclose($file); -} -*/ - if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", ""); $requestedDir = ''; if (!empty($_GET['dir'])) $requestedDir = $_GET['dir']; @@ -167,9 +152,9 @@ $files = array(); $dirs = array(); 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 ($file != "." && $file != ".." ) @@ -248,28 +233,28 @@ $dirs = array(); } } -// 2. LOAD CAPTIONS -$img_captions['']=''; -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) + // 2. LOAD CAPTIONS + $img_captions['']=''; + if (file_exists($currentdir ."/captions.txt")) { - list($img_filename, $img_caption) = explode('|', $img_capts); - $img_captions[$img_filename] = $img_caption; + $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); + $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($display_filename) { @@ -301,7 +286,9 @@ if (file_exists($currentdir ."/captions.txt")) // If file is not provided, image filename will be used instead. 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) { $linkUrl = urlencode("$currentdir/$file"); $imgParams = http_build_query(