$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);
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]);
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);