-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb2options.php
219 lines (195 loc) · 7.01 KB
/
b2options.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
$title = "Options";
/* <Options> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','standalone');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch($action) {
case "update":
$standalone = 1;
include ("./b2header.php");
$newposts_per_page=addslashes($HTTP_POST_VARS["newposts_per_page"]);
$newwhat_to_show=addslashes($HTTP_POST_VARS["newwhat_to_show"]);
$newarchive_mode=addslashes($HTTP_POST_VARS["newarchive_mode"]);
$newtime_difference=addslashes($HTTP_POST_VARS["newtime_difference"]);
$newautobr=addslashes($HTTP_POST_VARS["newautobr"]);
$newtime_format=addslashes($HTTP_POST_VARS["newtime_format"]);
$newdate_format=addslashes($HTTP_POST_VARS["newdate_format"]);
$query = "UPDATE $tablesettings SET posts_per_page=$newposts_per_page, what_to_show='$newwhat_to_show', archive_mode='$newarchive_mode', time_difference=$newtime_difference, AutoBR=$newautobr, time_format='$newtime_format', date_format='$newdate_format' WHERE ID = 1";
$result = mysql_query($query);
if ($result==false) {
$oops = "<b>ERROR</b>: couldn't update the options... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !<br /><br />".mysql_errno().": ".mysql_error();
die ($oops);
}
header ("Location: b2options.php");
break;
default:
$standalone=0;
include ("./b2header.php");
if ($user_level <= 3) {
die("You have no right to edit the options for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
?>
<form name="form" action="b2options.php" method="post">
<input type="hidden" name="action" value="update" />
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="550" cellpadding="5" cellspacing="0">
<tr height="40">
<td width="150" height="40">Show:</td>
<td width="350"><input type="text" name="newposts_per_page" value="<?php echo get_settings("posts_per_page") ?>" size="3">
<select name="newwhat_to_show">
<option value="days" <?php
$i = $what_to_show;
if ($i == "days")
echo " selected";
?>>days</option>
<option value="posts" <?php
if ($i == "posts")
echo " selected";
?>>posts</option>
<option value="paged" <?php
if ($i == "paged")
echo " selected";
?>>posts paged</option>
</select>
</td>
</tr>
<tr height="40">
<td height="40">Archive mode:</td>
<td><select name="newarchive_mode">
<?php $i = $archive_mode; ?>
<option value="daily"<?php
if ($i == "daily")
echo " selected";
?>>daily</option>
<option value="weekly"<?php
if ($i == "weekly")
echo " selected";
?>>weekly</option>
<option value="monthly"<?php
if ($i == "monthly")
echo " selected";
?>>monthly</option>
<option value="postbypost"<?php
if ($i == "postbypost")
echo " selected";
?>>post by post</option>
</select>
</tr>
<tr height="40">
<td height="40">Time difference:</td>
<td><input type="text" name="newtime_difference" value="<?php echo $time_difference ?>" size="2">
<i> if you're not on the timezone of your server</i>
</td>
</tr>
<tr height="40">
<td height="40" width="150">AutoBR:</td>
<td><select name="newautobr">
<option value="1" <?php
if ($autobr)
echo " selected";
?>>on</option>
<option value="0" <?php
if (!$autobr)
echo " selected";
?>>off</option>
</select>
<i>converts line-breaks into <br /> tags. (<a href="#autobr">note</a>)</i>
</td>
</tr>
<tr height="40">
<td height="40">Date format:</td>
<td><input type="text" name="newdate_format" value="<?php echo $date_format ?>" size="10">
<i> (<a href="#dateformat">note</a>)</i>
</td>
</tr>
<tr height="40">
<td height="40">Time format:</td>
<td><input type="text" name="newtime_format" value="<?php echo $time_format ?>" size="10">
<i> (<a href="#dateformat">note</a>)</i>
</td>
</tr>
<tr height="40">
<td height="40"> </td>
<td>
<input type="submit" name="submit" value="Update" class="search">
</td>
</tr>
</table>
<?php echo $tablebottom ?>
</form>
<br />
<?php echo $tabletop ?>
<a name="dateformat"></a><b>About Date & Time formats:</b><br />
<br />
You can format the date & time in many ways, using the PHP syntax.<br />
As quoted from the PHP manual, here are the letters you can use:<br />
<blockquote>
The following characters are recognized in the format string:<br />
a - "am" or "pm"<br />
A - "AM" or "PM"<br />
B - Swatch Internet time<br />
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"<br />
D - day of the week, textual, 3 letters; i.e. "Fri"<br />
F - month, textual, long; i.e. "January"<br />
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"<br />
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"<br />
h - hour, 12-hour format; i.e. "01" to "12"<br />
H - hour, 24-hour format; i.e. "00" to "23"<br />
i - minutes; i.e. "00" to "59"<br />
I (capital i) - "1" if Daylight Savings Time, "0" otherwise.<br />
j - day of the month without leading zeros; i.e. "1" to "31"<br />
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"<br />
L - boolean for whether it is a leap year; i.e. "0" or "1"<br />
m - month; i.e. "01" to "12"<br />
M - month, textual, 3 letters; i.e. "Jan"<br />
n - month without leading zeros; i.e. "1" to "12"<br />
r - RFC 822 formatted date; i.e. "Thu, 21 Dec 2000 16:01:07 +0200" (added in PHP 4.0.4)<br />
s - seconds; i.e. "00" to "59"<br />
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"<br />
t - number of days in the given month; i.e. "28" to "31"<br />
T - Timezone setting of this machine; i.e. "MDT"<br />
U - seconds since the epoch<br />
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)<br />
Y - year, 4 digits; i.e. "1999"<br />
y - year, 2 digits; i.e. "99"<br />
z - day of the year; i.e. "0" to "365"<br />
Z - timezone offset in seconds (i.e. "-43200" to "43200"). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.<br />
<br />
Unrecognized characters in the format string will be printed as-is.
</blockquote>
For more information and examples, check the PHP manual on <a href="http://www.php.net/manual/en/function.date.php">this page</a>.
<?php echo $tablebottom ?>
<?php
break;
}
/* </Options> */
include($b2inc."/b2footer.php") ?>