Changeset 31757
- Timestamp:
- 02/13/08 17:09:54 (5 months ago)
- Files:
-
- wp-ban/trunk/ban-options.php (modified) (9 diffs)
- wp-ban/trunk/readme.html (modified) (2 diffs)
- wp-ban/trunk/wp-ban.mo (modified) (previous)
- wp-ban/trunk/wp-ban.php (modified) (6 diffs)
- wp-ban/trunk/wp-ban.pot (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wp-ban/trunk/ban-options.php
r22746 r31757 29 29 $admin_login = trim($current_user->user_login); 30 30 $mode = trim($_GET['mode']); 31 $ban_settings = array('banned_ips', 'banned_hosts', 'banned_stats', 'banned_message', 'banned_referers', 'banned_exclude_ips', 'banned_ips_range' );31 $ban_settings = array('banned_ips', 'banned_hosts', 'banned_stats', 'banned_message', 'banned_referers', 'banned_exclude_ips', 'banned_ips_range', 'banned_user_agents'); 32 32 33 33 … … 42 42 $banned_hosts_post = explode("\n", trim($_POST['banned_hosts'])); 43 43 $banned_referers_post = explode("\n", trim($_POST['banned_referers'])); 44 $banned_user_agents_post = explode("\n", trim($_POST['banned_user_agents'])); 44 45 $banned_exclude_ips_post = explode("\n", trim($_POST['banned_exclude_ips'])); 45 46 $banned_message = trim($_POST['banned_template_message']); … … 87 88 } 88 89 } 90 if(!empty($banned_user_agents_post)) { 91 $banned_user_agents = array(); 92 foreach($banned_user_agents_post as $banned_user_agent) { 93 if(is_admin_user_agent($banned_user_agent)) { 94 $text .= '<font color="blue">'.sprintf(__('This User Agent \'%s\' Is Used By The Current Admin And Will Not Be Added To Ban List', 'wp-ban'), $banned_user_agent).'</font><br />'; 95 } else { 96 $banned_user_agents[] = trim($banned_user_agent); 97 } 98 } 99 } 89 100 if(!empty($banned_exclude_ips_post)) { 90 101 $banned_exclude_ips = array(); … … 97 108 $update_ban_queries[] = update_option('banned_hosts', $banned_hosts); 98 109 $update_ban_queries[] = update_option('banned_referers', $banned_referers); 110 $update_ban_queries[] = update_option('banned_user_agents', $banned_user_agents); 99 111 $update_ban_queries[] = update_option('banned_exclude_ips', $banned_exclude_ips); 100 112 $update_ban_queries[] = update_option('banned_message', $banned_message); … … 103 115 $update_ban_text[] = __('Banned Host Names', 'wp-ban'); 104 116 $update_ban_text[] = __('Banned Referers', 'wp-ban'); 117 $update_ban_text[] = __('Banned User Agents', 'wp-ban'); 105 118 $update_ban_text[] = __('Banned Excluded IPs', 'wp-ban'); 106 119 $update_ban_text[] = __('Banned Message', 'wp-ban'); … … 180 193 $banned_hosts = get_option('banned_hosts'); 181 194 $banned_referers = get_option('banned_referers'); 195 $banned_user_agents = get_option('banned_user_agents'); 182 196 $banned_exclude_ips = get_option('banned_exclude_ips'); 183 197 $banned_ips_display = ''; … … 206 220 } 207 221 } 222 if(!empty($banned_user_agents)) { 223 foreach($banned_user_agents as $banned_user_agent) { 224 $banned_user_agents_display .= $banned_user_agent."\n"; 225 } 226 } 208 227 if(!empty($banned_exclude_ips)) { 209 228 foreach($banned_exclude_ips as $banned_exclude_ip) { … … 215 234 $banned_hosts_display = trim($banned_hosts_display); 216 235 $banned_referers_display = trim($banned_referers_display); 236 $banned_user_agents_display = trim($banned_user_agents_display); 217 237 $banned_exclude_ips_display = trim($banned_exclude_ips_display); 218 238 $banned_stats = get_option('banned_stats'); … … 318 338 <td> 319 339 <textarea cols="40" rows="10" name="banned_referers"><?php echo $banned_referers_display; ?></textarea> 340 </td> 341 </tr> 342 <tr> 343 <td valign="top"> 344 <strong><?php _e('Banned User Agents', 'wp-ban'); ?>:</strong><br /> 345 <?php _e('Use <strong>*</strong> for wildcards', 'wp-ban'); ?>.<br /> 346 <?php _e('Start each entry on a new line.', 'wp-ban'); ?><br /><br /> 347 <?php _e('Examples:', 'wp-ban'); ?><br /> 348 <strong>»</strong> Mozilla<br /><br /> 349 </td> 350 <td> 351 <textarea cols="40" rows="10" name="banned_user_agents"><?php echo $banned_user_agents_display; ?></textarea> 320 352 </td> 321 353 </tr> wp-ban/trunk/readme.html
r22746 r31757 259 259 </p> 260 260 <p> 261 <strong>Updated:</strong><br />262 <strong>»</strong> 1st January 2008263 </p>264 <p>265 261 <strong>Note:</strong><br /> 266 262 <strong>»</strong> The <strong>Changelog</strong>, <strong>Installation</strong>, <strong>Upgrade</strong>, <strong>Usage</strong> Tab at the top of the page.<br /> … … 288 284 <li>NEW: Uses wp-ban.php Instead Of ban.php</li> 289 285 <li>NEW: Uses number_format_i18n()</li> 286 <li>NEW: Banned By User Agents (By: <a href="http://www.linkedin.com/in/jgbustos">Jorge Garcia de Bustos</a>)</li> 287 <li>FIXED: "unknown" IPs (By: <a href="http://www.linkedin.com/in/jgbustos">Jorge Garcia de Bustos</a>)</li> 290 288 </ul> 291 289 </li> wp-ban/trunk/wp-ban.php
r22746 r31757 48 48 if(!function_exists('get_IP')) { 49 49 function get_IP() { 50 if(empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { 51 $ip_address = $_SERVER["REMOTE_ADDR"]; 50 if(!empty($_SERVER['HTTP_CLIENT_IP'])) { 51 $ip_address = $_SERVER['HTTP_CLIENT_IP']; 52 } else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { 53 $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; 54 } else if(!empty($_SERVER['REMOTE_ADDR'])) { 55 $ip_address = $_SERVER['REMOTE_ADDR']; 52 56 } else { 53 $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];57 $ip_address = ''; 54 58 } 55 59 if(strpos($ip_address, ',') !== false) { … … 119 123 $banned_hosts = get_option('banned_hosts'); 120 124 $banned_referers = get_option('banned_referers'); 125 $banned_user_agents = get_option('banned_user_agents'); 121 126 $banned_exclude_ips = get_option('banned_exclude_ips'); 122 127 $is_excluded = false; … … 134 139 process_ban($banned_hosts, @gethostbyaddr(get_IP())); 135 140 process_ban($banned_referers, $_SERVER['HTTP_REFERER']); 141 process_ban($banned_user_agents, $_SERVER['HTTP_USER_AGENT']); 136 142 } 137 143 } … … 155 161 $range_end = ip2long($range_end); 156 162 $ip = ip2long($ip); 157 if($ip >= $range_start && $ip <= $range_end) {163 if($ip !== false && $ip >= $range_start && $ip <= $range_end) { 158 164 return true; 159 165 } … … 185 191 } 186 192 return false; 193 } 194 195 196 ### Function: Check Whether Or Not The User Agent Is Used by Admin 197 function is_admin_user_agent($check) { 198 $regexp = str_replace ('.', '\\.', $check); 199 $regexp = str_replace ('*', '.+', $regexp); 200 return ereg("^$regexp$", $_SERVER['HTTP_USER_AGENT']); 187 201 } 188 202 … … 215 229 add_option('banned_exclude_ips', $banned_exclude_ips, 'Banned Exclude IP'); 216 230 add_option('banned_ips_range', $banned_ips_range, 'Banned IP Range'); 231 // Database Upgrade For WP-Ban 1.30 232 add_option('banned_user_agents', $banned_user_agents, 'Banned User Agents'); 217 233 } 218 234 ?> wp-ban/trunk/wp-ban.pot
r22746 r31757 3 3 "Project-Id-Version: WP-Ban 1.30\n" 4 4 "POT-Creation-Date: \n" 5 "PO-Revision-Date: 200 7-10-21 20:22+0800\n"5 "PO-Revision-Date: 2008-02-14 01:09+0800\n" 6 6 "Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n" 7 7 "Language-Team: Lester Chan <gamerz84@hotmail.com>\n" … … 15 15 "X-Poedit-SearchPath-0: .\n" 16 16 17 #: ban-options.php:5 017 #: ban-options.php:51 18 18 #, php-format 19 19 msgid "This IP '%s' Belongs To The Admin And Will Not Be Added To Ban List" 20 20 msgstr "" 21 21 22 #: ban-options.php:6 322 #: ban-options.php:64 23 23 #, php-format 24 24 msgid "The Admin's IP '%s' Fall Within This Range (%s - %s) And Will Not Be Added To Ban List" 25 25 msgstr "" 26 26 27 #: ban-options.php:7 327 #: ban-options.php:74 28 28 #, php-format 29 29 msgid "This Hostname '%s' Belongs To The Admin And Will Not Be Added To Ban List" 30 30 msgstr "" 31 31 32 #: ban-options.php:8 332 #: ban-options.php:84 33 33 #, php-format 34 34 msgid "This Referer '%s' Belongs To This Site And Will Not Be Added To Ban List" 35 35 msgstr "" 36 36 37 #: ban-options.php:101 38 #: ban-options.php:269 37 #: ban-options.php:94 38 #, php-format 39 msgid "This User Agent '%s' Is Used By The Current Admin And Will Not Be Added To Ban List" 40 msgstr "" 41 42 #: ban-options.php:113 43 #: ban-options.php:289 39 44 msgid "Banned IPs" 40 45 msgstr "" 41 46 42 #: ban-options.php:102 47 #: ban-options.php:114 48 #: ban-options.php:303 49 msgid "Banned IP Range" 50 msgstr "" 51 52 #: ban-options.php:115 53 #: ban-options.php:316 54 msgid "Banned Host Names" 55 msgstr "" 56 57 #: ban-options.php:116 58 #: ban-options.php:330 59 msgid "Banned Referers" 60 msgstr "" 61 62 #: ban-options.php:117 63 #: ban-options.php:344 64 msgid "Banned User Agents" 65 msgstr "" 66 67 #: ban-options.php:118 68 msgid "Banned Excluded IPs" 69 msgstr "" 70 71 #: ban-options.php:119 72 #: ban-options.php:370 73 msgid "Banned Message" 74 msgstr "" 75 76 #: ban-options.php:123 77 msgid "Updated" 78 msgstr "" 79 80 #: ban-options.php:128 81 msgid "No Ban Option Updated" 82 msgstr "" 83 84 #: ban-options.php:135 85 #: ban-options.php:430 86 msgid "Reset Ban Stats" 87 msgstr "" 88 89 #: ban-options.php:139 90 msgid "All IP Ban Stats And Total Ban Stat Reseted" 91 msgstr "" 92 93 #: ban-options.php:147 94 msgid "Selected IP Ban Stats Reseted" 95 msgstr "" 96 97 #: ban-options.php:151 98 #: ban-options.php:467 99 msgid "UNINSTALL WP-Ban" 100 msgstr "" 101 102 #: ban-options.php:159 103 #, php-format 104 msgid "Setting Key '%s' has been deleted." 105 msgstr "" 106 107 #: ban-options.php:163 108 #, php-format 109 msgid "Error deleting Setting Key '%s'." 110 msgstr "" 111 112 #: ban-options.php:185 113 #: ban-options.php:437 114 msgid "Uninstall WP-Ban" 115 msgstr "" 116 117 #: ban-options.php:186 118 #, php-format 119 msgid "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-Ban Will Be Deactivated Automatically." 120 msgstr "" 121 122 #: ban-options.php:247 123 #: wp-ban.php:224 124 msgid "You Are Banned." 125 msgstr "" 126 127 #: ban-options.php:276 128 msgid "Ban Options" 129 msgstr "" 130 131 #: ban-options.php:278 132 #: ban-options.php:387 133 msgid "Update Options »" 134 msgstr "" 135 43 136 #: ban-options.php:283 44 msgid "Banned IP Range" 45 msgstr "" 46 47 #: ban-options.php:103 48 #: ban-options.php:296 49 msgid "Banned Host Names" 50 msgstr "" 51 52 #: ban-options.php:104 53 #: ban-options.php:310 54 msgid "Banned Referers" 55 msgstr "" 56 57 #: ban-options.php:105 58 msgid "Banned Excluded IPs" 59 msgstr "" 60 61 #: ban-options.php:106 62 #: ban-options.php:338 63 msgid "Banned Message" 64 msgstr "" 65 66 #: ban-options.php:110 67 msgid "Updated" 68 msgstr "" 69 70 #: ban-options.php:115 71 msgid "No Ban Option Updated" 72 msgstr "" 73 74 #: ban-options.php:122 137 #, php-format 138 msgid "Your IP is: <strong>%s</strong><br />Your Host Name is: <strong>%s</strong><br />Your Site URL is: <strong>%s</strong>" 139 msgstr "" 140 141 #: ban-options.php:284 142 msgid "Please <strong>DO NOT</strong> ban yourself." 143 msgstr "" 144 145 #: ban-options.php:290 146 msgid "Use <strong>*</strong> for wildcards." 147 msgstr "" 148 149 #: ban-options.php:291 150 #: ban-options.php:304 151 #: ban-options.php:318 152 #: ban-options.php:332 153 #: ban-options.php:346 154 #: ban-options.php:357 155 msgid "Start each entry on a new line." 156 msgstr "" 157 158 #: ban-options.php:292 159 #: ban-options.php:305 160 #: ban-options.php:319 161 #: ban-options.php:333 162 #: ban-options.php:347 163 #: ban-options.php:358 164 msgid "Examples:" 165 msgstr "" 166 167 #: ban-options.php:307 168 #: ban-options.php:335 169 #: ban-options.php:360 170 msgid "Notes:" 171 msgstr "" 172 173 #: ban-options.php:308 174 #: ban-options.php:361 175 msgid "No Wildcards Allowed." 176 msgstr "" 177 178 #: ban-options.php:317 179 #: ban-options.php:331 180 #: ban-options.php:345 181 msgid "Use <strong>*</strong> for wildcards" 182 msgstr "" 183 184 #: ban-options.php:336 185 msgid "There are ways to bypass this method of banning." 186 msgstr "" 187 188 #: ban-options.php:356 189 msgid "Banned Exclude IPs" 190 msgstr "" 191 192 #: ban-options.php:362 193 msgid "These Users Will Not Get Banned." 194 msgstr "" 195 196 #: ban-options.php:371 197 msgid "Allowed Variables:" 198 msgstr "" 199 200 #: ban-options.php:378 201 msgid "Restore Default Template" 202 msgstr "" 203 204 #: ban-options.php:379 205 msgid "Preview Banned Message" 206 msgstr "" 207 208 #: ban-options.php:394 209 msgid "Ban Stats" 210 msgstr "" 211 212 #: ban-options.php:397 213 msgid "IPs" 214 msgstr "" 215 75 216 #: ban-options.php:398 76 msgid "Reset Ban Stats"77 msgstr ""78 79 #: ban-options.php:12680 msgid "All IP Ban Stats And Total Ban Stat Reseted"81 msgstr ""82 83 #: ban-options.php:13484 msgid "Selected IP Ban Stats Reseted"85 msgstr ""86 87 #: ban-options.php:13888 #: ban-options.php:43589 msgid "UNINSTALL WP-Ban"90 msgstr ""91 92 #: ban-options.php:14693 #, php-format94 msgid "Setting Key '%s' has been deleted."95 msgstr ""96 97 #: ban-options.php:15098 #, php-format99 msgid "Error deleting Setting Key '%s'."100 msgstr ""101 102 #: ban-options.php:172103 #: ban-options.php:405104 msgid "Uninstall WP-Ban"105 msgstr ""106 107 #: ban-options.php:173108 #, php-format109 msgid "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-Ban Will Be Deactivated Automatically."110 msgstr ""111 112 #: ban-options.php:227113 #: wp-ban.php:210114 msgid "You Are Banned."115 msgstr ""116 117 #: ban-options.php:256118 msgid "Ban Options"119 msgstr ""120 121 #: ban-options.php:258122 #: ban-options.php:355123 msgid "Update Options »"124 msgstr ""125 126 #: ban-options.php:263127 #, php-format128 msgid "Your IP is: <strong>%s</strong><br />Your Host Name is: <strong>%s</strong><br />Your Site URL is: <strong>%s</strong>"129 msgstr ""130 131 #: ban-options.php:264132 msgid "Please <strong>DO NOT</strong> ban yourself."133 msgstr ""134 135 #: ban-options.php:270136 msgid "Use <strong>*</strong> for wildcards."137 msgstr ""138 139 #: ban-options.php:271140 #: ban-options.php:284141 #: ban-options.php:298142 #: ban-options.php:312143 #: ban-options.php:325144 msgid "Start each entry on a new line."145 msgstr ""146 147 #: ban-options.php:272148 #: ban-options.php:285149 #: ban-options.php:299150 #: ban-options.php:313151 #: ban-options.php:326152 msgid "Examples:"153 msgstr ""154 155 #: ban-options.php:287156 #: ban-options.php:315157 #: ban-options.php:328158 msgid "Notes:"159 msgstr ""160 161 #: ban-options.php:288162 #: ban-options.php:329163 msgid "No Wildcards Allowed."164 msgstr ""165 166 #: ban-options.php:297167 #: ban-options.php:311168 msgid "Use <strong>*</strong> for wildcards"169 msgstr ""170 171 #: ban-options.php:316172 msgid "There are ways to bypass this method of banning."173 msgstr ""174 175 #: ban-options.php:324176 msgid "Banned Exclude IPs"177 msgstr ""178 179 #: ban-options.php:330180 msgid "These Users Will Not Get Banned."181 msgstr ""182 183 #: ban-options.php:339184 msgid "Allowed Variables:"185 msgstr ""186 187 #: ban-options.php:346188 msgid "Restore Default Template"189 msgstr ""190 191 #: ban-options.php:347192 msgid "Preview Banned Message"193 msgstr ""194 195 #: ban-options.php:362196 msgid "Ban Stats"197 msgstr ""198 199 #: ban-options.php:365200 msgid "IPs"201 msgstr ""202 203 #: ban-options.php:366204 217 msgid "Attempts" 205 218 msgstr "" 206 219 207 #: ban-options.php:3 67220 #: ban-options.php:399 208 221 msgid "Action" 209 222 msgstr "" 210 223 211 #: ban-options.php: 388224 #: ban-options.php:420 212 225 msgid "No Attempts" 213 226 msgstr "" 214 227 215 #: ban-options.php: 393228 #: ban-options.php:425 216 229 msgid "Total Attempts:" 217 230 msgstr "" 218 231 219 #: ban-options.php: 395232 #: ban-options.php:427 220 233 msgid "Reset all IP ban stats and total ban stat?" 221 234 msgstr "" 222 235 223 #: ban-options.php: 398236 #: ban-options.php:430 224 237 msgid "You Are About To Reset Ban Stats." 225 238 msgstr "" 226 239 227 #: ban-options.php: 398240 #: ban-options.php:430 228 241 msgid "This Action Is Not Reversible. Are you sure?" 229 242 msgstr "" 230 243 231 #: ban-options.php:4 07244 #: ban-options.php:439 232 245 msgid "Deactivating WP-Ban plugin does not remove any data that may have been created, such as the ban options. To completely remove this plugin, you can uninstall it here." 233 246 msgstr "" 234 247 235 #: ban-options.php:4 10248 #: ban-options.php:442 236 249 msgid "WARNING:" 237 250 msgstr "" 238 251 239 #: ban-options.php:4 11252 #: ban-options.php:443 240 253 msgid "Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first." 241 254 msgstr "" 242 255 243 #: ban-options.php:4 14256 #: ban-options.php:446 244 257 msgid "The following WordPress Options will be DELETED:" 245 258 msgstr "" 246 259 247 #: ban-options.php:4 18260 #: ban-options.php:450 248 261 msgid "WordPress Options" 249 262 msgstr "" 250 263 251 #: ban-options.php:4 34264 #: ban-options.php:466 252 265 msgid "Yes" 253 266 msgstr "" 254 267 255 #: ban-options.php:4 35268 #: ban-options.php:467 256 269 msgid "" 257 270 "You Are About To Uninstall WP-Ban From WordPress.\\n"
