share
8 years ago
.htaccess
11 years ago
anti_malware.php
4 years ago
class-coupon.php
6 months ago
class-email-sodium.php
3 weeks ago
class-firewall-log.php
1 week ago
class-helpers.php
7 months ago
class-import-export.php
3 months ago
class-ip.php
4 months ago
class-nfw-database.php
6 months ago
class-nfw-session.php
1 week ago
class-php-session.php
1 year ago
class-plugin-upgrade.php
1 week ago
class_mail.php
3 weeks ago
event_updates.php
9 months ago
firewall.php
4 months ago
fw_centlog.php
1 week ago
fw_fileguard.php
4 months ago
fw_livelog.php
1 year ago
help.php
3 weeks ago
helpers.php
1 week ago
i18n-extra.php
3 weeks ago
i18n.php
1 year ago
index.html
13 years ago
init_update.php
1 year ago
install.php
1 year ago
install_default.php
6 months ago
loader.php
6 months ago
mail_template_firewall.php
1 year ago
mail_template_plugin.php
1 month ago
scheduled_tasks.php
3 years ago
settings_dashboard.php
1 month ago
settings_dashboard_about.php
3 weeks ago
settings_dashboard_statistics.php
1 month ago
settings_event_notifications.php
1 month ago
settings_events.php
1 month ago
settings_firewall_options.php
1 month ago
settings_firewall_policies.php
1 week ago
settings_login_protection.php
1 month ago
settings_logs.php
1 month ago
settings_logs_firewall_log.php
3 weeks ago
settings_logs_live_log.php
1 month ago
settings_monitoring.php
3 weeks ago
settings_monitoring_file_check.php
1 month ago
settings_monitoring_file_guard.php
1 month ago
settings_network.php
1 month ago
settings_security_rules.php
1 month ago
settings_security_rules_editor.php
1 month ago
settings_security_rules_update.php
1 week ago
sign.pub
7 years ago
thickbox.php
4 years ago
widget.php
3 years ago
wpplus.php
3 months ago
thickbox.php
453 lines
| 1 | <?php |
| 2 | /* |
| 3 | +---------------------------------------------------------------------+ |
| 4 | | NinjaFirewall (WP Edition) | |
| 5 | | | |
| 6 | | (c) NinTechNet - https://nintechnet.com/ | |
| 7 | +---------------------------------------------------------------------+ |
| 8 | | This program is free software: you can redistribute it and/or | |
| 9 | | modify it under the terms of the GNU General Public License as | |
| 10 | | published by the Free Software Foundation, either version 3 of | |
| 11 | | the License, or (at your option) any later version. | |
| 12 | | | |
| 13 | | This program is distributed in the hope that it will be useful, | |
| 14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | | GNU General Public License for more details. | |
| 17 | +---------------------------------------------------------------------+ i18n+ / sa / 2 |
| 18 | */ |
| 19 | |
| 20 | if (! defined( 'NFW_ENGINE_VERSION' ) ) { die( 'Forbidden' ); } |
| 21 | |
| 22 | nf_not_allowed( 'block', __LINE__ ); |
| 23 | |
| 24 | add_thickbox(); |
| 25 | |
| 26 | if ( defined( 'NFW_WPWAF' ) ) { |
| 27 | nfw_upgrade_fullwaf(); |
| 28 | |
| 29 | } else { |
| 30 | nfw_configure_fullwaf(); |
| 31 | } |
| 32 | |
| 33 | if (! empty( $errlog_content ) ) { |
| 34 | nfw_show_errorlog( $errlog_content ); |
| 35 | } |
| 36 | |
| 37 | return; |
| 38 | |
| 39 | // --------------------------------------------------------------------- |
| 40 | |
| 41 | function nfw_show_errorlog( $errlog_content ) { |
| 42 | |
| 43 | ?> |
| 44 | <div id="nfw-errorlog-thickbox-content" style="display:none;"> |
| 45 | <h2><?php _e('NinjaFirewall error log', 'ninjafirewall') ?></h2> |
| 46 | <div id="nfwaf-step1" style="height:80%"> |
| 47 | <p style="height:100%"> |
| 48 | <textarea class="large-text code" style="color:green;height:100%" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php |
| 49 | foreach( $errlog_content as $line ) { |
| 50 | echo htmlspecialchars( $line ); |
| 51 | } |
| 52 | ?></textarea> |
| 53 | </p> |
| 54 | <form method="post" onSubmit="return nfwjs_del_errorlog()"> |
| 55 | <input type="button" class="button-primary" name="close_log" value="<?php _e('Close Log', 'ninjafirewall') ?>" onclick="tb_remove()" /> <input type="submit" class="button-secondary" name="delete-error-log" value="<?php _e('Delete Log', 'ninjafirewall') ?>" /> |
| 56 | <?php wp_nonce_field('delete_error_log', 'nfwnonce_errorlog', 0); ?> |
| 57 | </form> |
| 58 | </div> |
| 59 | </div> |
| 60 | <?php |
| 61 | } |
| 62 | // --------------------------------------------------------------------- |
| 63 | |
| 64 | function nfw_upgrade_fullwaf() { |
| 65 | |
| 66 | if (! function_exists( 'get_home_path' ) ) { |
| 67 | include_once ABSPATH .'wp-admin/includes/file.php'; |
| 68 | } |
| 69 | $NFW_ABSPATH = get_home_path(); |
| 70 | |
| 71 | ?> |
| 72 | <div id="nfw-activate-thickbox-content" style="display:none"> |
| 73 | |
| 74 | <h2><?php _e('Activate Full WAF mode', 'ninjafirewall') ?></h2> |
| 75 | <?php |
| 76 | // Detect and warn about Docker image when upgrading to Full WAF mode |
| 77 | if ( function_exists( 'getenv_docker' ) ) { |
| 78 | echo '<div class="nfw-notice nfw-notice-red"><p>'. |
| 79 | esc_html__('Warning, it seems that you are running WordPress in a Docker image: activating the Full WAF mode may crash your site. Make sure to read the following recommendations:', 'ninjafirewall' ) .' <a href="https://wordpress.org/support/topic/fatal-error-cannot-retrieve-wordpress-credentials-using-docker-image/" target="_blank" rel="noreferrer noopener">'. esc_html__('WordPress and Docker image', 'ninjafirewall') . '</a></p></div>'; |
| 80 | } |
| 81 | ?> |
| 82 | <div id="nfwaf-step1"> |
| 83 | <p> |
| 84 | <?php |
| 85 | esc_html_e('In Full WAF mode, all scripts located inside the blog installation directories and sub-directories are protected by NinjaFirewall. It gives you the highest possible level of protection: security without compromise.', 'ninjafirewall'); |
| 86 | echo ' '; |
| 87 | printf( esc_html__('It works on most websites right out of the box, or may require %ssome very little tweaks%s. But in a few cases, mostly because of some shared hosting plans restrictions, it may simply not work at all.','ninjafirewall'), '<a href="https://blog.nintechnet.com/troubleshoot-ninjafirewall-installation-problems/" title="Troubleshoot NinjaFirewall installation problems." target="_blank">', '</a>'); |
| 88 | echo ' '; |
| 89 | esc_html_e('If this happened to you, don\'t worry: you could still run it in WordPress WAF mode. Despite being less powerful than the Full WAF mode, it offers a level of protection and performance much higher than other security plugins.', 'ninjafirewall'); |
| 90 | ?> |
| 91 | </p> |
| 92 | <?php |
| 93 | // Fetch the HTTP server and PHP SAPI |
| 94 | $s1 = ''; $s2 = ''; $s3 = ''; $s4 = ''; $s5 = ''; $s6 = ''; $s7 = ''; $s8 = ''; $type = ''; |
| 95 | $recommended = ' ' . __('(recommended)', 'ninjafirewall'); |
| 96 | $display_none = ' style="display:none"'; |
| 97 | $tr_ini_userini = ''; |
| 98 | $tr_ini_phpini = $display_none; |
| 99 | $tr_htaccess_modphp = $display_none; |
| 100 | $tr_htaccess_apachelsapi = $display_none; |
| 101 | $tr_htaccess_litespeed = $display_none; |
| 102 | $tr_htaccess_openlitespeed = $display_none; |
| 103 | $tr_htaccess_suphp = $display_none; |
| 104 | $diy_div_style = ''; |
| 105 | $div_nfwaf_step2 = $display_none; |
| 106 | |
| 107 | // Mod_php |
| 108 | if ( preg_match('/apache/i', PHP_SAPI) ) { |
| 109 | $http_server = 'apachemod'; |
| 110 | $s1 = $recommended ; |
| 111 | $type = 'htaccess'; |
| 112 | $tr_htaccess_modphp = ''; |
| 113 | $tr_ini_userini = $display_none; |
| 114 | |
| 115 | // Litespeed / Openlitespeed / Apache + LSAPI |
| 116 | } elseif ( preg_match( '/litespeed/i', PHP_SAPI ) ) { |
| 117 | |
| 118 | if ( isset( $_SERVER['LSWS_EDITION'] ) && stripos( $_SERVER['LSWS_EDITION'], 'Openlitespeed') === 0 ) { |
| 119 | $http_server = 'openlitespeed'; |
| 120 | $s6 = $recommended ; |
| 121 | $type = 'htaccess'; |
| 122 | $tr_htaccess_openlitespeed = ''; |
| 123 | $tr_ini_userini = $display_none; |
| 124 | $diy_div_style = $display_none; |
| 125 | $div_nfwaf_step2 = ''; |
| 126 | |
| 127 | } elseif ( isset( $_SERVER['SERVER_SOFTWARE'] ) && $_SERVER['SERVER_SOFTWARE'] == 'LiteSpeed' ) { |
| 128 | $http_server = 'litespeed'; |
| 129 | $s5 = $recommended ; |
| 130 | $type = 'htaccess'; |
| 131 | $tr_htaccess_litespeed = ''; |
| 132 | $tr_ini_userini = $display_none; |
| 133 | |
| 134 | } else { |
| 135 | $http_server = 'apachelsapi'; |
| 136 | $s8 = $recommended ; |
| 137 | $type = 'htaccess'; |
| 138 | $tr_htaccess_apachelsapi = ''; |
| 139 | $tr_ini_userini = $display_none; |
| 140 | } |
| 141 | |
| 142 | } else { |
| 143 | $type = 'ini'; |
| 144 | // Apache FCGI |
| 145 | if ( preg_match('/apache/i', $_SERVER['SERVER_SOFTWARE']) ) { |
| 146 | $http_server = 'apachecgi'; |
| 147 | $s2 = $recommended ; |
| 148 | |
| 149 | // NGINX |
| 150 | } elseif ( preg_match('/nginx/i', $_SERVER['SERVER_SOFTWARE']) ) { |
| 151 | $http_server = 'nginx'; |
| 152 | $s4 = $recommended; |
| 153 | |
| 154 | // Other webserver with FCGI |
| 155 | } else { |
| 156 | $http_server = 'othercgi'; |
| 157 | $s7 = $recommended ; |
| 158 | } |
| 159 | } |
| 160 | ?> |
| 161 | <table class="form-table nfw-table"> |
| 162 | <tr> |
| 163 | <th scope="row" class="row-med"><?php _e('Select your HTTP server and your PHP server API', 'ninjafirewall') ?> (<code>SAPI</code>)</th> |
| 164 | <td> |
| 165 | <?php /* HTTP value must be changed in JS and main script as well */ ?> |
| 166 | <select class="input" name="http_server" onchange="nfwjs_httpserver(this.value)"> |
| 167 | <option value="1"<?php selected($http_server, 'apachemod') ?>>Apache + PHP<?php echo PHP_MAJOR_VERSION ?> module<?php echo $s1 ?></option> |
| 168 | <option value="2"<?php selected($http_server, 'apachecgi') ?>>Apache + CGI/FastCGI or PHP-FPM<?php echo $s2 ?></option> |
| 169 | <option value="3"<?php selected($http_server, 'apachesuphp') ?>>Apache + suPHP</option> |
| 170 | <option value="8"<?php selected($http_server, 'apachelsapi') ?>>Apache + LSAPI/Cloudlinux<?php echo $s8 ?></option> |
| 171 | <option value="4"<?php selected($http_server, 'nginx') ?>>Nginx + CGI/FastCGI or PHP-FPM<?php echo $s4 ?></option> |
| 172 | <option value="5"<?php selected($http_server, 'litespeed') ?>>Litespeed<?php echo $s5 ?></option> |
| 173 | <option value="6"<?php selected($http_server, 'openlitespeed') ?>>Openlitespeed<?php echo $s6 ?></option> |
| 174 | <option value="7"<?php selected($http_server, 'othercgi') ?>><?php _e('Other webserver + CGI/FastCGI or PHP-FPM', 'ninjafirewall') ?><?php echo $s6 ?></option> |
| 175 | </select> |
| 176 | <p class="description"><a class="links" href="<?php echo wp_nonce_url( '?page=NinjaFirewall&nfw_act=99', 'show_phpinfo', 'nfwnonce' ); ?>" target="_blank"><?php _e('View PHPINFO', 'ninjafirewall') ?></a></p> |
| 177 | </td> |
| 178 | </tr> |
| 179 | <?php |
| 180 | $f1 = ''; $f2 = ''; |
| 181 | if ( file_exists( $NFW_ABSPATH .'.user.ini' ) ) { |
| 182 | $ini_type = 1; |
| 183 | $f1 = $recommended; |
| 184 | $tr_ini_phpini = $display_none; |
| 185 | $tr_ini_userini = ''; |
| 186 | } elseif ( file_exists( $NFW_ABSPATH .'php.ini' ) ) { |
| 187 | $ini_type = 2; |
| 188 | $f2 = $recommended; |
| 189 | $tr_ini_phpini = ''; |
| 190 | $tr_ini_userini = $display_none; |
| 191 | } else { |
| 192 | // fall back to .user.ini |
| 193 | $ini_type = 1; |
| 194 | $f1 = $recommended; |
| 195 | $tr_ini_phpini = $display_none; |
| 196 | $tr_ini_userini = ''; |
| 197 | } |
| 198 | // Hide all ini input if no ini required |
| 199 | if ( $type == 'ini' ) { |
| 200 | $ini_style = ''; |
| 201 | } else { |
| 202 | $ini_style = ' style="display:none"'; |
| 203 | $tr_ini_phpini = $display_none; |
| 204 | $tr_ini_userini = $display_none; |
| 205 | } |
| 206 | ?> |
| 207 | <tr id="tr-select-ini"<?php echo $ini_style ?>> |
| 208 | <th scope="row" class="row-med"><?php _e('Select the PHP initialization file supported by your server', 'ninjafirewall') ?></th> |
| 209 | <td> |
| 210 | <p><label><input type="radio" id="ini-type-user" onClick="nfwjs_radio_ini(1)" name="ini_type" value="1"<?php checked( $ini_type, 1 ) ?>><code>.user.ini</code><?php echo $f1 ?></label></p> |
| 211 | <p><label><input type="radio" id="ini-type-php" onClick="nfwjs_radio_ini(2)" name="ini_type" value="2"<?php checked( $ini_type, 2 ) ?>><code>php.ini</code><?php echo $f2 ?></label></p> |
| 212 | </td> |
| 213 | </tr> |
| 214 | </table> |
| 215 | </div> |
| 216 | |
| 217 | <table class="form-table nfw-table"> |
| 218 | <tr> |
| 219 | <th scope="row" class="row-med"><?php esc_html_e('Folders protected by NinjaFirewall', 'ninjafirewall') ?></th> |
| 220 | <td> |
| 221 | <?php esc_html_e('WordPress root directory:', 'ninjafirewall') ?> <code><?php echo htmlentities( ABSPATH ) ?></code> |
| 222 | <?php |
| 223 | $list = nfw_display_directories(); |
| 224 | ?> |
| 225 | <br /> |
| 226 | <p><?php esc_html_e('The following folders will be protected by NinjaFirewall. If you want to exclude some of them, uncheck them in the list below:', 'ninjafirewall') ?></p> |
| 227 | <div class="nfw-sub"> |
| 228 | <table class="form-table" style="margin-top:0"> |
| 229 | <?php echo $list ?> |
| 230 | </table> |
| 231 | </div> |
| 232 | <span class="description" style="color:#646970;"><?php esc_html_e('After setting up the Full WAF mode, you could come back to this page to re-configure it whenever you want.', 'ninjafirewall') ?></span> |
| 233 | </td> |
| 234 | </tr> |
| 235 | </table> |
| 236 | |
| 237 | <br /> |
| 238 | |
| 239 | <div class="font-15px" id="diy-div"<?php echo $diy_div_style ?>> |
| 240 | <p><label><input onClick="nfwjs_diy_chg(this.value)" id="diynfw" type="radio" name="diy-choice" value="nfw" checked /> <?php _e('Let NinjaFirewall make the necessary changes (recommended).', 'ninjafirewall') ?></label> |
| 241 | <br /> |
| 242 | <label><input onClick="nfwjs_diy_chg(this.value)" type="radio" name="diy-choice" value="usr" /> <?php _e('I want to make the changes myself.', 'ninjafirewall') ?></label></p> |
| 243 | <div id="diy-msg" style="display:none;background:#FFFFFF;border-left:4px solid #fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 15px;padding:1px 12px;border-left-color:orange;"> |
| 244 | <p><?php _e('Please make the changes below, then click on the "Finish Installation" button.', 'ninjafirewall') ?></p> |
| 245 | </div> |
| 246 | </div> |
| 247 | <?php |
| 248 | require_once __DIR__ .'/install.php'; |
| 249 | nfw_get_constants(); |
| 250 | |
| 251 | $file_missing = __('The %s file must be created, and the following lines of code added to it:', 'ninjafirewall'); |
| 252 | $file_exist = __('The following lines of code must be added to your existing %s file:', 'ninjafirewall'); |
| 253 | ?> |
| 254 | |
| 255 | <div id="nfwaf-step2"<?php echo $div_nfwaf_step2 ?>> |
| 256 | |
| 257 | <table class="form-table"> |
| 258 | <tr id="tr-ini-userini"<?php echo $tr_ini_userini ?>> |
| 259 | <td> |
| 260 | <?php |
| 261 | if ( file_exists( $NFW_ABSPATH .'.user.ini' ) ) { |
| 262 | $text = sprintf( $file_exist, '<code>'. htmlspecialchars( $NFW_ABSPATH ) .'<b>.user.ini</b>' .'</code>'); |
| 263 | } else { |
| 264 | $text = sprintf( $file_missing, '<code>'. htmlspecialchars( $NFW_ABSPATH ) .'<b>.user.ini</b>' .'</code>'); |
| 265 | } |
| 266 | echo $text; |
| 267 | ?> |
| 268 | <br /><textarea name="txtlog" class="large-text code" rows="6" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_PHPINI_BEGIN ."\n" . NFW_PHPINI_DATA ."\n". NFW_PHPINI_END ."\n"; ?></textarea> |
| 269 | </td> |
| 270 | </tr> |
| 271 | <tr id="tr-ini-phpini"<?php echo $tr_ini_phpini ?>> |
| 272 | <td> |
| 273 | <?php |
| 274 | if ( file_exists( $NFW_ABSPATH .'php.ini' ) ) { |
| 275 | $text = sprintf( $file_exist, '<code>'. htmlspecialchars( $NFW_ABSPATH ) .'<b>php.ini</b>' .'</code>'); |
| 276 | } else { |
| 277 | $text = sprintf( $file_missing, '<code>'. htmlspecialchars( $NFW_ABSPATH ) .'<b>php.ini</b>' .'</code>'); |
| 278 | } |
| 279 | echo $text; |
| 280 | ?> |
| 281 | <br /><textarea name="txtlog" class="large-text code" rows="6" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_PHPINI_BEGIN ."\n" . NFW_PHPINI_DATA ."\n". NFW_PHPINI_END ."\n"; ?></textarea> |
| 282 | </td> |
| 283 | </tr> |
| 284 | |
| 285 | |
| 286 | <?php |
| 287 | if ( file_exists( $NFW_ABSPATH .'.htaccess' ) ) { |
| 288 | $text = sprintf( $file_exist, '<code>'. htmlspecialchars( $NFW_ABSPATH ) .'<b>.htaccess</b>' .'</code>'); |
| 289 | } else { |
| 290 | $text = sprintf( $file_missing, '<code>'. htmlspecialchars( $NFW_ABSPATH ) .'<b>.htaccess</b>' .'</code>'); |
| 291 | } |
| 292 | ?> |
| 293 | <tr id="tr-htaccess-apachelsapi"<?php echo $tr_htaccess_apachelsapi ?>> |
| 294 | <td> |
| 295 | <?php |
| 296 | echo $text; |
| 297 | ?> |
| 298 | <br /><textarea name="txtlog" class="large-text code" rows="6" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_HTACCESS_BEGIN ."\n" . NFW_APACHELSAPI_DATA ."\n". NFW_HTACCESS_END ."\n"; ?></textarea> |
| 299 | </td> |
| 300 | </tr> |
| 301 | <tr id="tr-htaccess-modphp"<?php echo $tr_htaccess_modphp ?>> |
| 302 | <td> |
| 303 | <?php |
| 304 | echo $text; |
| 305 | ?> |
| 306 | <br /><textarea name="txtlog" class="large-text code" rows="6" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_HTACCESS_BEGIN ."\n" . NFW_HTACCESS_DATA ."\n". NFW_HTACCESS_END ."\n"; ?></textarea> |
| 307 | </td> |
| 308 | </tr> |
| 309 | <tr id="tr-htaccess-litespeed"<?php echo $tr_htaccess_litespeed ?>> |
| 310 | <td> |
| 311 | <?php |
| 312 | echo $text; |
| 313 | ?> |
| 314 | <br /><textarea name="txtlog" class="large-text code" rows="6" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_HTACCESS_BEGIN ."\n" . NFW_LITESPEED_DATA ."\n". NFW_HTACCESS_END ."\n"; ?></textarea> |
| 315 | </td> |
| 316 | </tr> |
| 317 | <tr id="tr-htaccess-openlitespeed"<?php echo $tr_htaccess_openlitespeed ?>> |
| 318 | <td> |
| 319 | <?php |
| 320 | esc_html_e('Log in to your Openlitespeed admin dashboard, click on "Virtual Host", select your domain, add the following instructions to the "php.ini Override" section in the "General" tab, and restart Openlitespeed:', 'ninjafirewall' ); |
| 321 | ?> |
| 322 | <br /><textarea name="txtlog" class="large-text code" rows="4" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_OPENLITESPEED_DATA ."\n"; ?></textarea> |
| 323 | <br /> |
| 324 | <br /> |
| 325 | <div style="background:#FFFFFF;border-left:4px solid #fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 15px;padding:1px 12px;border-left-color:orange;"> |
| 326 | <br> |
| 327 | <?php _e('Important: if one day you wanted to uninstall NinjaFirewall, do not forget to remove these instructions from your Openlitespeed admin dashboard <strong>before</strong> uninstalling NinjaFirewall because this installer could not do it for you.', 'ninjafirewall') ?> |
| 328 | <br> |
| 329 | </div> |
| 330 | </td> |
| 331 | </tr> |
| 332 | <tr id="tr-htaccess-suphp"<?php echo $tr_htaccess_suphp ?>> |
| 333 | <td> |
| 334 | <?php |
| 335 | echo $text; |
| 336 | ?> |
| 337 | <br /><textarea name="txtlog" class="large-text code" rows="6" style="color:green;font-size:13px" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" wrap="off"><?php echo NFW_HTACCESS_BEGIN ."\n" . NFW_SUPHP_DATA ."\n". NFW_HTACCESS_END ."\n"; ?></textarea> |
| 338 | </td> |
| 339 | </tr> |
| 340 | </table> |
| 341 | </div> |
| 342 | <div> |
| 343 | <p id="enable-sandbox"><label><input type="checkbox" checked="checked" name="enable_sandbox" /> <?php _e('Enable the sandbox.', 'ninjafirewall'); ?></label><br /><span class="description" style="color: #646970;"><?php _e('If there were a problem during the installation, NinjaFirewall would undo those changes automatically for you.', 'ninjafirewall') ?></span></p> |
| 344 | <input id="btn-waf-next" type="button" class="button-primary" name="step" value="<?php _e('Finish Installation', 'ninjafirewall') ?> »" onclick="nfwjs_fullwafsubmit()" /> |
| 345 | <?php wp_nonce_field('events_save', 'nfwnonce_fullwaf', 0); ?> |
| 346 | </div> |
| 347 | <br /> |
| 348 | <br /> |
| 349 | </div> |
| 350 | |
| 351 | <?php |
| 352 | } |
| 353 | |
| 354 | // --------------------------------------------------------------------- |
| 355 | // Configure Full WAF mode or downgrade to WP WAF mode. |
| 356 | |
| 357 | function nfw_configure_fullwaf() { |
| 358 | |
| 359 | ?> |
| 360 | <div id="nfw-configure-thickbox-content" style="display:none"> |
| 361 | |
| 362 | <h2><?php esc_html_e('Configuration', 'ninjafirewall') ?></h2> |
| 363 | |
| 364 | <table class="form-table nfw-table"> |
| 365 | <tr> |
| 366 | <th scope="row" class="row-med"><?php esc_html_e('Full WAF mode', 'ninjafirewall') ?></th> |
| 367 | <td> |
| 368 | <?php esc_html_e('WordPress root directory:', 'ninjafirewall') ?> <code><?php echo htmlentities( ABSPATH ) ?></code> |
| 369 | <?php |
| 370 | $list = nfw_display_directories(); |
| 371 | ?> |
| 372 | <br /> |
| 373 | <p><?php esc_html_e('The following folders will be protected by NinjaFirewall. If you want to exclude some of them, uncheck them in the list below:', 'ninjafirewall') ?></p> |
| 374 | <div class="nfw-sub"> |
| 375 | <table class="form-table" style="margin-top:0"> |
| 376 | <?php echo $list ?> |
| 377 | </table> |
| 378 | </div> |
| 379 | <br /> |
| 380 | <input id="btn-waf-next" type="button" class="button-secondary" name="fullwaf-configure" value="<?php esc_attr_e('Save Changes', 'ninjafirewall') ?>" onclick="nfwjs_fullwafconfig(1)" /> |
| 381 | </td> |
| 382 | </tr> |
| 383 | </table> |
| 384 | |
| 385 | <br /> |
| 386 | |
| 387 | <?php wp_nonce_field('events_save', 'nfwnonce_fullwaf', 0); ?> |
| 388 | |
| 389 | <table class="form-table nfw-table"> |
| 390 | <tr> |
| 391 | <th scope="row" class="row-med"><?php esc_html_e('WordPress WAF mode', 'ninjafirewall') ?></th> |
| 392 | <td> |
| 393 | <?php |
| 394 | // Look for OpenLitespeed: |
| 395 | if ( preg_match( '/litespeed/i', PHP_SAPI ) && isset( $_SERVER['LSWS_EDITION'] ) && |
| 396 | stripos( $_SERVER['LSWS_EDITION'], 'Openlitespeed') === 0 ) { |
| 397 | |
| 398 | esc_html_e('If you want to downgrade to WordPress WAF mode, log in to your Openlitespeed admin dashboard, click on "Virtual Host", select your domain and remove the "auto_prepend_file" directive from the "php.ini Override" section in the "General" tab, and restart Openlitespeed.', 'ninjafirewall' ); ?> |
| 399 | <p><input type="button" class="button-secondary" value="<?php esc_attr_e('Downgrade to WordPress WAF mode', 'ninjafirewall') ?>" disabled /></p> |
| 400 | <br /> |
| 401 | <?php |
| 402 | } else { |
| 403 | esc_html_e('If you want to downgrade to WordPress WAF mode, click the button below.', 'ninjafirewall') ?> |
| 404 | <br /> |
| 405 | <br /> |
| 406 | <input id="btn-waf-next" type="button" class="button-secondary" name="fullwaf-downgrade" value="<?php esc_attr_e('Downgrade to WordPress WAF mode', 'ninjafirewall') ?>" onclick="nfwjs_fullwafconfig(2)" /> |
| 407 | <br /> |
| 408 | <span class="description" style="color: #646970;"><?php esc_html_e('You may have to wait five minutes for the changes to take effect.', 'ninjafirewall') ?></span> |
| 409 | <?php |
| 410 | } |
| 411 | ?> |
| 412 | </td> |
| 413 | </tr> |
| 414 | </table> |
| 415 | <p><input type="button" class="button-secondary" value="<?php esc_attr_e('Cancel and Close', 'ninjafirewall') ?>" onclick="tb_remove();" /></p> |
| 416 | </div> |
| 417 | |
| 418 | <?php |
| 419 | } |
| 420 | |
| 421 | // --------------------------------------------------------------------- |
| 422 | // Display directories browser. |
| 423 | |
| 424 | function nfw_display_directories() { |
| 425 | |
| 426 | $nfw_options = nfw_get_option( 'nfw_options' ); |
| 427 | $nfw_exclude_waf_list = array(); |
| 428 | if (! empty( $nfw_options['exclude_waf_list'] ) ) { |
| 429 | $nfw_exclude_waf_list = json_decode( $nfw_options['exclude_waf_list'], true ); |
| 430 | } |
| 431 | $absfiles = scandir( ABSPATH ); |
| 432 | $list = ''; |
| 433 | $row = 0; |
| 434 | foreach( $absfiles as $item ) { |
| 435 | $checked = ''; |
| 436 | if ( $item != '.' && $item != '..' && is_dir( ABSPATH. $item ) ) { |
| 437 | if (! in_array( $item, $nfw_exclude_waf_list ) ) { |
| 438 | $checked = ' checked'; |
| 439 | } |
| 440 | ++$row; |
| 441 | if ( $row % 2 == 0 ) { |
| 442 | $r_color = 'f-white'; |
| 443 | } else { |
| 444 | $r_color = 'f-grey'; |
| 445 | } |
| 446 | $list .= '<tr class="'. $r_color .'"><td class="dir-list"><label><input type="checkbox" name="nfw_exclude_waf_list[]" value="'. htmlspecialchars( $item ) .'"'. $checked .' /> '. htmlspecialchars( $item ) .'/</label></td></tr>'; |
| 447 | } |
| 448 | } |
| 449 | return $list; |
| 450 | } |
| 451 | // --------------------------------------------------------------------- |
| 452 | // EOF |
| 453 |