WP htaccess Control - Version 2.7.2

Version Description

(30/03/2012) = * Feature: added Login Control.

Download this release

Release Info

Developer antonioandra.de
Plugin Icon wp plugin WP htaccess Control
Version 2.7.2
Comparing to
See all releases

Code changes from version 2.7.1 to 2.7.2

readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4man
7
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
8
  Requires at least: 2.7
9
  Tested up to: 3.3.1
10
- Stable tag: 2.7.1
11
 
12
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
13
 
@@ -25,7 +25,8 @@ Despite the name, many of the options now present on this plugin do not use the
25
  * Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
26
  * Customization (and canonization) of the Search Permalink Base;
27
  * Category, Author and Tag based archives (ex: *"http://your-site.com/category/stories/2010/12"*, *"http://your-site.com/author/admin/2010/12/page/2"* and *"http://your-site.com/tag/wordpress/2010/12"*), this will also work if you've removed the category base;
28
- * Maintenance mode.
 
29
 
30
  **Easy to use "Suggested htaccess" rules:**
31
 
@@ -75,6 +76,9 @@ Search redirection is based on Mark Jaquith's **Nice Search** but extended so th
75
 
76
  == Changelog ==
77
 
 
 
 
78
  = 2.7.1 (30/03/2012) =
79
  * *Fix:* regenerate rules on user creation or deletion;
80
  * *Fix:* toggle handle height glitch (admin panel);
7
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
8
  Requires at least: 2.7
9
  Tested up to: 3.3.1
10
+ Stable tag: 2.7.2
11
 
12
  Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
13
 
25
  * Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
26
  * Customization (and canonization) of the Search Permalink Base;
27
  * Category, Author and Tag based archives (ex: *"http://your-site.com/category/stories/2010/12"*, *"http://your-site.com/author/admin/2010/12/page/2"* and *"http://your-site.com/tag/wordpress/2010/12"*), this will also work if you've removed the category base;
28
+ * Maintenance mode;
29
+ * wp-login.php redirection.
30
 
31
  **Easy to use "Suggested htaccess" rules:**
32
 
76
 
77
  == Changelog ==
78
 
79
+ = 2.7.2 (30/03/2012) =
80
+ * *Feature:* added Login Control.
81
+
82
  = 2.7.1 (30/03/2012) =
83
  * *Fix:* regenerate rules on user creation or deletion;
84
  * *Fix:* toggle handle height glitch (admin panel);
wp-htaccess-control-ui.php CHANGED
@@ -44,7 +44,7 @@ $WPhtc_data=get_option('WPhtc_data');
44
  <li><a href="http://antonioandra.de/wp-htaccess-control"><img width="16" height="16" src="http://antonioandra.de/wp-content/themes/antonioandra.de/images/antonioandra.de_favicon.png"> Plugin Homepage</a></li>
45
  <li><a href="http://wordpress.org/extend/plugins/wp-htaccess-control/"><img src="http://s.wordpress.org/favicon.ico?3"> Plugin at Wordpress.org </a></li>
46
  <!--<li><a href="http://dardna.com/"><img src="http://dardna.com/favicon.ico"> Author Homepage</a></li>-->
47
- <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4mancha%40gmail%2ecom&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_US/i/icon/pp_favicon_x.ico"> Donate with Paypal</a></li>
48
  </ul>
49
  </div>
50
  </div>
@@ -456,6 +456,60 @@ $WPhtc_data=get_option('WPhtc_data');
456
  </tr>
457
  </table>
458
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  <?php wp_nonce_field('WPhtc_settings'); ?>
460
  <input type="hidden" name="action" value="update" />
461
  <div class="wphtc-menu">
44
  <li><a href="http://antonioandra.de/wp-htaccess-control"><img width="16" height="16" src="http://antonioandra.de/wp-content/themes/antonioandra.de/images/antonioandra.de_favicon.png"> Plugin Homepage</a></li>
45
  <li><a href="http://wordpress.org/extend/plugins/wp-htaccess-control/"><img src="http://s.wordpress.org/favicon.ico?3"> Plugin at Wordpress.org </a></li>
46
  <!--<li><a href="http://dardna.com/"><img src="http://dardna.com/favicon.ico"> Author Homepage</a></li>-->
