Changeset 7535

Show
Ignore:
Timestamp:
01/24/07 14:54:10 (1 year ago)
Author:
GamerZ
Message:

Minor Fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wp-ban/trunk/ban/ban.php

    r7445 r7535  
    9797### Function: Ban Options 
    9898function ban_options() { 
    99       global $wpdb; 
     99      global $wpdb, $current_user; 
     100      $admin_login = trim($current_user->user_login); 
    100101      // Form Processing  
    101102      if(!empty($_POST['do'])) { 
     
    120121      } 
    121122      if($_POST['Submit']) { 
     123            $text = ''; 
    122124            $update_ban_queries = array(); 
    123125            $update_ban_text = array();    
     
    128130                  $banned_ips = array(); 
    129131                  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 { 
    131135                              $banned_ips[] = trim($banned_ip); 
    132136                        } 
     
    136140                  $banned_hosts = array(); 
    137141                  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 { 
    139145                              $banned_hosts[] = trim($banned_host); 
    140146                        } 
     
    148154            $update_ban_text[] = __('Banned Message', 'wp-ban'); 
    149155            $i=0; 
    150             $text = ''; 
    151156            foreach($update_ban_queries as $update_ban_query) { 
    152157                  if($update_ban_query) { 
     
    181186<script type="text/javascript"> 
    182187/* <![CDATA[*/ 
     188      var checked = 0; 
    183189      function banned_default_templates(template) { 
    184190            var default_template; 
     
    189195            } 
    190196            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            } 
    191212      } 
    192213/* ]]> */ 
     
    200221                  <tr> 
    201222                        <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 /> 
    203224                              <?php _e('Please <strong>DO NOT</strong> ban yourself.', 'wp-ban'); ?> 
    204225                        </td> 
     
    259280                  <th width="40%">IPs</th> 
    260281                  <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();" />&nbsp; Action</th> 
    262283            </tr> 
    263284                  <?php 
     
    297318 
    298319 
     320### Function: Check Whether Or Not The IP Address Belongs To Admin 
     321function 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 
     333function 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 
    299344### Function: Create Ban Options 
    300345add_action('activate_ban/ban.php', 'ban_init'); 
  • wp-ban/trunk/ban/wp-ban.pot

    r7445 r7535  
    33"Project-Id-Version: WP-Ban 1.10\n" 
    44"POT-Creation-Date: \n" 
    5 "PO-Revision-Date: 2007-01-20 22:40+0800\n" 
     5"PO-Revision-Date: 2007-01-24 22:51+0800\n" 
    66"Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n" 
    77"Language-Team: Lester Chan <gamerz84@hotmail.com>\n" 
     
    1919msgstr "" 
    2020 
    21 #: ban.php:104 
    22 #: ban.php:292 
     21#: ban.php:105 
     22#: ban.php:313 
    2323msgid "Reset Ban Stats" 
    2424msgstr "" 
    2525 
    26 #: ban.php:108 
     26#: ban.php:109 
    2727msgid "All IP Ban Stats And Total Ban Stat Reseted" 
    2828msgstr "" 
    2929 
    30 #: ban.php:116 
     30#: ban.php:117 
    3131msgid "Selected IP Ban Stats Reseted" 
    3232msgstr "" 
    3333 
    34 #: ban.php:146 
    35 #: ban.php:208 
     34#: ban.php:133 
     35#, php-format 
     36msgid "This IP '%s' Belongs To The Admin And Will Not Be Added To Ban List" 
     37msgstr "" 
     38 
     39#: ban.php:143 
     40#, php-format 
     41msgid "This Hostname '%s' Belongs To The Admin Will Not Be Added To Ban List" 
     42msgstr "" 
     43 
     44#: ban.php:152 
     45#: ban.php:229 
    3646msgid "Banned IPs" 
    3747msgstr "" 
    3848 
    39 #: ban.php:147 
    40 #: ban.php:222 
     49#: ban.php:153 
     50#: ban.php:243 
    4151msgid "Banned Host Names" 
    4252msgstr "" 
    4353 
    44 #: ban.php:148 
    45 #: ban.php:236 
     54#: ban.php:154 
     55#: ban.php:257 
    4656msgid "Banned Message" 
    4757msgstr "" 
    4858 
    49 #: ban.php:153 
     59#: ban.php:158 
    5060msgid "Updated" 
    5161msgstr "" 
    5262 
    53 #: ban.php:158 
     63#: ban.php:163 
    5464msgid "No Ban Option Updated" 
    5565msgstr "" 
    5666 
    57 #: ban.php:187 
    58 #: ban.php:316 
     67#: ban.php:193 
     68#: ban.php:361 
    5969msgid "You Are Banned." 
    6070msgstr "" 
    6171 
    62 #: ban.php:197 
     72#: ban.php:218 
    6373msgid "Ban Options" 
    6474msgstr "" 
    6575 
    66 #: ban.php:202 
     76#: ban.php:223 
    6777#, php-format 
    6878msgid "Your IP is: <strong>%s</strong><br />Your Host Name is: <strong>%s</strong>" 
    6979msgstr "" 
    7080 
    71 #: ban.php:203 
     81#: ban.php:224 
    7282msgid "Please <strong>DO NOT</strong> ban yourself." 
    7383msgstr "" 
    7484 
    75 #: ban.php:209 
     85#: ban.php:230 
    7686msgid "Use <strong>*</strong> for wildcards." 
    7787msgstr "" 
    7888 
    79 #: ban.php:210 
    80 #: ban.php:224 
     89#: ban.php:231 
     90#: ban.php:245 
    8191msgid "Start each entry on a new line." 
    8292msgstr "" 
    8393 
    84 #: ban.php:211 
    85 #: ban.php:225 
     94#: ban.php:232 
     95#: ban.php:246 
    8696msgid "Examples:" 
    8797msgstr "" 
    8898 
    89 #: ban.php:223 
     99#: ban.php:244 
    90100msgid "Use <strong>*</strong> for wildcards" 
    91101msgstr "" 
    92102 
    93 #: ban.php:237 
     103#: ban.php:258 
    94104msgid "Allowed Variables:" 
    95105msgstr "" 
    96106 
    97 #: ban.php:242 
     107#: ban.php:263 
    98108msgid "Restore Default Template" 
    99109msgstr "" 
    100110 
    101 #: ban.php:249 
     111#: ban.php:270 
    102112msgid "Update Options" 
    103113msgstr "" 
    104114 
    105 #: ban.php:249 
     115#: ban.php:270 
    106116msgid "Cancel" 
    107117msgstr "" 
    108118 
    109 #: ban.php:255 
     119#: ban.php:276 
    110120msgid "Ban Stats" 
    111121msgstr "" 
    112122 
    113 #: ban.php:282 
     123#: ban.php:303 
    114124msgid "No Attempts" 
    115125msgstr "" 
    116126 
    117 #: ban.php:287 
     127#: ban.php:308 
    118128msgid "Total  Attempts:" 
    119129msgstr "" 
    120130 
    121 #: ban.php:289 
     131#: ban.php:310 
    122132msgid "Reset all IP ban stats and total ban stat?" 
    123133msgstr "" 
    124134 
    125 #: ban.php:292 
     135#: ban.php:313 
    126136msgid "You Are About To Reset Ban Stats." 
    127137msgstr "" 
    128138 
    129 #: ban.php:292 
     139#: ban.php:313 
    130140msgid "This Action Is Not Reversible. Are you sure?" 
    131141msgstr "" 
  • wp-ban/trunk/readme.html

    r7483 r7535  
    295295                                    <li>NEW: Added Ban Attempts Statistics In 'WP-Admin -> Manage -> Ban'</li> 
    296296                                    <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> 
    297299                              </ul> 
    298300                        </li>