Changeset 512 for trunk/include/functions.inc.php
- Timestamp:
- Sep 3, 2004, 5:01:05 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r507 r512 180 180 181 181 /** 182 * returns an array contening sub-directories 182 * returns an array contening sub-directories, excluding "CVS" 183 183 * 184 184 * @param string $dir 185 185 * @return array 186 186 */ 187 function get_dirs( $directory)187 function get_dirs($directory) 188 188 { 189 189 $sub_dirs = array(); 190 190 191 if ( $opendir = opendir( $directory ) ) 192 { 193 while ( $file = readdir ( $opendir ) ) 194 { 195 if ( $file != '.' and $file != '..' and is_dir ( $directory.'/'.$file ) ) 191 if ($opendir = opendir($directory)) 192 { 193 while ($file = readdir($opendir)) 194 { 195 if ($file != '.' 196 and $file != '..' 197 and is_dir($directory.'/'.$file) 198 and $file != 'CVS') 196 199 { 197 array_push( $sub_dirs, $file);200 array_push($sub_dirs, $file); 198 201 } 199 202 } … … 259 262 //-------------------------------------------- PhpWebGallery specific functions 260 263 261 // get_languages retourne un tableau contenant tous les languages 262 // disponibles pour PhpWebGallery 263 function get_languages( $rep_language ) 264 { 265 global $lang; 264 /** 265 * returns an array with a list of {language_code => language_name} 266 * 267 * @returns array 268 */ 269 function get_languages() 270 { 271 $dir = opendir(PHPWG_ROOT_PATH.'language'); 266 272 $languages = array(); 267 $i = 0; 268 if ( $opendir = opendir ( $rep_language ) ) 269 { 270 while ( $file = readdir ( $opendir ) ) 271 { 272 if ( is_dir ( $rep_language.$file )&& !substr_count($file,'.') && isset($lang['lang'][$file])) 273 { 274 $languages[$i++] =$lang['lang'][$file]; 275 } 276 } 277 } 273 274 while ($file = readdir($dir)) 275 { 276 $path = realpath(PHPWG_ROOT_PATH.'language/'.$file); 277 if (is_dir($path) and !is_link($path) and file_exists($path.'/iso.txt')) 278 { 279 list($language_name) = @file($path.'/iso.txt'); 280 $languages[$file] = $language_name; 281 } 282 } 283 closedir($dir); 284 @asort($languages); 285 @reset($languages); 286 278 287 return $languages; 279 288 } … … 540 549 return $query_string; 541 550 } 551 552 /** 553 * returns available templates 554 */ 555 function get_templates() 556 { 557 return get_dirs(PHPWG_ROOT_PATH.'template'); 558 } 542 559 ?>
Note: See TracChangeset
for help on using the changeset viewer.