47
+ <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=s4mancha%40gmail%2ecom&lc=US&item_name=WP%20htaccess%20Control%20%28Antonio%20Andrade%29&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img width="16" height="16" src="https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_US/i/icon/pp_favicon_x.ico"> Donate with Paypal</a></li>
48
  </ul>
49
  </div>
50
  </div>
456
  </tr>
457
  </table>
458
  </div>
459
+ <!-- Login Control -->
460
+ <div class="wphtc-section">
461
+ <div class="wphtc-section-title stuffbox">
462
+ <div title="Click to toggle" class="handlediv" style="background:url('<?php bloginfo("wpurl")?>/wp-admin/images/menu-bits.gif') no-repeat scroll left -111px transparent"><br></div>
463
+ <h3><?php _e('Login Control', 'wp-htaccess-control'); ?></h3>
464
+ </div>
465
+ <table class="form-table wphtc-inputs">
466
+ <tr valign="top">
467
+ <th scope="row" style="width:18%;"></th>
468
+ <td valign="middle" colspan="2">
469
+ <p class="description"><?php _e('The options below concern wp-login.php. You\'ll be able to redirect all traffic away from that page and set some allowed IPs.', 'wp-htaccess-control'); ?></p>
470
+ <p class="description"><?php _e('BEWARE: once disabled you won\'t be able to login through that form in any way, except for the listed IPs.', 'wp-htaccess-control'); ?></p>
471
+ <p class="description"><?php _e('If everything goes wrong directly edit your .htaccess file and delete the relevant part somewhere at the top.', 'wp-htaccess-control'); ?></p>
472
+ </td>
473
+ </tr>
474
+ <tr valign="top">
475
+ <th scope="row" style="width:18%;"><?php _e('Disable wp-login.php', 'wp-htaccess-control'); ?></th>
476
+ <td>
477
+ <input type="checkbox" name="WPhtc_login_disabled" value="true" <?php if($WPhtc_data['login_disabled']){ echo "checked";}?>/>
478
+ </td>
479
+ <td valign="middle">
480
+ <p class="description"><?php _e('This is the main switch. Make sure you know what you\'re doing.', 'wp-htaccess-control'); ?></p>
481
+ </td>
482
+ </tr>
483
+ <tr valign="top">
484
+ <th scope="row" style="width:18%;"><?php _e('Redirect', 'wp-htaccess-control'); ?></th>
485
+ <td valign="middle">
486
+ <input type="text" name="WPhtc_login_redirection" value="<?php echo $WPhtc_data['login_redirection']?>"/>
487
+ </td>
488
+ <td valign="middle">
489
+ <p class="description"><?php _e('This will be used as redirection url. You might use something like "member-login" to redirect people to "http://yoursite.com/member-login/". If empty the home page will be served as redirection.', 'wp-htaccess-control'); ?></p>
490
+ </td>
491
+ </tr>
492
+ <tr valign="top">
493
+ <th scope="row" style="width:18%;"><?php _e('Allowed IPs', 'wp-htaccess-control'); ?></th>
494
+ <td>
495
+ <textarea name="WPhtc_login_ips"><?php if(isset($WPhtc_data['login_ips'])){echo implode($WPhtc_data['login_ips'],"\n");}?></textarea>
496
+ </td>
497
+ <td valign="middle">
498
+ <p class="description"><?php _e('List of IPs allowed to access wp-login.php.', 'wp-htaccess-control'); ?></p>
499
+ <p class="description"><?php _e('Make sure you are have a static IP when using this.'); ?></p>
500
+ </td>
501
+ </tr>
502
+ <tr valign="top">
503
+ <th scope="row" style="width:18%;"><?php _e('Half-mode', 'wp-htaccess-control'); ?></th>
504
+ <td>
505
+ <input type="checkbox" name="WPhtc_login_half_mode" value="true" <?php if($WPhtc_data['login_half_mode']){ echo "checked";}?>/>
506
+ </td>
507
+ <td valign="middle">
508
+ <p class="description"><?php _e('(BETA) If set, this will still allow access to POST (login) requests, logout and to the password recovery form. I don\'t think this is very useful at the moment (login error messages will still show up on wp-login.php) but may be helpful for AJAX use.', 'wp-htaccess-control'); ?></p>
509
+ </td>
510
+ </tr>
511
+ </table>
512
+ </div>
513
  <?php wp_nonce_field('WPhtc_settings'); ?>
