-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.php
69 lines (60 loc) · 1.95 KB
/
install.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
<?php
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
/*
* freepbx-misdn -- mISDN module for FreePBX
*
* Copyright (C) 2006, Thomas Liske.
*
* Thomas Liske <[email protected]>
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
require_once(dirname(__FILE__).'/functions.inc.php');
outn(_("Checking for an xslt processor.."));
if (!function_exists('xslt_create')) {
out(_("nothing found."));
out(_("FATAL: can't continue installing, see module requirements."));
return false;
}
/* If we have an empty mISDN group list, create an example trunk and extensions group. */
if (!misdn_groups_list()) {
sql("DELETE FROM `misdn_ports`;");
$groups = array('nt' => array(), 'te' => array());
$p = 1;
foreach(misdn_dump() as $ar) {
$name = array_shift($ar);
array_shift($ar);
foreach($ar as $mode)
$groups[trim($mode)][] = $p++;
}
$ar = array();
$ptypes = array(
'te' => array(
'name' => 'TrunkPorts',
'type' => 1,
),
'nt' => array(
'name' => 'ExtensionPorts',
'type' => 0,
),
);
foreach($misdn_confkeys as $confkey) {
$keys[] = $confkey['name'];
$vals[] = misdn_format_sql($confkey['name'], $confkey['default']);
}
foreach(array_keys($groups) as $g) {
if (count($g)) {
sql('INSERT INTO `misdn_groups` (`name`,`type`,'.implode(',', $keys).") VALUES ('"._misdn_escape_string($ptypes[$g]['name'])."',".$ptypes[$g]['type'].",".implode(',', $vals).')');
foreach($groups[$g] as $p) {
sql("INSERT INTO `misdn_ports` (`port`, `group`) VALUES ($p, '"._misdn_escape_string($ptypes[$g]['name'])."')");
}
}
}
}