if($server > 0 && $zncserver['name'] == $server && $zncserver['protected'] === true && !$force) {
error("Access denied\n");
return;
+ } elseif($server > 0 && $zncserver['name'] == $server && (($zncserver['protected'] === true && $force) || $zncserver['protected'] === false)) {
+ $zncserver['conn'] = new ZNCServer($zncserver['host'], $zncserver['port'], (isset($zncserver['version']) ? $zncserver['version'] : NULL));
+ $zncserver['conn']->login($zncserver['auser'], $zncserver['apass']);
+ $trafficStats = $zncserver['conn']->getTrafficStats();
+ } else {
+ echo "No Servers configured...\n";
+ return;
}
$total = 0;
<?php
/* ZNCServerV1.class.php - ZNC Server Class - ZNCAdmin
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$classinfo = array(
- "name" => "ZNCServerV1",
- "version" => 1.000,
+ "name" => "ZNCServerV1",
+ "version" => 1.000,
);
class ZNCServerV1 {
- private $host, $port;
- private $connector;
-
- public function ZNCServerV1($host, $port, $connector = NULL) {
- $this->host = $host;
- $this->port = $port;
- if($connector == NULL)
- $connector = new HTTPConnector();
- $this->connector = $connector;
- }
+ private $host, $port;
+ private $connector;
+
+ public function ZNCServerV1($host, $port, $connector = NULL) {
+ $this->host = $host;
+ $this->port = $port;
+ if($connector == NULL)
+ $connector = new HTTPConnector();
+ $this->connector = $connector;
+ }
public function login($user, $pass) {
$post = array(
return $seenlist;
}
+ public function getTrafficStats() {
+ $html = $this->connector->get("http://".$this->host.":".$this->port."/mods/global/webadmin/traffic");
+ }
+
/*
$settings array elements:
nick
$post['autoclearchanbuffer'] = 'true';
$this->connector->post("http://".$this->host.":".$this->port."/mods/global/webadmin/addchan?user=".$username.'&network=default', $post);
}
-
+
}
?>
\ No newline at end of file