Project

General

Profile

« Previous | Next » 

Revision 16

Added by stefan about 19 years ago

Reduced redundant initialization code, removed further 'CVS' occurrences. Made $admin accessible in page_content function.

View differences:

preferences_form.php
1
<?php
2

  
3
// $Id: preferences_form.php,v 1.2 2005/04/02 06:25:37 rdjurovich Exp $
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
if(!defined('WB_URL')) {
27
	header('Location: ../index.php');
28
}
29

  
30
?>
31

  
32
<h1>&nbsp;<?php echo $HEADING['MY_SETTINGS']; ?></h1>
33

  
34
<form name="user" action="<?php echo WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
35
<input type="hidden" name="user_id" value="{USER_ID}" />
36

  
37
<table cellpadding="5" cellspacing="0" border="0" width="97%">
38
<tr>
39
	<td width="140"><?php echo $TEXT['DISPLAY_NAME']; ?>:</td>
40
	<td class="value_input">
41
		<input type="text" name="display_name" style="width: 380px;" maxlength="255" value="<?php echo $admin->get_display_name(); ?>" />
42
	</td>
43
</tr>
44
<tr>
45
	<td><?php echo $TEXT['LANGUAGE']; ?>:</td>
46
	<td>
47
		<select name="language" style="width: 380px;">
48
		<?php
49
		// Insert language values
1
<?php

2

  
3
// $Id$

4

  
5
/*

6

  
7
 Website Baker Project <http://www.websitebaker.org/>

8
 Copyright (C) 2004-2005, Ryan Djurovich

9

  
10
 Website Baker is free software; you can redistribute it and/or modify

11
 it under the terms of the GNU General Public License as published by

12
 the Free Software Foundation; either version 2 of the License, or

13
 (at your option) any later version.

14

  
15
 Website Baker is distributed in the hope that it will be useful,

16
 but WITHOUT ANY WARRANTY; without even the implied warranty of

17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

18
 GNU General Public License for more details.

19

  
20
 You should have received a copy of the GNU General Public License

21
 along with Website Baker; if not, write to the Free Software

22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

23

  
24
*/

25

  
26
if(!defined('WB_URL')) {

27
	header('Location: ../index.php');

28
}

29

  
30
?>

31

  
32
<h1>&nbsp;<?php echo $HEADING['MY_SETTINGS']; ?></h1>

33

  
34
<form name="user" action="<?php echo WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">

35
<input type="hidden" name="user_id" value="{USER_ID}" />

36

  
37
<table cellpadding="5" cellspacing="0" border="0" width="97%">

38
<tr>

39
	<td width="140"><?php echo $TEXT['DISPLAY_NAME']; ?>:</td>

40
	<td class="value_input">

41
		<input type="text" name="display_name" style="width: 380px;" maxlength="255" value="<?php echo $admin->get_display_name(); ?>" />

42
	</td>

43
</tr>

44
<tr>

45
	<td><?php echo $TEXT['LANGUAGE']; ?>:</td>

46
	<td>

47
		<select name="language" style="width: 380px;">

48
		<?php

49
		// Insert language values

50 50
		if($handle = opendir(WB_PATH.'/languages/')) {
51
		   while (false !== ($file = readdir($handle))) {
52
				if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'index.php') {
53
					// Get language name
54
					require(WB_PATH.'/languages/'.$file);
55
					// Check if it is selected
56
					if(LANGUAGE == $language_code) {
57
						?>
58
						<option value="<?php echo $language_code; ?>" selected><?php echo $language_name.' ('.$language_code.')'; ?></option>
59
						<?php
60
					} else {
61
						?>
62
						<option value="<?php echo $language_code; ?>"><?php echo $language_name.' ('.$language_code.')'; ?></option>
63
						<?php
64
					}
65
				}
66
			}
67
			// Restore language to original file
68
			require(WB_PATH.'/languages/'.LANGUAGE.'.php');
69
		}
