ERROR: Something went wrong. Please click here to get back to the gallery home.

'; $album = $_GET['album']; $pic = $_GET['pic']; $nav = $_GET['nav']; $slide = $_GET['slide']; $delay = $_GET['delay']; if (!$delay) { $delay = '4'; } if ($allow_user_size == 'yes') { // Size variables - should be able to trim this code down $tiny_res['width']='320'; $tiny_res['text']='320x240'; $small_res['width']='640'; $small_res['text']='640x480'; $medium_res['width']='800'; $medium_res['text']='800x600'; $large_res['width']='1024'; $large_res['text']='1024x768'; session_start(); if($_POST['custsize']) { switch ($_POST['custsize']) { case 'tiny': $cust_size=$tiny_res['width']; $tiny_res['selected']='SELECTED'; break; case 'small': $cust_size=$small_res['width']; $small_res['selected']='SELECTED'; break; case 'medium': $cust_size=$medium_res['width']; $medium_res['selected']='SELECTED'; break; case 'large': $cust_size=$large_res['width']; $large_res['selected']='SELECTED'; break; default: $cust_size=''; } if(!$_SESSION['cust_size']) { session_register('cust_size'); } } if($cust_size) { $resampled_width=$cust_size; } switch ($resampled_width) { case $tiny_res['width']: $tiny_res['selected']='SELECTED'; break; case $small_res['width']: $small_res['selected']='SELECTED'; break; case $medium_res['width']: $medium_res['selected']='SELECTED'; break; case $large_res['width']: $large_res['selected']='SELECTED'; break; } // end size variables } class picKLE { function picKLEsetup($album,$pic,$nav,$gallery_title,$title,$version,$filename,$numcol,$resampled_width,$thumb_width,$dis_files,$theme,$background,$error,$allow_user_size,$slide,$delay,$convert_path,$allow_original,$allow_slideshow,$admin_name,$admin_email) { $this->album = trim(urldecode($album)); $this->pic = trim(urldecode($pic)); $this->nav = trim($nav); $this->gallery_title = $gallery_title; $this->admin_name = $admin_name; $this->admin_email = $admin_email; $this->title = $title; $this->version = $version; $this->filename = $filename; $this->numcol = $numcol; $this->resampled_width = $resampled_width; $this->thumb_width = $thumb_width; $this->dis_files = $dis_files; $this->theme = $theme; $this->error = $error; $this->path = getcwd(); $this->allow_user_size = $allow_user_size; $this->allow_original = $allow_original; $this->allow_slideshow = $allow_slideshow; $this->convert_path = $convert_path; $this->slide = $slide; $this->delay = $delay; } function picKLEheader() { include("./picKLE-includes/header.php"); echo '

' .$this->gallery_title. '

'; if (!$this->album){ } else { // we'll kill the script later this just stops us from printing shit we don't want at the top if (ereg("^/", $this->album) or ereg("^../", $this->album) or ereg("^./", $this->album) or eregi("/\.\./", $this->album) or ereg("//$", $this->album)) { } else { $split = explode('/', $this->album); echo 'Home / '; for ($i = 0; $i < count($split)-1; $i++) { echo '' .$split[$i]. ' /'; } if (ereg("^/", $this->pic) or ereg("^../", $this->pic) or ereg("^./", $this->pic) or eregi("/\.\./", $this->pic) or ereg("/$", $this->pic) or !eregi(".(jpg|png|gif|jpeg)$", $this->pic)) { } else { if (is_file("picKLE-albums/$this->album$this->pic") == '1') { echo ' ' .$this->pic. ''; } } } } echo '
'; } function DirAndFile() { if (!$this->pic) { } else { if (ereg("^/", $this->pic) or ereg("^../", $this->pic) or ereg("^./", $this->pic) or eregi("/\.\./", $this->pic) or ereg("/$", $this->pic) or !eregi(".(jpg|png|gif|jpeg)$", $this->pic)) { echo $this->error; die(); } if (!eregi("[0-9]$", $this->delay)) { echo $this->error; die(); } } $this->album_dir = './picKLE-albums'; if (!$this->album) { if (is_dir($this->album_dir) == '1') { chdir($this->album_dir); } else { echo $this->error; die(); } } // This checks for a trialing / at the end of the album name, it has to be there elseif (ereg("^/", $this->album) or ereg("^../", $this->album) or ereg("^./", $this->album) or eregi("/\.\./", $this->album) or ereg("//$", $this->album)) { echo $this->error; die(); } elseif (is_dir('' .$this->album_dir. '/' .$this->album. '') == '1') { chdir('' .$this->album_dir. '/' .$this->album. ''); } else { echo $this->error; die(); } $handle=opendir('.'); $i=0; $j=0; while ($file = readdir($handle)) { if (is_file($file) == '1' && eregi(".(jpg|png|gif|jpeg)$", $file)) { $get_files[$i] = array('sortby' => strtolower($file), 'real' => $file); $i++; } // Remove the video check when we add in the video feature elseif (is_dir($file) == '1' && $file <> '.' && $file <> '..' && $file <> 'video') { $get_dirs[$j] = array('sortby' => strtolower($file), 'real' => $file); $j++; } else { } } $this->get_files = $get_files; $this->get_dirs = $get_dirs; closedir($handle); // gets the count of the pic and the prev and next thumb sort($this->get_files); for ($i=0; $i < count($this->get_files); $i++) { if ($this->get_files[$i]['real'] == $this->pic) { $this->num = $i + 1; if ($i - 1 >= 0) { $this->prev = substr($this->get_files[$i - 1]['real'], 0, strrpos($this->get_files[$i - 1]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i - 1]['real'], strrpos($this->get_files[$i - 1]['real'], ".")); $this->prev_real = $this->get_files[$i - 1]['real']; } if ($i + 1 < count($this->get_files)) { $this->next = substr($this->get_files[$i + 1]['real'], 0, strrpos($this->get_files[$i + 1]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i + 1]['real'], strrpos($this->get_files[$i + 1]['real'], ".")); $this->next_real = $this->get_files[$i + 1]['real']; } $this->slide_start = $this->get_files[$i]; $this->slide_stop = $this->get_files[$i - 1]; } } } function GenerateFolders() { if (isset($this->get_dirs) and !$this->pic) { sort($this->get_dirs); echo ''; for ($i=0; $i < count($this->get_dirs); $i++) { // Check if directory is there for the cache $cache_path='' .$this->path. '/' .$this->dotdot. 'picKLE-cache/' .$this->album. '' .$this->get_dirs[$i]['real']. ''; $check_cache_path=is_dir("$cache_path"); // Make sure you add this back or it won't create the cache dir if ($check_cache_path=='1') { } else { mkdir ("$cache_path", 0777); chmod ("$cache_path", 0777); } // Count for table columns $j++; if ($j == '1') { echo ''; } echo ''; if ($j == $this->numcol) { echo ''; $j=0; } } echo '



