| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
$http_headers_is_super_admin = is_super_admin(); |
| 6 |
if (isset($_GET['status'], $_GET['code']) && $_GET['status'] == 'ERR') { |
| 7 |
switch ($_GET['code']) { |
| 8 |
case 102: |
| 9 |
?> |
| 10 |
<div class="notice notice-error"> |
| 11 |
<h2><?php esc_html_e('Error!', 'http-headers'); ?></h2> |
| 12 |
<p><?php esc_html_e('Only Super Admin users have access to this functionality.', 'http-headers'); ?></p> |
| 13 |
</div> |
| 14 |
<?php |
| 15 |
break; |
| 16 |
} |
| 17 |
} |
| 18 |
include dirname(__FILE__) . '/includes/config.inc.php'; |
| 19 |
include dirname(__FILE__) . '/includes/breadcrumbs.inc.php'; |
| 20 |
?> |
| 21 |
<form method="post" action="options.php" accept-charset="utf-8"> |
| 22 |
<?php settings_fields( 'http-headers-mtd' ); ?> |
| 23 |
<?php do_settings_sections( 'http-headers-mtd' ); ?> |
| 24 |
<div style="display: flex; justify-content: space-between; gap: 20px"> |
| 25 |
<div style="width: 50%"> |
| 26 |
<table class="hh-index-table"> |
| 27 |
<thead> |
| 28 |
<tr> |
| 29 |
<th>Directive</th> |
| 30 |
<th>Value</th> |
| 31 |
</tr> |
| 32 |
</thead> |
| 33 |
<tbody> |
| 34 |
<tr class="active"> |
| 35 |
<td>PHP version</td> |
| 36 |
<td><?php echo esc_html(PHP_VERSION); ?></td> |
| 37 |
</tr> |
| 38 |
<tr class="active"> |
| 39 |
<td>Server Software</td> |
| 40 |
<td><?php echo esc_html(getenv('SERVER_SOFTWARE')); ?></td> |
| 41 |
</tr> |
| 42 |
<tr class="active"> |
| 43 |
<td>Server API</td> |
| 44 |
<td><?php echo esc_html(PHP_SAPI); ?></td> |
| 45 |
</tr> |
| 46 |
<tr class="active"> |
| 47 |
<td>user_ini.filename</td> |
| 48 |
<td><?php echo esc_html(ini_get('user_ini.filename')); ?></td> |
| 49 |
</tr> |
| 50 |
</tbody> |
| 51 |
</table> |
| 52 |
</div> |
| 53 |
<section class="hh-panel" style="width: 50%; box-sizing: border-box; margin: 0"> |
| 54 |
<table style="width: 100%"> |
| 55 |
<thead> |
| 56 |
<tr> |
| 57 |
<th colspan="2" style="text-align: left"><?php esc_html_e('Setup Location', 'http-headers'); ?></th> |
| 58 |
</tr> |
| 59 |
</thead> |
| 60 |
<tbody> |
| 61 |
<tr> |
| 62 |
<td>Location of <code>.htaccess</code></td> |
| 63 |
<td><?php |
| 64 |
if ($http_headers_is_super_admin) { |
| 65 |
?><input type="text" name="hh_htaccess_path" placeholder="<?php echo esc_attr(get_home_path()); ?>.htaccess" style="width: 100%" value="<?php echo esc_attr(get_option('hh_htaccess_path')); ?>"><?php |
| 66 |
} else { |
| 67 |
echo esc_html(get_option('hh_htaccess_path')); |
| 68 |
} |
| 69 |
?></td> |
| 70 |
</tr> |
| 71 |
<tr> |
| 72 |
<td>Location of <code>.user.ini</code></td> |
| 73 |
<td><?php |
| 74 |
if ($http_headers_is_super_admin) { |
| 75 |
?><input type="text" name="hh_user_ini_path" placeholder="<?php echo esc_attr(get_home_path()); ?>.user.ini" style="width: 100%" value="<?php echo esc_attr(get_option('hh_user_ini_path')); ?>"><?php |
| 76 |
} else { |
| 77 |
echo esc_html(get_option('hh_user_ini_path')); |
| 78 |
} |
| 79 |
?></td> |
| 80 |
</tr> |
| 81 |
<tr> |
| 82 |
<td>Location of <code>.hh-htpasswd</code></td> |
| 83 |
<td><?php |
| 84 |
if ($http_headers_is_super_admin) { |
| 85 |
?><input type="text" name="hh_htpasswd_path" placeholder="<?php echo esc_attr(get_home_path()); ?>.hh-htpasswd" style="width: 100%" value="<?php echo esc_attr(get_option('hh_htpasswd_path')); ?>"><?php |
| 86 |
} else { |
| 87 |
echo esc_html(get_option('hh_htpasswd_path')); |
| 88 |
} |
| 89 |
?></td> |
| 90 |
</tr> |
| 91 |
<tr> |
| 92 |
<td>Location of <code>.hh-htdigest</code></td> |
| 93 |
<td><?php |
| 94 |
if ($http_headers_is_super_admin) { |
| 95 |
?><input type="text" name="hh_htdigest_path" placeholder="<?php echo esc_attr(get_home_path()); ?>.hh-htdigest" style="width: 100%" value="<?php echo esc_attr(get_option('hh_htdigest_path')); ?>"><?php |
| 96 |
} else { |
| 97 |
echo esc_html(get_option('hh_htdigest_path')); |
| 98 |
} |
| 99 |
?></td> |
| 100 |
</tr> |
| 101 |
<?php |
| 102 |
if ($http_headers_is_super_admin) { |
| 103 |
?> |
| 104 |
<tr> |
| 105 |
<td></td> |
| 106 |
<td><?php submit_button(null, 'primary', null, false); ?></td> |
| 107 |
</tr> |
| 108 |
<?php |
| 109 |
} |
| 110 |
?> |
| 111 |
</tbody> |
| 112 |
</table> |
| 113 |
</section> |
| 114 |
</div> |
| 115 |
|
| 116 |
<section class="hh-panel"> |
| 117 |
<table class="form-table hh-table"> |
| 118 |
<tbody> |
| 119 |
<tr valign="top"> |
| 120 |
<th scope="row"><?php esc_html_e('Default mode', 'http-headers'); ?> |
| 121 |
<p class="description"><?php esc_html_e('Choose a method for sending of headers. Usually, the PHP method works perfectly. However, some third-party plugins like WP Super Cache may require switching to Apache method.', 'http-headers'); ?></p> |
| 122 |
</th> |
| 123 |
<td> </td> |
| 124 |
<td> |
| 125 |
<fieldset> |
| 126 |
<?php |
| 127 |
$http_headers_items = array( |
| 128 |
'php' => __('Use PHP to send headers (deprecated)', 'http-headers'), |
| 129 |
'htaccess' => __('Use Apache (mod_headers) to send headers', 'http-headers'), |
| 130 |
); |
| 131 |
$http_headers_method = get_option('hh_method'); |
| 132 |
foreach ($http_headers_items as $http_headers_key => $http_headers_val) { |
| 133 |
if ($http_headers_is_super_admin) { |
| 134 |
?><p><label><input type="radio" name="hh_method" value="<?php echo esc_attr($http_headers_key); ?>"<?php checked($http_headers_method, $http_headers_key, true); ?>><?php echo esc_html($http_headers_val); ?></label></p><?php |
| 135 |
} else { |
| 136 |
?><p><label><input type="radio"<?php checked($http_headers_method, $http_headers_key, true); ?> disabled><?php echo esc_html($http_headers_val); ?></label></p><?php |
| 137 |
} |
| 138 |
} |
| 139 |
?> |
| 140 |
</fieldset> |
| 141 |
</td> |
| 142 |
</tr> |
| 143 |
</tbody> |
| 144 |
</table> |
| 145 |
<?php |
| 146 |
if ($http_headers_is_super_admin) { |
| 147 |
submit_button(); |
| 148 |
} |
| 149 |
?> |
| 150 |
</section> |
| 151 |
</form> |