-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
92 lines (83 loc) · 2.39 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
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
<?php
/**
* @package FS_CURL
* @license BSD
* @author Raymond Chandler (intralanman) <[email protected]>
* @version 0.1
* initial page hit in all curl requests
*/
/**
* define for the time that execution of the script started
*/
define('START_TIME', preg_replace('/^0\.([0-9]+) ([0-9]+)$/', '\2.\1', microtime()));
/**
* Pre-Class initialization die function
* This function should be called on any
* critical error condition before the fs_curl
* class is successfully instantiated.
* @return void
*/
function file_not_found($no = false, $str = false, $file = false, $line = false)
{
if ($no == E_STRICT) {
return;
}
header('Content-Type: text/xml');
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
printf("<document type=\"freeswitch/xml\">\n");
printf(" <section name=\"result\">\n");
printf(" <result status=\"not found\"/>\n");
printf(" </section>\n");
if (!empty($no) && !empty($str) && !empty($file) && !empty($line)) {
printf(" <!-- ERROR: $no - ($str) on line $line of $file -->\n");
}
printf("</document>\n");
exit();
}
set_error_handler('file_not_found');
if (!(@include_once('fs_curl.php'))
|| !(@include_once('global_defines.php'))
) {
trigger_error(
'could not include fs_curl.php or global_defines.php', E_USER_ERROR
);
}
if (isset($_REQUEST['cdr'])) {
$section = 'cdr';
} else {
$section = $_REQUEST['section'];
}
$section_file = sprintf('fs_%s.php', $section);
include_once($section_file);
switch ($section) {
case 'configuration':
$config = $_REQUEST['key_value'];
$processor = sprintf('configuration/%s.php', $config);
$class = str_replace('.', '_', $config);
if (!(@include_once($processor))) {
trigger_error("unable to include $processor");
}
/**
* @var $conf fs_configuration
*/
$conf = new $class;
$conf->comment("class name is $class");
break;
case 'dialplan':
$conf = new fs_dialplan();
break;
case 'directory':
$conf = new fs_directory();
break;
case 'cdr':
$conf = new fs_cdr();
break;
case 'chatplan':
$conf = new fs_chatplan();
break;
}
$conf->debug('---- Start _REQUEST ----');
$conf->debug($_REQUEST);
$conf->debug('---- End _REQUEST ----');
$conf->main();
$conf->output_xml();