| @@ 164-180 (lines=17) @@ | ||
| 161 | * @param string $prefix |
|
| 162 | * @return array |
|
| 163 | */ |
|
| 164 | public static function getImgListAsArray($dirname, $prefix = '') |
|
| 165 | { |
|
| 166 | $filelist = array(); |
|
| 167 | if ($handle = opendir($dirname)) { |
|
| 168 | while (false !== ($file = readdir($handle))) { |
|
| 169 | if (preg_match('/(\.gif|\.jpg|\.png)$/i', $file)) { |
|
| 170 | $file = $prefix . $file; |
|
| 171 | $filelist[$file] = $file; |
|
| 172 | } |
|
| 173 | } |
|
| 174 | closedir($handle); |
|
| 175 | asort($filelist); |
|
| 176 | reset($filelist); |
|
| 177 | } |
|
| 178 | ||
| 179 | return $filelist; |
|
| 180 | } |
|
| 181 | ||
| 182 | /** |
|
| 183 | * gets list of html file names in a certain directory |
|
| @@ 188-204 (lines=17) @@ | ||
| 185 | * @param string $prefix |
|
| 186 | * @return array |
|
| 187 | */ |
|
| 188 | public static function getHtmlListAsArray($dirname, $prefix = '') |
|
| 189 | { |
|
| 190 | $filelist = array(); |
|
| 191 | if ($handle = opendir($dirname)) { |
|
| 192 | while (false !== ($file = readdir($handle))) { |
|
| 193 | if (preg_match('/(\.htm|\.html|\.xhtml|\.tpl)$/i', $file) && !is_dir($file)) { |
|
| 194 | $file = $prefix . $file; |
|
| 195 | $filelist[$file] = $prefix . $file; |
|
| 196 | } |
|
| 197 | } |
|
| 198 | closedir($handle); |
|
| 199 | asort($filelist); |
|
| 200 | reset($filelist); |
|
| 201 | } |
|
| 202 | ||
| 203 | return $filelist; |
|
| 204 | } |
|
| 205 | ||
| 206 | /** |
|
| 207 | * gets list of avatar file names in a certain directory |
|
| @@ 142-157 (lines=16) @@ | ||
| 139 | * |
|
| 140 | * @return array |
|
| 141 | */ |
|
| 142 | function getDirList($dirname) |
|
| 143 | { |
|
| 144 | $dirlist = array(); |
|
| 145 | if ($handle = opendir($dirname)) { |
|
| 146 | while ($file = readdir($handle)) { |
|
| 147 | if ($file{0} !== '.' && is_dir($dirname . $file)) { |
|
| 148 | $dirlist[] = $file; |
|
| 149 | } |
|
| 150 | } |
|
| 151 | closedir($handle); |
|
| 152 | asort($dirlist); |
|
| 153 | reset($dirlist); |
|
| 154 | } |
|
| 155 | ||
| 156 | return $dirlist; |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * @param $status |
|