Changeset 16 for trunk/Phergie/Event/Handler/AdminCommand.php
- Timestamp:
- 02/07/08 16:17:53 (5 years ago)
- Files:
-
- 1 modified
-
trunk/Phergie/Event/Handler/AdminCommand.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Phergie/Event/Handler/AdminCommand.php
r11 r16 28 28 abstract class Phergie_Event_Handler_AdminCommand extends Phergie_Event_Handler 29 29 { 30 protected $_admins = null;30 protected $_admins = array(); 31 31 32 public function isAdmin(Phergie_Event_Request $event )32 public function isAdmin(Phergie_Event_Request $event, $__class__ = __CLASS__) 33 33 { 34 if ($this->_admins === null) { 35 $this->initialize(); 34 $class = substr($__class__, 22); 35 if ($this->_admins[$class] === null) { 36 $this->initialize($class); 36 37 } 37 38 $mask = $event->getNick() .'!'. $event->getUsername() .'@'. $event->getHost(); 38 39 // Try to match mask against admin masks 39 foreach ($this->_admins as $admin) {40 foreach ($this->_admins[$class] as $admin) { 40 41 if (preg_match('{^'.$admin.'$}', $mask)) { 41 42 return true; … … 45 46 } 46 47 47 protected function initialize( )48 protected function initialize($class) 48 49 { 49 $admins = explode(',', $this->getIni('AdminCommand.admins')); 50 $ini = $this->getIni($class.'.admins'); 51 if(empty($ini)) 52 $ini = $this->getIni('AdminCommand.admins'); 53 $admins = explode(',', $ini); 50 54 $this->_admins = array(); 51 55 foreach ($admins as $admin) {