$settings['nick'] = $argv[2];
$settings['altnick'] = $argv[2]."`";
$settings['ident'] = $username;
- $ret = $addserv['conn']->addZNC($argv[2], $password, $settings, $add_settings['servers'], $add_settings['modules'], $add_settings['other']);
+ $ret = $addserv['conn']->addZNC($argv[2], $password, $settings, $add_settings['servers'], $add_settings['modules'], $add_settings['netmodules'], $add_settings['other']);
if($ret) {
echo "Added user ".$argv[2]." to Server ".$addserv['name'].".\n";
echo " Server Host: ".$addserv['public']." Port: ".$addserv['port']." SSL Port: ".$addserv['sslport']."\n";
altnick
ident
*/
- public function addZNC($username, $password, $settings, $servers, $modules, $others) {
+ public function addZNC($username, $password, $settings, $servers, $modules, $netmodules, $others) {
$html = $this->connector->get("http://".$this->host.":".$this->port."/mods/global/webadmin/adduser");
$exp = explode('name="_CSRF_Check" value="', $html);
$exp = explode('"', $exp[1]);
$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, $others)) {
+ if(!$this->addNetwork($username, $settings, $servers, $netmodules, $others)) {
return false;
}
return !preg_match("/Invalid Submission/i", $html);
return !preg_match("/Invalid Submission/i", $html);
}
- public function addNetwork($username, $settings, $servers, $others) {
+ public function addNetwork($username, $settings, $servers, $modules, $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]);
$post['floodrate'] = '1.0';
$post['floodburst'] = '4';
$post['user'] = $username;
+
+ $post['loadmod'] = array();
+ foreach($modules as $name => $args) {
+ $post['loadmod'][] = $name;
+ if($args != "")
+ $post['modargs_'.$name] = $args;
+ }
foreach($others as $name => $value) {
$post[$name] = $value;