From 0b0d21e95b699b5afb4170abffe47a898830a61e Mon Sep 17 00:00:00 2001 From: pk910 Date: Sun, 30 Jun 2013 01:11:39 +0200 Subject: [PATCH] fixed some PHP Warnings --- zncadmin/ZNCServerV1.class.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/zncadmin/ZNCServerV1.class.php b/zncadmin/ZNCServerV1.class.php index 1cac8e1..59bbfd6 100644 --- a/zncadmin/ZNCServerV1.class.php +++ b/zncadmin/ZNCServerV1.class.php @@ -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); -- 2.20.1