@@ -98,7 +98,10 @@ discard block |
||
98 | 98 | <section class="slice color-three no-margin"> |
99 | 99 | <div class="w-section inverse no-padding"> |
100 | 100 | <div style="color:red;margin-left: 60px;"> |
101 | - <?php if (isset($validation_errors)) echo $validation_errors; ?> |
|
101 | + <?php if (isset($validation_errors)) { |
|
102 | + echo $validation_errors; |
|
103 | +} |
|
104 | +?> |
|
102 | 105 | </div> |
103 | 106 | <?php echo $form; ?> |
104 | 107 | </div> |
@@ -113,7 +116,10 @@ discard block |
||
113 | 116 | <div class="row"> |
114 | 117 | <div class="col-md-12" align=center style='margin-top:15px;' > |
115 | 118 | <div style="color:red;margin-left: 60px;"> |
116 | - <?php if (isset($validation_errors)) echo $validation_errors; ?> |
|
119 | + <?php if (isset($validation_errors)) { |
|
120 | + echo $validation_errors; |
|
121 | +} |
|
122 | +?> |
|
117 | 123 | </div> |
118 | 124 | <form method="post" action="<?= base_url() ?>freeswitch/fssipprofile_add/add/" enctype="multipart/form-data" name='form1' id ="myForm1" > |
119 | 125 |
@@ -49,10 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | public function cleanup($bind) { |
51 | 51 | if (!is_array($bind)) { |
52 | - if (!empty($bind)) |
|
53 | - $bind = array($bind); |
|
54 | - else |
|
55 | - $bind = array(); |
|
52 | + if (!empty($bind)) { |
|
53 | + $bind = array($bind); |
|
54 | + } else { |
|
55 | + $bind = array(); |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | return $bind; |
58 | 59 | } |
@@ -65,10 +66,11 @@ discard block |
||
65 | 66 | try { |
66 | 67 | $pdostmt = $this->prepare($this->sql); |
67 | 68 | if ($pdostmt->execute($this->bind) !== false) { |
68 | - if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) |
|
69 | - return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
70 | - elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) |
|
71 | - return $pdostmt->rowCount(); |
|
69 | + if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) { |
|
70 | + return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
71 | + } elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) { |
|
72 | + return $pdostmt->rowCount(); |
|
73 | + } |
|
72 | 74 | } |
73 | 75 | } catch (PDOException $e) { |
74 | 76 | $this->error = $e->getMessage(); |
@@ -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 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($dataVariable['billsec'] == 0 && $dataVariable['hangup_cause'] == 'NORMAL_CLEARING') |
48 | 48 | { |
49 | 49 | $hangup_cause = isset($dataVariable['last_bridge_hangup_cause'])?$dataVariable['last_bridge_hangup_cause']:$dataVariable['hangup_cause']; |
50 | - }else{ |
|
50 | + } else{ |
|
51 | 51 | $hangup_cause = $dataVariable['hangup_cause']; |
52 | 52 | } |
53 | 53 | |
@@ -86,10 +86,12 @@ discard block |
||
86 | 86 | $actual_calltype = $dataVariable['calltype']; |
87 | 87 | |
88 | 88 | //Normalize origination and termination rates array |
89 | - if(isset($dataVariable['origination_rates'])) |
|
90 | - $origination_rate = normalize_origination_rate($dataVariable['origination_rates']); |
|
91 | - if(isset($dataVariable['termination_rates'])) |
|
92 | - $termination_rate = normalize_rate($dataVariable['termination_rates']); |
|
89 | + if(isset($dataVariable['origination_rates'])) { |
|
90 | + $origination_rate = normalize_origination_rate($dataVariable['origination_rates']); |
|
91 | + } |
|
92 | + if(isset($dataVariable['termination_rates'])) { |
|
93 | + $termination_rate = normalize_rate($dataVariable['termination_rates']); |
|
94 | + } |
|
93 | 95 | |
94 | 96 | //If receiver account id found then explicitly set call direction and call type |
95 | 97 | if(isset($dataVariable['receiver_accid'])) |
@@ -230,7 +232,7 @@ discard block |
||
230 | 232 | $logger->log("********* IN RESELLER FOR RECEIVER ENTRY END ******"); |
231 | 233 | return true; |
232 | 234 | |
233 | - }else{ |
|
235 | + } else{ |
|
234 | 236 | |
235 | 237 | $cdr_string = get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost); |
236 | 238 | |
@@ -262,11 +264,10 @@ discard block |
||
262 | 264 | $origination_rate[$accountid]['DESTINATION'] = $dataVariable['calltype']; |
263 | 265 | if($flag_parent == false){ |
264 | 266 | $cdr_string = get_cdr_string($localVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,0,0,$logger); |
265 | - } |
|
266 | - else{ |
|
267 | + } else{ |
|
267 | 268 | $cdr_string = get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost); |
268 | 269 | } |
269 | - }else{ |
|
270 | + } else{ |
|
270 | 271 | |
271 | 272 | $origination_rate_did = normalize_origination_rate($dataVariable['origination_rates_did']); |
272 | 273 | $debit = calc_cost($dataVariable,$origination_rate_did[$accountid],$logger,$decimal_points); |
@@ -274,8 +275,7 @@ discard block |
||
274 | 275 | if($flag_parent == false){ |
275 | 276 | |
276 | 277 | $cdr_string = get_cdr_string($localVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate_did,$provider_cost,$parentid,$debit,0,$logger); |
277 | - } |
|
278 | - else{ |
|
278 | + } else{ |
|
279 | 279 | $cdr_string = get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost); |
280 | 280 | } |
281 | 281 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if($flag_parent == false) |
284 | 284 | { |
285 | 285 | $query = "INSERT INTO cdrs(uniqueid,accountid,type,callerid,callednum,billseconds,trunk_id,trunkip,callerip,disposition,callstart,debit,cost,provider_id,pricelist_id,package_id,pattern,notes,rate_cost,reseller_id,reseller_code,reseller_code_destination,reseller_cost,provider_code,provider_code_destination,provider_cost,provider_call_cost,call_direction,calltype,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec) values ($cdr_string)"; |
286 | - }else{ |
|
286 | + } else{ |
|
287 | 287 | $query = "INSERT INTO reseller_cdrs (uniqueid,accountid,callerid,callednum,billseconds,disposition,callstart,debit,cost,pricelist_id,package_id,pattern,notes,rate_cost, |
288 | 288 | reseller_id,reseller_code,reseller_code_destination,reseller_cost,call_direction,calltype) values ($cdr_string)"; |
289 | 289 | } |
@@ -433,11 +433,12 @@ discard block |
||
433 | 433 | $query_counter = "SELECT id,seconds FROM counters WHERE accountid = ".$accountid." AND package_id = ".$package_id." AND status=1 LIMIT 1"; |
434 | 434 | $counter = $db->run($query_counter); |
435 | 435 | $logger->log("GET Counters : " . $query_counter); |
436 | - if($counter) |
|
437 | - return $counter[0]; |
|
438 | - else |
|
439 | - return ""; |
|
440 | -} |
|
436 | + if($counter) { |
|
437 | + return $counter[0]; |
|
438 | + } else { |
|
439 | + return ""; |
|
440 | + } |
|
441 | + } |
|
441 | 442 | |
442 | 443 | //Get user info |
443 | 444 | function get_accounts($parent_id,$logger, $db) { |
@@ -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 | } |
@@ -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 | } |
@@ -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 **********************************"); |
@@ -20,7 +20,10 @@ |
||
20 | 20 | <section class="slice color-three no-margin"> |
21 | 21 | <div class="w-section inverse no-padding"> |
22 | 22 | <div style="color:red;margin-left: 60px;"> |
23 | - <?php if (isset($validation_errors)) echo $validation_errors; ?> |
|
23 | + <?php if (isset($validation_errors)) { |
|
24 | + echo $validation_errors; |
|
25 | +} |
|
26 | +?> |
|
24 | 27 | </div> |
25 | 28 | <?php echo $form; ?> |
26 | 29 | </div> |
@@ -22,8 +22,9 @@ |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
26 | - exit('No direct script access allowed'); |
|
25 | +if (!defined('BASEPATH')) { |
|
26 | + exit('No direct script access allowed'); |
|
27 | +} |
|
27 | 28 | |
28 | 29 | class Package_form { |
29 | 30 |