Changeset 11

Show
Ignore:
Timestamp:
02/06/08 22:57:05 (5 years ago)
Author:
Seldaek
Message:

fixes #7
* bugfix in AdminCommand?
* added some comments in DNSLookup

Location:
trunk/Phergie/Event/Handler
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/Phergie/Event/Handler/AdminCommand.php

    r8 r11  
    6666                ); 
    6767                // Replace * so that they match correctly in a regex 
    68                 $this->_admins[] = str_replace('*', ($excluded === '' ? '.*' : '[^'.$excluded.']'), $admin); 
     68                $this->_admins[] = str_replace('*', ($excluded === '' ? '.*' : '[^'.$excluded.']*'), $admin); 
    6969        } 
    7070    } 
  • trunk/Phergie/Event/Handler/DNSLookup.php

    r10 r11  
    1010    public function onPrivmsg(Phergie_Event_Request $event) 
    1111    { 
     12        // Check if we have [rev]dns IP-address and if the IP is valid 
    1213        if (preg_match('#^(?:rev)?dns ((?:[0-9]{1,3}\.){3}[0-9]{1,3})$#i', $event->getArgument(1), $m) && ip2long($m[1]) !== false) { 
    1314                $this->doPrivmsg($event->getArgument(0), $m[1].' resolved as '.gethostbyaddr(long2ip(ip2long($m[1])))); 
    14         } elseif (preg_match('#^(?:rev)?dns ((?:[a-z0-9]+\.)+[a-z]{2,6})$#i', $event->getArgument(1), $m)) { 
     15        } 
     16        // Check if we have [rev]dns host 
     17        elseif (preg_match('#^(?:rev)?dns ((?:[a-z0-9]+\.)+[a-z]{2,6})$#i', $event->getArgument(1), $m)) { 
    1518                if(($ip = gethostbyname($m[1])) !== $m[1]) { 
    1619                $this->doPrivmsg($event->getArgument(0), $m[1] .' resolved as '.$ip);