read()) { if(in_array(strtolower(fileext($entry)), $imgextarray) && preg_match("/^[\w\-\.\[\]\(\)\<\> &]+$/", substr($entry, 0, strrpos($entry, '.'))) && strlen($entry) < 30 && is_file($pdir.'/'.$entry)) { $postimg[$perdir][] = array('url' => $entry); $postimgjs .= ($count ? ',' : '').'"'.$entry.'"'; $count++; } } $postimgjs .='];'; $postimgdir->close(); } savecache('postimg', $postimg); $cachedir = DISCUZ_ROOT.'./data/cache/'; if(@$fp = fopen($cachedir.'common_postimg.js', 'w')) { fwrite($fp, $postimgjs); fclose($fp); } else { exit('Can not write to cache files, please check directory ./data/ and ./data/cache/ .'); } } ?>