Changeset 7535
- Timestamp:
- 01/24/07 14:54:10 (1 year ago)
- Files:
-
- wp-ban/trunk/ban/ban.php (modified) (10 diffs)
- wp-ban/trunk/ban/wp-ban.pot (modified) (2 diffs)
- wp-ban/trunk/readme.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wp-ban/trunk/ban/ban.php
r7445 r7535 97 97 ### Function: Ban Options 98 98 function ban_options() { 99 global $wpdb; 99 global $wpdb, $current_user; 100 $admin_login = trim($current_user->user_login); 100 101 // Form Processing 101 102 if(!empty($_POST['do'])) { … … 120 121 } 121 122 if($_POST['Submit']) { 123 $text = ''; 122 124 $update_ban_queries = array(); 123 125 $update_ban_text = array(); … … 128 130 $banned_ips = array(); 129 131 foreach($banned_ips_post as $banned_ip) { 130 if($banned_ip != get_IP()) { 132 if($admin_login == 'admin' && ($banned_ip == get_IP() || is_admin_ip($banned_ip))) { 133 $text .= '<font color="blue">'.sprintf(__('This IP \'%s\' Belongs To The Admin And Will Not Be Added To Ban List', 'wp-ban'),$banned_ip).'</font><br />'; 134 } else { 131 135 $banned_ips[] = trim($banned_ip); 132 136 } … … 136 140 $banned_hosts = array(); 137 141 foreach($banned_hosts_post as $banned_host) { 138 if($banned_host != gethostbyaddr(get_IP())) { 142 if($admin_login == 'admin' && ($banned_host == gethostbyaddr(get_IP()) || is_admin_hostname($banned_host))) { 143 $text .= '<font color="blue">'.sprintf(__('This Hostname \'%s\' Belongs To The Admin Will Not Be Added To Ban List', 'wp-ban'), $banned_host).'</font><br />'; 144 } else { 139 145 $banned_hosts[] = trim($banned_host); 140 146 } … … 148 154 $update_ban_text[] = __('Banned Message', 'wp-ban'); 149 155 $i=0; 150 $text = '';151 156 foreach($update_ban_queries as $update_ban_query) { 152 157 if($update_ban_query) { … … 181 186 <script type="text/javascript"> 182 187 /* <![CDATA[*/ 188 var checked = 0; 183 189 function banned_default_templates(template) { 184 190 var default_template; … … 189 195 } 190 196 document.getElementById("banned_template_" + template).value = default_template; 197 } 198 function toggle_checkbox() { 199 checkboxes = document.getElementsByName('delete_ips[]'); 200 total = checkboxes.length; 201 if(checked == 0) { 202 for (var i = 0; i < total; i++) { 203 checkboxes[i].checked = true; 204 } 205 checked++; 206 } else if(checked == 1) { 207 for (var i = 0; i < total; i++) { 208 checkboxes[i].checked = false; 209 } 210 checked--; 211 } 191 212 } 192 213 /* ]]> */ … … 200 221 <tr> 201 222 <td valign="top" colspan="2" align="center"> 202 <?php sprintf(__('Your IP is: <strong>%s</strong><br />Your Host Name is: <strong>%s</strong>', 'wp-ban'), get_IP(), gethostbyaddr(get_IP())); ?><br />223 <?php printf(__('Your IP is: <strong>%s</strong><br />Your Host Name is: <strong>%s</strong>', 'wp-ban'), get_IP(), gethostbyaddr(get_IP())); ?><br /> 203 224 <?php _e('Please <strong>DO NOT</strong> ban yourself.', 'wp-ban'); ?> 204 225 </td> … … 259 280 <th width="40%">IPs</th> 260 281 <th width="30%">Attempts</th> 261 <th width="30%"> Action</th>282 <th width="30%"><input type="checkbox" name="toogle_checkbox" value="1" onclick="toggle_checkbox();" /> Action</th> 262 283 </tr> 263 284 <?php … … 297 318 298 319 320 ### Function: Check Whether Or Not The IP Address Belongs To Admin 321 function is_admin_ip($check) { 322 $admin_ip = get_IP(); 323 $regexp = str_replace ('.', '\\.', $check); 324 $regexp = str_replace ('*', '.+', $regexp); 325 if(ereg("^$regexp$", $admin_ip)) { 326 return true; 327 } 328 return false; 329 } 330 331 332 ### Function: Check Whether Or Not The Hostname Belongs To Admin 333 function is_admin_hostname($check) { 334 $admin_hostname = gethostbyaddr(get_IP()); 335 $regexp = str_replace ('.', '\\.', $check); 336 $regexp = str_replace ('*', '.+', $regexp); 337 if(ereg("^$regexp$", $admin_hostname)) { 338 return true; 339 } 340 return false; 341 } 342 343 299 344 ### Function: Create Ban Options 300 345 add_action('activate_ban/ban.php', 'ban_init'); wp-ban/trunk/ban/wp-ban.pot
r7445 r7535 3 3 "Project-Id-Version: WP-Ban 1.10\n" 4 4 "POT-Creation-Date: \n" 5 "PO-Revision-Date: 2007-01-2 0 22:40+0800\n"5 "PO-Revision-Date: 2007-01-24 22:51+0800\n" 6 6 "Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n" 7 7 "Language-Team: Lester Chan <gamerz84@hotmail.com>\n" … … 19 19 msgstr "" 20 20 21 #: ban.php:10 422 #: ban.php: 29221 #: ban.php:105 22 #: ban.php:313 23 23 msgid "Reset Ban Stats" 24 24 msgstr "" 25 25 26 #: ban.php:10 826 #: ban.php:109 27 27 msgid "All IP Ban Stats And Total Ban Stat Reseted" 28 28 msgstr "" 29 29 30 #: ban.php:11 630 #: ban.php:117 31 31 msgid "Selected IP Ban Stats Reseted" 32 32 msgstr "" 33 33 34 #: ban.php:146 35 #: ban.php:208 34 #: ban.php:133 35 #, php-format 36 msgid "This IP '%s' Belongs To The Admin And Will Not Be Added To Ban List" 37 msgstr "" 38 39 #: ban.php:143 40 #, php-format 41 msgid "This Hostname '%s' Belongs To The Admin Will Not Be Added To Ban List" 42 msgstr "" 43 44 #: ban.php:152 45 #: ban.php:229 36 46 msgid "Banned IPs" 37 47 msgstr "" 38 48 39 #: ban.php:1 4740 #: ban.php:2 2249 #: ban.php:153 50 #: ban.php:243 41 51 msgid "Banned Host Names" 42 52 msgstr "" 43 53 44 #: ban.php:1 4845 #: ban.php:2 3654 #: ban.php:154 55 #: ban.php:257 46 56 msgid "Banned Message" 47 57 msgstr "" 48 58 49 #: ban.php:15 359 #: ban.php:158 50 60 msgid "Updated" 51 61 msgstr "" 52 62 53 #: ban.php:1 5863 #: ban.php:163 54 64 msgid "No Ban Option Updated" 55 65 msgstr "" 56 66 57 #: ban.php:1 8758 #: ban.php:3 1667 #: ban.php:193 68 #: ban.php:361 59 69 msgid "You Are Banned." 60 70 msgstr "" 61 71 62 #: ban.php: 19772 #: ban.php:218 63 73 msgid "Ban Options" 64 74 msgstr "" 65 75 66 #: ban.php:2 0276 #: ban.php:223 67 77 #, php-format 68 78 msgid "Your IP is: <strong>%s</strong><br />Your Host Name is: <strong>%s</strong>" 69 79 msgstr "" 70 80 71 #: ban.php:2 0381 #: ban.php:224 72 82 msgid "Please <strong>DO NOT</strong> ban yourself." 73 83 msgstr "" 74 84 75 #: ban.php:2 0985 #: ban.php:230 76 86 msgid "Use <strong>*</strong> for wildcards." 77 87 msgstr "" 78 88 79 #: ban.php:2 1080 #: ban.php:2 2489 #: ban.php:231 90 #: ban.php:245 81 91 msgid "Start each entry on a new line." 82 92 msgstr "" 83 93 84 #: ban.php:2 1185 #: ban.php:2 2594 #: ban.php:232 95 #: ban.php:246 86 96 msgid "Examples:" 87 97 msgstr "" 88 98 89 #: ban.php:2 2399 #: ban.php:244 90 100 msgid "Use <strong>*</strong> for wildcards" 91 101 msgstr "" 92 102 93 #: ban.php:2 37103 #: ban.php:258 94 104 msgid "Allowed Variables:" 95 105 msgstr "" 96 106 97 #: ban.php:2 42107 #: ban.php:263 98 108 msgid "Restore Default Template" 99 109 msgstr "" 100 110 101 #: ban.php:2 49111 #: ban.php:270 102 112 msgid "Update Options" 103 113 msgstr "" 104 114 105 #: ban.php:2 49115 #: ban.php:270 106 116 msgid "Cancel" 107 117 msgstr "" 108 118 109 #: ban.php:2 55119 #: ban.php:276 110 120 msgid "Ban Stats" 111 121 msgstr "" 112 122 113 #: ban.php: 282123 #: ban.php:303 114 124 msgid "No Attempts" 115 125 msgstr "" 116 126 117 #: ban.php: 287127 #: ban.php:308 118 128 msgid "Total Attempts:" 119 129 msgstr "" 120 130 121 #: ban.php: 289131 #: ban.php:310 122 132 msgid "Reset all IP ban stats and total ban stat?" 123 133 msgstr "" 124 134 125 #: ban.php: 292135 #: ban.php:313 126 136 msgid "You Are About To Reset Ban Stats." 127 137 msgstr "" 128 138 129 #: ban.php: 292139 #: ban.php:313 130 140 msgid "This Action Is Not Reversible. Are you sure?" 131 141 msgstr "" wp-ban/trunk/readme.html
r7483 r7535 295 295 <li>NEW: Added Ban Attempts Statistics In 'WP-Admin -> Manage -> Ban'</li> 296 296 <li>NEW: Move Ban Tab To 'WP-Admin -> Manage'</li> 297 <li>NEW: Added Toggle All Checkboxes</li> 298 <li>FIXED: Main Administrator Of The Site Cannot Be Banned.</li> 297 299 </ul> 298 300 </li>
