"; print "\n"; print "\n"; print "\n"; if ($mode == "album" or $mode == "view" or $mode=="edit" or $mode == "save") { print "PayneCentral Photo Galley: $album\n"; } else { print "PayneCentral Photo Galery: List of Albums\n"; } print "\n"; print "\n"; print "

 

"; print "

\n"; //print "
"; print "
"; print ""; preg_match("/(.*\/).*$/",$app_path,$matches); $virbase = $matches[1] . $vir_base; $realbase = $pix_base; $dynbase = $matches[1] . $dyn_base; //print "realbase: $realbase
"; //print "dynbase: $dynbase"; $imgbase = dirname($PHP_SELF); ($imgbase == '/') and $imgbase = ''; $fullalbumdir = "$realbase/$album"; print "\n"; if (file_exists ($fullalbumdir . "/" . $album_text)){ $text_width = ($thumb_size + 40)*$display_cols; print "\n"; } set_time_limit(0); $handle=opendir($fullalbumdir); $colcounter = 0; while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file) and !preg_match("/__scaled_/",$file) ) { $filelist[] = $file; } } rewinddir($handle); while (($file = readdir($handle)) != '') { if (is_dir($realbase . "/$album/" . $file) and $file != "." and $file != ".." and substr($file, 0, 4) != "old_" and $file != "bad" and substr($file, 0, 1) != "_" and $file != "_vti_cnf" and $file != "thumbnails" and $file != "html" ) { $dirlist[] = $file; } } is_array($dirlist) and sort($dirlist); is_array($filelist) and sort($filelist); $totalfiles = sizeof($filelist); print ""; if ($start == 0){ for ($i = 0 ; $i < sizeof($dirlist) ; $i++) { $dirname = $dirlist[$i]; if ($colcounter == $display_cols) { print "\n"; $colcounter = 0; } if ( (file_exists($fullalbumdir . "/" . $dirname . "/index.htm" )) or (file_exists($fullalbumdir . "/" . $dirname . "/index.html" )) or (file_exists($fullalbumdir . "/" . $dirname . "/default.htm" )) ) { // print "\n"; $colcounter++; } } for ($x = $start ; $x < ($start+$items_per_page - $i ) and $filelist[$x] ; $x++) { $file = $filelist[$x]; if ($colcounter == $display_cols) { print "\n"; $colcounter = 0; } if (is_dir($realbase . "/$album/" . $file)) { { print "\n"; $colcounter++; } else if (preg_match("/.*\.jpg/i",$file)) { $sourcefile = "$realbase/$album/$file"; preg_match("/(.*)\.jpg/i",$file,$parts); $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; checkDir("$dynbase/$album"); #if (!file_exists("$dynbase/$album")) { #mkdir("$dynbase/$album",0755); #} #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); $this_title = ""; $title_filename = $fullalbumdir . "/" . $parts[1] . ".txt"; if (file_exists ($title_filename)){ $fd = fopen ($title_filename, "r"); $contents = fread ($fd, filesize ($title_filename)); fclose ($fd); $this_title= "title=\"" . $contents . "\""; } print "\n"; $colcounter++; } } for ($i = 0 ; $i < ($display_cols - $colcounter) ; $i++) { print "\n"; } print "\n"; print "
"; if ($dispsize == '') $dispsize = $default_size; if ($start == '') $start = 0; if (preg_match("/\.\./",$pic) or preg_match("/\.\./",$album)) { print "Please refrain from trying to access unauthorized files in this manner.
"; print "Have a nice day."; } else if ($mode == 'home' or $mode == '') { print "

Albums:

\n"; $handle=opendir($pix_base); while (($file = readdir($handle)) != '') { if ($file != "." && $file != "..") { $alblist[] = $file; } } is_array($alblist) and sort($alblist); for ($i = 0 ; $i < sizeof($alblist) ; $i++) { print " "; print "$alblist[$i]\n"; print " 
\n"; } print " 
\n"; closedir($handle); ## Album View (Thumbnails) } else if ($mode == 'album') { NavBar("album",$album,$start); print "
" ; print " "; print "


"; include $fullalbumdir . "/" . $album_text; print "

 "; print " "; } else { print "
 "; } print "$dirname\n"; print " 


