{$var}', '/\\(:thumb(list)?\\s*(.*?):\\)/ei', "FmtThumbList(\$pagename,PSS('$2'),'$1')"); function FmtThumbList($pagename, $args, $list='') { global $UploadDir, $UploadPrefixFmt, $UploadUrlFmt, $AlwaysRedoThumbs, $ThumbTableCols,$ThumbBgColor, $TimeFmt, $EnableDirectDownload, $ThumbPx, $ThumbTitleFormat, $ThumbLimit, $AlwaysLinkOriginal, $ThumbListUseTmpl, $ThumbMaxArea, $ThumbLinkAdd, $ThumbAdd; static $ThumbGalNum = 0; $ThumbGalNum++; $opt = ParseArgs($args); $currentpage = $pagename = MakePageName($pagename, $pagename); if($list)//usual "thumblist" { if (@$opt[''][0]) $pagename = MakePageName($pagename, $opt[''][0]); } else// "thumb" was used { if (! @$opt[''][0]) return; if(preg_match("!^(.*)\\/([^\\/]+)$!", $opt[''][0], $m) ) { $pagename = MakePageName($pagename, $m[1]); $opt['image'] = $m[2]; } else $opt['image'] = $opt[''][0]; $opt['cols'] = 0; } $page = RetrieveAuthPage($pagename,"read"); if (!$page) { return; } if(!$_POST['preview'] && !$AlwaysRedoThumbs && intval(@$opt['supercache'])) { $output = ThumbGetCache($currentpage, $pagename, $ThumbGalNum); if($output) return '<:block>'. Keep($output); } if (@$opt['skip']) $skipmatch = '/^' . str_replace(array("\\*", "\\?", "\\|"), array(".*", ".", "|"), preg_quote($opt['skip'])) . '$/i'; if (@$opt['name']) $pattern = '/^' . str_replace(array("\\*", "\\?", "\\|"), array(".*", ".", "|"), preg_quote($opt['name'])) . '$/i'; $titlefmt =(@$opt['titlefmt'])? $opt['titlefmt'] : $ThumbTitleFormat; if (@$opt['px'] && intval($opt['px']) > 0 ) $Px = intval($opt['px']); elseif(@intval(@$opt['width']))$Px = $Width = intval($opt['width']); else $Px = $ThumbPx; $atarget = (@$opt['target'])? ' target="'.htmlspecialchars($opt['target']).'"' : ''; $usetpl = isset($opt['usetemplate'])?$opt['usetemplate'] : $ThumbListUseTmpl; $thumbcols = isset($opt['cols'])? intval($opt['cols']) : $ThumbTableCols; $caption = @$opt['caption']; if (@floatval(@$opt['maxarea'])) $maxarea = floatval($opt['maxarea']); else $maxarea = $ThumbMaxArea; $maxarea *= 1000000; $start = intval(@$opt['start']); if(!$start)$start = 1; $limit = isset($opt['limit'])? intval(@$opt['limit']) : $ThumbLimit; $tableattributes = array("border", "cellpadding", "cellspacing", "rules", "style", "bgcolor", "align"); $mytabattr = ""; foreach($tableattributes as $k) { if(isset($opt[$k])) $mytabattr .= " $k=\"".htmlspecialchars($opt[$k])."\""; } $mybgcolor = preg_match("/^#[0-9a-f]{6}$/i", @$opt['bgcolor'])? $opt['bgcolor'] : $ThumbBgColor; $uploaddir = FmtPageName("$UploadDir$UploadPrefixFmt", $pagename); $uploadurl = FmtPageName(IsEnabled($EnableDirectDownload, 1) ? "$UploadUrlFmt$UploadPrefixFmt/" : "\$PageUrl?action=download&upname=", $pagename); $dirp = @opendir($uploaddir); if (!$dirp) return ''; $filelist = array(); while (($file=readdir($dirp)) !== false) { if ($file{0} == '.') continue; if (@$opt['image'] && $file != $opt['image']) continue; if (!preg_match("/\\.(jpe?g|png|gif)$/i", $file)) continue; if (preg_match("/^th\\d+---/", $file)) continue; if (@$skipmatch && preg_match(@$skipmatch, $file)) continue; if (@$pattern && !preg_match($pattern, $file)) continue; $LastModified = filemtime("$uploaddir/$file"); $filelist[$file] = $LastModified; } closedir($dirp); if(!count($filelist) ) return; asort($filelist); $filelist=array_keys($filelist); if($thumbcols) { $Px4 = $Px+4; $outputstart = "
"; $td2 = " | \n"; } else {$td1 = " "; $td2 = '';} $td=0; $i=1; $output = ''; foreach($filelist as $x=>$file) { $filepath = "$uploaddir/$file"; $info = @getimagesize($filepath); if(! $info) continue; if($maxarea > $info[0]*$info[1]) continue; if($start>1 && $i<$start) { $i++; continue; } if($limit>0 && $i>=$limit+$start) { break; } $stat = stat($filepath); $replArr = array( "%%" => "%", "%G" => $ThumbGalNum, "%f" => $file, "%w" => $info[0], "%h" => $info[1], "%b" => $stat['size'], "%k" => round($stat['size']/1024), "%t" => strftime($TimeFmt, $stat['mtime']) ); $title = htmlspecialchars(strtr($titlefmt, $replArr)); $thumbadd = strtr($ThumbAdd, $replArr); $thumblinkadd = strtr($ThumbLinkAdd, $replArr); $name = PUE("$uploadurl$file"); if($thumbcols && $td%$thumbcols == 0)$output .= "