fixed some PHP Warnings
authorpk910 <philipp@zoelle1.de>
Sat, 29 Jun 2013 23:11:39 +0000 (01:11 +0200)
committerpk910 <philipp@zoelle1.de>
Sat, 29 Jun 2013 23:11:39 +0000 (01:11 +0200)
zncadmin/ZNCServerV1.class.php

index 1cac8e1c0e7586859597f08d561939e6314cdeb5..59bbfd6e25f602d688b59b9ed44315f94d65e52e 100644 (file)
@@ -128,7 +128,7 @@ class ZNCServerV1 {
         $html = $this->connector->post("http://".$this->host.":".$this->port."/mods/global/webadmin/adduser", $post);
 
         if(!preg_match("/Invalid Submission/i", $html)) {
-            if(!$this->addNetwork($username, $settings, $servers, $other)) {
+            if(!$this->addNetwork($username, $settings, $servers, $others)) {
                 return false;
             }
             return !preg_match("/Invalid Submission/i", $html);
@@ -136,7 +136,7 @@ class ZNCServerV1 {
         return !preg_match("/Invalid Submission/i", $html);
     }
 
-    public function addNetwork($username, $settings, $servers, $other) {
+    public function addNetwork($username, $settings, $servers, $others) {
         $html = $this->connector->get("http://".$this->host.":".$this->port."/mods/global/webadmin/addnetwork?user=".$username);
         $exp = explode('name="_CSRF_Check" value="', $html);
         $exp = explode('"', $exp[1]);
@@ -303,19 +303,25 @@ class ZNCServerV1 {
         if($new_servers) {
             $post['servers'] = implode("\n", $new_servers);
         }
-        foreach($add_modules as $name => $args) {
-            $post['loadmod'][] = $name;
-            if($args != "")
-                $post['modargs_'.$name] = $args;
+        if($add_modules) {
+            foreach($add_modules as $name => $args) {
+                $post['loadmod'][] = $name;
+                if($args != "")
+                    $post['modargs_'.$name] = $args;
+            }
         }
-        foreach($del_modules as $name => $args) {
-            foreach($post['loadmod'] as $index => $mod) {
-                if(strtolower($mod) == strtolower($name))
-                    unset($post['loadmod'][$index]);
+        if($del_modules) {
+            foreach($del_modules as $name => $args) {
+                foreach($post['loadmod'] as $index => $mod) {
+                    if(strtolower($mod) == strtolower($name))
+                        unset($post['loadmod'][$index]);
+                }
             }
         }
-        foreach($others as $name => $value) {
-            $post[$name] = $value;
+        if($others) {
+            foreach($others as $name => $value) {
+                $post[$name] = $value;
+            }
         }
         $html = $this->connector->post("http://".$this->host.":".$this->port."/mods/global/webadmin/edituser?user=".$username, $post);
         return !preg_match("/Invalid Submission/i", $html);