-
Notifications
You must be signed in to change notification settings - Fork 4
/
config_form.php
408 lines (374 loc) · 20 KB
/
config_form.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<?php
require_once('admin.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php');
global $wpdb,$wp_roles;
if (!TestWPVersion()) {
print("<h1>Warning!</h1>
<p>Postie only works on on Word Press version 2.0 and above</p>");
exit();
}
$title = __('Postie Options');
$parent_file = 'options-general.php';
$config = GetConfig();
$messages[1] = "Configuration successfully updated!";
$messages[2] = "Error - unable to save configuration";
?>
<?php if (isset($_GET['message'])) : ?>
<div class="updated"><p><?php _e($messages[$_GET['message']]); ?></p></div>
<?php endif; ?>
<div class="wrap">
<h2><?php _e('Postie Options') ?></h2>
<p>
<form name="postie-options" method="post" action="<?php echo get_option('siteurl') . "/wp-content/plugins/postie/config_handler.php"?>">
<input type="hidden" name="action" value="reset" />
<p align="right"><?php _e("If you would like to start over - you can click the button on the right to reset all configurations to the default.");?></p>
<p class="submit">
<input name="Submit" value="<?php _e("Reset Configs To Default")?> »" type="submit">
</p>
</form>
</p>
<p>
<form name="postie-options" method="get" action="<?php echo get_option('siteurl') . "/wp-content/plugins/postie/get_mail.php"?>">
<p align="right"><?php _e("To run the check mail script manually");?></p>
<p class="submit">
<input name="Submit" value="<?php _e("Run Postie");?> »" type="submit">
</p>
</form>
</p>
<p>
<form name="postie-options" method="post" action="<?php echo get_option('siteurl') . "/wp-content/plugins/postie/config_handler.php"?>">
<input type="hidden" name="action" value="test" />
<p align="right"><?php _e("If you have problems with Postie this will run a special script to test your configuraiton options");?></p>
<p class="submit">
<input name="Submit" value="<?php _e("Test Config");?>»" type="submit">
</p>
</form>
</p>
<form name="postie-options" method="post" action="<?php echo get_option('siteurl') . "/wp-content/plugins/postie/config_handler.php"?>">
<input type="hidden" name="action" value="config" />
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<!-- <tr><td colspan=2> -->
<!-- <fieldset class="options"> -->
<!-- <legend><?php _e('Directory Settings');?></legend> -->
<!-- <table width="100%" cellspacing="2" cellpadding="5" class="editform"> -->
<!-- </table> -->
<!-- </fieldset> -->
<!-- </td> -->
<!-- </tr> -->
<tr><td colspan=2>
<fieldset class="options">
<legend><?php _e('Authorization Settings');?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<?php echo BuildBooleanSelect("Allow Anyone To Post Via Email","TURN_AUTHORIZATION_OFF",$config["TURN_AUTHORIZATION_OFF"],"Changing this to yes is NOT RECOMMEDED - anything that gets sent in will automatically be posted. This could make it easier to compromise your server - YOU HAVE BEEN WARNED.");?>
<tr>
<th scope="row"><?php _e('Roles That Can Post:') ?></th>
<td>
<table>
<tr><th>Administrator role can always post.</th>
<?php
foreach($wp_roles->role_names as $roleId => $name) {
$role = &$wp_roles->get_role($roleId);
if ($role->has_cap("post_via_postie")) {
$checked = " CHECKED ";
}
else {
$checked = "";
}
if ($roleId != "administrator") {
print("<tr><td><input type='checkbox' value='1' name='ROLE_ACCESS[$roleId]' $checked >".$name."</td></tr>");
}
}
?>
</table>
<br />
<code><?php _e("This allows you to grant access to other users to post if they have the proper access level");?></code>
</td>
</tr>
<?php echo BuildTextArea("Authorized Addresses","AUTHORIZED_ADDRESSES",$config["AUTHORIZED_ADDRESSES"],"Put each email address on a single line. Posts from emails in this list will be treated as if they came from the admin. If you would prefer to have users post under their own name - create a WordPress user with the correct access level.");?>
</table>
</fieldset>
</td>
</tr>
<tr><td colspan=2>
<fieldset class="options">
<legend><?php _e('Directory Settings');?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Directory For Photos:') ?> </th>
<td>
<input name="PHOTOSDIR" type="text" id="PHOTOSDIR" value="<?php echo $config["PHOTOSDIR"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>/wp-photos/</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Directory For Files:') ?> </th>
<td>
<input name="FILESDIR" type="text" id="FILESDIR" value="<?php echo $config["FILESDIR"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>/wp-filez/</code>
<br />
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr><td colspan=2>
<fieldset class="options">
<legend><?php _e('Message Settings');?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th scope="row"><?php _e('Default post by mail category:') ?></th>
<td><select name="DEFAULT_POST_CATEGORY" id="DEFAULT_POST_CATEGORY">
<?php
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
foreach ($categories as $category) {
$selected = ($category->cat_ID == $config["DEFAULT_POST_CATEGORY"] ? "SELECTED": NULL);
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
}
?>
</select></td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Default Title:') ?> </th>
<td>
<input name="DEFAULT_TITLE" type="text" id="DEFAULT_TITLE" value="<?php echo $config["DEFAULT_TITLE"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>Live from the field</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Prefered Text Type (HTML/plain):') ?> </th>
<td>
<select name="PREFER_TEXT_TYPE" id="PREFER_TEXT_TYPE">
<option value="plain">plain</option>
<option value="html" <?php if($config["PREFER_TEXT_TYPE"] == "html") { echo "SELECTED";} ?>>html</option>
</select><br />
<?php _e("Recommended");?>: <code>plain</code>
<br />
</td>
</tr>
<?php echo BuildBooleanSelect("Forward Rejected Mail","FORWARD_REJECTED_MAIL",$config["FORWARD_REJECTED_MAIL"]);?>
<?php echo BuildBooleanSelect("Allow Subject In Mail","ALLOW_SUBJECT_IN_MAIL",$config["ALLOW_SUBJECT_IN_MAIL"]);?>
<?php echo BuildBooleanSelect("Allow HTML In Mail Subject","ALLOW_HTML_IN_SUBJECT",$config["ALLOW_HTML_IN_SUBJECT"]);?>
<?php echo BuildBooleanSelect("Allow HTML In Mail Body","ALLOW_HTML_IN_BODY",$config["ALLOW_HTML_IN_BODY"]);?>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Encoding for pages and feeds:') ?> </th>
<td>
<input name="MESSAGE_ENCODING" type="text" id="MESSAGE_ENCODING" value="<?php echo $config["MESSAGE_ENCODING"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>UTF-8</code> - it should handle ISO-8859-1 as well
<br />
</td>
</tr>
<?php echo BuildBooleanSelect("Decode Quoted Printable Data","MESSAGE_DEQUOTE",$config["MESSAGE_DEQUOTE"], "Should be yes in most cases.");?>
<?php echo BuildTextArea("Supported File Types","SUPPORTED_FILE_TYPES",$config["SUPPORTED_FILE_TYPES"],"Put each type on a single line.");?>
<?php echo BuildTextArea("Banned File Names","BANNED_FILES_LIST",$config["BANNED_FILES_LIST"],"Put each file name on a single line.Files matching this list will never be posted to your blog.");?>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Tag Of Message Start:') ?> </th>
<td>
<p>This tag can be used to remove any text from a message that the email provider puts at the top of the message</p>
<input name="MESSAGE_START" type="text" id="MESSAGE_START" value="<?php echo $config["MESSAGE_START"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>:start</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Tag Of Message End:') ?> </th>
<td>
<p>This tag can be used to remove any text from a message that the email provider puts at the bottom of the message</p>
<input name="MESSAGE_END" type="text" id="MESSAGE_END" value="<?php echo $config["MESSAGE_END"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>:end</code>
<br />
</td>
</tr>
<?php echo BuildBooleanSelect("Drop The Signature From Mail","DROP_SIGNATURE",$config["DROP_SIGNATURE"]);?>
<?php echo BuildTextArea("Signature Patterns","SIG_PATTERN_LIST",$config["SIG_PATTERN_LIST"],"Put each pattern on a seperate line and make sure to escape any special characters.");?>
</table>
</fieldset>
</td>
</tr>
<tr><td colspan=2>
<fieldset class="options">
<legend><?php _e('Image Settings');?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<?php if (!HasGDInstalled()):?>
<tr>
<th scope="row">No GD Support </th>
<td>Currently your installation of PHP does not have GD installed so no image resizing can occur.
<input type="hidden" name="RESIZE_LARGE_IMAGES" value="0">
<input type="hidden" name="JPEGQUALITY"" value="80">
</td>
</tr>
<?php else:?>
<?php echo BuildBooleanSelect("Post Images At End","IMAGES_APPEND",$config["IMAGES_APPEND"],"No means they will be put before the text of the message.");?>
<?php echo BuildBooleanSelect("Resize Large Images","RESIZE_LARGE_IMAGES",$config["RESIZE_LARGE_IMAGES"]);?>
<tr>
<th scope="row"><?php _e('Maximum Image Width:') ?> </th>
<td><input name="MAX_IMAGE_WIDTH" type="text" id="MAX_IMAGE_WIDTH" value="<?php echo $config['MAX_IMAGE_WIDTH']; ?>" size="4" />
<?php _e('pixels') ?>
<br /><?php _e("Recommended");?>: <code>400</code><br />
</td>
</tr>
<tr>
<th scope="row"><?php _e('Maximum Image Height:') ?> </th>
<td><input name="MAX_IMAGE_HEIGHT" type="text" id="MAX_IMAGE_HEIGHT" value="<?php echo $config['MAX_IMAGE_HEIGHT']; ?>" size="4" />
<?php _e('pixels') ?>
<br /><?php _e("Recommended");?>: <code>Leave Blank</code><br />
</td>
</tr>
<tr>
<th scope="row"><?php _e('JPEG Compression:') ?> </th>
<td><input name="JPEGQUALITY" type="text" id="JPEGQUALITY" value="<?php echo $config['JPEGQUALITY']; ?>" size="3" />
<?php _e('%') ?>
<br /><?php _e("Recommended");?>: <code>80</code>%
</td>
</tr>
<?php endif;?>
<?php echo BuildBooleanSelect("Use ImageMagick","USE_IMAGEMAGICK",$config["USE_IMAGEMAGICK"]);?>
<tr>
<th scope="row"><?php _e('convert binary location:') ?> </th>
<td><input name="IMAGEMAGICK_CONVERT" type="text" id="IMAGEMAGICK_CONVERT" value="<?php echo $config['IMAGEMAGICK_CONVERT']; ?>" size="30" />
<br /><?php _e("Recommended");?>: <code>only needed if you are using ImageMagick <br /> should be /usr/bin/convert</code>
</td>
</tr>
<?php echo BuildBooleanSelect("Automatic SmartSharp Mask","AUTO_SMART_SHARP",$config["AUTO_SMART_SHARP"],"This automatically smart sharpens the images that are posted. This feature is <b>EXPERIMENTAL</b>. It alsot takes a lot of processing power");?>
<?php echo BuildBooleanSelect("Start Image Count At 0","START_IMAGE_COUNT_AT_ZERO",$config["START_IMAGE_COUNT_AT_ZERO"]);?>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Image Place Holder Tag:') ?> </th>
<td>
<input name="IMAGE_PLACEHOLDER" type="text" id="IMAGE_PLACEHOLDER" value="<?php echo $config["IMAGE_PLACEHOLDER"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>#img%#</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Image CSS Class:') ?> </th>
<td>
<input name="IMAGECLASS" type="text" id="IMAGECLASS" value="<?php echo $config["IMAGECLASS"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>postie-image</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Image CSS Style:') ?> </th>
<td>
<input name="IMAGESTYLE" type="text" id="IMAGESTYLE" value="<?php echo $config["IMAGESTYLE"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>border: none;</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Image Div CSS:') ?> </th>
<td>
<input name="IMAGEDIV" type="text" id="IMAGEDIV" value="<?php echo $config["IMAGEDIV"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>postie-image-div</code><p>This is the CSS class of a div that wraps each image. Can be used to style the post</p>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Attachment Div CSS:') ?> </th>
<td>
<input name="ATTACHMENTDIV" type="text" id="ATTACHMENTDIV" value="<?php echo $config["ATTACHMENTDIV"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>postie-attachment-div</code><p>This is the CSS class of a div that wraps each file attachment. Can be used to style the post</p>
<br />
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr><td colspan=2>
<fieldset class="options">
<legend><?php _e('3GP');?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<?php echo BuildBooleanSelect("Embed 3GP videos as QuickTime","3GP_QT",$config["3GP_QT"],"This controls if the video is just a link or embeded in the page using QuickTime");?>
<tr>
<th scope="row"><?php _e('Location of ffmpeg:') ?> </th>
<td><input name="3GP_FFMPEG" type="text" id="3GP_FFMPEG" value="<?php echo $config['3GP_FFMPEG']; ?>" size="30" />
<br /><?php _e("Recommended");?>: <code><?php _e("only needed if you are on a Linux server and use 3gp video,and don't embed the video. This allows postie to make thumbnail of the very first frame");?> <br /><?php _e("should be /usr/bin/ffmpeg");?></code>
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('3GP CSS Class:') ?> </th>
<td>
<input name="3GPCLASS" type="text" id="3GPCLASS" value="<?php echo $config["3GPCLASS"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>wp-mailvideo</code>
<br />
</td>
</tr>
<tr>
<th width="33%" valign="top" scope="row"><?php _e('3GP Div CSS:') ?> </th>
<td>
<input name="3GPDIV" type="text" id="3GPDIV" value="<?php echo $config["3GPDIV"]; ?>" size="50" /><br />
<?php _e("Recommended");?>: <code>postie-3gp-div</code><p>This is the CSS class of a div that wraps each 3GP video. Can be used to style the post</p>
<br />
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr><td colspan=2>
<fieldset class="options">
<legend><?php _e('Mailserver Settings');?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
<th scope="row"><?php _e('Mail Protocol:') ?></th>
<td>
<table>
<tr><td>
<select name="INPUT_PROTOCOL" id="INPUT_PROTOCOL">
<option value="pop3">POP3</option>
<?php if (HasIMAPSupport(false)):?>
<option value="imap" <?php if($config["INPUT_PROTOCOL"] == "imap") { echo "SELECTED";} ?>>IMAP</option>
<option value="pop3-ssl" <?php if($config["INPUT_PROTOCOL"] == "pop3-ssl") { echo "SELECTED";} ?>>POP3-SSL</option>
<option value="imap-ssl" <?php if($config["INPUT_PROTOCOL"] == "imap-ssl") { echo "SELECTED";} ?>>IMAP-SSL</option>
<?php else:?>
<option value="pop3" ><?php _e("IMAP/IMAP-SSL/POP3-SSL unavailable");?></option>
<?php endif;?>
</select>
</td><td>
<code><?php _e("Standard Ports:");?><br />
<?php _e("POP3");?> - 110<br />
<?php _e("IMAP");?> - 143<br />
<?php _e("IMAP-SSL");?>- 993 <br />
<?php _e("POP3-SSL");?> - 995 <br />
</code>
</td></tr></table></td>
<tr>
<th scope="row"><?php _e('Postie Time Correction:') ?> </th>
<td><input name="TIME_OFFSET" type="text" id="TIME_OFFSET" size="2" value="<?php echo $config['TIME_OFFSET']; ?>" />
<?php _e('hours') ?>
<br />
<?php _e("Recommended");?>: <code><?php _e("Should be the same as your normal offset - but this lets you adjust it in cases where that doesn't work.");?></code>
<br />
</td>
</tr>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Mail Server:') ?></th>
<td><input name="MAIL_SERVER" type="text" id="MAIL_SERVER" value="<?php echo $config["MAIL_SERVER"];?>" size="40" />
<?php _e('Port:') ?>
<input name="MAIL_SERVER_PORT" type="text" id="MAIL_SERVER_PORT" value="<?php echo $config["MAIL_SERVER_PORT"];?>" size="6" />
</td>
</tr>
<tr valign="top">
<th width="33%" scope="row"><?php _e('Mail Userid:') ?></th>
<td><input name="MAIL_USERID" type="text" id="MAIL_USERID" value="<?php echo $config["MAIL_USERID"]; ?>" size="40" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Mail Password:') ?></th>
<td>
<input name="MAIL_PASSWORD" type="text" id="MAIL_PASSWORD" value="<?php echo $config["MAIL_PASSWORD"]; ?>" size="40" />
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<p class="submit">
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" />
</p>
</form>
</div>