Verzeichnisstruktur phpBB-2.0.0
- Veröffentlicht
- 03.04.2002
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
functions_selects.php
001 <?php
002 /***************************************************************************
003 * function_selects.php
004 * -------------------
005 * begin : Saturday, Feb 13, 2001
006 * copyright : (C) 2001 The phpBB Group
007 * email : support@phpbb.com
008 *
009 * $Id$
010 *
011 *
012 ***************************************************************************/
013
014 /***************************************************************************
015 *
016 * This program is free software; you can redistribute it and/or modify
017 * it under the terms of the GNU General Public License as published by
018 * the Free Software Foundation; either version 2 of the License, or
019 * (at your option) any later version.
020 *
021 *
022 ***************************************************************************/
023
024 //
025 // Pick a language, any language ...
026 //
027 function language_select($default, $select_name = "language", $dirname="language")
028 {
029 global $phpEx, $phpbb_root_path;
030
031 $dir = opendir($phpbb_root_path . $dirname);
032
033 $lang = array();
034 while ( $file = readdir($dir) )
035 {
036 if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)) && !is_link(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)))
037 {
038 $filename = trim(str_replace("lang_", "", $file));
039 $displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
040 $displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
041 $lang[$displayname] = $filename;
042 }
043 }
044
045 closedir($dir);
046
047 @asort($lang);
048 @reset($lang);
049
050 $lang_select = '<select name="' . $select_name . '">';
051 while ( list($displayname, $filename) = @each($lang) )
052 {
053 $selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
054 $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
055 }
056 $lang_select .= '</select>';
057
058 return $lang_select;
059 }
060
061 //
062 // Pick a template/theme combo,
063 //
064 function style_select($default_style, $select_name = "style", $dirname = "templates")
065 {
066 global $db;
067
068 $sql = "SELECT themes_id, style_name
069 FROM " . THEMES_TABLE . "
070 ORDER BY template_name, themes_id";
071 if ( !($result = $db->sql_query($sql)) )
072 {
073 message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql);
074 }
075
076 $style_select = '<select name="' . $select_name . '">';
077 while ( $row = $db->sql_fetchrow($result) )
078 {
079 $selected = ( $row['themes_id'] == $default_style ) ? ' selected="selected"' : '';
080
081 $style_select .= '<option value="' . $row['themes_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
082 }
083 $style_select .= "</select>";
084
085 return $style_select;
086 }
087
088 //
089 // Pick a timezone
090 //
091 function tz_select($default, $select_name = 'timezone')
092 {
093 global $sys_timezone, $lang;
094
095 if ( !isset($default) )
096 {
097 $default == $sys_timezone;
098 }
099 $tz_select = '<select name="' . $select_name . '">';
100
101 while( list($offset, $zone) = @each($lang['tz']) )
102 {
103 $selected = ( $offset == $default ) ? ' selected="selected"' : '';
104 $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
105 }
106 $tz_select .= '</select>';
107
108 return $tz_select;
109 }
110
111 ?>