@@ -25,19 +25,19 @@ |
||
25 | 25 | define('ENVIRONMENT', 'production'); |
26 | 26 | |
27 | 27 | if (defined('ENVIRONMENT')) { |
28 | - switch (ENVIRONMENT) { |
|
29 | - case 'development': |
|
30 | - error_reporting(E_ALL); |
|
31 | - break; |
|
28 | + switch (ENVIRONMENT) { |
|
29 | + case 'development': |
|
30 | + error_reporting(E_ALL); |
|
31 | + break; |
|
32 | 32 | |
33 | - case 'testing': |
|
34 | - case 'production': |
|
35 | - error_reporting(0); |
|
36 | - break; |
|
33 | + case 'testing': |
|
34 | + case 'production': |
|
35 | + error_reporting(0); |
|
36 | + break; |
|
37 | 37 | |
38 | - default: |
|
39 | - error_reporting(E_ALL); |
|
40 | - } |
|
38 | + default: |
|
39 | + error_reporting(E_ALL); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | //Include file |
@@ -59,8 +59,8 @@ |
||
59 | 59 | //set_error_handler('xml_not_found'); |
60 | 60 | |
61 | 61 | //Define file name |
62 | -$file = "astpp." . $_REQUEST['section'] . ".php"; |
|
62 | +$file = "astpp.".$_REQUEST['section'].".php"; |
|
63 | 63 | |
64 | 64 | //Include file |
65 | -include_once("scripts/" . $file); |
|
65 | +include_once("scripts/".$file); |
|
66 | 66 | ?> |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | case 'development': |
30 | 30 | // error_reporting(E_ALL); |
31 | - error_reporting(E_ERROR|E_WARNING|E_PARSE); |
|
31 | + error_reporting(E_ERROR|E_WARNING|E_PARSE); |
|
32 | 32 | break; |
33 | 33 | |
34 | 34 | case 'testing': |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | |
63 | 63 | if(isset($_SERVER["CONTENT_TYPE"]) && $_SERVER["CONTENT_TYPE"] == "application/json") { |
64 | 64 | |
65 | - $db->run("SET NAMES utf8"); |
|
66 | - $data = json_decode(file_get_contents("php://input"),true); |
|
67 | - //error_log(print_r($data,true)); |
|
68 | - $logger->log(print_r($data,true)); |
|
69 | - process_cdr($data,$db,$logger,$decimal_points); |
|
65 | + $db->run("SET NAMES utf8"); |
|
66 | + $data = json_decode(file_get_contents("php://input"),true); |
|
67 | + //error_log(print_r($data,true)); |
|
68 | + $logger->log(print_r($data,true)); |
|
69 | + process_cdr($data,$db,$logger,$decimal_points); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | //$db->cleanup(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | case 'development': |
30 | 30 | // error_reporting(E_ALL); |
31 | - error_reporting(E_ERROR|E_WARNING|E_PARSE); |
|
31 | + error_reporting(E_ERROR | E_WARNING | E_PARSE); |
|
32 | 32 | break; |
33 | 33 | |
34 | 34 | case 'testing': |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | $config = $lib->get_configurations($db); |
56 | 56 | |
57 | 57 | //Set default decimal points |
58 | -$decimal_points = ($config['decimal_points'] <= 0)?4:$config['decimal_points']; |
|
58 | +$decimal_points = ($config['decimal_points'] <= 0) ? 4 : $config['decimal_points']; |
|
59 | 59 | |
60 | 60 | //Define logger object |
61 | 61 | $logger = new logger($lib); |
62 | 62 | |
63 | -if(isset($_SERVER["CONTENT_TYPE"]) && $_SERVER["CONTENT_TYPE"] == "application/json") { |
|
63 | +if (isset($_SERVER["CONTENT_TYPE"]) && $_SERVER["CONTENT_TYPE"] == "application/json") { |
|
64 | 64 | |
65 | 65 | $db->run("SET NAMES utf8"); |
66 | - $data = json_decode(file_get_contents("php://input"),true); |
|
66 | + $data = json_decode(file_get_contents("php://input"), true); |
|
67 | 67 | //error_log(print_r($data,true)); |
68 | - $logger->log(print_r($data,true)); |
|
69 | - process_cdr($data,$db,$logger,$decimal_points); |
|
68 | + $logger->log(print_r($data, true)); |
|
69 | + process_cdr($data, $db, $logger, $decimal_points); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | //$db->cleanup(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | //Define user rates array for parsing |
25 | -$CONST_USER_RATE = array ( |
|
25 | +$CONST_USER_RATE = array( |
|
26 | 26 | 'RID' => 'id', |
27 | 27 | 'RCD' => 'code', |
28 | 28 | 'RDS' => 'destination', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ); |
37 | 37 | |
38 | 38 | //Define carrier rates array for parsing |
39 | -$CONST_CARRIER_RATE = array ( |
|
39 | +$CONST_CARRIER_RATE = array( |
|
40 | 40 | 'CID' => 'id', |
41 | 41 | 'CCD' => 'code', |
42 | 42 | 'CDS' => 'destination', |
@@ -23,172 +23,172 @@ discard block |
||
23 | 23 | |
24 | 24 | //If module/app not found |
25 | 25 | function xml_not_found() { |
26 | - header('Content-Type: text/xml'); |
|
27 | - |
|
28 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
29 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
30 | - $xml .= " <section name=\"result\">\n"; |
|
31 | - $xml .= " <result status=\"not found\"/>\n"; |
|
32 | - $xml .= " </section>\n"; |
|
33 | - $xml .= "</document>\n"; |
|
34 | - echo $xml; |
|
35 | - exit(); |
|
26 | + header('Content-Type: text/xml'); |
|
27 | + |
|
28 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
29 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
30 | + $xml .= " <section name=\"result\">\n"; |
|
31 | + $xml .= " <result status=\"not found\"/>\n"; |
|
32 | + $xml .= " </section>\n"; |
|
33 | + $xml .= "</document>\n"; |
|
34 | + echo $xml; |
|
35 | + exit(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | //Build acl xml |
39 | 39 | function load_acl($logger, $db,$config) { |
40 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
41 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
42 | - $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
43 | - $xml .= " <configuration name=\"acl.conf\" description=\"Network List\">\n"; |
|
44 | - $xml .= " <network-lists>\n"; |
|
40 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
41 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
42 | + $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
43 | + $xml .= " <configuration name=\"acl.conf\" description=\"Network List\">\n"; |
|
44 | + $xml .= " <network-lists>\n"; |
|
45 | 45 | $xml .= " <list name=\"default\" default=\"deny\">\n"; |
46 | 46 | |
47 | - //For customer and provider ips |
|
48 | - $query = "SELECT ip FROM ip_map,accounts WHERE ip_map.accountid=accounts.id AND accounts.status=0 AND deleted=0"; |
|
49 | - $logger->log("ACL Query : " . $query); |
|
50 | - $res_acl = $db->run($query); |
|
51 | - $logger->log($res_acl); |
|
47 | + //For customer and provider ips |
|
48 | + $query = "SELECT ip FROM ip_map,accounts WHERE ip_map.accountid=accounts.id AND accounts.status=0 AND deleted=0"; |
|
49 | + $logger->log("ACL Query : " . $query); |
|
50 | + $res_acl = $db->run($query); |
|
51 | + $logger->log($res_acl); |
|
52 | 52 | |
53 | 53 | foreach ($res_acl as $res_acl_key => $res_acl_value) { |
54 | 54 | $xml .= " <node type=\"allow\" cidr=\"" . $res_acl_value['ip'] . "\"/>\n"; |
55 | 55 | } |
56 | 56 | |
57 | - //For gateways |
|
57 | + //For gateways |
|
58 | 58 | $query = "SELECT * FROM gateways WHERE status=0"; |
59 | - $logger->log("Sofia Gateway Query : " . $query); |
|
60 | - $sp_gw = $db->run($query); |
|
61 | - $logger->log($sp_gw); |
|
62 | - |
|
63 | - foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
64 | - |
|
65 | - $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
66 | - foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
67 | - if ($sp_gw_settings_value != "" && $sp_gw_settings_key == "proxy") |
|
68 | - { |
|
69 | - $tmp_ip_arr = explode(":",$sp_gw_settings_value); |
|
70 | - if (!filter_var($tmp_ip_arr[0], FILTER_VALIDATE_IP) === false) { |
|
71 | - $xml .= " <node type=\"allow\" cidr=\"" . $tmp_ip_arr[0] . "/32\"/>\n"; |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
75 | - |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - //For opensips |
|
80 | - if($config['opensips'] == '0') |
|
81 | - { |
|
82 | - $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
83 | - } |
|
84 | - |
|
85 | - $xml .= " </list>\n"; |
|
86 | - |
|
87 | - //For loopback |
|
88 | - if($config['opensips'] == '0') |
|
89 | - { |
|
90 | - $xml .= "<list name=\"loopback.auto\" default=\"allow\">\n"; |
|
91 | - $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
92 | - $xml .= "</list>\n"; |
|
93 | - } |
|
94 | - |
|
95 | - //For event handing |
|
96 | - $xml .= "<list name=\"event\" default=\"deny\">\n"; |
|
97 | - $xml .= ($config['opensips'] == "0")?"<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n":"\n"; |
|
98 | - $xml .= "<node type=\"allow\" cidr=\"127.0.0.0/8\"/>\n"; |
|
99 | - $xml .= "</list>\n"; |
|
100 | - $xml .= " </network-lists>\n"; |
|
101 | - $xml .= " </configuration>\n"; |
|
102 | - $xml .= " </section>\n"; |
|
103 | - $xml .= "</document>\n"; |
|
104 | - $logger->log($xml); |
|
105 | - return $xml; |
|
59 | + $logger->log("Sofia Gateway Query : " . $query); |
|
60 | + $sp_gw = $db->run($query); |
|
61 | + $logger->log($sp_gw); |
|
62 | + |
|
63 | + foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
64 | + |
|
65 | + $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
66 | + foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
67 | + if ($sp_gw_settings_value != "" && $sp_gw_settings_key == "proxy") |
|
68 | + { |
|
69 | + $tmp_ip_arr = explode(":",$sp_gw_settings_value); |
|
70 | + if (!filter_var($tmp_ip_arr[0], FILTER_VALIDATE_IP) === false) { |
|
71 | + $xml .= " <node type=\"allow\" cidr=\"" . $tmp_ip_arr[0] . "/32\"/>\n"; |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | + |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + //For opensips |
|
80 | + if($config['opensips'] == '0') |
|
81 | + { |
|
82 | + $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
83 | + } |
|
84 | + |
|
85 | + $xml .= " </list>\n"; |
|
86 | + |
|
87 | + //For loopback |
|
88 | + if($config['opensips'] == '0') |
|
89 | + { |
|
90 | + $xml .= "<list name=\"loopback.auto\" default=\"allow\">\n"; |
|
91 | + $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
|
92 | + $xml .= "</list>\n"; |
|
93 | + } |
|
94 | + |
|
95 | + //For event handing |
|
96 | + $xml .= "<list name=\"event\" default=\"deny\">\n"; |
|
97 | + $xml .= ($config['opensips'] == "0")?"<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n":"\n"; |
|
98 | + $xml .= "<node type=\"allow\" cidr=\"127.0.0.0/8\"/>\n"; |
|
99 | + $xml .= "</list>\n"; |
|
100 | + $xml .= " </network-lists>\n"; |
|
101 | + $xml .= " </configuration>\n"; |
|
102 | + $xml .= " </section>\n"; |
|
103 | + $xml .= "</document>\n"; |
|
104 | + $logger->log($xml); |
|
105 | + return $xml; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //Build sofia xml |
109 | 109 | function load_sofia($logger, $db) { |
110 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
111 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
112 | - $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
113 | - $xml .= " <configuration name=\"sofia.conf\" description=\"SIP Profile\">\n"; |
|
114 | - $xml .= " <profiles>\n"; |
|
110 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
111 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
112 | + $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
|
113 | + $xml .= " <configuration name=\"sofia.conf\" description=\"SIP Profile\">\n"; |
|
114 | + $xml .= " <profiles>\n"; |
|
115 | 115 | |
116 | - $query = "SELECT * FROM sip_profiles WHERE status=0"; |
|
117 | - $logger->log("Sofia Query : " . $query); |
|
118 | - $res_sp = $db->run($query); |
|
119 | - //$logger->log($res_sp); |
|
116 | + $query = "SELECT * FROM sip_profiles WHERE status=0"; |
|
117 | + $logger->log("Sofia Query : " . $query); |
|
118 | + $res_sp = $db->run($query); |
|
119 | + //$logger->log($res_sp); |
|
120 | 120 | |
121 | - foreach ($res_sp as $sp_key => $sp_value) { |
|
121 | + foreach ($res_sp as $sp_key => $sp_value) { |
|
122 | 122 | |
123 | 123 | $settings = json_decode($sp_value['profile_data'], true); |
124 | 124 | //$logger->log(print_r($settings,true)); |
125 | - $xml .= " <profile name=\"" . $sp_value['name'] . "\">\n"; |
|
125 | + $xml .= " <profile name=\"" . $sp_value['name'] . "\">\n"; |
|
126 | 126 | |
127 | - $xml .= " <domains>\n"; |
|
128 | - $xml .= " <domain name=\"" . $sp_value['sip_ip'] . "\" alias=\"true\" parse=\"true\"/>\n"; |
|
129 | - $xml .= " </domains>\n"; |
|
130 | - /*$xml .= " <aliases>\n"; |
|
127 | + $xml .= " <domains>\n"; |
|
128 | + $xml .= " <domain name=\"" . $sp_value['sip_ip'] . "\" alias=\"true\" parse=\"true\"/>\n"; |
|
129 | + $xml .= " </domains>\n"; |
|
130 | + /*$xml .= " <aliases>\n"; |
|
131 | 131 | $xml .= " <alias name=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
132 | 132 | $xml .= " </aliases>\n";*/ |
133 | 133 | |
134 | 134 | $xml .= " <settings>\n"; |
135 | - $xml .= " <param name=\"sip-ip\" value=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
|
136 | - $xml .= " <param name=\"sip-port\" value=\"" . $sp_value['sip_port'] . "\"/>\n"; |
|
135 | + $xml .= " <param name=\"sip-ip\" value=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
|
136 | + $xml .= " <param name=\"sip-port\" value=\"" . $sp_value['sip_port'] . "\"/>\n"; |
|
137 | 137 | foreach($settings as $set_key => $set_val) |
138 | 138 | { |
139 | - $xml .= " <param name=\"" . $set_key . "\" value=\"" . $set_val . "\"/>\n"; |
|
139 | + $xml .= " <param name=\"" . $set_key . "\" value=\"" . $set_val . "\"/>\n"; |
|
140 | 140 | } |
141 | - $xml .= " </settings>\n"; |
|
141 | + $xml .= " </settings>\n"; |
|
142 | 142 | |
143 | 143 | |
144 | - //Gateway block start |
|
145 | - $xml .= " <gateways>\n"; |
|
146 | - $query = "SELECT * FROM gateways WHERE sip_profile_id=" . $sp_value['id'] . " AND status=0"; |
|
147 | - $logger->log("Sofia Gateway Query : " . $query); |
|
148 | - $sp_gw = $db->run($query); |
|
149 | - $logger->log($sp_gw); |
|
150 | - foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
151 | - $xml .= " <gateway name=\"" . $sp_gw_value['name'] . "\">\n"; |
|
144 | + //Gateway block start |
|
145 | + $xml .= " <gateways>\n"; |
|
146 | + $query = "SELECT * FROM gateways WHERE sip_profile_id=" . $sp_value['id'] . " AND status=0"; |
|
147 | + $logger->log("Sofia Gateway Query : " . $query); |
|
148 | + $sp_gw = $db->run($query); |
|
149 | + $logger->log($sp_gw); |
|
150 | + foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
|
151 | + $xml .= " <gateway name=\"" . $sp_gw_value['name'] . "\">\n"; |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | 155 | $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
156 | - foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
157 | - if ($sp_gw_settings_value != "") |
|
158 | - $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
159 | - } |
|
160 | - $xml .= " </gateway>\n"; |
|
161 | - } |
|
162 | - $xml .= " </gateways>\n"; |
|
163 | - //Gateway block end |
|
164 | - |
|
165 | - $xml .= " </profile>\n"; |
|
166 | - } |
|
156 | + foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
|
157 | + if ($sp_gw_settings_value != "") |
|
158 | + $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
159 | + } |
|
160 | + $xml .= " </gateway>\n"; |
|
161 | + } |
|
162 | + $xml .= " </gateways>\n"; |
|
163 | + //Gateway block end |
|
164 | + |
|
165 | + $xml .= " </profile>\n"; |
|
166 | + } |
|
167 | 167 | //echo $xml; |
168 | - $xml .= " </profiles>\n"; |
|
169 | - $xml .= " </configuration>\n"; |
|
170 | - $xml .= " </section>\n"; |
|
171 | - $xml .= "</document>\n"; |
|
172 | - $logger->log($xml); |
|
173 | - return $xml; |
|
168 | + $xml .= " </profiles>\n"; |
|
169 | + $xml .= " </configuration>\n"; |
|
170 | + $xml .= " </section>\n"; |
|
171 | + $xml .= "</document>\n"; |
|
172 | + $logger->log($xml); |
|
173 | + return $xml; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | //Build directory xml |
177 | 177 | function load_directory($logger, $db) { |
178 | - $xml = ""; |
|
178 | + $xml = ""; |
|
179 | 179 | |
180 | - $query = "SELECT username,dir_params,dir_vars,number as accountcode,accountid FROM sip_devices,accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='" . $_REQUEST['user']."' limit 1"; |
|
180 | + $query = "SELECT username,dir_params,dir_vars,number as accountcode,accountid FROM sip_devices,accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='" . $_REQUEST['user']."' limit 1"; |
|
181 | 181 | |
182 | - $logger->log("Directory Query : " . $query); |
|
183 | - $res_dir = $db->run($query); |
|
184 | - $logger->log($res_dir); |
|
182 | + $logger->log("Directory Query : " . $query); |
|
183 | + $res_dir = $db->run($query); |
|
184 | + $logger->log($res_dir); |
|
185 | 185 | |
186 | - foreach ($res_dir as $res_dir_key => $res_dir_value) { |
|
187 | - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
188 | - $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
189 | - $xml .= " <section name=\"Directory\" description=\"Directory\">\n"; |
|
190 | - $xml .= " <domain name=\"" . $_REQUEST['domain'] . "\" alias=\"true\">\n"; |
|
191 | - $xml .= " <user id=\"" . $_REQUEST['user'] . "\">\n"; |
|
186 | + foreach ($res_dir as $res_dir_key => $res_dir_value) { |
|
187 | + $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
|
188 | + $xml .= "<document type=\"freeswitch/xml\">\n"; |
|
189 | + $xml .= " <section name=\"Directory\" description=\"Directory\">\n"; |
|
190 | + $xml .= " <domain name=\"" . $_REQUEST['domain'] . "\" alias=\"true\">\n"; |
|
191 | + $xml .= " <user id=\"" . $_REQUEST['user'] . "\">\n"; |
|
192 | 192 | |
193 | 193 | $params = json_decode($res_dir_value['dir_params'], true); |
194 | 194 | |
@@ -196,36 +196,36 @@ discard block |
||
196 | 196 | $param_xml = $var_xml = ""; |
197 | 197 | foreach($params as $parms_key => $res_dir_params) |
198 | 198 | { |
199 | - $param_xml .= "<param name=\"" . $parms_key . "\" value=\"" . $res_dir_params . "\"/>\n"; |
|
199 | + $param_xml .= "<param name=\"" . $parms_key . "\" value=\"" . $res_dir_params . "\"/>\n"; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | foreach($vars as $var_key => $res_dir_vars) |
203 | 203 | { |
204 | - $var_xml .= "<variable name=\"" . $var_key . "\" value=\"" . $res_dir_vars . "\"/>\n"; |
|
204 | + $var_xml .= "<variable name=\"" . $var_key . "\" value=\"" . $res_dir_vars . "\"/>\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
208 | - $xml .= " <params>\n"; |
|
209 | - $xml .= $param_xml; |
|
210 | - $xml .= "<param name=\"allow-empty-password\" value=\"false\"/>\n"; |
|
211 | - $xml .= "<param name=\"dial-string\" value=\"{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${domain_name}}\${sofia_contact(*/\${dialed_user}@\${domain_name})}\"/>\n"; |
|
212 | - $xml .= " </params>\n"; |
|
213 | - |
|
214 | - $xml .= " <variables>\n"; |
|
215 | - $xml .= $var_xml; |
|
216 | - $xml .= "<variable name=\"sipcall\" value=\"true\"/>\n"; |
|
217 | - $xml .= "<variable name=\"accountcode\" value=\"" . $res_dir_value['accountcode'] . "\"/>\n"; |
|
218 | - $xml .= "<variable name=\"domain_name\" value=\"" . $_REQUEST['domain'] . "\"/>\n"; |
|
219 | - $xml .= " </variables>\n"; |
|
220 | - |
|
221 | - $xml .= " </user>\n"; |
|
222 | - $xml .= " </domain>\n"; |
|
223 | - $xml .= " </section>\n"; |
|
224 | - $xml .= "</document>\n"; |
|
225 | - } |
|
208 | + $xml .= " <params>\n"; |
|
209 | + $xml .= $param_xml; |
|
210 | + $xml .= "<param name=\"allow-empty-password\" value=\"false\"/>\n"; |
|
211 | + $xml .= "<param name=\"dial-string\" value=\"{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${domain_name}}\${sofia_contact(*/\${dialed_user}@\${domain_name})}\"/>\n"; |
|
212 | + $xml .= " </params>\n"; |
|
213 | + |
|
214 | + $xml .= " <variables>\n"; |
|
215 | + $xml .= $var_xml; |
|
216 | + $xml .= "<variable name=\"sipcall\" value=\"true\"/>\n"; |
|
217 | + $xml .= "<variable name=\"accountcode\" value=\"" . $res_dir_value['accountcode'] . "\"/>\n"; |
|
218 | + $xml .= "<variable name=\"domain_name\" value=\"" . $_REQUEST['domain'] . "\"/>\n"; |
|
219 | + $xml .= " </variables>\n"; |
|
220 | + |
|
221 | + $xml .= " </user>\n"; |
|
222 | + $xml .= " </domain>\n"; |
|
223 | + $xml .= " </section>\n"; |
|
224 | + $xml .= "</document>\n"; |
|
225 | + } |
|
226 | 226 | |
227 | - $logger->log($xml); |
|
228 | - return $xml; |
|
227 | + $logger->log($xml); |
|
228 | + return $xml; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | ?> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | //Build acl xml |
39 | -function load_acl($logger, $db,$config) { |
|
39 | +function load_acl($logger, $db, $config) { |
|
40 | 40 | $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
41 | 41 | $xml .= "<document type=\"freeswitch/xml\">\n"; |
42 | 42 | $xml .= " <section name=\"Configuration\" description=\"Configuration\">\n"; |
@@ -46,29 +46,29 @@ discard block |
||
46 | 46 | |
47 | 47 | //For customer and provider ips |
48 | 48 | $query = "SELECT ip FROM ip_map,accounts WHERE ip_map.accountid=accounts.id AND accounts.status=0 AND deleted=0"; |
49 | - $logger->log("ACL Query : " . $query); |
|
49 | + $logger->log("ACL Query : ".$query); |
|
50 | 50 | $res_acl = $db->run($query); |
51 | 51 | $logger->log($res_acl); |
52 | 52 | |
53 | 53 | foreach ($res_acl as $res_acl_key => $res_acl_value) { |
54 | - $xml .= " <node type=\"allow\" cidr=\"" . $res_acl_value['ip'] . "\"/>\n"; |
|
54 | + $xml .= " <node type=\"allow\" cidr=\"".$res_acl_value['ip']."\"/>\n"; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | //For gateways |
58 | 58 | $query = "SELECT * FROM gateways WHERE status=0"; |
59 | - $logger->log("Sofia Gateway Query : " . $query); |
|
59 | + $logger->log("Sofia Gateway Query : ".$query); |
|
60 | 60 | $sp_gw = $db->run($query); |
61 | 61 | $logger->log($sp_gw); |
62 | 62 | |
63 | 63 | foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
64 | 64 | |
65 | - $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
65 | + $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
66 | 66 | foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
67 | 67 | if ($sp_gw_settings_value != "" && $sp_gw_settings_key == "proxy") |
68 | 68 | { |
69 | - $tmp_ip_arr = explode(":",$sp_gw_settings_value); |
|
70 | - if (!filter_var($tmp_ip_arr[0], FILTER_VALIDATE_IP) === false) { |
|
71 | - $xml .= " <node type=\"allow\" cidr=\"" . $tmp_ip_arr[0] . "/32\"/>\n"; |
|
69 | + $tmp_ip_arr = explode(":", $sp_gw_settings_value); |
|
70 | + if ( ! filter_var($tmp_ip_arr[0], FILTER_VALIDATE_IP) === false) { |
|
71 | + $xml .= " <node type=\"allow\" cidr=\"".$tmp_ip_arr[0]."/32\"/>\n"; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | |
79 | 79 | //For opensips |
80 | - if($config['opensips'] == '0') |
|
80 | + if ($config['opensips'] == '0') |
|
81 | 81 | { |
82 | 82 | $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $xml .= " </list>\n"; |
86 | 86 | |
87 | 87 | //For loopback |
88 | - if($config['opensips'] == '0') |
|
88 | + if ($config['opensips'] == '0') |
|
89 | 89 | { |
90 | 90 | $xml .= "<list name=\"loopback.auto\" default=\"allow\">\n"; |
91 | 91 | $xml .= "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n"; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | //For event handing |
96 | 96 | $xml .= "<list name=\"event\" default=\"deny\">\n"; |
97 | - $xml .= ($config['opensips'] == "0")?"<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n":"\n"; |
|
97 | + $xml .= ($config['opensips'] == "0") ? "<node type=\"allow\" cidr=\"".$config['opensips_domain']."/32\"/>\n" : "\n"; |
|
98 | 98 | $xml .= "<node type=\"allow\" cidr=\"127.0.0.0/8\"/>\n"; |
99 | 99 | $xml .= "</list>\n"; |
100 | 100 | $xml .= " </network-lists>\n"; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $xml .= " <profiles>\n"; |
115 | 115 | |
116 | 116 | $query = "SELECT * FROM sip_profiles WHERE status=0"; |
117 | - $logger->log("Sofia Query : " . $query); |
|
117 | + $logger->log("Sofia Query : ".$query); |
|
118 | 118 | $res_sp = $db->run($query); |
119 | 119 | //$logger->log($res_sp); |
120 | 120 | |
@@ -122,40 +122,40 @@ discard block |
||
122 | 122 | |
123 | 123 | $settings = json_decode($sp_value['profile_data'], true); |
124 | 124 | //$logger->log(print_r($settings,true)); |
125 | - $xml .= " <profile name=\"" . $sp_value['name'] . "\">\n"; |
|
125 | + $xml .= " <profile name=\"".$sp_value['name']."\">\n"; |
|
126 | 126 | |
127 | 127 | $xml .= " <domains>\n"; |
128 | - $xml .= " <domain name=\"" . $sp_value['sip_ip'] . "\" alias=\"true\" parse=\"true\"/>\n"; |
|
128 | + $xml .= " <domain name=\"".$sp_value['sip_ip']."\" alias=\"true\" parse=\"true\"/>\n"; |
|
129 | 129 | $xml .= " </domains>\n"; |
130 | 130 | /*$xml .= " <aliases>\n"; |
131 | 131 | $xml .= " <alias name=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
132 | 132 | $xml .= " </aliases>\n";*/ |
133 | 133 | |
134 | 134 | $xml .= " <settings>\n"; |
135 | - $xml .= " <param name=\"sip-ip\" value=\"" . $sp_value['sip_ip'] . "\"/>\n"; |
|
136 | - $xml .= " <param name=\"sip-port\" value=\"" . $sp_value['sip_port'] . "\"/>\n"; |
|
137 | - foreach($settings as $set_key => $set_val) |
|
135 | + $xml .= " <param name=\"sip-ip\" value=\"".$sp_value['sip_ip']."\"/>\n"; |
|
136 | + $xml .= " <param name=\"sip-port\" value=\"".$sp_value['sip_port']."\"/>\n"; |
|
137 | + foreach ($settings as $set_key => $set_val) |
|
138 | 138 | { |
139 | - $xml .= " <param name=\"" . $set_key . "\" value=\"" . $set_val . "\"/>\n"; |
|
139 | + $xml .= " <param name=\"".$set_key."\" value=\"".$set_val."\"/>\n"; |
|
140 | 140 | } |
141 | 141 | $xml .= " </settings>\n"; |
142 | 142 | |
143 | 143 | |
144 | 144 | //Gateway block start |
145 | 145 | $xml .= " <gateways>\n"; |
146 | - $query = "SELECT * FROM gateways WHERE sip_profile_id=" . $sp_value['id'] . " AND status=0"; |
|
147 | - $logger->log("Sofia Gateway Query : " . $query); |
|
146 | + $query = "SELECT * FROM gateways WHERE sip_profile_id=".$sp_value['id']." AND status=0"; |
|
147 | + $logger->log("Sofia Gateway Query : ".$query); |
|
148 | 148 | $sp_gw = $db->run($query); |
149 | 149 | $logger->log($sp_gw); |
150 | 150 | foreach ($sp_gw as $sp_gw_key => $sp_gw_value) { |
151 | - $xml .= " <gateway name=\"" . $sp_gw_value['name'] . "\">\n"; |
|
151 | + $xml .= " <gateway name=\"".$sp_gw_value['name']."\">\n"; |
|
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | - $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
155 | + $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
|
156 | 156 | foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
157 | 157 | if ($sp_gw_settings_value != "") |
158 | - $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
158 | + $xml .= " <param name=\"".$sp_gw_settings_key."\" value=\"".$sp_gw_settings_value."\"/>\n"; |
|
159 | 159 | } |
160 | 160 | $xml .= " </gateway>\n"; |
161 | 161 | } |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | function load_directory($logger, $db) { |
178 | 178 | $xml = ""; |
179 | 179 | |
180 | - $query = "SELECT username,dir_params,dir_vars,number as accountcode,accountid FROM sip_devices,accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='" . $_REQUEST['user']."' limit 1"; |
|
180 | + $query = "SELECT username,dir_params,dir_vars,number as accountcode,accountid FROM sip_devices,accounts WHERE accounts.status=0 AND accounts.deleted=0 AND accounts.id=sip_devices.accountid AND username='".$_REQUEST['user']."' limit 1"; |
|
181 | 181 | |
182 | - $logger->log("Directory Query : " . $query); |
|
182 | + $logger->log("Directory Query : ".$query); |
|
183 | 183 | $res_dir = $db->run($query); |
184 | 184 | $logger->log($res_dir); |
185 | 185 | |
@@ -187,21 +187,21 @@ discard block |
||
187 | 187 | $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; |
188 | 188 | $xml .= "<document type=\"freeswitch/xml\">\n"; |
189 | 189 | $xml .= " <section name=\"Directory\" description=\"Directory\">\n"; |
190 | - $xml .= " <domain name=\"" . $_REQUEST['domain'] . "\" alias=\"true\">\n"; |
|
191 | - $xml .= " <user id=\"" . $_REQUEST['user'] . "\">\n"; |
|
190 | + $xml .= " <domain name=\"".$_REQUEST['domain']."\" alias=\"true\">\n"; |
|
191 | + $xml .= " <user id=\"".$_REQUEST['user']."\">\n"; |
|
192 | 192 | |
193 | 193 | $params = json_decode($res_dir_value['dir_params'], true); |
194 | 194 | |
195 | 195 | $vars = json_decode($res_dir_value['dir_vars'], true); |
196 | 196 | $param_xml = $var_xml = ""; |
197 | - foreach($params as $parms_key => $res_dir_params) |
|
197 | + foreach ($params as $parms_key => $res_dir_params) |
|
198 | 198 | { |
199 | - $param_xml .= "<param name=\"" . $parms_key . "\" value=\"" . $res_dir_params . "\"/>\n"; |
|
199 | + $param_xml .= "<param name=\"".$parms_key."\" value=\"".$res_dir_params."\"/>\n"; |
|
200 | 200 | } |
201 | 201 | |
202 | - foreach($vars as $var_key => $res_dir_vars) |
|
202 | + foreach ($vars as $var_key => $res_dir_vars) |
|
203 | 203 | { |
204 | - $var_xml .= "<variable name=\"" . $var_key . "\" value=\"" . $res_dir_vars . "\"/>\n"; |
|
204 | + $var_xml .= "<variable name=\"".$var_key."\" value=\"".$res_dir_vars."\"/>\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | $xml .= " <variables>\n"; |
215 | 215 | $xml .= $var_xml; |
216 | 216 | $xml .= "<variable name=\"sipcall\" value=\"true\"/>\n"; |
217 | - $xml .= "<variable name=\"accountcode\" value=\"" . $res_dir_value['accountcode'] . "\"/>\n"; |
|
218 | - $xml .= "<variable name=\"domain_name\" value=\"" . $_REQUEST['domain'] . "\"/>\n"; |
|
217 | + $xml .= "<variable name=\"accountcode\" value=\"".$res_dir_value['accountcode']."\"/>\n"; |
|
218 | + $xml .= "<variable name=\"domain_name\" value=\"".$_REQUEST['domain']."\"/>\n"; |
|
219 | 219 | $xml .= " </variables>\n"; |
220 | 220 | |
221 | 221 | $xml .= " </user>\n"; |
@@ -154,8 +154,9 @@ |
||
154 | 154 | |
155 | 155 | $sp_gw_settings = json_decode($sp_gw_value['gateway_data'], true); |
156 | 156 | foreach ($sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value) { |
157 | - if ($sp_gw_settings_value != "") |
|
158 | - $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
157 | + if ($sp_gw_settings_value != "") { |
|
158 | + $xml .= " <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n"; |
|
159 | + } |
|
159 | 160 | } |
160 | 161 | $xml .= " </gateway>\n"; |
161 | 162 | } |
@@ -23,29 +23,29 @@ |
||
23 | 23 | |
24 | 24 | class logger { |
25 | 25 | |
26 | - var $fp; |
|
27 | - var $config; |
|
26 | + var $fp; |
|
27 | + var $config; |
|
28 | 28 | |
29 | - function logger($lib) { |
|
30 | - $this->config = $lib->config; |
|
31 | - $this->config['log_path'] = "/var/log/astpp/"; |
|
32 | - if ($this->config['debug'] == '0') |
|
33 | - $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
34 | - } |
|
29 | + function logger($lib) { |
|
30 | + $this->config = $lib->config; |
|
31 | + $this->config['log_path'] = "/var/log/astpp/"; |
|
32 | + if ($this->config['debug'] == '0') |
|
33 | + $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
34 | + } |
|
35 | 35 | |
36 | - function log($log) { |
|
37 | - if ($this->config['debug'] == '0') { |
|
38 | - if (is_array($log)) |
|
39 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
40 | - else |
|
41 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
42 | - } |
|
43 | - } |
|
36 | + function log($log) { |
|
37 | + if ($this->config['debug'] == '0') { |
|
38 | + if (is_array($log)) |
|
39 | + fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
40 | + else |
|
41 | + fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - function close() { |
|
46 | - if ($this->config['debug'] == '0') |
|
47 | - fclose($this->fp); |
|
48 | - } |
|
45 | + function close() { |
|
46 | + if ($this->config['debug'] == '0') |
|
47 | + fclose($this->fp); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
51 | 51 |
@@ -30,15 +30,15 @@ |
||
30 | 30 | $this->config = $lib->config; |
31 | 31 | $this->config['log_path'] = "/var/log/astpp/"; |
32 | 32 | if ($this->config['debug'] == '0') |
33 | - $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
33 | + $this->fp = fopen($this->config['log_path'].'astpp_'.date('Y-m-d').'.txt', 'a'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | function log($log) { |
37 | 37 | if ($this->config['debug'] == '0') { |
38 | 38 | if (is_array($log)) |
39 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
39 | + fwrite($this->fp, "[".date('Y-m-d H:i:s')."] ".print_r($log, TRUE)); |
|
40 | 40 | else |
41 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
41 | + fwrite($this->fp, "[".date('Y-m-d H:i:s')."] ".$log."\n"); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -29,22 +29,25 @@ |
||
29 | 29 | function logger($lib) { |
30 | 30 | $this->config = $lib->config; |
31 | 31 | $this->config['log_path'] = "/var/log/astpp/"; |
32 | - if ($this->config['debug'] == '0') |
|
33 | - $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
32 | + if ($this->config['debug'] == '0') { |
|
33 | + $this->fp = fopen($this->config['log_path'] . 'astpp_' . date('Y-m-d') . '.txt', 'a'); |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | |
36 | 37 | function log($log) { |
37 | 38 | if ($this->config['debug'] == '0') { |
38 | - if (is_array($log)) |
|
39 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
40 | - else |
|
41 | - fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
39 | + if (is_array($log)) { |
|
40 | + fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . print_r($log, TRUE)); |
|
41 | + } else { |
|
42 | + fwrite($this->fp, "[" . date('Y-m-d H:i:s') . "] " . $log . "\n"); |
|
43 | + } |
|
42 | 44 | } |
43 | 45 | } |
44 | 46 | |
45 | 47 | function close() { |
46 | - if ($this->config['debug'] == '0') |
|
47 | - fclose($this->fp); |
|
48 | + if ($this->config['debug'] == '0') { |
|
49 | + fclose($this->fp); |
|
50 | + } |
|
48 | 51 | } |
49 | 52 | |
50 | 53 | } |
@@ -23,16 +23,16 @@ |
||
23 | 23 | |
24 | 24 | class lib { |
25 | 25 | |
26 | - var $config; |
|
26 | + var $config; |
|
27 | 27 | |
28 | - function get_configurations($db) { |
|
29 | - $query = "SELECT * FROM system WHERE group_title IN ('global','opensips')"; |
|
30 | - $res_conf = $db->run($query); |
|
31 | - foreach ($res_conf as $res_conf_key => $res_conf_value) |
|
32 | - $this->config[$res_conf_value['name']] = $res_conf_value['value']; |
|
28 | + function get_configurations($db) { |
|
29 | + $query = "SELECT * FROM system WHERE group_title IN ('global','opensips')"; |
|
30 | + $res_conf = $db->run($query); |
|
31 | + foreach ($res_conf as $res_conf_key => $res_conf_value) |
|
32 | + $this->config[$res_conf_value['name']] = $res_conf_value['value']; |
|
33 | 33 | |
34 | - return $this->config; |
|
35 | - } |
|
34 | + return $this->config; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | } |
38 | 38 |
@@ -28,8 +28,9 @@ |
||
28 | 28 | function get_configurations($db) { |
29 | 29 | $query = "SELECT * FROM system WHERE group_title IN ('global','opensips')"; |
30 | 30 | $res_conf = $db->run($query); |
31 | - foreach ($res_conf as $res_conf_key => $res_conf_value) |
|
32 | - $this->config[$res_conf_value['name']] = $res_conf_value['value']; |
|
31 | + foreach ($res_conf as $res_conf_key => $res_conf_value) { |
|
32 | + $this->config[$res_conf_value['name']] = $res_conf_value['value']; |
|
33 | + } |
|
33 | 34 | |
34 | 35 | return $this->config; |
35 | 36 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | |
26 | 26 | $xml = ""; |
27 | 27 | if ($_REQUEST['key_value'] == 'sofia.conf') { |
28 | - $xml = load_sofia($logger, $db); |
|
29 | - header('Content-Type: text/xml'); |
|
30 | - echo $xml; |
|
28 | + $xml = load_sofia($logger, $db); |
|
29 | + header('Content-Type: text/xml'); |
|
30 | + echo $xml; |
|
31 | 31 | } elseif ($_REQUEST['key_value'] == 'acl.conf') { |
32 | - $xml = load_acl($logger, $db,$config); |
|
33 | - header('Content-Type: text/xml'); |
|
34 | - echo $xml; |
|
32 | + $xml = load_acl($logger, $db,$config); |
|
33 | + header('Content-Type: text/xml'); |
|
34 | + echo $xml; |
|
35 | 35 | } else { |
36 | - xml_not_found(); |
|
36 | + xml_not_found(); |
|
37 | 37 | } |
38 | 38 | $logger->log("*************************** Configuration Ends **********************************"); |
39 | 39 | exit(); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | header('Content-Type: text/xml'); |
30 | 30 | echo $xml; |
31 | 31 | } elseif ($_REQUEST['key_value'] == 'acl.conf') { |
32 | - $xml = load_acl($logger, $db,$config); |
|
32 | + $xml = load_acl($logger, $db, $config); |
|
33 | 33 | header('Content-Type: text/xml'); |
34 | 34 | echo $xml; |
35 | 35 | } else { |
@@ -27,12 +27,12 @@ |
||
27 | 27 | |
28 | 28 | |
29 | 29 | if (isset($_REQUEST['user']) && isset($_REQUEST['domain'])) { |
30 | - $xml = load_directory($logger, $db); |
|
31 | - if ($xml == "") |
|
32 | - xml_not_found(); |
|
33 | - echo $xml; |
|
30 | + $xml = load_directory($logger, $db); |
|
31 | + if ($xml == "") |
|
32 | + xml_not_found(); |
|
33 | + echo $xml; |
|
34 | 34 | }else { |
35 | - xml_not_found(); |
|
35 | + xml_not_found(); |
|
36 | 36 | } |
37 | 37 | $logger->log("*************************** Directory Ends **********************************"); |
38 | 38 | exit(); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | if ($xml == "") |
32 | 32 | xml_not_found(); |
33 | 33 | echo $xml; |
34 | -}else { |
|
34 | +} else { |
|
35 | 35 | xml_not_found(); |
36 | 36 | } |
37 | 37 | $logger->log("*************************** Directory Ends **********************************"); |
@@ -28,10 +28,11 @@ |
||
28 | 28 | |
29 | 29 | if (isset($_REQUEST['user']) && isset($_REQUEST['domain'])) { |
30 | 30 | $xml = load_directory($logger, $db); |
31 | - if ($xml == "") |
|
32 | - xml_not_found(); |
|
31 | + if ($xml == "") { |
|
32 | + xml_not_found(); |
|
33 | + } |
|
33 | 34 | echo $xml; |
34 | -}else { |
|
35 | +} else { |
|
35 | 36 | xml_not_found(); |
36 | 37 | } |
37 | 38 | $logger->log("*************************** Directory Ends **********************************"); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @access private |
31 | 31 | * @param string the database name |
32 | - * @return bool |
|
32 | + * @return string |
|
33 | 33 | */ |
34 | 34 | function _create_database($name) |
35 | 35 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @access private |
45 | 45 | * @param string the database name |
46 | - * @return bool |
|
46 | + * @return string |
|
47 | 47 | */ |
48 | 48 | function _drop_database($name) |
49 | 49 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * Drop Table |
57 | 57 | * |
58 | 58 | * @access private |
59 | - * @return bool |
|
59 | + * @return string |
|
60 | 60 | */ |
61 | 61 | function _drop_table($table) |
62 | 62 | { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param mixed primary key(s) |
75 | 75 | * @param mixed key(s) |
76 | 76 | * @param boolean should 'IF NOT EXISTS' be added to the SQL |
77 | - * @return bool |
|
77 | + * @return string |
|
78 | 78 | */ |
79 | 79 | function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) |
80 | 80 | { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param string the default value |
187 | 187 | * @param boolean should 'NOT NULL' be added |
188 | 188 | * @param string the field after which we should add the new field |
189 | - * @return object |
|
189 | + * @return string |
|
190 | 190 | */ |
191 | 191 | function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') |
192 | 192 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $sql .= "\n\t".$this->db->_protect_identifiers($field); |
105 | 105 | |
106 | - $sql .= ' '.$attributes['TYPE']; |
|
106 | + $sql .= ' '.$attributes['TYPE']; |
|
107 | 107 | |
108 | 108 | if (array_key_exists('CONSTRAINT', $attributes)) |
109 | 109 | { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if (count($primary_keys) > 0) |
146 | 146 | { |
147 | 147 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
148 | - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; |
|
148 | + $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).")"; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (is_array($keys) && count($keys) > 0) |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $key = array($this->db->_protect_identifiers($key)); |
162 | 162 | } |
163 | 163 | |
164 | - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; |
|
164 | + $sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).")"; |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | if ($after_field != '') |
218 | 218 | { |
219 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
219 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return $sql; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -96,8 +98,7 @@ discard block |
||
96 | 98 | if (is_numeric($field)) |
97 | 99 | { |
98 | 100 | $sql .= "\n\t$attributes"; |
99 | - } |
|
100 | - else |
|
101 | + } else |
|
101 | 102 | { |
102 | 103 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
103 | 104 | |
@@ -123,8 +124,7 @@ discard block |
||
123 | 124 | if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) |
124 | 125 | { |
125 | 126 | $sql .= ' NULL'; |
126 | - } |
|
127 | - else |
|
127 | + } else |
|
128 | 128 | { |
129 | 129 | $sql .= ' NOT NULL'; |
130 | 130 | } |
@@ -155,8 +155,7 @@ discard block |
||
155 | 155 | if (is_array($key)) |
156 | 156 | { |
157 | 157 | $key = $this->db->_protect_identifiers($key); |
158 | - } |
|
159 | - else |
|
158 | + } else |
|
160 | 159 | { |
161 | 160 | $key = array($this->db->_protect_identifiers($key)); |
162 | 161 | } |
@@ -208,8 +207,7 @@ discard block |
||
208 | 207 | if ($null === NULL) |
209 | 208 | { |
210 | 209 | $sql .= ' NULL'; |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $sql .= ' NOT NULL'; |
215 | 213 | } |