@@ -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 | } |
@@ -24,97 +24,97 @@ discard block |
||
24 | 24 | |
25 | 25 | //Parse user and rates array which we got in cdr xml |
26 | 26 | function parse_rates_array($xml_rate, $constant_array, $logger) { |
27 | - $rates_array = array(); |
|
27 | + $rates_array = array(); |
|
28 | 28 | |
29 | - //decode string using urldecode |
|
30 | - $xml_rate = urldecode($xml_rate); |
|
31 | - $xml_rate_array = explode("||", $xml_rate); |
|
29 | + //decode string using urldecode |
|
30 | + $xml_rate = urldecode($xml_rate); |
|
31 | + $xml_rate_array = explode("||", $xml_rate); |
|
32 | 32 | |
33 | - foreach ($xml_rate_array as $rate_key => $rate_value) { |
|
34 | - $rates_array = explode("|", $rate_value); |
|
33 | + foreach ($xml_rate_array as $rate_key => $rate_value) { |
|
34 | + $rates_array = explode("|", $rate_value); |
|
35 | 35 | |
36 | - $user_id_param = $rates_array[count($rates_array) - 1]; |
|
37 | - $user_id = (substr($user_id_param, 0, 3) == 'UID') ? substr($user_id_param, 3) : 0; |
|
36 | + $user_id_param = $rates_array[count($rates_array) - 1]; |
|
37 | + $user_id = (substr($user_id_param, 0, 3) == 'UID') ? substr($user_id_param, 3) : 0; |
|
38 | 38 | |
39 | - foreach ($rates_array as $key => $value) { |
|
40 | - $rates_array_info[$user_id][$constant_array[substr($value, 0, 3)]] = substr($value, 3); |
|
41 | - } |
|
42 | - } |
|
43 | - return $rates_array_info; |
|
39 | + foreach ($rates_array as $key => $value) { |
|
40 | + $rates_array_info[$user_id][$constant_array[substr($value, 0, 3)]] = substr($value, 3); |
|
41 | + } |
|
42 | + } |
|
43 | + return $rates_array_info; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | //Process package |
47 | 47 | function process_package($xml_cdr, $user_id, $rates_array, $logger, $db) { |
48 | - $duration = $xml_cdr->variables->duration; |
|
49 | - $xml_cdr->variables->package_id = 0; |
|
50 | - $flag = false; |
|
51 | - if ($duration > 0 && $xml_cdr->variables->call_direction == 'outbound') { |
|
52 | - $destination_number = $xml_cdr->variables->effective_destination_number; |
|
53 | - |
|
54 | - $number_len = strlen($destination_number); |
|
55 | - $number_loop_str = '('; |
|
56 | - while ($number_len > 0) { |
|
57 | - $number_loop_str .= " code='".substr($destination_number, 0, $number_len)."' OR "; |
|
58 | - $number_len -= 1; |
|
59 | - } |
|
60 | - $number_loop_str .= " code='--')"; |
|
61 | - |
|
62 | - $query = "SELECT A.id as package_id,code,includedseconds FROM tbl_package AS A ,tbl_package_codes AS B WHERE ".$number_loop_str." AND B.package_id = A.id AND A.ratecard_id=".$rates_array['ratecard_id']." AND A.status=0 AND A.is_del=0 ORDER BY length(code) DESC"; |
|
63 | - $logger->log("Package Query : ".$query); |
|
64 | - $res_package = $db->run($query); |
|
65 | - |
|
66 | - foreach ($res_package as $res_package_key => $package_info) { |
|
67 | - if (isset($package_info['package_id'])) { |
|
68 | - $query = "SELECT SUM(used_seconds) as used_seconds FROM tbl_package_usage WHERE code=".$package_info['code']." AND package_id=".$package_info['package_id']." AND user_id=".$user_id; |
|
69 | - $logger->log("Package usage Query : ".$query); |
|
70 | - $res_pkg_usg = $db->run($query); |
|
71 | - $package_usage_info = $res_pkg_usg[0]; |
|
72 | - |
|
73 | - $used_seconds = (isset($package_usage_info['used_seconds'])) ? $package_usage_info['used_seconds'] : 0; |
|
74 | - |
|
75 | - $logger->log("Included seconds : ".$package_info['includedseconds'].", Used seconds : ".$used_seconds); |
|
76 | - if ($package_info['includedseconds'] > $used_seconds) { |
|
77 | - $remaining_seconds = $package_info['includedseconds'] - ($duration + $used_seconds); |
|
78 | - if ($remaining_seconds > 0) { |
|
79 | - $dud_sec = $duration; |
|
80 | - $duration = 0; |
|
81 | - } else { |
|
82 | - $dud_sec = $duration - abs($remaining_seconds); |
|
83 | - $duration = abs($remaining_seconds); |
|
84 | - } |
|
85 | - $flag = true; |
|
86 | - $xml_cdr->variables->package_id = $package_info['package_id']; |
|
87 | - |
|
88 | - $query = "INSERT INTO tbl_package_usage (package_id,user_id,code,used_seconds) VALUES (".$package_info['package_id'].",".$user_id.",'".$package_info['code']."',".$dud_sec.") ON DUPLICATE KEY UPDATE used_seconds=used_seconds+".$dud_sec; |
|
89 | - $logger->log("Package Usage Query : ".$query); |
|
90 | - $db->run($query); |
|
91 | - |
|
92 | - break; |
|
93 | - } |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
97 | - return array($duration, $flag); |
|
48 | + $duration = $xml_cdr->variables->duration; |
|
49 | + $xml_cdr->variables->package_id = 0; |
|
50 | + $flag = false; |
|
51 | + if ($duration > 0 && $xml_cdr->variables->call_direction == 'outbound') { |
|
52 | + $destination_number = $xml_cdr->variables->effective_destination_number; |
|
53 | + |
|
54 | + $number_len = strlen($destination_number); |
|
55 | + $number_loop_str = '('; |
|
56 | + while ($number_len > 0) { |
|
57 | + $number_loop_str .= " code='".substr($destination_number, 0, $number_len)."' OR "; |
|
58 | + $number_len -= 1; |
|
59 | + } |
|
60 | + $number_loop_str .= " code='--')"; |
|
61 | + |
|
62 | + $query = "SELECT A.id as package_id,code,includedseconds FROM tbl_package AS A ,tbl_package_codes AS B WHERE ".$number_loop_str." AND B.package_id = A.id AND A.ratecard_id=".$rates_array['ratecard_id']." AND A.status=0 AND A.is_del=0 ORDER BY length(code) DESC"; |
|
63 | + $logger->log("Package Query : ".$query); |
|
64 | + $res_package = $db->run($query); |
|
65 | + |
|
66 | + foreach ($res_package as $res_package_key => $package_info) { |
|
67 | + if (isset($package_info['package_id'])) { |
|
68 | + $query = "SELECT SUM(used_seconds) as used_seconds FROM tbl_package_usage WHERE code=".$package_info['code']." AND package_id=".$package_info['package_id']." AND user_id=".$user_id; |
|
69 | + $logger->log("Package usage Query : ".$query); |
|
70 | + $res_pkg_usg = $db->run($query); |
|
71 | + $package_usage_info = $res_pkg_usg[0]; |
|
72 | + |
|
73 | + $used_seconds = (isset($package_usage_info['used_seconds'])) ? $package_usage_info['used_seconds'] : 0; |
|
74 | + |
|
75 | + $logger->log("Included seconds : ".$package_info['includedseconds'].", Used seconds : ".$used_seconds); |
|
76 | + if ($package_info['includedseconds'] > $used_seconds) { |
|
77 | + $remaining_seconds = $package_info['includedseconds'] - ($duration + $used_seconds); |
|
78 | + if ($remaining_seconds > 0) { |
|
79 | + $dud_sec = $duration; |
|
80 | + $duration = 0; |
|
81 | + } else { |
|
82 | + $dud_sec = $duration - abs($remaining_seconds); |
|
83 | + $duration = abs($remaining_seconds); |
|
84 | + } |
|
85 | + $flag = true; |
|
86 | + $xml_cdr->variables->package_id = $package_info['package_id']; |
|
87 | + |
|
88 | + $query = "INSERT INTO tbl_package_usage (package_id,user_id,code,used_seconds) VALUES (".$package_info['package_id'].",".$user_id.",'".$package_info['code']."',".$dud_sec.") ON DUPLICATE KEY UPDATE used_seconds=used_seconds+".$dud_sec; |
|
89 | + $logger->log("Package Usage Query : ".$query); |
|
90 | + $db->run($query); |
|
91 | + |
|
92 | + break; |
|
93 | + } |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | + return array($duration, $flag); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | //Process user/vendor cdr |
101 | 101 | function do_cdr_process($xml_cdr, $debit, $cost, $vendor_cost, $rates_array, $parent_id = 0, $parent_rates, $carrier_rates_array, $logger, $db) { |
102 | - $query_string = "'".$xml_cdr->variables->uuid."','".$xml_cdr->variables->user_id."','".$xml_cdr->variables->entity_id."','".urldecode($xml_cdr->variables->effective_caller_id_name)."','".$xml_cdr->variables->effective_caller_id_number."','".$xml_cdr->variables->effective_destination_number."',".$xml_cdr->variables->duration.",'".$xml_cdr->variables->carrier_id."','".$xml_cdr->callflow[0]->caller_profile->originatee->originatee_caller_profile->network_addr."','".$xml_cdr->variables->sip_contact_host."','".$xml_cdr->variables->hangup_cause."','".urldecode($xml_cdr->variables->start_stamp)."',".$debit.",".$cost.",'".$xml_cdr->variables->vendor_id."',".$vendor_cost.",".$rates_array['ratecard_id'].",".$xml_cdr->variables->package_id.",'".$rates_array['code']."','".$rates_array['destination']."','".$rates_array['cost']."','".$parent_id."','".@$parent_rates['code']."','".@$parent_rates['destination']."','".@$parent_rates['cost']."','".@$carrier_rates_array['code']."','".@$carrier_rates_array['destination']."','".@$carrier_rates_array['cost']."','".$xml_cdr->variables->call_direction."','".urldecode($xml_cdr->variables->profile_start_stamp)."','".urldecode($xml_cdr->variables->answer_stamp)."','".urldecode($xml_cdr->variables->bridge_stamp)."','".urldecode($xml_cdr->variables->progress_stamp)."','".urldecode($xml_cdr->variables->progress_media_stamp)."','".urldecode($xml_cdr->variables->end_stamp)."',".$xml_cdr->variables->billmsec.",".$xml_cdr->variables->answermsec.",".$xml_cdr->variables->waitmsec.",".$xml_cdr->variables->progress_mediamsec.",".$xml_cdr->variables->flow_billmsec; |
|
102 | + $query_string = "'".$xml_cdr->variables->uuid."','".$xml_cdr->variables->user_id."','".$xml_cdr->variables->entity_id."','".urldecode($xml_cdr->variables->effective_caller_id_name)."','".$xml_cdr->variables->effective_caller_id_number."','".$xml_cdr->variables->effective_destination_number."',".$xml_cdr->variables->duration.",'".$xml_cdr->variables->carrier_id."','".$xml_cdr->callflow[0]->caller_profile->originatee->originatee_caller_profile->network_addr."','".$xml_cdr->variables->sip_contact_host."','".$xml_cdr->variables->hangup_cause."','".urldecode($xml_cdr->variables->start_stamp)."',".$debit.",".$cost.",'".$xml_cdr->variables->vendor_id."',".$vendor_cost.",".$rates_array['ratecard_id'].",".$xml_cdr->variables->package_id.",'".$rates_array['code']."','".$rates_array['destination']."','".$rates_array['cost']."','".$parent_id."','".@$parent_rates['code']."','".@$parent_rates['destination']."','".@$parent_rates['cost']."','".@$carrier_rates_array['code']."','".@$carrier_rates_array['destination']."','".@$carrier_rates_array['cost']."','".$xml_cdr->variables->call_direction."','".urldecode($xml_cdr->variables->profile_start_stamp)."','".urldecode($xml_cdr->variables->answer_stamp)."','".urldecode($xml_cdr->variables->bridge_stamp)."','".urldecode($xml_cdr->variables->progress_stamp)."','".urldecode($xml_cdr->variables->progress_media_stamp)."','".urldecode($xml_cdr->variables->end_stamp)."',".$xml_cdr->variables->billmsec.",".$xml_cdr->variables->answermsec.",".$xml_cdr->variables->waitmsec.",".$xml_cdr->variables->progress_mediamsec.",".$xml_cdr->variables->flow_billmsec; |
|
103 | 103 | |
104 | - $query = "INSERT INTO tbl_cdrs (uniqueid,user_id,entity_id,callerid_name,callerid_number,dstnum,duration,carrier_id,carrierip,callerip,disposition,start_stamp,debit,cost,vendor_id,vendor_cost,ratecard_id,package_id,rate_code,rate_code_destination,rate_cost,parent_id,parent_code,parent_code_destination,parent_cost,carrier_code,carrier_code_destination ,carrier_cost,call_direction,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec) values ($query_string)"; |
|
104 | + $query = "INSERT INTO tbl_cdrs (uniqueid,user_id,entity_id,callerid_name,callerid_number,dstnum,duration,carrier_id,carrierip,callerip,disposition,start_stamp,debit,cost,vendor_id,vendor_cost,ratecard_id,package_id,rate_code,rate_code_destination,rate_cost,parent_id,parent_code,parent_code_destination,parent_cost,carrier_code,carrier_code_destination ,carrier_cost,call_direction,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec) values ($query_string)"; |
|
105 | 105 | |
106 | - $logger->log("CDR Query : ".$query); |
|
107 | - $db->run($query); |
|
106 | + $logger->log("CDR Query : ".$query); |
|
107 | + $db->run($query); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //Process reseller cdr |
111 | 111 | function do_reseller_cdr_process($xml_cdr, $debit, $cost, $rates_array, $parent_id = 0, $parent_rates, $logger, $db) { |
112 | - $query_string = "'".$xml_cdr->variables->uuid."','".$xml_cdr->variables->user_id."','".urldecode($xml_cdr->variables->effective_caller_id_name)."','".$xml_cdr->variables->effective_caller_id_number."','".$xml_cdr->variables->effective_destination_number."',".$xml_cdr->variables->duration.",'".$xml_cdr->variables->hangup_cause."','".urldecode($xml_cdr->variables->start_stamp)."',".$debit.",".$cost.",".$rates_array['ratecard_id'].",".$xml_cdr->variables->package_id.",'".$rates_array['code']."','".$rates_array['destination']."','".$rates_array['cost']."','".$parent_id."','".@$parent_rates['code']."','".@$parent_rates['destination']."','".@$parent_rates['cost']."','".$xml_cdr->variables->call_direction."'"; |
|
112 | + $query_string = "'".$xml_cdr->variables->uuid."','".$xml_cdr->variables->user_id."','".urldecode($xml_cdr->variables->effective_caller_id_name)."','".$xml_cdr->variables->effective_caller_id_number."','".$xml_cdr->variables->effective_destination_number."',".$xml_cdr->variables->duration.",'".$xml_cdr->variables->hangup_cause."','".urldecode($xml_cdr->variables->start_stamp)."',".$debit.",".$cost.",".$rates_array['ratecard_id'].",".$xml_cdr->variables->package_id.",'".$rates_array['code']."','".$rates_array['destination']."','".$rates_array['cost']."','".$parent_id."','".@$parent_rates['code']."','".@$parent_rates['destination']."','".@$parent_rates['cost']."','".$xml_cdr->variables->call_direction."'"; |
|
113 | 113 | |
114 | - $query = "INSERT INTO tbl_cdrs_reseller (uniqueid,reseller_id,callerid_name,callerid_number,dstnum,duration,disposition,start_stamp,debit,cost,ratecard_id,package_id,rate_code,rate_code_destination,rate_cost,parent_id,parent_code,parent_code_destination,parent_cost,call_direction) values ($query_string)"; |
|
114 | + $query = "INSERT INTO tbl_cdrs_reseller (uniqueid,reseller_id,callerid_name,callerid_number,dstnum,duration,disposition,start_stamp,debit,cost,ratecard_id,package_id,rate_code,rate_code_destination,rate_cost,parent_id,parent_code,parent_code_destination,parent_cost,call_direction) values ($query_string)"; |
|
115 | 115 | |
116 | - $logger->log("CDR Query : ".$query); |
|
117 | - $db->run($query); |
|
116 | + $logger->log("CDR Query : ".$query); |
|
117 | + $db->run($query); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | //Update user balance |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * @param integer $entity_id |
123 | 123 | */ |
124 | 124 | function update_balance($user_id, $amount, $entity_id, $logger, $db) { |
125 | - if ($amount > 0) { |
|
126 | - $math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+'; |
|
127 | - $query = "UPDATE tbl_users SET credit=credit$math_sign".$amount." WHERE id=".$user_id; |
|
128 | - $logger->log("Balance update : ".$query); |
|
129 | - $db->run($query); |
|
130 | - } |
|
125 | + if ($amount > 0) { |
|
126 | + $math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+'; |
|
127 | + $query = "UPDATE tbl_users SET credit=credit$math_sign".$amount." WHERE id=".$user_id; |
|
128 | + $logger->log("Balance update : ".$query); |
|
129 | + $db->run($query); |
|
130 | + } |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | //Get user info |
134 | 134 | function get_user_info($parent_id, $db) { |
135 | - $query = "SELECT * FROM tbl_users WHERE id=".$parent_id; |
|
136 | - $res_user = $db->run($query); |
|
137 | - return $res_user[0]; |
|
135 | + $query = "SELECT * FROM tbl_users WHERE id=".$parent_id; |
|
136 | + $res_user = $db->run($query); |
|
137 | + return $res_user[0]; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | ?> |
@@ -23,61 +23,61 @@ |
||
23 | 23 | |
24 | 24 | class db extends PDO { |
25 | 25 | |
26 | - private $error; |
|
27 | - private $sql; |
|
28 | - private $bind; |
|
29 | - private $errorCallbackFunction; |
|
30 | - private $errorMsgFormat; |
|
26 | + private $error; |
|
27 | + private $sql; |
|
28 | + private $bind; |
|
29 | + private $errorCallbackFunction; |
|
30 | + private $errorMsgFormat; |
|
31 | 31 | |
32 | - public function __construct($dsn = "", $user = "", $passwd = "") { |
|
32 | + public function __construct($dsn = "", $user = "", $passwd = "") { |
|
33 | 33 | |
34 | - $config = parse_ini_file("/var/lib/astpp/astpp-config.conf"); |
|
34 | + $config = parse_ini_file("/var/lib/astpp/astpp-config.conf"); |
|
35 | 35 | |
36 | - $options = array( |
|
37 | - PDO::ATTR_PERSISTENT => true, |
|
38 | - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION |
|
39 | - ); |
|
36 | + $options = array( |
|
37 | + PDO::ATTR_PERSISTENT => true, |
|
38 | + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION |
|
39 | + ); |
|
40 | 40 | |
41 | - try { |
|
42 | - parent::__construct("mysql:host=".$config['dbhost'].";dbname=".$config['dbname']."", $config['dbuser'], $config['dbpass'], $options); |
|
43 | - } catch (PDOException $e) { |
|
41 | + try { |
|
42 | + parent::__construct("mysql:host=".$config['dbhost'].";dbname=".$config['dbname']."", $config['dbuser'], $config['dbpass'], $options); |
|
43 | + } catch (PDOException $e) { |
|
44 | 44 | |
45 | - $this->error = $e->getMessage(); |
|
46 | - } |
|
47 | - echo $this->error; |
|
48 | - } |
|
45 | + $this->error = $e->getMessage(); |
|
46 | + } |
|
47 | + echo $this->error; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $bind |
|
52 | - */ |
|
53 | - public function cleanup($bind) { |
|
54 | - if ( ! is_array($bind)) { |
|
55 | - if ( ! empty($bind)) |
|
56 | - $bind = array($bind); |
|
57 | - else |
|
58 | - $bind = array(); |
|
59 | - } |
|
60 | - return $bind; |
|
61 | - } |
|
50 | + /** |
|
51 | + * @param string $bind |
|
52 | + */ |
|
53 | + public function cleanup($bind) { |
|
54 | + if ( ! is_array($bind)) { |
|
55 | + if ( ! empty($bind)) |
|
56 | + $bind = array($bind); |
|
57 | + else |
|
58 | + $bind = array(); |
|
59 | + } |
|
60 | + return $bind; |
|
61 | + } |
|
62 | 62 | |
63 | - public function run($sql, $bind = "") { |
|
64 | - $this->sql = trim($sql); |
|
65 | - $this->bind = $this->cleanup($bind); |
|
66 | - $this->error = ""; |
|
63 | + public function run($sql, $bind = "") { |
|
64 | + $this->sql = trim($sql); |
|
65 | + $this->bind = $this->cleanup($bind); |
|
66 | + $this->error = ""; |
|
67 | 67 | |
68 | - try { |
|
69 | - $pdostmt = $this->prepare($this->sql); |
|
70 | - if ($pdostmt->execute($this->bind) !== false) { |
|
71 | - if (preg_match("/^(".implode("|", array("select", "describe", "pragma")).") /i", $this->sql)) |
|
72 | - return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
73 | - elseif (preg_match("/^(".implode("|", array("delete", "insert", "update")).") /i", $this->sql)) |
|
74 | - return $pdostmt->rowCount(); |
|
75 | - } |
|
76 | - } catch (PDOException $e) { |
|
77 | - $this->error = $e->getMessage(); |
|
78 | - return $this->error; |
|
79 | - } |
|
80 | - } |
|
68 | + try { |
|
69 | + $pdostmt = $this->prepare($this->sql); |
|
70 | + if ($pdostmt->execute($this->bind) !== false) { |
|
71 | + if (preg_match("/^(".implode("|", array("select", "describe", "pragma")).") /i", $this->sql)) |
|
72 | + return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
73 | + elseif (preg_match("/^(".implode("|", array("delete", "insert", "update")).") /i", $this->sql)) |
|
74 | + return $pdostmt->rowCount(); |
|
75 | + } |
|
76 | + } catch (PDOException $e) { |
|
77 | + $this->error = $e->getMessage(); |
|
78 | + return $this->error; |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -52,10 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function cleanup($bind) { |
54 | 54 | if ( ! is_array($bind)) { |
55 | - if ( ! empty($bind)) |
|
56 | - $bind = array($bind); |
|
57 | - else |
|
58 | - $bind = array(); |
|
55 | + if ( ! empty($bind)) { |
|
56 | + $bind = array($bind); |
|
57 | + } else { |
|
58 | + $bind = array(); |
|
59 | + } |
|
59 | 60 | } |
60 | 61 | return $bind; |
61 | 62 | } |
@@ -68,10 +69,11 @@ discard block |
||
68 | 69 | try { |
69 | 70 | $pdostmt = $this->prepare($this->sql); |
70 | 71 | if ($pdostmt->execute($this->bind) !== false) { |
71 | - if (preg_match("/^(".implode("|", array("select", "describe", "pragma")).") /i", $this->sql)) |
|
72 | - return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
73 | - elseif (preg_match("/^(".implode("|", array("delete", "insert", "update")).") /i", $this->sql)) |
|
74 | - return $pdostmt->rowCount(); |
|
72 | + if (preg_match("/^(".implode("|", array("select", "describe", "pragma")).") /i", $this->sql)) { |
|
73 | + return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
74 | + } elseif (preg_match("/^(".implode("|", array("delete", "insert", "update")).") /i", $this->sql)) { |
|
75 | + return $pdostmt->rowCount(); |
|
76 | + } |
|
75 | 77 | } |
76 | 78 | } catch (PDOException $e) { |
77 | 79 | $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 | } |
@@ -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 sip_devices.status=0 AND 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 sip_devices.status=0 AND 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"; |
@@ -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 | } |
@@ -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 **********************************"); |
@@ -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 **********************************"); |
@@ -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 { |
@@ -6,12 +6,12 @@ |
||
6 | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
7 | 7 | <title> |
8 | 8 | <?php |
9 | - $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
10 | - $this->db->select('*'); |
|
11 | - $this->db->order_by('accountid', 'desc'); |
|
12 | - $this->db->limit(1); |
|
13 | - $invoiceconf = $this->db->get('invoice_conf'); |
|
14 | - $invoiceconf = (array)$invoiceconf->first_row(); |
|
9 | + $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
10 | + $this->db->select('*'); |
|
11 | + $this->db->order_by('accountid', 'desc'); |
|
12 | + $this->db->limit(1); |
|
13 | + $invoiceconf = $this->db->get('invoice_conf'); |
|
14 | + $invoiceconf = (array)$invoiceconf->first_row(); |
|
15 | 15 | if(isset($invoiceconf['website_title']) && $invoiceconf['website_title']!='') { |
16 | 16 | ?> |
17 | 17 | Log In | <?php echo $invoiceconf['website_title']; ?> |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
7 | 7 | <title> |
8 | 8 | <?php |
9 | - $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
9 | + $this->db->where('domain', $_SERVER['HTTP_HOST']); |
|
10 | 10 | $this->db->select('*'); |
11 | 11 | $this->db->order_by('accountid', 'desc'); |
12 | 12 | $this->db->limit(1); |
13 | 13 | $invoiceconf = $this->db->get('invoice_conf'); |
14 | 14 | $invoiceconf = (array)$invoiceconf->first_row(); |
15 | - if(isset($invoiceconf['website_title']) && $invoiceconf['website_title']!='') { |
|
15 | + if (isset($invoiceconf['website_title']) && $invoiceconf['website_title'] != '') { |
|
16 | 16 | ?> |
17 | 17 | Log In | <?php echo $invoiceconf['website_title']; ?> |
18 | 18 | <?php |
19 | - }else{ |
|
19 | + } else { |
|
20 | 20 | ?> |
21 | 21 | Log In | ASTPP - Open Source Voip Billing Solution |
22 | 22 | <?php |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | <div class="row"> |
55 | 55 | |
56 | 56 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
57 | - <?php if (isset($astpp_notification)){ ?> |
|
57 | + <?php if (isset($astpp_notification)) { ?> |
|
58 | 58 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
59 | - <?php }else{ |
|
59 | + <?php } else { |
|
60 | 60 | echo " "; |
61 | 61 | } ?> |
62 | 62 | </span></div> <br/> |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | <h2 class="text-center"> |
71 | 71 | |
72 | 72 | <?php |
73 | - if(isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != ""){ |
|
73 | + if (isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != "") { |
|
74 | 74 | $logo = $this->session->userdata['user_logo']; |
75 | - }else{ |
|
75 | + } else { |
|
76 | 76 | $logo = 'logo.png'; |
77 | 77 | } |
78 | 78 | |
79 | 79 | if ($this->session->userdata('userlevel_logintype') != '0') {?> |
80 | - <img style="height:53px;width:216px;" id="logo" alt="login" src="<?php echo base_url(); ?>upload/<?php echo$logo;?>"> |
|
80 | + <img style="height:53px;width:216px;" id="logo" alt="login" src="<?php echo base_url(); ?>upload/<?php echo$logo; ?>"> |
|
81 | 81 | <? } else {?> |
82 | - <img style="height:53px;width:216px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='login' src="<?php echo base_url(); ?>upload/<?php echo$logo;?>"> |
|
82 | + <img style="height:53px;width:216px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='login' src="<?php echo base_url(); ?>upload/<?php echo$logo; ?>"> |
|
83 | 83 | <? }?> |
84 | 84 | <div class="clear"></div> |
85 | 85 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | ?> |
17 | 17 | Log In | <?php echo $invoiceconf['website_title']; ?> |
18 | 18 | <?php |
19 | - }else{ |
|
19 | + } else{ |
|
20 | 20 | ?> |
21 | 21 | Log In | ASTPP - Open Source Voip Billing Solution |
22 | 22 | <?php |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
57 | 57 | <?php if (isset($astpp_notification)){ ?> |
58 | 58 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
59 | - <?php }else{ |
|
59 | + <?php } else{ |
|
60 | 60 | echo " "; |
61 | 61 | } ?> |
62 | 62 | </span></div> <br/> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | <?php |
73 | 73 | if(isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != ""){ |
74 | 74 | $logo = $this->session->userdata['user_logo']; |
75 | - }else{ |
|
75 | + } else{ |
|
76 | 76 | $logo = 'logo.png'; |
77 | 77 | } |
78 | 78 |
@@ -6,12 +6,12 @@ |
||
6 | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
7 | 7 | <title> |
8 | 8 | <?php |
9 | - $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
10 | - $this->db->select('*'); |
|
11 | - $this->db->order_by('accountid', 'desc'); |
|
12 | - $this->db->limit(1); |
|
13 | - $invoiceconf = $this->db->get('invoice_conf'); |
|
14 | - $invoiceconf = (array)$invoiceconf->first_row(); |
|
9 | + $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
10 | + $this->db->select('*'); |
|
11 | + $this->db->order_by('accountid', 'desc'); |
|
12 | + $this->db->limit(1); |
|
13 | + $invoiceconf = $this->db->get('invoice_conf'); |
|
14 | + $invoiceconf = (array)$invoiceconf->first_row(); |
|
15 | 15 | if(isset($invoiceconf['website_title']) && $invoiceconf['website_title']!='') { |
16 | 16 | ?> |
17 | 17 | Forgot Password | <?php echo $invoiceconf['website_title']; ?> |
@@ -6,17 +6,17 @@ discard block |
||
6 | 6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
7 | 7 | <title> |
8 | 8 | <?php |
9 | - $this->db->where('domain',$_SERVER['HTTP_HOST']); |
|
9 | + $this->db->where('domain', $_SERVER['HTTP_HOST']); |
|
10 | 10 | $this->db->select('*'); |
11 | 11 | $this->db->order_by('accountid', 'desc'); |
12 | 12 | $this->db->limit(1); |
13 | 13 | $invoiceconf = $this->db->get('invoice_conf'); |
14 | 14 | $invoiceconf = (array)$invoiceconf->first_row(); |
15 | - if(isset($invoiceconf['website_title']) && $invoiceconf['website_title']!='') { |
|
15 | + if (isset($invoiceconf['website_title']) && $invoiceconf['website_title'] != '') { |
|
16 | 16 | ?> |
17 | 17 | Forgot Password | <?php echo $invoiceconf['website_title']; ?> |
18 | 18 | <?php |
19 | - }else{ |
|
19 | + } else { |
|
20 | 20 | ?> |
21 | 21 | Forgot Password | ASTPP - Open Source Voip Billing Solution |
22 | 22 | <?php |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | <div class="row"> |
58 | 58 | <div class="col-md-4 col-md-offset-4"> |
59 | 59 | <span class="login_error"> |
60 | - <?php if (isset($astpp_notification)){ ?> |
|
60 | + <?php if (isset($astpp_notification)) { ?> |
|
61 | 61 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
62 | - <?php }else{ |
|
62 | + <?php } else { |
|
63 | 63 | echo " "; |
64 | 64 | } ?> |
65 | 65 | </span> |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | <!-- Header Start--> |
76 | 76 | <div class="col-md-12"> |
77 | 77 | <?php |
78 | - if(isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != ""){ |
|
78 | + if (isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != "") { |
|
79 | 79 | $logo = $this->session->userdata['user_logo']; |
80 | - }else{ |
|
80 | + } else { |
|
81 | 81 | $logo = 'logo.png'; |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ($this->session->userdata('userlevel_logintype') != '0') {?> |
85 | 85 | <a class="col-md-8" style="padding:0px 0px 10px 0px" href="<?php echo base_url(); ?>"> |
86 | - <img style="height: 44px; width:216px;" id="logo" alt="dashboard" src="<?php echo base_url(); ?>upload/<?php echo$logo;?>"> |
|
86 | + <img style="height: 44px; width:216px;" id="logo" alt="dashboard" src="<?php echo base_url(); ?>upload/<?php echo$logo; ?>"> |
|
87 | 87 | <? } else {?> |
88 | 88 | <a class="col-md-8" style="padding:0px 0px 20px 0px" href="<?php echo base_url(); ?>"> |
89 | - <img style="height: 44px; width:216px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='ASTPP - Open Source Voip Billing Solution' src="<?php echo base_url(); ?>upload/<?php echo$logo;?>"> |
|
89 | + <img style="height: 44px; width:216px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='ASTPP - Open Source Voip Billing Solution' src="<?php echo base_url(); ?>upload/<?php echo$logo; ?>"> |
|
90 | 90 | <? }?> |
91 | 91 | |
92 | 92 | </a> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | ?> |
17 | 17 | Forgot Password | <?php echo $invoiceconf['website_title']; ?> |
18 | 18 | <?php |
19 | - }else{ |
|
19 | + } else{ |
|
20 | 20 | ?> |
21 | 21 | Forgot Password | ASTPP - Open Source Voip Billing Solution |
22 | 22 | <?php |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <span class="login_error"> |
60 | 60 | <?php if (isset($astpp_notification)){ ?> |
61 | 61 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
62 | - <?php }else{ |
|
62 | + <?php } else{ |
|
63 | 63 | echo " "; |
64 | 64 | } ?> |
65 | 65 | </span> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | <?php |
78 | 78 | if(isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != ""){ |
79 | 79 | $logo = $this->session->userdata['user_logo']; |
80 | - }else{ |
|
80 | + } else{ |
|
81 | 81 | $logo = 'logo.png'; |
82 | 82 | } |
83 | 83 | |
@@ -104,10 +104,18 @@ discard block |
||
104 | 104 | <div class="input-group col-md-12 margin-t-15 padding-r-32 padding-l-32"> |
105 | 105 | <span class="input-group-addon"><i class="fa fa-envelope"></i></span> |
106 | 106 | |
107 | - <input type="text" class="form-control" id="email" name="email" placeholder="User Name OR Email" value = "<?php if (isset($value['email'])) echo $value['email']; else ''; ?>" style="height:40px;"> |
|
107 | + <input type="text" class="form-control" id="email" name="email" placeholder="User Name OR Email" value = "<?php if (isset($value['email'])) { |
|
108 | + echo $value['email']; |
|
109 | +} else { |
|
110 | + ''; |
|
111 | +} |
|
112 | +?>" style="height:40px;"> |
|
108 | 113 | </div> |
109 | 114 | |
110 | - <?php if (isset($error['email'])) echo $error['email']; ?> |
|
115 | + <?php if (isset($error['email'])) { |
|
116 | + echo $error['email']; |
|
117 | +} |
|
118 | +?> |
|
111 | 119 | <div style="width: 97.67%; float: left;text-align: left; margin: 2% 22%;"> |
112 | 120 | <span id="e_name" style="color:red;"> </span> |
113 | 121 | </div> |