forked from FreePBX/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.did.php
134 lines (126 loc) · 4.62 KB
/
page.did.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php /* $Id$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
$request = $_REQUEST;
$extdisplay = $_REQUEST['extdisplay'];
extract($request, EXTR_SKIP);
$tabindex = 0;
if($action == 'delIncoming'){
$message = 'Route '.$extdisplay.' '._("deleted").'!';
}
$formdata = array('extdisplay' => $extdisplay,
'old_extdisplay' => isset($old_extdisplay) ? $old_extdisplay : '',
'dispnum' => isset($dispnum) ? $dispnum : '',
'account' => isset($account) ? $account : '',
'goto' => isset($goto) ? $goto : '',
'ringing' => isset($ringing) ? $ringing : '',
'reversal' => isset($reversal) ? $reversal : '',
'description' => isset($description) ? $description : '',
'privacyman' => isset($privacyman) ? $privacyman : '',
'pmmaxretries' => isset($pmmaxretries) ? $pmmaxretries : '',
'pmminlength' => isset($pmminlength) ? $pmminlength : '',
'alertinfo' => isset($alertinfo) ? $alertinfo : '',
'mohclass' => isset($mohclass) ? $mohclass : '',
'grppre' => isset($grppre) ? $grppre : '',
'delay_answer' => isset($delay_answer) ? $delay_answer : '',
'pricid' => isset($pricid) ? $pricid : '',
'rnavsort' => isset($rnavsort) ? $rnavsort : '',
'didfilter' => isset($didfilter) ? $didfilter : '',
'rvolume' => isset($rvolume) ? $rvolume : '',
'indication_zone' => isset($indication_zone) ? $indication_zone : '',
'heading' => '<h2>'._("Add Incoming Route").'</h2>',
);
if($extdisplay){
$extarray=explode('/',$extdisplay,2);
$ininfo=core_did_get($extarray[0],$extarray[1]);
if (is_array($ininfo) && !empty($ininfo)) {
extract($ininfo);
}
$description = htmlspecialchars($description);
$extension = htmlspecialchars($extension);
$cidnum = htmlspecialchars($cidnum);
$grppre = htmlspecialchars($grppre);
$heading = '<h2>'._("Route").': ';
if($description){
$heading .= $description . '</h2>';
}else{
$heading .= $extdisplay . '</h2>';
}
$formdata['heading'] = $heading;
$formdata['description'] = $description;
$formdata['extension'] = $extension;
$formdata['cidnum'] = $cidnum;
$formdata['alertinfo'] = $alertinfo;
$formdata['grppre'] = $grppre;
$formdata['destination'] = $destination;
$formdata['pricid'] = $pricid;
$formdata['alertinfo'] = $alertinfo;
$formdata['ringing'] = $ringing;
$formdata['fanswer'] = $fanswer;
$formdata['reversal'] = $reversal;
$formdata['delay_answer'] = $delay_answer;
$formdata['privacyman'] = $privacyman;
$formdata['pmmaxretries'] = $pmmaxretries;
$formdata['pmminlength'] = $pmminlength;
$formdata['pmminlength'] = $pmminlength;
$formdata['mohclass'] = $mohclass;
$formdata['rvolume'] = $rvolume;
$formdata['indication_zone'] = $indication_zone;
}else{
$extension = isset($extarray[0]) ? $extarray[0] : '';
$cidnum = isset($extarray[1]) ? $extarray[1] : '';
$extdisplay = '';
$heading = '<h2>'._("Add Incoming Route").'</h2>';
$formdata['heading'] = $heading;
$formdata['extension'] = $extension;
$formdata['cidnum'] = $cidnum;
$formdata['extdisplay'] = $extdisplay;
}
// If this is a direct did, e.g. from-did-direct,nnn,1 then make a link to the extension
//
$did_dest = !empty($destination) ? explode(',',$destination) : array();
if (isset($did_dest[0]) && $did_dest[0] == 'from-did-direct') {
if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) {
$editURL = '?display=users&extdisplay='.$did_dest[1];
$EXTorUSER = _("User");
}else{
$editURL = '?display=extensions&extdisplay='.$did_dest[1];
$EXTorUSER = _("Extension");
}
$result = core_users_get($did_dest[1]);
$label = '<span><img width="16" height="16" border="0" title="'.sprintf(_("Edit %s"),$EXTorUSER).'" alt="" src="images/user_edit.png"/> '.sprintf(_("Edit %s %s (%s)"),$EXTorUSER, $did_dest[1],$result['name']).'</span>';
$link= "<p><a href=".$editURL.">".$label."</a></p>";
$formdata['userlink'] = $link;
}
$view = !empty($request['view']) ? $request['view'] : '';
$display_mode = "advanced";
$mode = \FreePBX::Config()->get("FPBXOPMODE");
if(!empty($mode)) {
$display_mode = $mode;
}
switch($view){
case "form":
if($display_mode == "basic") {
$content = load_view(__DIR__.'/views/did/basic_form.php', $formdata);
} else {
$content = load_view(__DIR__.'/views/did/advanced_form.php', $formdata);
}
break;
default:
$content = load_view(__DIR__.'/views/did/didgrid.php');
break;
}
?>
<div class="container-fluid">
<h1><?php echo _('Inbound Routes')?></h1>
<div class = "display no-border">
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<?php echo $content ?>
</div>
</div>
</div>
</div>
</div>
</div>