예제 #1
0
파일: util.php 프로젝트: Bauani/voipconf
function get_switch($filename, $username)
{
    $switches = array();
    $ini = new Ini();
    $ini->load($filename);
    foreach ($ini->sections() as $host) {
        if ($ini->get($host, "context") == $username) {
            $switch["host"] = $ini->get($host, "host");
            $switch["call-limit"] = $ini->get($host, "call-limit");
            $switches[] = $switch;
        }
    }
    return $switches;
}
예제 #2
0
파일: export.php 프로젝트: Bauani/voipconf
 */
$access_role = "reader";
require_once "access.php";
require_once "lib/validate.php";
Header("Content-Type: text/plain; charset=UTF-8");
if ($_GET["type"] == "sig") {
    echo "voipconf\n";
    exit(0);
}
if (($mac = valid_mac($_GET["mac"])) === false) {
    exit(1);
}
require_once "lib/ini.php";
$chan = new Ini();
$chan->load($g_chan_sync);
foreach ($chan->sections() as $user) {
    if ($chan->get($user, "mac") == $mac) {
        $username = $user;
        break;
    }
}
if (!isset($username)) {
    exit(1);
}
switch ($_GET["type"]) {
    case "sbo":
        ?>
[<?php 
        echo $username;
        ?>
]
예제 #3
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);