forked from tm1000/freepbx-simple-endpointmanager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
57 lines (52 loc) · 1.96 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
$blank = FALSE;
require_once 'includes/provisioner/samples/json.php';
$bootstrap_settings['freepbx_auth'] = false;
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
include_once('/etc/asterisk/freepbx.conf');
}
include('includes/webprov.php');
$prov = new webprov();
$location = isset($_REQUEST['location']) ? $_REQUEST['location'] : '';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : '';
if(!$blank) {
$prov->tpl->draw( 'header' );
switch($location) {
case 'add':
$provis_conf = @parse_ini_file('/etc/hipbx.d/provis.conf', false, INI_SCANNER_RAW);
$nets=array();
if (!isset($provis_conf['NETWORK'])) {
$nets = array(array('name' => 'Unconfigured'));
} else {
foreach($provis_conf['NETWORK'] as $name => $net) {
array_push($nets, array('name' => $name, 'network' => $net));
}
}
$start_mac = isset($_REQUEST['mac']) ? $_REQUEST['mac'] : '';
$prov->tpl->assign( 'start_mac', $start_mac );
$prov->tpl->assign( 'devices', $prov->get_devices('SPA502G') );
$prov->tpl->assign( 'networks', $nets );
$prov->tpl->draw( 'add' );
break;
case 'swap':
$prov->tpl->assign( 'devices', $prov->get_managed_devices() );
$prov->tpl->draw( 'swap' );
break;
case 'del':
$prov->tpl->assign( 'devices', $prov->get_managed_devices() );
$prov->tpl->draw( 'del' );
break;
case 'manage':
$prov->tpl->assign( 'devices', $prov->get_managed_devices() );
$prov->tpl->draw( 'manage' );
break;
case 'manage_phone':
include 'includes/edit_phone.php';
break;
default:
$prov->tpl->assign( 'address', 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"].'p.php/' );
$prov->tpl->draw( 'index' );
break;
}
$prov->tpl->draw( 'footer' );
}