' .$this->get_dirs[$i]['real']. '

'; } } function DisplayThumbs() { // If text file is there and we are not viewing a picture include it if (is_file("album.txt") == '1' && !$this->pic) { echo '

Album description:
'; include("album.txt"); echo '

'; } // I will get rid of this soon - legacy support, actually this whole fucking description setup kinda sucks elseif (is_file(str_replace("/", "", substr(getcwd(), strrpos(getcwd(), "/"))).".txt") == '1' && !$this->pic) { echo '

Album description:
'; include(str_replace("/", "", substr(getcwd(), strrpos(getcwd(), "/"))).".txt"); echo '

'; } // $this->album <> NULL was added so pics don't display in the root of the album if (!$this->pic && $this->album <> NULL) { if (!$this->get_files && !$this->get_dirs) { echo '
This folder is empty.

'; } elseif (!$this->get_files && isset($this->get_dirs)) { } else { sort($this->get_files); echo ''; // this loop will generate all the thumbs $cache_path='' .$this->path. '/' .$this->dotdot. 'picKLE-cache/' .$this->album. ''; for ($i=0; $i < count($this->get_files); $i++) { $thumb = substr($this->get_files[$i]['real'], 0, strrpos($this->get_files[$i]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i]['real'], strrpos($this->get_files[$i]['real'], ".")); if (!is_file("$cache_path/$thumb") == '1') { $file = $this->get_files[$i]['real']; $pic_info = getimagesize($this->get_files[$i]['real']); $ratio = $pic_info[0] / $this->thumb_width; $new_h = $pic_info[1] / $ratio; $x='x'; $make_magick = system(''.$this->convert_path.'convert -size '.$this->thumb_width.''.$x.''.$new_h.' -geometry '.$this->thumb_width.''.$x.''.$new_h.' "'.$file.'" "'.$cache_path.''.$thumb.'" >/dev/null 2>/dev/null', $retval); if (!($retval)) { chmod ("$cache_path/$thumb", 0666); } else { echo 'That didn\'t work as planned. (imagemagick isn\'t installed, isn\'working right, or you didn\'t make picKLE-cache writable)
'; } } } if(!$this->nav){ } else { if (!eregi("[0-9]$", $this->nav)) { echo $this->error; die(); } } // this loop will display the thumbs if (!$this->nav or $this->nav == '1') { $nav_count = $this->dis_files; if ($nav_count < count($this->get_files)) { $this->nav_m = 1; $this->nav = 1; } elseif ($nav_count >= count($this->get_files)) { $nav_count = count($this->get_files); } $start = 0; } else { $nav_count = $this->nav * $this->dis_files; if ($nav_count / count($this->get_files) > 2) { echo $this->error; die(); } elseif ($nav_count >= count($this->get_files)) { $nav_count = count($this->get_files); $this->nav_l = 1; } else { $this->nav_m = 1; $this->nav_l = 1; } $start = ($this->nav - 1)* $this->dis_files; } for ($i=$start; $i < $nav_count; $i++) { $thumb = substr($this->get_files[$i]['real'], 0, strrpos($this->get_files[$i]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i]['real'], strrpos($this->get_files[$i]['real'], ".")); $j++; if ($j == '1') { echo ''; } echo ''; if ($j == $this->numcol) { echo ''; $j=0; } } echo '

album). '' .str_replace(" ", "%20", $thumb). '" border="1">
' .substr($this->get_files[$i]['real'], 0, strrpos($this->get_files[$i]['real'], ".")). '


'; if ($this->nav_l == '1') { $nav_l = $this->nav - 1; echo '  '; } $start_pic = $start + 1; echo '' .$start_pic. ' - ' .$nav_count. ' of ' .count($this->get_files). ''; if ($this->nav_m == '1') { $nav_m = $this->nav + 1; echo '  '; } echo '
'; } } } function DisplayPic() { echo ''; if (!$this->prev_real) { echo ''; } else { echo ''; } echo ''; } else { if (!$this->pic) { } else { echo $this->error; die(); } } if (!$this->next_real) { echo ''; } else { echo ''; } echo '
'; if (is_file($this->pic) == '1' && eregi(".(jpg|png|gif|jpeg)$", $this->pic)) { $cache_path='' .$this->path. '/' .$this->dotdot. 'picKLE-cache/' .$this->album. ''; $resampled = substr($this->pic, 0, strrpos($this->pic, "."))."_$this->resampled_width".substr($this->pic, strrpos($this->pic, ".")); $pic_info = getimagesize($this->pic); $ratio = $pic_info[0] / $this->resampled_width; $new_h = round($pic_info[1] / $ratio); $x='x'; $display = '

Viewing picture ' .$this->num. ' of ' .count($this->get_files). '
'; if ($this->allow_user_size == 'yes') { $display .= '
'; } $display .= 'album). '' .str_replace(" ", "%20", $resampled). '" border="1">
'; if ($this->allow_slideshow == 'yes') { $display .= 'Slideshow: start - stop
Second delay: [ 2 - 4 - 6 - 8 - 10 ]
'; } $display2 = '

