136
|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
if(!defined('WP_ADMIN') OR !current_user_can('manage_options')) wp_die(__('You do not have sufficient permissions to access this page.')); |
|
5 |
|
|
6 |
load_plugin_textdomain('wp-explorer', 'wp-content/plugins/wp-explorer'); |
|
7 |
if($_POST['do'] == 'update') |
|
8 |
{ |
|
9 |
require ('inc/functions_misc.php'); |
|
10 |
check_admin_referer('update-wp-explorer-options'); |
|
11 |
$wp_explorer_options = $_POST['wp_explorer_options']; |
|
12 |
$wp_explorer_default = wp_explorer_opmap(); |
|
13 |
|
|
14 |
if ($wp_explorer_options) |
|
15 |
{ |
|
16 |
foreach ($wp_explorer_options as $key => $value) |
|
17 |
{ |
|
18 |
$wp_explorer_options[$key] = $_POST['revert'][$key] ? $wp_explorer_default[$key] : stripslashes_deep(trim($value)); |
|
19 |
} |
|
20 |
update_option('wp_explorer_options', $wp_explorer_options); |
|
21 |
?><div id="message" class="updated fade"><p><?php _e('Options saved.', 'wp-explorer') ?></p></div><?php |
|
22 |
} |
|
23 |
} |
|
24 |
|
|
25 |
$wp_explorer_options = get_option('wp_explorer_options'); |
|
26 |
$wp_explorer_options_map[] = array('name' => 'tmp_main', 'title' => __('Template: Main', 'wp-explorer'), 'input' => 'textarea' ); |
|
27 |
$wp_explorer_options_map[] = array('name' => 'tmp_dirtbl', 'title' => __('Template: Folders Table', 'wp-explorer'), 'input' => 'textarea' ); |
|
28 |
$wp_explorer_options_map[] = array('name' => 'tmp_dirbit', 'title' => __('Template: Folders Bit', 'wp-explorer'), 'input' => 'textarea' ); |
|
29 |
$wp_explorer_options_map[] = array('name' => 'tmp_filetbl', 'title' => __('Template: Files Table', 'wp-explorer'), 'input' => 'textarea' ); |
|
30 |
$wp_explorer_options_map[] = array('name' => 'tmp_filebit', 'title' => __('Template: Files Bit', 'wp-explorer'), 'input' => 'textarea' ); |
|
31 |
$wp_explorer_options_map[] = array('name' => 'tmp_error', 'title' => __('Template: Error', 'wp-explorer'), 'input' => 'textarea' ); |
|
32 |
$wp_explorer_options_map[] = array('name' => 'exclude_files', 'title' => __('Exclude Files From Listing', 'wp-explorer'), 'input' => 'text' ); |
|
33 |
$wp_explorer_options_map[] = array('name' => 'exclude_folders', 'title' => __('Exclude Folders From Listing', 'wp-explorer'), 'input' => 'text' ); |
|
34 |
$wp_explorer_options_map[] = array('name' => 'exclude_extensions', 'title' => __('Exclude Extensions From Listing', 'wp-explorer'), 'input' => 'text' ); |
|
35 |
$wp_explorer_options_map[] = array('name' => 'enable_antileech', 'title' => __('Enable htaccess anti-leech protection', 'wp-explorer'), 'input' => 'radioyesno' ); |
|
36 |
$wp_explorer_options_map[] = array('name' => 'enable_fancylinks', 'title' => __('Enable Pretty Links', 'wp-explorer'), 'input' => 'radioyesno' ); |
|
37 |
?> |
|
38 |
|
|
39 |
<div class="wrap"> |
|
40 |
<h2><?php _e('WP Explorer Options', 'wp-explorer'); ?></h2> |
|
41 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> |
|
42 |
<?php wp_nonce_field('update-wp-explorer-options') ?> |
|
43 |
<table class="form-table"> |
|
44 |
<?php |
|
45 |
foreach($wp_explorer_options_map as $opt): |
|
46 |
$id = $opt['name']; |
|
47 |
$name = 'wp_explorer_options['.$opt['name'].']'; |
|
48 |
$value = attribute_escape($wp_explorer_options[$id]); |
|
49 |
?> |
|
50 |
<tr valign="top"> |
|
51 |
<th scope="row" nowrap="nowrap"><?php echo $opt['title']; ?>:</th> |
|
52 |
<td> |
|
53 |
<?php |
|
54 |
if($opt['input'] == 'textarea'): ?> |
|
55 |
<textarea cols="80" rows="20" id="<?php echo $id; ?>" name="<?php echo $name; ?>"><?php echo $value; ?></textarea> <?php |
|
56 |
if(substr($id, 0, 4) == 'tmp_'): ?> |
|
57 |
<br /><input type="checkbox" name="revert[<?php echo $id; ?>]" value="1" /> <?php _e('Revert Template', 'wp-explorer'); |
|
58 |
endif; |
|
59 |
elseif($opt['input'] == 'text'): ?> |
|
60 |
<input size="80" type="text" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="<?php echo $value; ?>" /><br /> |
|
61 |
<?php _e('Separate with commas', 'wp-explorer'); |
|
62 |
elseif($opt['input'] == 'radioyesno'): ?> |
|
63 |
<input type="radio" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="1" <?php echo ($value ? 'checked="checked"' : ''); ?>/><?php _e('Yes', 'wp-explorer'); ?> |
|
64 |
<input type="radio" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="0" <?php echo (!$value ? 'checked="checked"' : ''); ?>/><?php _e('No', 'wp-explorer'); ?> |
|
65 |
<?php endif; ?> |
|
66 |
</td> |
|
67 |
</tr> |
|
68 |
<?php endforeach; ?> |
|
69 |
<tr> |
|
70 |
<td colspan="2" align="center"> |
|
71 |
<input type="hidden" name="do" value="update" /> |
|
72 |
<input type="submit" name="submit" class="button" value="<?php _e('Save Changes', 'wp-explorer'); ?>" /> |
|
73 |
</td> |
|
74 |
</tr> |
|
75 |
</table> |
|
76 |
</form> |
|
77 |
</div> |