function MatchPageNames($pagelist, $pat) { # Note: MatchNames() is the generic function matching patterns, # works for attachments and other arrays. We can commit to # keep it generic, even if we someday change MatchPageNames(). return MatchNames($pagelist, $pat); }
function AttachExist($pagename, $condparm='*') { global $UploadFileFmt; @list($fpat, $pn) = explode(' ', $condparm, 2); $pn = ($pn > '') ? MakePageName($pagename, $pn) : $pagename; $uploaddir = FmtPageName($UploadFileFmt, $pn); $flist = array(); $dirp = @opendir($uploaddir); if ($dirp) { while (($file = readdir($dirp)) !== false) if ($file{0} != '.') $flist[] = $file; closedir($dirp); $flist = MatchNames($flist, $fpat); } return count($flist); }