Version Description
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-Ban |
Version | 1.31 |
Comparing to | |
See all releases |
Code changes from version 1.30 to 1.31
- ban-options.php +2 -2
- ban-preview.php +7 -2
- readme.html +12 -5
- readme.txt +1 -1
- wp-ban.mo +0 -0
- wp-ban.php +28 -5
- wp-ban.pot +5 -5
ban-options.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
+----------------------------------------------------------------+
|
4 |
| |
|
5 |
-
| WordPress 2.5 Plugin: WP-Ban 1.
|
6 |
| Copyright (c) 2008 Lester "GaMerZ" Chan |
|
7 |
| |
|
8 |
| File Written By: |
|
@@ -265,7 +265,7 @@ switch($mode) {
|
|
265 |
}
|
266 |
}
|
267 |
function preview_bannedmessage() {
|
268 |
-
window.open('<?php echo
|
269 |
}
|
270 |
/* ]]> */
|
271 |
</script>
|
2 |
/*
|
3 |
+----------------------------------------------------------------+
|
4 |
| |
|
5 |
+
| WordPress 2.5 Plugin: WP-Ban 1.31 |
|
6 |
| Copyright (c) 2008 Lester "GaMerZ" Chan |
|
7 |
| |
|
8 |
| File Written By: |
|
265 |
}
|
266 |
}
|
267 |
function preview_bannedmessage() {
|
268 |
+
window.open('<?php echo WP_PLUGIN_URL.'/wp-ban/ban-preview.php'; ?>');
|
269 |
}
|
270 |
/* ]]> */
|
271 |
</script>
|
ban-preview.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
+----------------------------------------------------------------+
|
4 |
| |
|
5 |
-
| WordPress 2.5 Plugin: WP-Ban 1.
|
6 |
| Copyright (c) 2008 Lester "GaMerZ" Chan |
|
7 |
| |
|
8 |
| File Written By: |
|
@@ -18,7 +18,12 @@
|
|
18 |
|
19 |
|
20 |
### Require wp-config.php
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
### Display Banned Message
|
2 |
/*
|
3 |
+----------------------------------------------------------------+
|
4 |
| |
|
5 |
+
| WordPress 2.5 Plugin: WP-Ban 1.31 |
|
6 |
| Copyright (c) 2008 Lester "GaMerZ" Chan |
|
7 |
| |
|
8 |
| File Written By: |
|
18 |
|
19 |
|
20 |
### Require wp-config.php
|
21 |
+
$wp_root = '../../..';
|
22 |
+
if (file_exists($wp_root.'/wp-load.php')) {
|
23 |
+
require_once($wp_root.'/wp-load.php');
|
24 |
+
} else {
|
25 |
+
require_once($wp_root.'/wp-config.php');
|
26 |
+
}
|
27 |
|
28 |
|
29 |
### Display Banned Message
|
readme.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<html>
|
3 |
<head>
|
4 |
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
5 |
-
<title>WP-Ban 1.
|
6 |
<style type="text/css" media="screen">
|
7 |
/* Default Style */
|
8 |
BODY {
|
@@ -203,7 +203,7 @@
|
|
203 |
<body>
|
204 |
<div id="Container">
|
205 |
<!-- Title -->
|
206 |
-
<div id="Title">WP-Ban 1.
|
207 |
|
208 |
<!-- Tabs -->
|
209 |
<ul id="Tabs">
|
@@ -234,7 +234,7 @@
|
|
234 |
</p>
|
235 |
<p>
|
236 |
<strong>Download:</strong><br />
|
237 |
-
<strong>»</strong> <a href="http://downloads.wordpress.org/plugin/wp-ban.1.
|
238 |
<strong>»</strong> <a href="http://downloads.wordpress.org/plugin/wp-ban.1.00.zip" title="http://downloads.wordpress.org/plugin/wp-ban.1.00.zip">WP-Ban 1.00 For WordPress 2.0.x</a><br />
|
239 |
</p>
|
240 |
<p>
|
@@ -276,6 +276,13 @@
|
|
276 |
<div id="Changelog" style="display: none;">
|
277 |
<div class="SubTitle">» Changelog</div>
|
278 |
<ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
<li>
|
280 |
<strong>Version 1.30 (01-06-2008)</strong>
|
281 |
<ul>
|
@@ -347,7 +354,7 @@
|
|
347 |
<!-- Upgrade Instructions -->
|
348 |
<div id="Upgrade" style="display: none;">
|
349 |
<div class="SubTitle">» Upgrade Instructions</div>
|
350 |
-
<div class="SubSubTitle">From v1.0x To v1.
|
351 |
<ol>
|
352 |
<li>
|
353 |
<strong>Deactivate</strong> WP-Ban Plugin
|
@@ -389,6 +396,6 @@
|
|
389 |
</div>
|
390 |
</div>
|
391 |
</div>
|
392 |
-
<p id="Copyright">WP-Ban 1.
|
393 |
</body>
|
394 |
</html>
|
2 |
<html>
|
3 |
<head>
|
4 |
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
5 |
+
<title>WP-Ban 1.31 Readme</title>
|
6 |
<style type="text/css" media="screen">
|
7 |
/* Default Style */
|
8 |
BODY {
|
203 |
<body>
|
204 |
<div id="Container">
|
205 |
<!-- Title -->
|
206 |
+
<div id="Title">WP-Ban 1.31 <span style="color: #aaaaaa;">Readme</span></div>
|
207 |
|
208 |
<!-- Tabs -->
|
209 |
<ul id="Tabs">
|
234 |
</p>
|
235 |
<p>
|
236 |
<strong>Download:</strong><br />
|
237 |
+
<strong>»</strong> <a href="http://downloads.wordpress.org/plugin/wp-ban.1.31.zip" title="http://downloads.wordpress.org/plugin/wp-ban.1.31.zip">WP-Ban 1.31 For WordPress 2.1.x And Above</a><br />
|
238 |
<strong>»</strong> <a href="http://downloads.wordpress.org/plugin/wp-ban.1.00.zip" title="http://downloads.wordpress.org/plugin/wp-ban.1.00.zip">WP-Ban 1.00 For WordPress 2.0.x</a><br />
|
239 |
</p>
|
240 |
<p>
|
276 |
<div id="Changelog" style="display: none;">
|
277 |
<div class="SubTitle">» Changelog</div>
|
278 |
<ul>
|
279 |
+
<li>
|
280 |
+
<strong>Version 1.31 (16-07-2008)</strong>
|
281 |
+
<ul>
|
282 |
+
<li>NEW: Works With WordPress 2.6</li>
|
283 |
+
<li>FIXED: Do Not Ban If IP is "unknown"</li>
|
284 |
+
</ul>
|
285 |
+
</li>
|
286 |
<li>
|
287 |
<strong>Version 1.30 (01-06-2008)</strong>
|
288 |
<ul>
|
354 |
<!-- Upgrade Instructions -->
|
355 |
<div id="Upgrade" style="display: none;">
|
356 |
<div class="SubTitle">» Upgrade Instructions</div>
|
357 |
+
<div class="SubSubTitle">From v1.0x To v1.31</div>
|
358 |
<ol>
|
359 |
<li>
|
360 |
<strong>Deactivate</strong> WP-Ban Plugin
|
396 |
</div>
|
397 |
</div>
|
398 |
</div>
|
399 |
+
<p id="Copyright">WP-Ban 1.31<br />Copyright © 2008 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
|
400 |
</body>
|
401 |
</html>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: GamerZ
|
|
3 |
Donate link: http://lesterchan.net/wordpress
|
4 |
Tags: banned, ban, deny, denied, permission, ip, hostname, host, spam, bots, bot, exclude, referer, url, referral, range
|
5 |
Requires at least: 2.5.0
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
Ban users by IP, IP Range, host name and referer url from visiting your WordPress's blog.
|
9 |
|
3 |
Donate link: http://lesterchan.net/wordpress
|
4 |
Tags: banned, ban, deny, denied, permission, ip, hostname, host, spam, bots, bot, exclude, referer, url, referral, range
|
5 |
Requires at least: 2.5.0
|
6 |
+
Stable tag: 1.31
|
7 |
|
8 |
Ban users by IP, IP Range, host name and referer url from visiting your WordPress's blog.
|
9 |
|
wp-ban.mo
CHANGED
Binary file
|
wp-ban.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-Ban
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Ban users by IP, IP Range, host name, user agent and referer url from visiting your WordPress's blog. It will display a custom ban message when the banned IP, IP range, host name, user agent or referer url tries to visit you blog. You can also exclude certain IPs from being banned. There will be statistics recordered on how many times they attemp to visit your blog. It allows wildcard matching too.
|
6 |
-
Version: 1.
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
*/
|
@@ -28,10 +28,29 @@ Author URI: http://lesterchan.net
|
|
28 |
*/
|
29 |
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
### Create Text Domain For Translation
|
32 |
add_action('init', 'ban_textdomain');
|
33 |
function ban_textdomain() {
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
|
@@ -118,6 +137,10 @@ function process_ban_ip_range($banned_ips_range) {
|
|
118 |
### Function: Banned
|
119 |
add_action('init', 'banned');
|
120 |
function banned() {
|
|
|
|
|
|
|
|
|
121 |
$banned_ips = get_option('banned_ips');
|
122 |
$banned_ips_range = get_option('banned_ips_range');
|
123 |
$banned_hosts = get_option('banned_hosts');
|
@@ -127,16 +150,16 @@ function banned() {
|
|
127 |
$is_excluded = false;
|
128 |
if(!empty($banned_exclude_ips)) {
|
129 |
foreach($banned_exclude_ips as $banned_exclude_ip) {
|
130 |
-
if(
|
131 |
$is_excluded = true;
|
132 |
break;
|
133 |
}
|
134 |
}
|
135 |
}
|
136 |
if(!$is_excluded) {
|
137 |
-
process_ban($banned_ips,
|
138 |
process_ban_ip_range($banned_ips_range);
|
139 |
-
process_ban($banned_hosts, @gethostbyaddr(
|
140 |
process_ban($banned_referers, $_SERVER['HTTP_REFERER']);
|
141 |
process_ban($banned_user_agents, $_SERVER['HTTP_USER_AGENT']);
|
142 |
}
|
3 |
Plugin Name: WP-Ban
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Ban users by IP, IP Range, host name, user agent and referer url from visiting your WordPress's blog. It will display a custom ban message when the banned IP, IP range, host name, user agent or referer url tries to visit you blog. You can also exclude certain IPs from being banned. There will be statistics recordered on how many times they attemp to visit your blog. It allows wildcard matching too.
|
6 |
+
Version: 1.31
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
*/
|
28 |
*/
|
29 |
|
30 |
|
31 |
+
### Use WordPress 2.6 Constants
|
32 |
+
if (!defined('WP_CONTENT_DIR')) {
|
33 |
+
define( 'WP_CONTENT_DIR', ABSPATH.'wp-content');
|
34 |
+
}
|
35 |
+
if (!defined('WP_CONTENT_URL')) {
|
36 |
+
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content');
|
37 |
+
}
|
38 |
+
if (!defined('WP_PLUGIN_DIR')) {
|
39 |
+
define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins');
|
40 |
+
}
|
41 |
+
if (!defined('WP_PLUGIN_URL')) {
|
42 |
+
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
### Create Text Domain For Translation
|
47 |
add_action('init', 'ban_textdomain');
|
48 |
function ban_textdomain() {
|
49 |
+
if (!function_exists('wp_print_styles')) {
|
50 |
+
load_plugin_textdomain('wp-ban', 'wp-content/plugins/wp-ban');
|
51 |
+
} else {
|
52 |
+
load_plugin_textdomain('wp-ban', false, 'wp-ban');
|
53 |
+
}
|
54 |
}
|
55 |
|
56 |
|
137 |
### Function: Banned
|
138 |
add_action('init', 'banned');
|
139 |
function banned() {
|
140 |
+
$ip = get_IP();
|
141 |
+
if($ip == 'unknown') {
|
142 |
+
return;
|
143 |
+
}
|
144 |
$banned_ips = get_option('banned_ips');
|
145 |
$banned_ips_range = get_option('banned_ips_range');
|
146 |
$banned_hosts = get_option('banned_hosts');
|
150 |
$is_excluded = false;
|
151 |
if(!empty($banned_exclude_ips)) {
|
152 |
foreach($banned_exclude_ips as $banned_exclude_ip) {
|
153 |
+
if($ip == $banned_exclude_ip) {
|
154 |
$is_excluded = true;
|
155 |
break;
|
156 |
}
|
157 |
}
|
158 |
}
|
159 |
if(!$is_excluded) {
|
160 |
+
process_ban($banned_ips, $ip);
|
161 |
process_ban_ip_range($banned_ips_range);
|
162 |
+
process_ban($banned_hosts, @gethostbyaddr($ip));
|
163 |
process_ban($banned_referers, $_SERVER['HTTP_REFERER']);
|
164 |
process_ban($banned_user_agents, $_SERVER['HTTP_USER_AGENT']);
|
165 |
}
|
wp-ban.pot
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: WP-Ban 1.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2008-
|
6 |
-
"PO-Revision-Date: 2008-
|
7 |
"Last-Translator: Lester Chan <lesterchan@gmail.com>\n"
|
8 |
"Language-Team: Lester Chan <gamerz84@hotmail.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -121,7 +121,7 @@ msgid "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-Ban Wil
|
|
121 |
msgstr ""
|
122 |
|
123 |
#: ban-options.php:247
|
124 |
-
#: wp-ban.php:
|
125 |
msgid "You Are Banned."
|
126 |
msgstr ""
|
127 |
|
@@ -281,7 +281,7 @@ msgid ""
|
|
281 |
" Choose [Cancel] To Stop, [OK] To Uninstall."
|
282 |
msgstr ""
|
283 |
|
284 |
-
#: wp-ban.php:
|
285 |
msgid "Ban"
|
286 |
msgstr ""
|
287 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: WP-Ban 1.31\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2008-07-15 15:17+0800\n"
|
6 |
+
"PO-Revision-Date: 2008-07-15 15:18+0800\n"
|
7 |
"Last-Translator: Lester Chan <lesterchan@gmail.com>\n"
|
8 |
"Language-Team: Lester Chan <gamerz84@hotmail.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
121 |
msgstr ""
|
122 |
|
123 |
#: ban-options.php:247
|
124 |
+
#: wp-ban.php:247
|
125 |
msgid "You Are Banned."
|
126 |
msgstr ""
|
127 |
|
281 |
" Choose [Cancel] To Stop, [OK] To Uninstall."
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: wp-ban.php:61
|
285 |
msgid "Ban"
|
286 |
msgstr ""
|
287 |
|