' .'File uploaded on:
'.date("F j Y, H:i:s", filemtime("$this->pic")). '
'; $size_orig = '
' .$pic_info[0]. ' x ' .$pic_info[1]. ' pixels
'; if ($pic_info[0] <= $this->resampled_width) { $size_new = $size_orig; } else { $size_new = '
' .$this->resampled_width. ' x ' .$new_h. ' pixels
'; } if (is_file("$cache_path$resampled") == '1' && eregi(".(jpg|png|gif|jpeg)$", "$cache_path$resampled")) { nop; } elseif ($pic_info[0] < $this->resampled_width) { $make_magick = system(''.$this->convert_path.'convert "'.$this->pic.'" "'.$cache_path.''.$resampled.'" >/dev/null 2>/dev/null', $retval); if (!($retval)) { chmod ("$cache_path$resampled", 0666); } else { echo 'That didn\'t work as planned. (imagemagick isn\'t installed, isn\'working right, or you didn\'t make picKLE-cache writable)
'; } } else { $make_magick = system(''.$this->convert_path.'convert -geometry '.$this->resampled_width.''.$x.''.$new_h.' "'.$this->pic.'" "'.$cache_path.''.$resampled.'" >/dev/null 2>/dev/null', $retval); if (!($retval)) { chmod ("$cache_path$resampled", 0666); } else { echo 'That didn\'t work as planned. (imagemagick isn\'t installed, isn\'working right, or you didn\'t make picKLE-cache writable)
'; } } echo '' .$display. '
album). ''. str_replace(" ", "%20", $this->prev) . '" align="left" border="1">
<-prev

' .$this->pic. '
'; // If text file is there it if (is_file('' .$this->pic. '.txt') == '1') { echo '

Pic description:
'; include('' .$this->pic. '.txt'); echo '

'; } echo '' .$display2. '
Resampled size:' .$size_new. 'Original size:
' .$size_orig. '
'; if($this->allow_original == 'yes') { echo 'View original
'; } echo '
album). ''. str_replace(" ", "%20", $this->next). '" align="right" border="1">
next->
'; } function picKLEslide() { if ($this->pic) { if (!$this->next_real) { echo ''; } else { echo ''; } } } function picKLEfooter() { echo '
Indexed by ' .$this->title. ' ' .$this->version. ' © '.date(Y).'
Content by ' .$this->admin_name. ' © '.date(Y).'
'; include("$this->path/picKLE-includes/footer.php"); } } ?> picKLEsetup($album,$pic,$nav,$gallery_title,$title,$version,$filename,$numcol,$resampled_width,$thumb_width,$dis_files,$theme,$background,$error,$allow_user_size,$slide,$delay,$convert_path,$allow_original,$allow_slideshow,$admin_name,$admin_email); $gallery->DirAndFile(); ?> <?php echo '' .$gallery_title. ' - ' .$title. ' ' .$version. '';?> picKLEslide(); } ?>
picKLEheader(); $gallery->GenerateFolders(); $gallery->DisplayThumbs(); $gallery->DisplayPic(); $gallery->picKLEfooter(); ?>