70
		?>
71
		</select>
72
	</td>
73
</tr>
74
<tr>
75
	<td><?php echo $TEXT['TIMEZONE']; ?>:</td>
76
	<td>
77
		<select name="timezone" style="width: 380px;">
78
			<option value="-20"><?php echo $TEXT['PLEASE_SELECT']; ?>...</option>
79
			<?php
80
			// Insert default timezone values
81
			require_once(ADMIN_PATH.'/interface/timezones.php');
82
			foreach($TIMEZONES AS $hour_offset => $title) {
83
				if($admin->get_timezone() == $hour_offset*60*60) {
84
					?>
85
					<option value="<?php echo $hour_offset; ?>" selected><?php echo $title; ?></option>
86
					<?php
87
				} else {
88
					?>
89
					<option value="<?php echo $hour_offset; ?>"><?php echo $title; ?></option>
90
					<?php
91
				}
92
			}
93
			?>
94
		</select>
95
	</td>
96
</tr>
97
<tr>
98
	<td><?php echo $TEXT['DATE_FORMAT']; ?>:</td>
99
	<td>
100
		<select name="date_format" style="width: 98%;">
101
			<option value="">Please select...</option>
102
			<?php
103
			// Insert date format list
104
			$user_time = true;
105
			require_once(ADMIN_PATH.'/interface/date_formats.php');
106
			foreach($DATE_FORMATS AS $format => $title) {
107
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
108
				if($format != 'system_default') {
109
					$value = $format;
110
				} else {
111
					$value = '';
112
				}
113
				if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
114
					$selected = ' selected';
115
				} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
116
					$selected = ' selected';
117
				} else {
118
					$selected = '';
119
				}
120
				echo '<option value="'.$value.'"'.$selected.'>'.$title.'</option>';
121
			}
122
			?>>
123
		</select>
124
	</td>
125
</tr>
126
<tr>
127
	<td><?php echo $TEXT['TIME_FORMAT']; ?>:</td>
128
	<td>
129
		<select name="time_format" style="width: 98%;">
130
			<option value="">Please select...</option>
131
			<?php
132
			// Insert time format list
133
			$user_time = true;
134
			require_once(ADMIN_PATH.'/interface/time_formats.php');
135
			foreach($TIME_FORMATS AS $format => $title) {
136
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
137
				if($format != 'system_default') {
138
					$value = $format;
139
				} else {
140
					$value = '';
141
				}
142
				if(TIME_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
143
					$selected = ' selected';
144
				} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
145
					$selected = ' selected';
146
				} else {
147
					$selected = '';
148
				}
149
				echo '<option value="'.$value.'"'.$selected.'>'.$title.'</option>';
150
			}
151
			?>
152
		</select>
153
	</td>
154
</tr>
155
<tr>
156
	<td>&nbsp;</td>
157
	<td>
158
		<input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
159
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
160
	</td>
161
</tr>
162
</table>
163

  
164
</form>
165

  
166

  
167
<h1>&nbsp;<?php echo $HEADING['MY_EMAIL']; ?></h1>
168

  
169
<form name="email" action="<?php echo WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
170
<input type="hidden" name="user_id" value="{USER_ID}" />
171

  
172
<table cellpadding="5" cellspacing="0" border="0" width="97%">
173
<tr>
174
	<td width="140"><?php echo $TEXT['CURRENT_PASSWORD']; ?>:</td>
175
	<td>
176
		<input type="password" name="current_password" style="width: 380px;" />
177
	</td>
178
</tr>
179
<tr>
180
	<td><?php echo $TEXT['EMAIL']; ?>:</td>
181
	<td class="value_input">
182
		<input type="text" name="email" style="width: 380px;" maxlength="255" value="<?php echo $admin->get_email(); ?>" />
183
	</td>
184
</tr>
185
<tr>
186
	<td>&nbsp;</td>
187
	<td>
188
		<input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
189
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
190
	</td>