"; } print " $file\n"; print ""; print "
$file\n"; print "
"; } else if ($mode == 'view') { $handle=opendir("$pix_base/$album"); while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file) and !preg_match("/__scaled_/",$file) ) { $filelist[] = $file; } } sort($filelist); $picindex = -1; for($i=0 ; $i\n"; clearstatcache(); $sourcefile = "$realbase/$album/$pic"; $virsource = "$virbase/$album/$pic"; $dlinksize = $dispsize; $srcsize = GetImageSize("$sourcefile"); if ($dispsize >= $srcsize[1]) { $dispsize = "Original"; } if ($dispsize == 'Original') { $viewfile = $virsource; $viewpic = $pic; $imgsrc = preg_replace('/ /',"%20","/$vir_base/$album/$viewpic"); } else { preg_match("/(.*)\.jpg/i",$pic,$parts); $viewpic = "$parts[1]__scaled_$dispsize.jpg"; $viewfile = "$dynbase/$album/$viewpic"; $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$viewpic"); } #if (!file_exists($viewfile)) { createImage($dispsize,$sourcefile,$viewfile); #} $viewsize = GetImageSize("$viewfile"); print ""; print "
"; // print "
"; print "Start | "; if ($start > 0) { print "Prev $items_per_page | "; } else { print "Prev $items_per_page | "; } if ($totalfiles > $x) { print "Next $items_per_page | "; } else { print "Next $items_per_page | "; } print ""; if ($totalfiles > 0) { print "Images " . ($start+1) . " to $x of $totalfiles
\n"; } else { print " "; } print "
"; print ""; $title_filename = $fullalbumdir . "/" . $parts[1] . ".txt"; if (file_exists ($title_filename)){ $fd = fopen ($title_filename, "r"); $contents = fread ($fd, filesize ($title_filename)); fclose ($fd); print "
" . $contents; } print "
\n"; #if ($show_exif) { #$exif = read_exif_data($sourcefile); #while(list($k,$v)=each($exif)) { #echo "$k: $v
\n"; #} #} } if ($mode == 'save') { print "\n"; print "\n"; print " Return to Album"; } if ($mode == 'edit') { print ""; NavBar("album",$album,$start); print "\n"; $text_width = ($thumb_size + 40)*$display_cols; print "\n"; print ""; set_time_limit(0); $handle=opendir($fullalbumdir); $colcounter = 0; while (($file = readdir($handle)) != '') { if (preg_match("/.*\.jpg/i",$file) and !preg_match("/__scaled_/",$file) ) { $filelist[] = $file; } } rewinddir($handle); while (($file = readdir($handle)) != '') { if (is_dir($realbase . "/$album/" . $file) and $file != "." and $file != ".." and substr($file, 0, 4) != "old_" and $file != "bad" and $file != "_vti_cnf" and $file != "thumbnails" and $file != "html" ) { $dirlist[] = $file; } } is_array($dirlist) and sort($dirlist); is_array($filelist) and sort($filelist); $totalfiles = sizeof($filelist); print ""; for ($x = 0 ; $x < $totalfiles; $x++) { $file = $filelist[$x]; print ""; if (preg_match("/.*\.jpg/i",$file)) { $sourcefile = "$realbase/$album/$file"; preg_match("/(.*)\.jpg/i",$file,$parts); $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; checkDir("$dynbase/$album"); } $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); print ""; $this_title = ""; $title_filename = $fullalbumdir . "/" . $parts[1] . ".txt"; if (file_exists ($title_filename)){ $fd = fopen ($title_filename, "r"); $contents = stripslashes(fread ($fd, filesize ($title_filename))); fclose ($fd); $this_title= $contents ; } print ""; print "\n"; } print ""; } print "
\n"; // print "
\n"; } print "\n"; print "\n"; print ""; ############ print "\n"; } $totalfiles = sizeof($filelist); #print "Charcoal\n"; #print " | Paint\n"; #print " | Shade\n"; #print "
\n"; print "
\n"; if ($filelist[($picindex-1)] != '') { $prevfile = $filelist[($picindex-1)]; $sourcefile = "$realbase/$album/$prevfile"; preg_match("/(.*)\.jpg/i",$prevfile,$parts); checkDir("$dynbase/$album"); #if (!file_exists("$dynbase/$album")) { #mkdir("$dynbase/$album",0755); #} $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); print ""; print "<-Prev
"; } else { print "
"; #print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print ""; print "
(Original Photo Size = $srcsize[0]x$srcsize[1])
\n"; // print "

edit caption
"; // print "

edit caption
"; #print "
\n"; if ($filelist[($picindex+1)] != '') { $nextfile = $filelist[($picindex+1)]; $sourcefile = "$realbase/$album/$nextfile"; preg_match("/(.*)\.jpg/i",$nextfile,$parts); checkDir("$dynbase/$album"); #if (!file_exists("$dynbase/$album")) { #mkdir("$dynbase/$album",0755); #} $thumbpic = "$parts[1]__scaled_$thumb_size.jpg"; $thumbfile = "$dynbase/$album/$thumbpic"; #if (!file_exists("$thumbfile")) { createImage($thumb_size,$sourcefile,$thumbfile,$thumb_border); #} $thumbsize = GetImageSize($thumbfile); $imgsrc = preg_replace('/ /',"%20","/$dyn_base/$album/$thumbpic"); print ""; print "Next ->
"; print "
"; } else { print "
" ; print " "; print "directory: "; print $fullalbumdir . "
"; print "files: "; print $totalfiles; print "

"; if (strlen($album_desc) > 0) { $album_desc = stripslashes($album_desc); $file = $fullalbumdir . "/info.txt"; $fp = fopen($file, "w"); fwrite($fp, $album_desc); print $file . " => " . $album_desc . " SAVED
" ; fclose($fp); } for ($x = 0 ; $x < $totalfiles; $x++) { $T = "\$T" . $x; $F = "\$F" . $x; eval ("\$T = \"$T\";"); eval ("\$F = \"$F\";"); if (strlen ($T) > 0 ){ $file = $fullalbumdir . "/" . $F; $fp = fopen($file, "w"); $T = stripslashes($T); fwrite($fp, $T); print $file . " => " . $T . " SAVED
" ; fclose($fp); } } print "
" ; print " "; print "

"; // get contents of a file into a string // $filename = $fullalbumdir . "/" . $album_text; // $fd = fopen ($filename, "r"); // $contents = fread ($fd, filesize ($filename)); // fclose ($fd); print "Album description (HTML is OK)
"; print ""; print "

" ; print "\n"; print ""; print ""; print "$file"; print ""; print ""; print ""; print "
\n"; print "Generated by a variation of PHPix $version"; print "\n"; print "\n"; print "\n"; ?>