X-Git-Url: http://git.pk910.de/?p=ZNCAdmin.git;a=blobdiff_plain;f=zncadmin%2FZNCServerV1.class.php;fp=zncadmin%2FZNCServerV1.class.php;h=59bbfd6e25f602d688b59b9ed44315f94d65e52e;hp=1cac8e1c0e7586859597f08d561939e6314cdeb5;hb=0b0d21e95b699b5afb4170abffe47a898830a61e;hpb=a002a07957fe9d65ba856662aa95a5ab4b2697ae 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);