예제 #1
0
파일: edit.php 프로젝트: Bauani/voipconf
        $usr->add($model["username"], $gateway);
    }
    $ael = new ExtAel();
    $ael->load($g_ext_ael);
    if (isset($old_user)) {
        $ael->delete($old_user);
    }
    $ael->add($model["username"]);
    $chan->dump($g_chan_sync);
    $sip->dump($g_sip);
    $usr->dump($g_ext_usr);
    $ael->dump($g_ext_ael);
    reload_all($g_vpn);
    header("Location: " . dirname($_SERVER["PHP_SELF"]) . "/list.php");
    exit;
}
// load generic info by mac
$ini = new Ini();
$ini->load($g_chan_sync);
foreach ($ini->sections() as $user) {
    if ($ini->get($user, "mac") == $model["mac"]) {
        $model["username"] = $ini->get($user, "authname");
        $model["password"] = $ini->get($user, "secret");
        break;
    }
}
// load switch info by username
$model["switch"] = get_switch($g_sip, $model["username"]);
// load gateway info by username
$model["gateway"] = get_gateway($g_ext_usr, $model["username"]);
render("Edit", "edit", $model);
예제 #2
0
파일: list.php 프로젝트: Bauani/voipconf
            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();
foreach ($ini->sections() as $user) {
    if ($user == "general") {
        continue;
    }
    $conf = array();
    $conf["mac"] = $ini->get($user, "mac");
    $conf["username"] = $user;
    $conf["switch"] = get_switch($g_sip, $user);
    $conf["gateway"] = get_gateway($g_ext_usr, $user);
    $model[] = $conf;
}
render("Configurations", "list", $model);