--- a/visitor-maps-extended-referer-field/visitor-maps-extended-referer.php
+++ b/visitor-maps-extended-referer-field/visitor-maps-extended-referer.php
@@ -3,7 +3,7 @@
* @package
* @author Jason Lau
* @link http://jasonlau.biz
- * @copyright 2011-2014
+ * @copyright 2011-2013
* @license GNU/GPL 3+
* @uses WordPress
@@ -11,11 +11,11 @@
Plugin URI: http://jasonlau.biz
Description: Extend <a href="http://www.642weather.com/weather/scripts-wordpress-visitor-maps.php" target="_blank">Visitor Maps and Who's Online</a> with extra features, such as IP and referer banning. Display the referring host name and search string.
Author: Jason Lau
-Version: 1.2.6
+Version: 1.2.3
Author URI: http://jasonlau.biz
*/
-define("VMERF_VERSION", "1.2.6");
+define("VMERF_VERSION", "1.2.3");
define("VMERF_SLUG", "visitor-maps-extended-referer");
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
exit('Please don't access this file directly.');
@@ -114,6 +114,10 @@
function vmerf_new_list($referer){
$new_list = "# BEGIN Referers
<IfModule mod_rewrite.c>
+# Uncomment 'Options +FollowSymlinks' if your server returns a '500 Internal Server' error.
+# This means your server is not configured with FollowSymLinks in the '' section of the 'httpd.conf'.
+# Contact your system administrator for advice with this issue.
+# Options +FollowSymlinks
# Cond start
RewriteCond %{HTTP_REFERER} " . str_replace(".", ".", $referer) . " [NC]
# Cond end
@@ -306,52 +310,41 @@
if(!is_dir(plugin_dir_path('visitor-maps'))){
wp_die("<strong>Notice:</strong> The <a href="http://wordpress.org/extend/plugins/visitor-maps/" target="_blank">Visitor Maps and Who's Online</a> plugin must be installed before installing <em>Visitor Maps Extended Referer Field</em>.");
}
-
- $vmerf_htbackup = get_option("vmerf_htbackup", false);
- $vmerf_banned_ips = get_option("vmerf_banned_ips", array());
- $vmerf_banned_referers = get_option("vmerf_banned_referers", array());
- $vmerf_auto_update = get_option("vmerf_auto_update",false);
- $vmerf_auto_update_time = get_option('vmerf_auto_update_time', 5);
-
- if(!$vmerf_htbackup){
+ if(!get_option("vmerf_htbackup")){
$htbackup = ABSPATH . ".htaccess.backup." . vmerf_create_random(6);
- update_option("vmerf_htbackup", $htbackup);
- if(!vmerf_backup_htaccess($htbackup)){
+ update_option("vmerf_htbackup", $htbackup);
+ } else {
+ $htbackup = get_option("vmerf_htbackup");
+ }
+ if(!get_option("vmerf_banned_ips") || (!is_array(get_option("vmerf_banned_ips")) && strlen(get_option("vmerf_banned_ips")) < 1)){
+ update_option("vmerf_banned_ips", array());
+ } else if(!is_array(get_option("vmerf_banned_ips")) && strlen(get_option("vmerf_banned_ips")) > 0){
+ $ips = explode(", ", get_option("vmerf_banned_ips"));
+ update_option("vmerf_banned_ips", $ips);
+ }
+ if(!get_option("vmerf_banned_referers")){
+ update_option("vmerf_banned_referers", array());
+ }
+ update_option("vmerf_wp_version", $wp_version);
+ if(!vmerf_backup_htaccess()){
update_option("vmerf_htaccess_warning", true);
update_option("vmerf_htaccess", false);
- } else {
- update_option("vmerf_htaccess_warning", false);
- update_option("vmerf_htaccess", true);
- }
} else {
update_option("vmerf_htaccess_warning", false);
update_option("vmerf_htaccess", true);
- }
-
- /* Backwards Compatibility */
- if(!is_array($vmerf_banned_ips) && strlen($vmerf_banned_ips) > 0){
- $ips = explode(", ", $vmerf_banned_ips);
- update_option("vmerf_banned_ips", $ips);
- } else {
- update_option("vmerf_banned_ips", $vmerf_banned_ips);
- }
-
- if(!is_array($vmerf_banned_referers) && strlen($vmerf_banned_referers) > 0){
- $referers = explode(", ", $vmerf_banned_referers);
- update_option("vmerf_banned_referers", $referers);
- } else {
- update_option("vmerf_banned_referers", $vmerf_banned_referers);
- }
- /* /Backwards Compatibility */
-
- update_option("vmerf_wp_version", $wp_version);
+ vmerf_rebuild_htaccess(false);
+ }
update_option("vmerf_version", VMERF_VERSION);
- update_option("vmerf_auto_update", $vmerf_auto_update);
- update_option("vmerf_auto_update_time", $vmerf_auto_update_time);
+ update_option("vmerf_auto_update", "false");
+ update_option("vmerf_auto_update_time", 5);
}
-function vmerf_backup_htaccess($htbackup){
- if(!copy(ABSPATH . ".htaccess", $htbackup)){
+function vmerf_backup_htaccess(){
+ $htbackup = get_option("vmerf_htbackup");
+ if(file_exists($htbackup)){
+ @unlink($htbackup);
+ }
+ if(!@copy(ABSPATH . ".htaccess", $htbackup)){
return false;
} else {
return true;
@@ -389,8 +382,7 @@
$vmerf_settings = array('preserve_data' => true);
$preserve_data = intval($vmerf_settings['preserve_data']);
if(!$preserve_data):
- $vmerf_htbackup = get_option("vmerf_htbackup");
- copy(ABSPATH . ".htaccess", $vmerf_htbackup);
+ copy(ABSPATH . ".htaccess", get_option("vmerf_htbackup"));
update_option("vmerf_banned_ips", array());
update_option("vmerf_banned_referers", array());
vmerf_rebuild_htaccess();
@@ -463,8 +455,7 @@
function vmerf_rebuild_htaccess($backup=true){
if($backup){
- $htbackup = get_option("vmerf_htbackup");
- vmerf_backup_htaccess($htbackup);
+ vmerf_backup_htaccess();
}
$htcontent = vmerf_read();
if(@eregi("Visitor Maps Extended", $htcontent)){