@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Feedback extends MX_Controller { |
24 | 24 | function __construct() { |
25 | - parent::__construct (); |
|
25 | + parent::__construct(); |
|
26 | 26 | } |
27 | 27 | function index() { |
28 | 28 | $data ['account_info'] = $this->session->userdata ['accountinfo']; |
29 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
29 | + $data ['username'] = $this->session->userdata('user_name'); |
|
30 | 30 | $data ['page_title'] = "Feedback"; |
31 | - $this->load->view ( 'view_feedback', $data ); |
|
31 | + $this->load->view('view_feedback', $data); |
|
32 | 32 | } |
33 | 33 | function customer_feedback_result($flag = FALSE) { |
34 | 34 | if ($flag) { |
35 | - $account_info = array (); |
|
36 | - $this->db->where ( "accountid", "1" ); |
|
37 | - $res = $this->db->get ( 'invoice_conf' ); |
|
35 | + $account_info = array(); |
|
36 | + $this->db->where("accountid", "1"); |
|
37 | + $res = $this->db->get('invoice_conf'); |
|
38 | 38 | if ($res->num_rows > 0) { |
39 | - $masterdata = $res->result_array (); |
|
39 | + $masterdata = $res->result_array(); |
|
40 | 40 | $account_info = $masterdata ['0']; |
41 | 41 | |
42 | 42 | $company_name = $account_info ['company_name']; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $emailaddress = $account_info ['emailaddress']; |
51 | 51 | $website = $account_info ['website']; |
52 | 52 | |
53 | - $data = array ( |
|
53 | + $data = array( |
|
54 | 54 | "name" => "Admin", |
55 | 55 | "company_name" => $company_name, |
56 | 56 | "address" => $address, |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | ); |
68 | 68 | } |
69 | 69 | } else { |
70 | - $account_info = array (); |
|
71 | - $this->db->where ( "type", "-1" ); |
|
72 | - $res = $this->db->get ( 'accounts' ); |
|
70 | + $account_info = array(); |
|
71 | + $this->db->where("type", "-1"); |
|
72 | + $res = $this->db->get('accounts'); |
|
73 | 73 | if ($res->num_rows > 0) { |
74 | - $masterdata = $res->result_array (); |
|
74 | + $masterdata = $res->result_array(); |
|
75 | 75 | $account_info = $masterdata ['0']; |
76 | 76 | |
77 | 77 | $name = $_REQUEST ['name'] = "Admin"; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $telephone_2 = $account_info ['telephone_2']; |
89 | 89 | $province = $account_info ['province']; |
90 | 90 | |
91 | - $data = array ( |
|
91 | + $data = array( |
|
92 | 92 | "name" => $name, |
93 | 93 | "email" => $email, |
94 | 94 | "feedback" => $feedback, |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | "FLAG" => "FALSE" |
107 | 107 | ); |
108 | 108 | |
109 | - $data_new = json_encode ( $data ); |
|
109 | + $data_new = json_encode($data); |
|
110 | 110 | } |
111 | 111 | } |
112 | - $ch = curl_init (); |
|
113 | - curl_setopt ( $ch, CURLOPT_URL, 'http://feedback.astppbilling.org/feedback.php' ); |
|
114 | - curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); |
|
115 | - curl_setopt ( $ch, CURLOPT_HEADER, 1 ); |
|
116 | - curl_setopt ( $ch, CURLOPT_POST, 1 ); |
|
117 | - curl_setopt ( $ch, CURLOPT_VERBOSE, 1 ); |
|
118 | - curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
|
119 | - curl_setopt ( $ch, CURLOPT_FRESH_CONNECT, 1 ); |
|
120 | - curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
121 | - curl_setopt ( $ch, CURLINFO_HEADER_OUT, 1 ); |
|
122 | - curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data ); |
|
112 | + $ch = curl_init(); |
|
113 | + curl_setopt($ch, CURLOPT_URL, 'http://feedback.astppbilling.org/feedback.php'); |
|
114 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); |
|
115 | + curl_setopt($ch, CURLOPT_HEADER, 1); |
|
116 | + curl_setopt($ch, CURLOPT_POST, 1); |
|
117 | + curl_setopt($ch, CURLOPT_VERBOSE, 1); |
|
118 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
119 | + curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); |
|
120 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
121 | + curl_setopt($ch, CURLINFO_HEADER_OUT, 1); |
|
122 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
|
123 | 123 | |
124 | - $response = curl_exec ( $ch ); |
|
125 | - if (! $flag) |
|
126 | - redirect ( base_url () . 'feedback/thanks' ); |
|
124 | + $response = curl_exec($ch); |
|
125 | + if ( ! $flag) |
|
126 | + redirect(base_url().'feedback/thanks'); |
|
127 | 127 | } |
128 | 128 | function thanks() { |
129 | - $this->load->view ( 'view_feedback_response' ); |
|
129 | + $this->load->view('view_feedback_response'); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | ?> |
@@ -122,8 +122,9 @@ |
||
122 | 122 | curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data ); |
123 | 123 | |
124 | 124 | $response = curl_exec ( $ch ); |
125 | - if (! $flag) |
|
126 | - redirect ( base_url () . 'feedback/thanks' ); |
|
125 | + if (! $flag) { |
|
126 | + redirect ( base_url () . 'feedback/thanks' ); |
|
127 | + } |
|
127 | 128 | } |
128 | 129 | function thanks() { |
129 | 130 | $this->load->view ( 'view_feedback_response' ); |
@@ -22,27 +22,27 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Newmail extends MX_Controller { |
24 | 24 | function __construct() { |
25 | - $this->load->library ( 'astpp/email_lib' ); |
|
26 | - parent::__construct (); |
|
25 | + $this->load->library('astpp/email_lib'); |
|
26 | + parent::__construct(); |
|
27 | 27 | } |
28 | 28 | function index() { |
29 | 29 | $data ['account_info'] = $this->session->userdata ['accountinfo']; |
30 | - $data ['username'] = $this->session->userdata ( 'user_name' ); |
|
30 | + $data ['username'] = $this->session->userdata('user_name'); |
|
31 | 31 | $data ['page_title'] = "Test Mail"; |
32 | - $this->load->view ( 'view_newmail', $data ); |
|
32 | + $this->load->view('view_newmail', $data); |
|
33 | 33 | } |
34 | 34 | function customer_mail_result($flag = FALSE) { |
35 | 35 | $account_info = $this->session->userdata ['accountinfo']; |
36 | - $post_array = $this->input->post (); |
|
36 | + $post_array = $this->input->post(); |
|
37 | 37 | $post_array ['accountid'] = $account_info ['id']; |
38 | 38 | $post_array ['history_id'] = 0; |
39 | 39 | $post_array ['email'] = $post_array ['to']; |
40 | - unset ( $post_array ['to'] ); |
|
41 | - $this->email_lib->send_email ( $post_array, $post_array, '', '', 0, 0 ); |
|
42 | - $this->thanks (); |
|
40 | + unset ($post_array ['to']); |
|
41 | + $this->email_lib->send_email($post_array, $post_array, '', '', 0, 0); |
|
42 | + $this->thanks(); |
|
43 | 43 | } |
44 | 44 | function thanks() { |
45 | - $this->load->view ( 'view_mail_response' ); |
|
45 | + $this->load->view('view_mail_response'); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | ?> |
@@ -22,23 +22,23 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Getstatus extends MX_Controller { |
24 | 24 | function __construct() { |
25 | - parent::__construct (); |
|
26 | - $this->load->model ( "db_model" ); |
|
27 | - $this->load->library ( "astpp/common" ); |
|
25 | + parent::__construct(); |
|
26 | + $this->load->model("db_model"); |
|
27 | + $this->load->library("astpp/common"); |
|
28 | 28 | } |
29 | 29 | function customer_list_status($id) { |
30 | - $post_data = $this->input->post (); |
|
31 | - $post_data ['table'] = $this->common->decode ( $post_data ['table'] ); |
|
30 | + $post_data = $this->input->post(); |
|
31 | + $post_data ['table'] = $this->common->decode($post_data ['table']); |
|
32 | 32 | $data ['status'] = $post_data ['status'] == 'true' ? 0 : 1; |
33 | 33 | if ($post_data ['table'] == 'accounts') { |
34 | - $where = array ( |
|
34 | + $where = array( |
|
35 | 35 | 'id' => $post_data ['id'] |
36 | 36 | ); |
37 | - $account_data = ( array ) $this->db_model->getSelect ( "*", "accounts", $where )->first_row (); |
|
37 | + $account_data = (array)$this->db_model->getSelect("*", "accounts", $where)->first_row(); |
|
38 | 38 | } |
39 | - $result = $post_data ['table'] == 'accounts' && $post_data ['id'] == 1 ? null : $this->db->update ( $post_data ['table'], $data, array ( |
|
39 | + $result = $post_data ['table'] == 'accounts' && $post_data ['id'] == 1 ? null : $this->db->update($post_data ['table'], $data, array( |
|
40 | 40 | "id" => $post_data ['id'] |
41 | - ) ); |
|
41 | + )); |
|
42 | 42 | echo TRUE; |
43 | 43 | } |
44 | 44 | } |
@@ -22,48 +22,48 @@ discard block |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Getbalance extends MX_Controller { |
24 | 24 | function Getbalance() { |
25 | - parent::__construct (); |
|
26 | - $this->load->model ( 'common_model' ); |
|
27 | - $this->load->library ( 'common' ); |
|
28 | - $this->load->model ( 'db_model' ); |
|
29 | - $this->load->model ( 'Astpp_common' ); |
|
25 | + parent::__construct(); |
|
26 | + $this->load->model('common_model'); |
|
27 | + $this->load->library('common'); |
|
28 | + $this->load->model('db_model'); |
|
29 | + $this->load->model('Astpp_common'); |
|
30 | 30 | } |
31 | 31 | function index($sipnumber = '') { |
32 | 32 | $opensips_flag = common_model::$global_config ['system_config'] ['opensips']; |
33 | 33 | $accountid_arr = 0; |
34 | 34 | if ($opensips_flag == '1') { |
35 | - $where = array ( |
|
35 | + $where = array( |
|
36 | 36 | 'username' => $sipnumber |
37 | 37 | ); |
38 | - $accountid_arr = $this->db_model->getSelect ( 'accountid', 'sip_devices', $where ); |
|
38 | + $accountid_arr = $this->db_model->getSelect('accountid', 'sip_devices', $where); |
|
39 | 39 | } else { |
40 | 40 | $db_config = Common_model::$global_config ['system_config']; |
41 | - $opensipdsn = "mysql://" . $db_config ['opensips_dbuser'] . ":" . $db_config ['opensips_dbpass'] . "@" . $db_config ['opensips_dbhost'] . "/" . $db_config ['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
42 | - $this->opensips_db = $this->load->database ( $opensipdsn, true ); |
|
43 | - $this->opensips_db->where ( array ( |
|
41 | + $opensipdsn = "mysql://".$db_config ['opensips_dbuser'].":".$db_config ['opensips_dbpass']."@".$db_config ['opensips_dbhost']."/".$db_config ['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
42 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
43 | + $this->opensips_db->where(array( |
|
44 | 44 | "username" => $sipnumber |
45 | - ) ); |
|
46 | - $accountnum_arr = $this->opensips_db->get ( "subscriber" ); |
|
47 | - $accountnum_arr = $accountnum_arr->result_array (); |
|
48 | - foreach ( $accountnum_arr as $value_num ) { |
|
49 | - $accountid_arr = $this->db_model->getSelect ( 'id', 'accounts', array ( |
|
45 | + )); |
|
46 | + $accountnum_arr = $this->opensips_db->get("subscriber"); |
|
47 | + $accountnum_arr = $accountnum_arr->result_array(); |
|
48 | + foreach ($accountnum_arr as $value_num) { |
|
49 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', array( |
|
50 | 50 | 'number' => $value_num ['accountcode'] |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | if ($accountid_arr == '') { |
55 | 55 | echo "Please enter proper username of SIP Account"; |
56 | 56 | } |
57 | - if ($accountid_arr->num_rows () == 0) { |
|
58 | - $where = array ( |
|
57 | + if ($accountid_arr->num_rows() == 0) { |
|
58 | + $where = array( |
|
59 | 59 | 'number' => $sipnumber |
60 | 60 | ); |
61 | - $accountid_arr = $this->db_model->getSelect ( 'id', 'accounts', $where ); |
|
61 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', $where); |
|
62 | 62 | } |
63 | - if ($accountid_arr->num_rows () > 0) { |
|
64 | - $accountid_arr = $accountid_arr->result_array (); |
|
63 | + if ($accountid_arr->num_rows() > 0) { |
|
64 | + $accountid_arr = $accountid_arr->result_array(); |
|
65 | 65 | if ($opensips_flag == '1') { |
66 | - foreach ( $accountid_arr [0] as $key => $value ) { |
|
66 | + foreach ($accountid_arr [0] as $key => $value) { |
|
67 | 67 | } |
68 | 68 | if ($key == 'id') { |
69 | 69 | $accountid = $accountid_arr [0] ['id']; |
@@ -75,36 +75,36 @@ discard block |
||
75 | 75 | } |
76 | 76 | $to_currency = common_model::$global_config ['system_config'] ['base_currency']; |
77 | 77 | if ($accountid > 0) { |
78 | - $where = array ( |
|
78 | + $where = array( |
|
79 | 79 | 'id' => $accountid |
80 | 80 | ); |
81 | - $balance = $this->db_model->getSelect ( 'balance,currency_id', 'accounts', $where ); |
|
82 | - if ($balance->num_rows () > 0) { |
|
81 | + $balance = $this->db_model->getSelect('balance,currency_id', 'accounts', $where); |
|
82 | + if ($balance->num_rows() > 0) { |
|
83 | 83 | // get balance,currency using by user from account number. |
84 | - $balance_arr = $balance->result_array (); |
|
84 | + $balance_arr = $balance->result_array(); |
|
85 | 85 | $balance = $balance_arr ['0'] ['balance']; |
86 | 86 | $currency = $balance_arr ['0'] ['currency_id']; |
87 | 87 | // Get Base Currency From System which is main currency of system. |
88 | - $base_currency_arr = $this->db_model->getSelect ( 'value', 'system', array ( |
|
88 | + $base_currency_arr = $this->db_model->getSelect('value', 'system', array( |
|
89 | 89 | 'name' => 'base_currency' |
90 | - ) ); |
|
91 | - $base_currency_arr = $base_currency_arr->result_array (); |
|
90 | + )); |
|
91 | + $base_currency_arr = $base_currency_arr->result_array(); |
|
92 | 92 | $base_currency = $base_currency_arr ['0'] ['value']; |
93 | 93 | // Get basse Currency rate from Currency Name. |
94 | - $base_currency_info = $this->db_model->getSelect ( '*', 'currency', array ( |
|
94 | + $base_currency_info = $this->db_model->getSelect('*', 'currency', array( |
|
95 | 95 | 'currency' => $base_currency |
96 | - ) ); |
|
97 | - $base_currency_info = $base_currency_info->result_array (); |
|
96 | + )); |
|
97 | + $base_currency_info = $base_currency_info->result_array(); |
|
98 | 98 | $base_currency_rate = $base_currency_info ['0'] ['currencyrate']; |
99 | 99 | $base_currency_name = $base_currency_info ['0'] ['currency']; |
100 | 100 | // Find Currency Rate of user Currency from its currency_id |
101 | - $where = array ( |
|
101 | + $where = array( |
|
102 | 102 | 'id' => $currency |
103 | 103 | ); |
104 | - $user_currency_info = $this->db_model->getSelect ( "*", 'currency', $where ); |
|
104 | + $user_currency_info = $this->db_model->getSelect("*", 'currency', $where); |
|
105 | 105 | // user Currency Is deleted or Not |
106 | - if ($user_currency_info->num_rows () > 0) { |
|
107 | - $user_currency_info = $user_currency_info->result_array (); |
|
106 | + if ($user_currency_info->num_rows() > 0) { |
|
107 | + $user_currency_info = $user_currency_info->result_array(); |
|
108 | 108 | $user_currency = $user_currency_info ['0'] ['currencyrate']; |
109 | 109 | $user_currency_name = $user_currency_info ['0'] ['currency']; |
110 | 110 | } else { |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | $user_currency_name = $base_currency_name; |
113 | 113 | } |
114 | 114 | // Convert Balance of user in user currency |
115 | - $convert_balance = round ( ($balance * $user_currency) / $base_currency_rate, 2 ); |
|
116 | - $convert_balance = sprintf ( "%.2f", $convert_balance ) . ' ' . $user_currency_name; |
|
117 | - echo "Balance : " . $convert_balance; |
|
115 | + $convert_balance = round(($balance * $user_currency) / $base_currency_rate, 2); |
|
116 | + $convert_balance = sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
117 | + echo "Balance : ".$convert_balance; |
|
118 | 118 | } |
119 | 119 | } else { |
120 | - echo "0.00 " . $to_currency; |
|
120 | + echo "0.00 ".$to_currency; |
|
121 | 121 | } |
122 | 122 | } else { |
123 | 123 | echo "Please enter proper username of SIP Account"; |
@@ -22,30 +22,30 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Lowbalance extends CI_Controller { |
24 | 24 | function __construct() { |
25 | - parent::__construct (); |
|
26 | - if (! defined ( 'CRON' )) |
|
25 | + parent::__construct(); |
|
26 | + if ( ! defined('CRON')) |
|
27 | 27 | exit (); |
28 | - $this->load->model ( "db_model" ); |
|
29 | - $this->load->library ( "astpp/common" ); |
|
28 | + $this->load->model("db_model"); |
|
29 | + $this->load->library("astpp/common"); |
|
30 | 30 | } |
31 | 31 | function low_balance() { |
32 | - $where = array ( |
|
32 | + $where = array( |
|
33 | 33 | "notify_flag" => 0, |
34 | 34 | "deleted" => "0", |
35 | 35 | "status" => "0" |
36 | 36 | ); |
37 | - $entity_array = array ( |
|
37 | + $entity_array = array( |
|
38 | 38 | "0", |
39 | 39 | "1", |
40 | 40 | "3" |
41 | 41 | ); |
42 | - $this->db->where_in ( "type", $entity_array ); |
|
43 | - $query = $this->db_model->getSelect ( "*", "accounts", $where ); |
|
42 | + $this->db->where_in("type", $entity_array); |
|
43 | + $query = $this->db_model->getSelect("*", "accounts", $where); |
|
44 | 44 | if ($query->num_rows > 0) { |
45 | - $account_data = $query->result_array (); |
|
46 | - foreach ( $account_data as $data_key => $accountinfo ) { |
|
45 | + $account_data = $query->result_array(); |
|
46 | + foreach ($account_data as $data_key => $accountinfo) { |
|
47 | 47 | if (($accountinfo ['posttoexternal'] == 0 && ($accountinfo ["balance"] <= $accountinfo ["notify_credit_limit"])) || ($accountinfo ['posttoexternal'] == 1 && ($accountinfo ["credit_limit"] - $accountinfo ["balance"]) <= $accountinfo ["notify_credit_limit"])) { |
48 | - $this->common->mail_to_users ( "email_low_balance", $accountinfo ); |
|
48 | + $this->common->mail_to_users("email_low_balance", $accountinfo); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
@@ -23,8 +23,9 @@ |
||
23 | 23 | class Lowbalance extends CI_Controller { |
24 | 24 | function __construct() { |
25 | 25 | parent::__construct (); |
26 | - if (! defined ( 'CRON' )) |
|
27 | - exit (); |
|
26 | + if (! defined ( 'CRON' )) { |
|
27 | + exit (); |
|
28 | + } |
|
28 | 29 | $this->load->model ( "db_model" ); |
29 | 30 | $this->load->library ( "astpp/common" ); |
30 | 31 | } |
@@ -22,23 +22,23 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Broadcastemail extends CI_Controller { |
24 | 24 | function __construct() { |
25 | - parent::__construct (); |
|
26 | - if (! defined ( 'CRON' )) |
|
25 | + parent::__construct(); |
|
26 | + if ( ! defined('CRON')) |
|
27 | 27 | exit (); |
28 | - $this->load->model ( "db_model" ); |
|
29 | - $this->load->library ( "astpp/email_lib" ); |
|
28 | + $this->load->model("db_model"); |
|
29 | + $this->load->library("astpp/email_lib"); |
|
30 | 30 | } |
31 | 31 | function broadcast_email() { |
32 | - $where = array ( |
|
32 | + $where = array( |
|
33 | 33 | "status" => "1" |
34 | 34 | ); |
35 | - $query = $this->db_model->getSelect ( "*", "mail_details", $where ); |
|
35 | + $query = $this->db_model->getSelect("*", "mail_details", $where); |
|
36 | 36 | if ($query->num_rows > 0) { |
37 | - $account_data = $query->result_array (); |
|
38 | - foreach ( $account_data as $data_key => $account_value ) { |
|
37 | + $account_data = $query->result_array(); |
|
38 | + foreach ($account_data as $data_key => $account_value) { |
|
39 | 39 | $account_value ['history_id'] = $account_value ['id']; |
40 | - unset ( $account_value ['id'] ); |
|
41 | - $this->email_lib->send_email ( '', $account_value, '', $account_value ['attachment'], 1, 0, 1 ); |
|
40 | + unset ($account_value ['id']); |
|
41 | + $this->email_lib->send_email('', $account_value, '', $account_value ['attachment'], 1, 0, 1); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
@@ -23,8 +23,9 @@ |
||
23 | 23 | class Broadcastemail extends CI_Controller { |
24 | 24 | function __construct() { |
25 | 25 | parent::__construct (); |
26 | - if (! defined ( 'CRON' )) |
|
27 | - exit (); |
|
26 | + if (! defined ( 'CRON' )) { |
|
27 | + exit (); |
|
28 | + } |
|
28 | 29 | $this->load->model ( "db_model" ); |
29 | 30 | $this->load->library ( "astpp/email_lib" ); |
30 | 31 | } |
@@ -22,46 +22,46 @@ discard block |
||
22 | 22 | // ############################################################################## |
23 | 23 | class Currencyupdate extends CI_Controller { |
24 | 24 | function __construct() { |
25 | - parent::__construct (); |
|
25 | + parent::__construct(); |
|
26 | 26 | // if(!defined( 'CRON' ) ) |
27 | 27 | // exit(); |
28 | - $this->load->model ( "db_model" ); |
|
29 | - $this->load->library ( "astpp/common" ); |
|
28 | + $this->load->model("db_model"); |
|
29 | + $this->load->library("astpp/common"); |
|
30 | 30 | } |
31 | 31 | function update_currency() { |
32 | - $where = array ( |
|
32 | + $where = array( |
|
33 | 33 | "currency <>" => Common_model::$global_config ['system_config'] ['base_currency'] |
34 | 34 | ); |
35 | - $query = $this->db_model->getSelect ( "*", "currency", $where ); |
|
35 | + $query = $this->db_model->getSelect("*", "currency", $where); |
|
36 | 36 | |
37 | 37 | if ($query->num_rows > 0) { |
38 | - $currency_data = $query->result_array (); |
|
38 | + $currency_data = $query->result_array(); |
|
39 | 39 | $url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="; |
40 | - foreach ( $currency_data as $currency_value ) { |
|
41 | - $url .= Common_model::$global_config ['system_config'] ['base_currency'] . $currency_value ['currency'] . '=X+'; |
|
40 | + foreach ($currency_data as $currency_value) { |
|
41 | + $url .= Common_model::$global_config ['system_config'] ['base_currency'].$currency_value ['currency'].'=X+'; |
|
42 | 42 | } |
43 | 43 | $url .= '&f=l1'; |
44 | 44 | |
45 | 45 | $sql = ''; |
46 | - $response = $this->curl_response ( $url ); |
|
47 | - $content_data = explode ( ' ', $response ); |
|
46 | + $response = $this->curl_response($url); |
|
47 | + $content_data = explode(' ', $response); |
|
48 | 48 | |
49 | - foreach ( $content_data as $content_data1 ) { |
|
50 | - $currency_arr = explode ( "\n", $content_data1 ); |
|
51 | - foreach ( $currency_arr as $final_val ) { |
|
52 | - $currency_final = array (); |
|
53 | - $currency_final = explode ( ',', $final_val ); |
|
54 | - if (isset ( $currency_final [1] ) && $currency_final [1] != "" && $currency_final [0] != '' && $currency_final [1] != 'N/A') { |
|
55 | - $sql = "UPDATE currency SET currencyRate = " . $currency_final [1] . " WHERE currency = '" . substr ( $currency_final [0], 4, 3 ) . "'"; |
|
56 | - $this->db->query ( $sql ); |
|
49 | + foreach ($content_data as $content_data1) { |
|
50 | + $currency_arr = explode("\n", $content_data1); |
|
51 | + foreach ($currency_arr as $final_val) { |
|
52 | + $currency_final = array(); |
|
53 | + $currency_final = explode(',', $final_val); |
|
54 | + if (isset ($currency_final [1]) && $currency_final [1] != "" && $currency_final [0] != '' && $currency_final [1] != 'N/A') { |
|
55 | + $sql = "UPDATE currency SET currencyRate = ".$currency_final [1]." WHERE currency = '".substr($currency_final [0], 4, 3)."'"; |
|
56 | + $this->db->query($sql); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | - $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '" . Common_model::$global_config ['system_config'] ['base_currency'] . "'"; |
|
61 | - $this->db->query ( $sql ); |
|
60 | + $sql = "UPDATE currency SET currencyRate = '1' WHERE currency = '".Common_model::$global_config ['system_config'] ['base_currency']."'"; |
|
61 | + $this->db->query($sql); |
|
62 | 62 | } |
63 | - $this->session->set_flashdata ( "astpp_errormsg", "Currency exchange rates successfully updated." ); |
|
64 | - redirect ( base_url () . "/systems/currency_list/" ); |
|
63 | + $this->session->set_flashdata("astpp_errormsg", "Currency exchange rates successfully updated."); |
|
64 | + redirect(base_url()."/systems/currency_list/"); |
|
65 | 65 | exit (); |
66 | 66 | } |
67 | 67 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | * @param string $url |
71 | 71 | */ |
72 | 72 | function curl_response($url) { |
73 | - $ch = curl_init (); // Initialising cURL |
|
74 | - curl_setopt ( $ch, CURLOPT_URL, $url ); |
|
75 | - curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 ); |
|
76 | - curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
77 | - curl_setopt ( $ch, CURLOPT_ENCODING, "" ); |
|
78 | - curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)" ); |
|
79 | - $data = curl_exec ( $ch ); // Executing the cURL request and assigning the returned data to the $data variable |
|
80 | - curl_close ( $ch ); // Closing cURL |
|
73 | + $ch = curl_init(); // Initialising cURL |
|
74 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
75 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
76 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
77 | + curl_setopt($ch, CURLOPT_ENCODING, ""); |
|
78 | + curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)"); |
|
79 | + $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable |
|
80 | + curl_close($ch); // Closing cURL |
|
81 | 81 | return $data; |
82 | 82 | } |
83 | 83 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | class Run_CRON extends CI_Controller { |
39 | 39 | function __construct() { |
40 | - parent::__construct (); |
|
41 | - if (! defined ( 'CRON' )) |
|
40 | + parent::__construct(); |
|
41 | + if ( ! defined('CRON')) |
|
42 | 42 | exit (); |
43 | 43 | } |
44 | 44 | function __destruct() { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * All |
57 | 57 | */ |
58 | 58 | function all() { |
59 | - $this->generate_sitemap (); |
|
59 | + $this->generate_sitemap(); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | */ |
65 | 65 | function generate_sitemap() { |
66 | 66 | // Live Mode: |
67 | - if (! CRON_BETA_MODE) |
|
68 | - $cron_id = $this->cron->create ( 'Sitemap (Google|Bing|Ask|Yahoo!)' ); |
|
67 | + if ( ! CRON_BETA_MODE) |
|
68 | + $cron_id = $this->cron->create('Sitemap (Google|Bing|Ask|Yahoo!)'); |
|
69 | 69 | |
70 | 70 | // Example Code |
71 | 71 | |
72 | - $this->load->library ( 'sitemap' ); |
|
73 | - $this->load->config ( 'sitemap' ); |
|
72 | + $this->load->library('sitemap'); |
|
73 | + $this->load->config('sitemap'); |
|
74 | 74 | |
75 | 75 | // ... |
76 | 76 | // ... |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | |
79 | 79 | // Sandbox Mode: |
80 | 80 | if (CRON_BETA_MODE) |
81 | - $this->sitemap->generate_xml ( null, false ); |
|
81 | + $this->sitemap->generate_xml(null, false); |
|
82 | 82 | |
83 | 83 | // Live Mode: |
84 | 84 | else { |
85 | 85 | echo 'live'; |
86 | 86 | |
87 | - $this->sitemap->generate_xml (); |
|
88 | - $this->cron->update ( $cron_id ); |
|
87 | + $this->sitemap->generate_xml(); |
|
88 | + $this->cron->update($cron_id); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | class Run_CRON extends CI_Controller { |
39 | 39 | function __construct() { |
40 | 40 | parent::__construct (); |
41 | - if (! defined ( 'CRON' )) |
|
42 | - exit (); |
|
41 | + if (! defined ( 'CRON' )) { |
|
42 | + exit (); |
|
43 | + } |
|
43 | 44 | } |
44 | 45 | function __destruct() { |
45 | 46 | } |
@@ -64,8 +65,9 @@ discard block |
||
64 | 65 | */ |
65 | 66 | function generate_sitemap() { |
66 | 67 | // Live Mode: |
67 | - if (! CRON_BETA_MODE) |
|
68 | - $cron_id = $this->cron->create ( 'Sitemap (Google|Bing|Ask|Yahoo!)' ); |
|
68 | + if (! CRON_BETA_MODE) { |
|
69 | + $cron_id = $this->cron->create ( 'Sitemap (Google|Bing|Ask|Yahoo!)' ); |
|
70 | + } |
|
69 | 71 | |
70 | 72 | // Example Code |
71 | 73 | |
@@ -77,8 +79,9 @@ discard block |
||
77 | 79 | // ... |
78 | 80 | |
79 | 81 | // Sandbox Mode: |
80 | - if (CRON_BETA_MODE) |
|
81 | - $this->sitemap->generate_xml ( null, false ); |
|
82 | + if (CRON_BETA_MODE) { |
|
83 | + $this->sitemap->generate_xml ( null, false ); |
|
84 | + } |
|
82 | 85 | |
83 | 86 | // Live Mode: |
84 | 87 | else { |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined ( 'BASEPATH' )) { |
|
4 | - exit ( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('BASEPATH')) { |
|
4 | + exit ('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | /* |
7 | 7 | | ------------------------------------------------------------------------- |