add some code for traffic stats
[ZNCAdmin.git] / zncadmin / ZNCServerV1.class.php
index 59bbfd6e25f602d688b59b9ed44315f94d65e52e..e18976736eab737ddaeac17061c1ce4de5c8363b 100644 (file)
@@ -1,37 +1,37 @@
 <?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(
@@ -92,6 +92,10 @@ class ZNCServerV1 {
         return $seenlist;
     }
 
+    public function getTrafficStats() {
+        $html = $this->connector->get("http://".$this->host.":".$this->port."/mods/global/webadmin/traffic");
+    }
+
     /*
     $settings array elements:
         nick
@@ -391,7 +395,7 @@ class ZNCServerV1 {
         $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