- private $host, $port;
- private $connector;
-
- public function ZNCServer($host, $port) {
- $this->host = $host;
- $this->port = $port;
- $this->connector = new HTTPConnector();
- }
-
- public function login($user, $pass) {
- $post = array(
- "user" => $user,
- "pass" => $pass,
- "submitted" => "1"
- );
- $this->connector->post("http://".$this->host.":".$this->port."/login", $post);
- $http = $this->connector->get("http://".$this->host.":".$this->port."/?cookie_check=true");
- $logged_in = !preg_match("/errorbar/i", $http);
-
- return $logged_in;
- }
-
- public function getUserList() {
- $html = $this->connector->get("http://".$this->host.":".$this->port."/mods/webadmin/listusers");
- $exp = explode('<div class="toptable">', $html);
- $exp = explode('</div>', $exp[1]);
- $exp = explode('<tbody>', $exp[0]);
- $exp = explode('</tbody>', $exp[1]);
- $list = explode('<tr class=', $exp[0]);
- $userlist = array();
- for($i = 1; $i < count($list); $i++) {
- $userdata = array();
- $exp = explode('<td>', $list[$i]);
- $exp2 = explode('</td>', $exp[2]);
- $userdata['user'] = $exp2[0];
- $exp2 = explode('</td>', $exp[3]);
- $userdata['clients'] = $exp2[0];
- $exp2 = explode('</td>', $exp[4]);
- $userdata['server'] = $exp2[0];
- $exp2 = explode('</td>', $exp[5]);
- $userdata['nick'] = $exp2[0];
- $userlist[] = $userdata;
- }
- return $userlist;
- }
-
+ private $host, $port;
+ private $connector;
+
+ public function ZNCServer($host, $port) {
+ $this->host = $host;
+ $this->port = $port;
+ $this->connector = new HTTPConnector();
+ }
+
+ public function login($user, $pass) {
+ $post = array(
+ "user" => $user,
+ "pass" => $pass,
+ "submitted" => "1"
+ );
+ $this->connector->post("http://".$this->host.":".$this->port."/login", $post);
+ $http = $this->connector->get("http://".$this->host.":".$this->port."/?cookie_check=true");
+ $logged_in = !preg_match("/errorbar/i", $http);
+
+ return $logged_in;
+ }
+
+ public function getUserList() {
+ $html = $this->connector->get("http://".$this->host.":".$this->port."/mods/global/webadmin/listusers");
+ $exp = explode('<div class="toptable">', $html);
+ $exp = explode('</div>', $exp[1]);
+ $exp = explode('<tbody>', $exp[0]);
+ $exp = explode('</tbody>', $exp[1]);
+ $list = explode('<tr class=', $exp[0]);
+ $userlist = array();
+ for($i = 1; $i < count($list); $i++) {
+ $userdata = array();
+ $exp = explode('<td>', $list[$i]);
+ $exp2 = explode('</td>', $exp[2]);
+ $userdata['user'] = $exp2[0];
+ $exp2 = explode('</td>', $exp[3]);
+ $userdata['server'] = $exp2[0];
+ $exp2 = explode('</td>', $exp[4]);
+ $userdata['clients'] = $exp2[0];
+ $userlist[] = $userdata;
+ }
+ return $userlist;
+ }
+