} foreach ($model["switch"] as $i => $switch) { if (in_array($switch["host"], $hosts)) { __invalid_entry($model, "switch[{$i}][host]", "Duplicate Switch Host"); } else { $hosts[] = $switch["host"]; } $sip->add($switch["host"], "type", "friend"); $sip->add($switch["host"], "host", $switch["host"]); $sip->add($switch["host"], "context", $model["username"]); $sip->add($switch["host"], "call-limit", $switch["call-limit"]); } $usr = new ExtUsr(); $usr->load($g_ext_usr); if (isset($old_user)) { $usr->delete($old_user); } $prefix = array(); foreach ($model["gateway"] as $i => $gateway) { if (in_array($gateway["prefix"], $prefix)) { __invalid_entry($model, "gateway[{$i}][prefix]", "Duplicate Gateway Prefix"); } else { $prefix[] = $gateway["prefix"]; } $usr->add($model["username"], $gateway); } $ael = new ExtAel(); $ael->load($g_ext_ael); if (isset($old_user)) { $ael->delete($old_user); }
break; } } if (isset($target_user)) { $ini->load($g_sip); foreach ($ini->sections() as $host) { if ($ini->get($host, "context") == $target_user) { $ini->deleteSection($host); } } $ini->dump($g_sip); } if (isset($target_user)) { $ext = new ExtUsr(); $ext->load($g_ext_usr); $ext->delete($target_user); $ext->dump($g_ext_usr); } if (isset($target_user)) { $ext = new ExtAel(); $ext->load($g_ext_ael); $ext->delete($target_user); $ext->dump($g_ext_ael); } reload_all($g_vpn); } } } $ini = new Ini(); $ini->load($g_chan_sync); $model = array();