514
  <input type="hidden" name="action" value="update" />
515
  <div class="wphtc-menu">
wp-htaccess-control.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
6
- Version: 2.7.1
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
@@ -338,6 +338,26 @@ if (!class_exists("WPhtc")) {
338
  }
339
  $new_rules.="# WPhtc: End Maintenance Mode\n";
340
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  # Custom htaccess
342
  if($WPhtc_data['hta']){
343
  $new_rules.="\n# WPhtc: Begin Custom htaccess\n";
@@ -641,6 +661,18 @@ if (!class_exists("WPhtc")) {
641
  }
642
  }
643
  $WPhtc_data['maintenance_redirection']=trim($_POST['WPhtc_maintenance_redirection']);
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
  # Unsetting inclusion of Author pages on Google XML Sitemap options, we'll add those links to the sitemap later with our Custom Author Permalink
646
  $WPhtc_data['sm_enabled']=$_POST['WPhtc_sm_enabled'];
3
  Plugin Name: WP htaccess Control
4
  Plugin URI: http://dardna.com/wp-htaccess-control
5
  Description: Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
6
+ Version: 2.7.2
7
  Author: António Andrade
8
  Author URI: http://dardna.com
9
  */
338
  }
339
  $new_rules.="# WPhtc: End Maintenance Mode\n";
340
  }
341
+
342
+ # Login Control
343
+ if($WPhtc_data['login_disabled']){
344
+ $no_ips=count($WPhtc_data['login_ips']);
345
+ $new_rules.="\n# WPhtc: Begin Login Control (start deleting here if you're having trouble logging in)\n";
346
+ # redirect
347
+ $new_rules.="RewriteEngine on\n";
348
+ $new_rules.="RewriteCond %{REQUEST_URI} .wp-login\.php* [NC]\n";
349
+ if($WPhtc_data['login_half_mode']){
350
+ $new_rules.="RewriteCond %{REQUEST_METHOD} !=POST\n";
351
+ $new_rules.="RewriteCond %{QUERY_STRING} !action=(logout|lostpassword|postpass|retrievepassword|resetpass|rp)*\n";
352
+ }
353
+ if($no_ips>0){
354
+ for($i=0;$i<$no_ips;$i++){
355
+ $new_rules.="RewriteCond %{REMOTE_HOST} !^".str_replace(".","\.",trim($WPhtc_data['login_ips'][$i]))."\n";
356
+ }
357
+ }
358
+ $new_rules.="RewriteRule .* ".$WPhtc_data['login_redirection']." [R=301,L]\n";
359
+ $new_rules.="# WPhtc: End Login Control Mode (stop deleting here if you're having trouble logging in)\n";
360
+ }
361
  # Custom htaccess
362
  if($WPhtc_data['hta']){
363
  $new_rules.="\n# WPhtc: Begin Custom htaccess\n";
661
  }
662
  }
663
  $WPhtc_data['maintenance_redirection']=trim($_POST['WPhtc_maintenance_redirection']);
664
+ # get login control data
665
+ $WPhtc_data['login_disabled']=$_POST['WPhtc_login_disabled'];
666
+ $WPhtc_data['login_half_mode']=$_POST['WPhtc_login_half_mode'];
667
+ $WPhtc_data['login_redirection']=trim($_POST['WPhtc_login_redirection']);
668
+ $lines=preg_split("/\n|,/",$_POST['WPhtc_login_ips']);
669
+ $WPhtc_data['login_ips']=array();
670
+ foreach($lines as $line){
671
+ trim($line);
672
+ if(preg_match("/[a-z,0-9,\.]/",$line)){
673
+ $WPhtc_data['login_ips'][]=$line;
674
+ }
675
+ }
676
 
677
  # Unsetting inclusion of Author pages on Google XML Sitemap options, we'll add those links to the sitemap later with our Custom Author Permalink
678
  $WPhtc_data['sm_enabled']=$_POST['WPhtc_sm_enabled'];