X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=Uplink%2FP10_Server.class.php;h=ba9200e24c796905eecd53aa0504f9ab35b38aae;hb=ecbd414862800db8bb4c45dfc640c9090f80dce1;hp=f36bbeae3cc1c4092e251e0301f5e88ee3603be4;hpb=e8b8beead9e81f42f9c125d82ab6b21b60718f67;p=PHP-P10.git diff --git a/Uplink/P10_Server.class.php b/Uplink/P10_Server.class.php index f36bbea..ba9200e 100644 --- a/Uplink/P10_Server.class.php +++ b/Uplink/P10_Server.class.php @@ -70,13 +70,31 @@ class P10_Server { private static $static_servers = array(); - public static getServerByNum($numeric) { + public static function getServerByNum($numeric) { if(array_key_exists($numeric, self::$static_servers)) { return self::$static_servers[$numeric]; } return NULL; } + public static function getServerByName($name) { + $name = strtolower($name); + foreach(self::$static_servers as $server) { + if(strtolower($server->getName()) == $name) { + return $server; + } + } + return NULL; + } + + public static function getServerCount() { + return count(self::$static_servers); + } + + public static function getServers() { + return self::$static_servers; + } + private $name; private $numeric; @@ -98,8 +116,10 @@ class P10_Server { self::$static_servers[$numeric] = $this; } - public function disconnectServer($linked_only = false) { + public function disconnectServer($eventHandler, $linked_only = false) { if(!$linked_only) { + if($eventHandler) + $eventHandler->event_squit($this); if($this->parent_server) { $this->parent_server->delServer($this); } @@ -107,7 +127,7 @@ class P10_Server { unset(self::$static_servers[$this->numeric]); } foreach($this->servers as $server) { - $server->disconnectServer(); + $server->disconnectServer($eventHandler); } } @@ -165,6 +185,10 @@ class P10_Server { public function getUsers() { return $this->users; } + + public function getUserCount() { + return count($this->users); + } } ?> \ No newline at end of file