Changeset 351 for trunk/include/functions.inc.php
- Timestamp:
- Feb 7, 2004, 12:50:26 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r345 r351 258 258 while ( $file = readdir ( $opendir ) ) 259 259 { 260 if ( is_file ( $rep_language.$file ) 261 and $file != "index.php" 262 and strrchr ( $file, "." ) == ".php" ) 260 if ( is_dir ( $rep_language.$file )&& !substr_count($file,'.') ) 263 261 { 264 $languages[$i++] = 265 substr ( $file, 0, strlen ( $file ) 266 - strlen ( strrchr ( $file, "." ) ) ); 262 $languages[$i++] =$file; 267 263 } 268 264 } … … 455 451 $debug.= "\n"; 456 452 } 453 454 // 455 // Initialise user settings on page load 456 function init_userprefs($userdata) 457 { 458 global $conf, $template, $lang, $phpwg_root_path; 459 460 $style = $conf['default_style']; 461 if ( !$userdata['is_the_guest'] ) 462 { 463 if ( !empty($userdata['language'])) 464 { 465 $conf['default_lang'] = $userdata['language']; 466 } 467 if ( !empty($userdata['template'])) 468 { 469 $style = $userdata['template']; 470 } 471 } 472 473 if ( !file_exists(@realpath($phpwg_root_path . 'language/' . $conf['default_lang'] . '/lang_main.php')) ) 474 { 475 $conf['default_lang'] = 'english'; 476 } 477 478 include_once($phpwg_root_path . 'language/' . $conf['default_lang'] . '/lang_main.php'); 479 $template= setup_style($style); 480 481 return; 482 } 483 484 function setup_style($style) 485 { 486 global $phpwg_root_path; 487 488 $template_path = 'template/' ; 489 $template_name = $style ; 490 491 $template = new Template($phpwg_root_path . $template_path . $template_name); 492 return $template; 493 } 494 495 function encode_ip($dotquad_ip) 496 { 497 $ip_sep = explode('.', $dotquad_ip); 498 return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); 499 } 500 501 function decode_ip($int_ip) 502 { 503 $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); 504 return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); 505 } 506 457 507 ?>
Note: See TracChangeset
for help on using the changeset viewer.