191
</tr>
192
</table>
193

  
194
</form>
195

  
196

  
197
<h1>&nbsp;<?php echo $HEADING['MY_PASSWORD']; ?></h1>
198

  
199
<form name="user" action="<?php echo WB_URL.'/account/preferences.php'; ?>" method="post">
200
<input type="hidden" name="user_id" value="{USER_ID}" />
201

  
202
<table cellpadding="5" cellspacing="0" border="0" width="97%">
203
<tr>
204
	<td width="140"><?php echo $TEXT['CURRENT_PASSWORD']; ?>:</td>
205
	<td>
206
		<input type="password" name="current_password" style="width: 380px;" />
207
	</td>
208
</tr>
209
<tr>
210
	<td><?php echo $TEXT['NEW_PASSWORD']; ?>:</td>
211
	<td>
212
		<input type="password" name="new_password" style="width: 380px;" />
213
	</td>
214
</tr>
215
<tr>
216
	<td><?php echo $TEXT['RETYPE_NEW_PASSWORD']; ?>:</td>
217
	<td>
218
		<input type="password" name="new_password2" style="width: 380px;" />
219
	</td>
220
</tr>
221
</tr>
222
<tr>
223
	<td>&nbsp;</td>
224
	<td>
225
		<input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
226
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
227
	</td>
228
</tr>
229
</table>
230

  
231
</form>
51
		   while (false !== ($file = readdir($handle))) {
52
				if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'index.php') {
53
					// Get language name
54
					require(WB_PATH.'/languages/'.$file);
55
					// Check if it is selected
56
					if(LANGUAGE == $language_code) {
57
						?>
58
						<option value="<?php echo $language_code; ?>" selected><?php echo $language_name.' ('.$language_code.')'; ?></option>
59
						<?php
60
					} else {
61
						?>
62
						<option value="<?php echo $language_code; ?>"><?php echo $language_name.' ('.$language_code.')'; ?></option>
63
						<?php
64
					}
65
				}
66
			}
67
			// Restore language to original file
68
			require(WB_PATH.'/languages/'.LANGUAGE.'.php');
69
		}
70
		?>
71
		</select>
72
	</td>
73
</tr>
74
<tr>
75
	<td><?php echo $TEXT['TIMEZONE']; ?>:</td>
76
	<td>
77
		<select name="timezone" style="width: 380px;">
78
			<option value="-20"><?php echo $TEXT['PLEASE_SELECT']; ?>...</option>
79
			<?php
80
			// Insert default timezone values
81
			require_once(ADMIN_PATH.'/interface/timezones.php');
82
			foreach($TIMEZONES AS $hour_offset => $title) {
83
				if($admin->get_timezone() == $hour_offset*60*60) {
84
					?>
85
					<option value="<?php echo $hour_offset; ?>" selected><?php echo $title; ?></option>
86
					<?php
87
				} else {
88
					?>
89
					<option value="<?php echo $hour_offset; ?>"><?php echo $title; ?></option>
90
					<?php
91
				}
92
			}
93
			?>
94
		</select>
95
	</td>
96
</tr>
97
<tr>
98
	<td><?php echo $TEXT['DATE_FORMAT']; ?>:</td>
99
	<td>
100
		<select name="date_format" style="width: 98%;">
101
			<option value="">Please select...</option>
102
			<?php
103
			// Insert date format list
104
			$user_time = true;
105
			require_once(ADMIN_PATH.'/interface/date_formats.php');
106
			foreach($DATE_FORMATS AS $format => $title) {
107
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
108
				if($format != 'system_default') {
109
					$value = $format;
110
				} else {
111
					$value = '';
112
				}
113
				if(DATE_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
114
					$selected = ' selected';
115
				} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
116
					$selected = ' selected';
117
				} else {
118
					$selected = '';
119
				}
120
				echo '<option value="'.$value.'"'.$selected.'>'.$title.'</option>';
121
			}
122
			?>>
