$val) {
$cmd = "";
$cmd = preg_replace('/^.*-(long|brief)$/', '1', $key);
if (($cmd == "long") || ($cmd == "brief")) {
$key = preg_replace('/.jpg-(long|brief)$/', '.txt', $key);
$val = trim($val); // REmove blank spaces at end of string
if ($val) {
$new_data[$key][$cmd] = $val;
}
}
}
$dir = GALLERY_ROOT . "/" . get_var('dir');
// Go thru each image and save comments to file.
foreach ($new_data as $key => $val) {
$handle = fopen("$dir/$key", "w");
if ($handle) {
if (fwrite($handle, $new_data[$key]['brief'] . "\n") == FALSE) {
print "Failed to write to file: $dir/$key
";
} else if (fwrite($handle, $new_data[$key]['long'] . "\n") == FALSE) {
print "Failed to write to file: $dir/$key
";
}
} else {
print "Failed to open file: $dir/$key
";
}
}
}
?>
Welcome to the gallery page.
"; } $title = @file("$path/title.txt"); if (!$title) { $title[0] = preg_replace("|^.*/([^/]*)$|", "$1", $dir); } # Remove the leading "./" in the directory variable $dir = preg_replace("|^./|", "", $dir); # Space out the "/" in the directory variable for cosmetic purposes $title_dir = preg_replace("|/|", " :: ", $dir); if ($dir != ".") { $title_dir = "gallery :: $title_dir"; } $title_dir_arr = preg_split("/ :: /", $title_dir); $num = count($title_dir_arr); $i = 0; $url = "/gallery.php?comment=$comment&dir=."; while ($i < $num-1) { if ($i > 0) { $url = "$url%2F" . urlencode($title_dir_arr[$i]); } $title_dir_arr[$i] = "$title_dir_arr[$i]"; $i++; } $title_dir = implode(" $arrow_img ", $title_dir_arr); # Only display the title dir path if we are not at the root if ($dir != ".") { print "$title_dir
";
}
} // FOREACH
print "There was an error displaying the gallery. Please contact Ray Hodel. "; print "This is anot a directory: $path
; exit; } // IF IS_DIR Display_Thumbs($path, $dir, $comment); ############################################ ################ Display_Thumbs ############################################ ## Purpose ## ## function Display_Thumbs($path, $dir, $comment) { global $domain; $owners = get_owners($dir); $i = 0; $columns = 6; $align = 'center'; if ($comment == 'yes') { $columns = 1; $align = 'left'; } $file_array = array(); if (@is_dir($path)) { if ($dh = @opendir($path)) { while (($file = @readdir($dh)) !== false) { if (($file[0] != ".") && (!is_dir("$path/$file"))) { $file_array[] = $file; } } if (count($file_array)) { sort($file_array); } if (count($file_array) > 0) { $file_array = preg_grep("/\.gif$/", $file_array); sort($file_array); if ($comment == 'yes') { print ""; } } // IF COUNT } // IF $DH } else { print "There was an error displaying the gallery. Please contact Ray Hodel. "; print "This is anot a directory: $path
"; exit; } // IF IS_DIR } ############################################ ################ Display_Image ############################################ ## Purpose ## ## function Display_Image($image, $dir) { $arrow_img = "
";
# Space out the "/" in the directory variable for cosmetic purposes
$title_dir = preg_replace("|/|", " :: ", $dir);
$title_dir_arr = preg_split("/ :: /", $title_dir);
$num = count($title_dir_arr);
$i = 0;
$url = "http://www.hodel.com/gallery.php?dir=.";
while ($i < $num) {
if ($i > 0) {
$url = "$url%2F" . urlencode($title_dir_arr[$i]);
}
$title_dir_arr[$i] = "$title_dir_arr[$i]";
$i++;
}
$title_dir = implode(" $little_arrow ", $title_dir_arr);
$image_fn = preg_replace("|^.*/([^/]*)$|", "$1", $image);
if ($dir != ".") {
print "$title_dir $little_arrow $image_fn";
}
print "$title[0]
"; print "| $image |