* @version $Revision: 1.4 $ $Date: 2004/11/20 19:51:43 $ * */ include_once('config.php'); $template = new template(); $template->title = 'View Image'; $template->section = 'home'; $template->right_column = 0; $template->description = $template->title; $template->open_page(); function match_img($istr){$testo = preg_match_all("/[0-9]{3,4}_p[0-9]{1,2}_[0-9]{1,2}\.[a-zA-Z]{3}/", $istr, $match); return $match;} function getpage($istr){$testo = preg_match("/p[0-9]{1,2}/", $istr, $match); return ltrim($match[0],"p");} function getnum($istr){$testo = preg_match("/_[0-9]{1,2}/", $istr, $match); return ltrim($match[0],"_");} function getrev($istr){$testo = preg_match("/[0-9]{3,4}/", $istr, $match); return $match[0];} function makelist($imgar) { $tlist=''; $rowsplit=6; foreach($imgar as $key => $img) { if($key!=0 && fmod($key,$rowsplit)==0){$tlist.="";} $tlist.= ''; } $tlist.='
'.show_review_image($img, 100, '').'
'; return $tlist; } function makenav($imgar, $id) { $istr=$_REQUEST["i"]; $folds = preg_split('[/]', $istr, -1, PREG_SPLIT_NO_EMPTY); $thec = count($imgar) - 1; if($id!=0) { if($thec == $id) { $nid = 0; $bid = $id-1; } else { $nid = $id+1; $bid = $id-1; } } else { $nid = $id+1; $bid = $thec; } $nimage = ''; $bimage = ''; $tlist=''; $tlist.=''; $tlist.=''; $tlist.='
'.$bimage.''.$nimage.'
'; echo $tlist; } function show_review_image($image, $thumb_size, $caption, $border = 1, $class = 'revimages') { $istr=$_REQUEST["i"]; $folds = preg_split('[/]', $istr, -1, PREG_SPLIT_NO_EMPTY); if($border == 1) { $bord = ' class="border" '; } $rimage = ''; $rimage .= ''; $thumb = file_exists($_SERVER['DOCUMENT_ROOT'] . '/images/' . $folds[1] . '/' . $folds[2] . '/thumbs/' . $image); if(!$thumb) { $th = new phpthumb(); $th->src = $_SERVER['DOCUMENT_ROOT'] . '/images/' . $folds[1] . '/' . $folds[2] . '/' . $image; $th->w = $thumb_size; $th->config_error_die_on_error = false; if ($th->GenerateThumbnail()) { $th->RenderToFile($_SERVER['DOCUMENT_ROOT'] . '/images/' . $folds[1] . '/' . $folds[2] . '/thumbs/' . $image); } else { echo 'Failed: '.$th->error; } } $rimage .= ''; $rimage .= ''; if($caption) { $rimage .= '

' . $caption . '

'; } return $rimage; } function checkstr($strin) { $ext=substr($strin,-3); $pass=0; switch($ext) { case "jpg": $pass=1; case "gif": $pass=1; case "png": $pass=1; case "bmp": $pass=1; } if($pass){return true;}else{return false;} } $ichk = substr($_REQUEST["i"], 0, 8); if($ichk == '/images/') { $istr=$_REQUEST["i"]; $imgin = match_img($istr); $startimg = $imgin[0][0]; $folds = preg_split('[/]', $istr, -1, PREG_SPLIT_NO_EMPTY); if($startimg!="") { if(checkstr($startimg)) { $revnum = getrev($startimg); $pagenum = getpage($startimg); $num = getnum($startimg); $path = rtrim($istr, $startimg); $incpath = str_replace("images","includes",$path); $revfile = ".".$incpath.$revnum."_".$pagenum.".inc"; $page = implode("",file($revfile)); $imglist = match_img($page); $imgs=count($imglist[0]); $indx = array_search($startimg,$imglist[0]); if($imgs>1) { $out='
'; $out.=makelist($imglist[0]); $out.="

"; } else { $out=""; } ?>

" title="Click to Return to Review">

">

BACK TO REVIEW

BACK TO REVIEW

'); } ?> close_page(); ?>