123
		</select>
124
	</td>
125
</tr>
126
<tr>
127
	<td><?php echo $TEXT['TIME_FORMAT']; ?>:</td>
128
	<td>
129
		<select name="time_format" style="width: 98%;">
130
			<option value="">Please select...</option>
131
			<?php
132
			// Insert time format list
133
			$user_time = true;
134
			require_once(ADMIN_PATH.'/interface/time_formats.php');
135
			foreach($TIME_FORMATS AS $format => $title) {
136
				$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
137
				if($format != 'system_default') {
138
					$value = $format;
139
				} else {
140
					$value = '';
141
				}
142
				if(TIME_FORMAT == $format AND !isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
143
					$selected = ' selected';
144
				} elseif($format == 'system_default' AND isset($_SESSION['USE_DEFAULT_TIME_FORMAT'])) {
145
					$selected = ' selected';
146
				} else {
147
					$selected = '';
148
				}
149
				echo '<option value="'.$value.'"'.$selected.'>'.$title.'</option>';
150
			}
151
			?>
152
		</select>
153
	</td>
154
</tr>
155
<tr>
156
	<td>&nbsp;</td>
157
	<td>
158
		<input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
159
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
160
	</td>
161
</tr>
162
</table>
163

  
164
</form>
165

  
166

  
167
<h1>&nbsp;<?php echo $HEADING['MY_EMAIL']; ?></h1>
168

  
169
<form name="email" action="<?php echo WB_URL.'/account/preferences.php'; ?>" method="post" style="margin-bottom: 5px;">
170
<input type="hidden" name="user_id" value="{USER_ID}" />
171

  
172
<table cellpadding="5" cellspacing="0" border="0" width="97%">
173
<tr>
174
	<td width="140"><?php echo $TEXT['CURRENT_PASSWORD']; ?>:</td>
175
	<td>
176
		<input type="password" name="current_password" style="width: 380px;" />
177
	</td>
178
</tr>
179
<tr>
180
	<td><?php echo $TEXT['EMAIL']; ?>:</td>
181
	<td class="value_input">
182
		<input type="text" name="email" style="width: 380px;" maxlength="255" value="<?php echo $admin->get_email(); ?>" />
183
	</td>
184
</tr>
185
<tr>
186
	<td>&nbsp;</td>
187
	<td>
188
		<input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
189
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
190
	</td>
191
</tr>
192
</table>
193

  
194
</form>
195

  
196

  
197
<h1>&nbsp;<?php echo $HEADING['MY_PASSWORD']; ?></h1>
198

  
199
<form name="user" action="<?php echo WB_URL.'/account/preferences.php'; ?>" method="post">
200
<input type="hidden" name="user_id" value="{USER_ID}" />
201

  
202
<table cellpadding="5" cellspacing="0" border="0" width="97%">
203
<tr>
204
	<td width="140"><?php echo $TEXT['CURRENT_PASSWORD']; ?>:</td>
205
	<td>
206
		<input type="password" name="current_password" style="width: 380px;" />
207
	</td>
208
</tr>
209
<tr>
210
	<td><?php echo $TEXT['NEW_PASSWORD']; ?>:</td>
211
	<td>
212
		<input type="password" name="new_password" style="width: 380px;" />
213
	</td>
214
</tr>
215
<tr>
216
	<td><?php echo $TEXT['RETYPE_NEW_PASSWORD']; ?>:</td>
217
	<td>
218
		<input type="password" name="new_password2" style="width: 380px;" />
219
	</td>
220
</tr>
221
</tr>
222
<tr>
223
	<td>&nbsp;</td>
224
	<td>
225
		<input type="submit" name="submit" value="<?php echo $TEXT['SAVE']; ?>" />
226
		<input type="reset" name="reset" value="<?php echo $TEXT['RESET']; ?>" />
227
	</td>
228
</tr>
229
</table>
230

  
231
</form>

Also available in: Unified diff