Example #1
0
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;
}
Example #2
0
$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;
        ?>
]
type=friend
Example #3
0
<?php

require_once 'packages/sys/Ini.class.php';
$ini = new Ini('editplus.ini');
$ini->parse();
echo "<pre>";
print_r($ini->get());
echo "</pre>";
Example #4
0
        $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);
Example #5
0
            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);