@@ -31,11 +31,11 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - function customer_list_status($id){ |
|
34 | + function customer_list_status($id) { |
|
35 | 35 | $post_data = $this->input->post(); |
36 | - $post_data['table']=$this->common->decode($post_data['table']); |
|
37 | - $data['status']=$post_data['status'] =='true'? 0:1; |
|
38 | - $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
36 | + $post_data['table'] = $this->common->decode($post_data['table']); |
|
37 | + $data['status'] = $post_data['status'] == 'true' ? 0 : 1; |
|
38 | + $result = $post_data['table'] == 'accounts' && $post_data['id'] == 1 ? null : $this->db->update($post_data['table'], $data, array("id"=>$post_data['id'])); |
|
39 | 39 | echo TRUE; |
40 | 40 | } |
41 | 41 |
@@ -25,19 +25,19 @@ |
||
25 | 25 | function __construct() |
26 | 26 | { |
27 | 27 | parent::__construct(); |
28 | - if(!defined( 'CRON' ) ) |
|
28 | + if ( ! defined('CRON')) |
|
29 | 29 | exit(); |
30 | 30 | $this->load->model("db_model"); |
31 | 31 | $this->load->library("astpp/common"); |
32 | 32 | } |
33 | - function low_creditlimit(){ |
|
34 | - $where = array("posttoexternal"=>1,"deleted" => "0","status"=>"0"); |
|
33 | + function low_creditlimit() { |
|
34 | + $where = array("posttoexternal"=>1, "deleted" => "0", "status"=>"0"); |
|
35 | 35 | $query = $this->db_model->getSelect("*", "accounts", $where); |
36 | - if($query->num_rows >0){ |
|
36 | + if ($query->num_rows > 0) { |
|
37 | 37 | $account_data = $query->result_array(); |
38 | - foreach($account_data as $data_key =>$account_value){ |
|
39 | - if(($account_value["balance"]) >= $account_value["credit_limit"]){ |
|
40 | - $this->common->mail_to_users("email_low_balance",$account_value); |
|
38 | + foreach ($account_data as $data_key =>$account_value) { |
|
39 | + if (($account_value["balance"]) >= $account_value["credit_limit"]) { |
|
40 | + $this->common->mail_to_users("email_low_balance", $account_value); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
@@ -25,19 +25,19 @@ |
||
25 | 25 | function __construct() |
26 | 26 | { |
27 | 27 | parent::__construct(); |
28 | - if(!defined( 'CRON' ) ) |
|
28 | + if ( ! defined('CRON')) |
|
29 | 29 | exit(); |
30 | 30 | $this->load->model("db_model"); |
31 | 31 | $this->load->library("astpp/common"); |
32 | 32 | } |
33 | - function low_balance(){ |
|
34 | - $where = array("posttoexternal"=>0,"notify_flag"=>0,"deleted" => "0","status"=>"0"); |
|
33 | + function low_balance() { |
|
34 | + $where = array("posttoexternal"=>0, "notify_flag"=>0, "deleted" => "0", "status"=>"0"); |
|
35 | 35 | $query = $this->db_model->getSelect("*", "accounts", $where); |
36 | - if($query->num_rows >0){ |
|
36 | + if ($query->num_rows > 0) { |
|
37 | 37 | $account_data = $query->result_array(); |
38 | - foreach($account_data as $data_key =>$accountinfo){ |
|
39 | - if(($accountinfo["balance"]) <= $accountinfo["notify_credit_limit"]){ |
|
40 | - $this->common->mail_to_users("email_low_balance",$accountinfo); |
|
38 | + foreach ($account_data as $data_key =>$accountinfo) { |
|
39 | + if (($accountinfo["balance"]) <= $accountinfo["notify_credit_limit"]) { |
|
40 | + $this->common->mail_to_users("email_low_balance", $accountinfo); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
@@ -31,83 +31,83 @@ |
||
31 | 31 | $this->load->model('db_model'); |
32 | 32 | $this->load->model('Astpp_common'); |
33 | 33 | } |
34 | - function index($sipnumber=''){ |
|
35 | - $opensips_flag=common_model::$global_config['system_config']['opensips']; |
|
36 | - $accountid_arr=0; |
|
37 | - if($opensips_flag == '1'){ |
|
38 | - $where=array('username'=>$sipnumber); |
|
39 | - $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
|
34 | + function index($sipnumber = '') { |
|
35 | + $opensips_flag = common_model::$global_config['system_config']['opensips']; |
|
36 | + $accountid_arr = 0; |
|
37 | + if ($opensips_flag == '1') { |
|
38 | + $where = array('username'=>$sipnumber); |
|
39 | + $accountid_arr = $this->db_model->getSelect('accountid', 'sip_devices', $where); |
|
40 | 40 | } |
41 | - else{ |
|
41 | + else { |
|
42 | 42 | $db_config = Common_model::$global_config['system_config']; |
43 | - $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="; |
|
43 | + $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="; |
|
44 | 44 | $this->opensips_db = $this->load->database($opensipdsn, true); |
45 | 45 | $this->opensips_db->where(array("username"=>$sipnumber)); |
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('number'=>$value_num['accountcode'])); |
|
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('number'=>$value_num['accountcode'])); |
|
50 | 50 | } |
51 | 51 | } |
52 | - if($accountid_arr == ''){ |
|
52 | + if ($accountid_arr == '') { |
|
53 | 53 | echo "Please enter proper username of SIP Account"; |
54 | 54 | } |
55 | - if($accountid_arr->num_rows()==0 ){ |
|
56 | - $where=array('number'=>$sipnumber); |
|
57 | - $accountid_arr=$this->db_model->getSelect('id','accounts',$where); |
|
55 | + if ($accountid_arr->num_rows() == 0) { |
|
56 | + $where = array('number'=>$sipnumber); |
|
57 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', $where); |
|
58 | 58 | } |
59 | - if($accountid_arr->num_rows()>0){ |
|
60 | - $accountid_arr=$accountid_arr->result_array(); |
|
61 | - if($opensips_flag == '1'){ |
|
62 | - foreach($accountid_arr[0] as $key=>$value){ |
|
59 | + if ($accountid_arr->num_rows() > 0) { |
|
60 | + $accountid_arr = $accountid_arr->result_array(); |
|
61 | + if ($opensips_flag == '1') { |
|
62 | + foreach ($accountid_arr[0] as $key=>$value) { |
|
63 | 63 | } |
64 | - if($key== 'id'){ |
|
65 | - $accountid=$accountid_arr[0]['id']; |
|
66 | - } else{ |
|
67 | - $accountid=$accountid_arr[0]['accountid']; |
|
64 | + if ($key == 'id') { |
|
65 | + $accountid = $accountid_arr[0]['id']; |
|
66 | + } else { |
|
67 | + $accountid = $accountid_arr[0]['accountid']; |
|
68 | 68 | } |
69 | - } else{ |
|
70 | - $accountid=$accountid_arr[0]['id']; |
|
69 | + } else { |
|
70 | + $accountid = $accountid_arr[0]['id']; |
|
71 | 71 | } |
72 | 72 | $to_currency = common_model::$global_config['system_config']['base_currency']; |
73 | - if($accountid > 0){ |
|
74 | - $where=array('id'=>$accountid); |
|
75 | - $balance=$this->db_model->getSelect('balance,currency_id','accounts',$where); |
|
76 | - if($balance->num_rows() > 0){ |
|
73 | + if ($accountid > 0) { |
|
74 | + $where = array('id'=>$accountid); |
|
75 | + $balance = $this->db_model->getSelect('balance,currency_id', 'accounts', $where); |
|
76 | + if ($balance->num_rows() > 0) { |
|
77 | 77 | //get balance,currency using by user from account number. |
78 | 78 | $balance_arr = $balance->result_array(); |
79 | - $balance=$balance_arr['0']['balance']; |
|
80 | - $currency=$balance_arr['0']['currency_id']; |
|
79 | + $balance = $balance_arr['0']['balance']; |
|
80 | + $currency = $balance_arr['0']['currency_id']; |
|
81 | 81 | //Get Base Currency From System which is main currency of system. |
82 | - $base_currency_arr=$this->db_model->getSelect('value','system',array('name'=>'base_currency')); |
|
83 | - $base_currency_arr=$base_currency_arr->result_array(); |
|
84 | - $base_currency=$base_currency_arr['0']['value']; |
|
82 | + $base_currency_arr = $this->db_model->getSelect('value', 'system', array('name'=>'base_currency')); |
|
83 | + $base_currency_arr = $base_currency_arr->result_array(); |
|
84 | + $base_currency = $base_currency_arr['0']['value']; |
|
85 | 85 | //Get basse Currency rate from Currency Name. |
86 | - $base_currency_info=$this->db_model->getSelect('*','currency',array('currency'=>$base_currency)); |
|
87 | - $base_currency_info=$base_currency_info->result_array(); |
|
88 | - $base_currency_rate=$base_currency_info['0']['currencyrate']; |
|
89 | - $base_currency_name=$base_currency_info['0']['currency']; |
|
86 | + $base_currency_info = $this->db_model->getSelect('*', 'currency', array('currency'=>$base_currency)); |
|
87 | + $base_currency_info = $base_currency_info->result_array(); |
|
88 | + $base_currency_rate = $base_currency_info['0']['currencyrate']; |
|
89 | + $base_currency_name = $base_currency_info['0']['currency']; |
|
90 | 90 | //Find Currency Rate of user Currency from its currency_id |
91 | - $where= array('id'=>$currency); |
|
92 | - $user_currency_info=$this->db_model->getSelect("*",'currency',$where); |
|
91 | + $where = array('id'=>$currency); |
|
92 | + $user_currency_info = $this->db_model->getSelect("*", 'currency', $where); |
|
93 | 93 | //user Currency Is deleted or Not |
94 | - if($user_currency_info->num_rows() > 0){ |
|
95 | - $user_currency_info=$user_currency_info->result_array(); |
|
96 | - $user_currency=$user_currency_info['0']['currencyrate']; |
|
97 | - $user_currency_name=$user_currency_info['0']['currency']; |
|
98 | - } else{ |
|
99 | - $user_currency=$base_currency_rate; |
|
100 | - $user_currency_name=$base_currency_name; |
|
94 | + if ($user_currency_info->num_rows() > 0) { |
|
95 | + $user_currency_info = $user_currency_info->result_array(); |
|
96 | + $user_currency = $user_currency_info['0']['currencyrate']; |
|
97 | + $user_currency_name = $user_currency_info['0']['currency']; |
|
98 | + } else { |
|
99 | + $user_currency = $base_currency_rate; |
|
100 | + $user_currency_name = $base_currency_name; |
|
101 | 101 | } |
102 | 102 | // Convert Balance of user in user currency |
103 | - $convert_balance=round(($balance * $user_currency)/$base_currency_rate,2); |
|
104 | - $convert_balance=sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
103 | + $convert_balance = round(($balance * $user_currency) / $base_currency_rate, 2); |
|
104 | + $convert_balance = sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
105 | 105 | echo "Balance : ".$convert_balance; |
106 | 106 | } |
107 | - } else{ |
|
107 | + } else { |
|
108 | 108 | echo "0.00 ".$to_currency; |
109 | 109 | } |
110 | - } else{ |
|
110 | + } else { |
|
111 | 111 | echo "Please enter proper username of SIP Account"; |
112 | 112 | } |
113 | 113 | } |
@@ -28,59 +28,59 @@ discard block |
||
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | |
31 | - function index(){ |
|
31 | + function index() { |
|
32 | 32 | $data['account_info'] = $this->session->userdata['accountinfo']; |
33 | 33 | $data['username'] = $this->session->userdata('user_name'); |
34 | 34 | $data['page_title'] = "Feedback"; |
35 | - $this->load->view('view_feedback',$data); |
|
35 | + $this->load->view('view_feedback', $data); |
|
36 | 36 | } |
37 | - function customer_feedback_result($flag=FALSE){ |
|
38 | - if($flag){ |
|
37 | + function customer_feedback_result($flag = FALSE) { |
|
38 | + if ($flag) { |
|
39 | 39 | $account_info = array(); |
40 | - $this->db->where("accountid","1"); |
|
40 | + $this->db->where("accountid", "1"); |
|
41 | 41 | $res = $this->db->get('invoice_conf'); |
42 | - if($res->num_rows > 0){ |
|
42 | + if ($res->num_rows > 0) { |
|
43 | 43 | $masterdata = $res->result_array(); |
44 | 44 | $account_info = $masterdata['0']; |
45 | 45 | |
46 | - $company_name=$account_info['company_name']; |
|
47 | - $address=$account_info['address']; |
|
48 | - $city=$account_info['city']; |
|
49 | - $province=$account_info['province']; |
|
50 | - $country=$account_info['country']; |
|
51 | - $zipcode=$account_info['zipcode']; |
|
52 | - $telephone=$account_info['telephone']; |
|
53 | - $fax=$account_info['fax']; |
|
54 | - $emailaddress=$account_info['emailaddress']; |
|
55 | - $website=$account_info['website']; |
|
46 | + $company_name = $account_info['company_name']; |
|
47 | + $address = $account_info['address']; |
|
48 | + $city = $account_info['city']; |
|
49 | + $province = $account_info['province']; |
|
50 | + $country = $account_info['country']; |
|
51 | + $zipcode = $account_info['zipcode']; |
|
52 | + $telephone = $account_info['telephone']; |
|
53 | + $fax = $account_info['fax']; |
|
54 | + $emailaddress = $account_info['emailaddress']; |
|
55 | + $website = $account_info['website']; |
|
56 | 56 | |
57 | - $data=array("name"=>"Admin","company_name"=>$company_name,"address"=>$address,"city"=>$city,"province"=>$province,"country"=>$country,"zipcode"=>$zipcode,"telephone"=>$telephone,"fax"=>$fax,"emailaddress"=>$emailaddress,"website"=>$website,"serverip"=>$_SERVER['SERVER_NAME'],"FLAG"=>"TRUE"); |
|
57 | + $data = array("name"=>"Admin", "company_name"=>$company_name, "address"=>$address, "city"=>$city, "province"=>$province, "country"=>$country, "zipcode"=>$zipcode, "telephone"=>$telephone, "fax"=>$fax, "emailaddress"=>$emailaddress, "website"=>$website, "serverip"=>$_SERVER['SERVER_NAME'], "FLAG"=>"TRUE"); |
|
58 | 58 | } |
59 | - } else{ |
|
59 | + } else { |
|
60 | 60 | $account_info = array(); |
61 | - $this->db->where("type","-1"); |
|
61 | + $this->db->where("type", "-1"); |
|
62 | 62 | $res = $this->db->get('accounts'); |
63 | - if($res->num_rows > 0){ |
|
63 | + if ($res->num_rows > 0) { |
|
64 | 64 | $masterdata = $res->result_array(); |
65 | 65 | $account_info = $masterdata['0']; |
66 | 66 | |
67 | - $name=$_REQUEST['name']="Admin"; |
|
68 | - $email=$_REQUEST['email']=$account_info['email']; |
|
69 | - $feedback=$_REQUEST['feedback']; |
|
70 | - $first_name=$account_info['first_name']; |
|
71 | - $last_name=$account_info['last_name']; |
|
72 | - $city=$account_info['city']; |
|
73 | - $telephone_1=$account_info['telephone_1']; |
|
74 | - $account_email=$account_info['email']; |
|
75 | - $company_name=$account_info['company_name']; |
|
76 | - $address_1=$account_info['address_1']; |
|
77 | - $address_2=$account_info['address_2']; |
|
78 | - $telephone_2=$account_info['telephone_2']; |
|
79 | - $province=$account_info['province']; |
|
67 | + $name = $_REQUEST['name'] = "Admin"; |
|
68 | + $email = $_REQUEST['email'] = $account_info['email']; |
|
69 | + $feedback = $_REQUEST['feedback']; |
|
70 | + $first_name = $account_info['first_name']; |
|
71 | + $last_name = $account_info['last_name']; |
|
72 | + $city = $account_info['city']; |
|
73 | + $telephone_1 = $account_info['telephone_1']; |
|
74 | + $account_email = $account_info['email']; |
|
75 | + $company_name = $account_info['company_name']; |
|
76 | + $address_1 = $account_info['address_1']; |
|
77 | + $address_2 = $account_info['address_2']; |
|
78 | + $telephone_2 = $account_info['telephone_2']; |
|
79 | + $province = $account_info['province']; |
|
80 | 80 | |
81 | - $data=array("name"=>$name,"email"=>$email,"feedback"=>$feedback,"first_name"=>$first_name,"last_name"=>$last_name,"city"=>$city,"telephone_1"=>$telephone_1,"account_email"=>$account_email,"company_name"=>$company_name,"address_1"=>$address_1,"address_2"=>$address_2,"telephone_2"=>$telephone_2,"province"=>$province,"serverip"=>$_SERVER['SERVER_ADDR'],"FLAG"=>"FALSE"); |
|
81 | + $data = array("name"=>$name, "email"=>$email, "feedback"=>$feedback, "first_name"=>$first_name, "last_name"=>$last_name, "city"=>$city, "telephone_1"=>$telephone_1, "account_email"=>$account_email, "company_name"=>$company_name, "address_1"=>$address_1, "address_2"=>$address_2, "telephone_2"=>$telephone_2, "province"=>$province, "serverip"=>$_SERVER['SERVER_ADDR'], "FLAG"=>"FALSE"); |
|
82 | 82 | |
83 | - $data_new= json_encode($data); |
|
83 | + $data_new = json_encode($data); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | $ch = curl_init(); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
97 | 97 | |
98 | 98 | $response = curl_exec($ch); |
99 | - if(!$flag) |
|
100 | - redirect(base_url() . 'feedback/thanks'); |
|
99 | + if ( ! $flag) |
|
100 | + redirect(base_url().'feedback/thanks'); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } |
104 | - function thanks(){ |
|
104 | + function thanks() { |
|
105 | 105 | $this->load->view('view_feedback_response'); |
106 | 106 | } |
107 | 107 |
@@ -25,21 +25,21 @@ |
||
25 | 25 | function __construct() |
26 | 26 | { |
27 | 27 | parent::__construct(); |
28 | - if(!defined( 'CRON' ) ) |
|
28 | + if ( ! defined('CRON')) |
|
29 | 29 | exit(); |
30 | 30 | $this->load->model("db_model"); |
31 | 31 | $this->load->library("astpp/email_lib"); |
32 | 32 | } |
33 | - function broadcast_email(){ |
|
33 | + function broadcast_email() { |
|
34 | 34 | |
35 | 35 | $where = array("status"=>"1"); |
36 | 36 | $query = $this->db_model->getSelect("*", "mail_details", $where); |
37 | - if($query->num_rows >0){ |
|
37 | + if ($query->num_rows > 0) { |
|
38 | 38 | $account_data = $query->result_array(); |
39 | - foreach($account_data as $data_key =>$account_value){ |
|
40 | - $account_value['history_id']=$account_value['id']; |
|
39 | + foreach ($account_data as $data_key =>$account_value) { |
|
40 | + $account_value['history_id'] = $account_value['id']; |
|
41 | 41 | unset($account_value['id']); |
42 | - $this->email_lib->send_email('',$account_value,'',$account_value['attachment'],1,0,1); |
|
42 | + $this->email_lib->send_email('', $account_value, '', $account_value['attachment'], 1, 0, 1); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | -class Locale{ |
|
30 | +class Locale { |
|
31 | 31 | |
32 | 32 | function __construct($library_name = '') { |
33 | 33 | |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | $this->CI->load->driver('cache'); |
39 | 39 | $this->set_lang(); |
40 | 40 | } |
41 | - function set_lang($lang=FALSE){ |
|
41 | + function set_lang($lang = FALSE) { |
|
42 | 42 | |
43 | - $current_locale=$this->CI->session->userdata('user_language'); |
|
44 | - if(empty($current_locale)){ |
|
45 | - $current_locale= 'en_US'; |
|
43 | + $current_locale = $this->CI->session->userdata('user_language'); |
|
44 | + if (empty($current_locale)) { |
|
45 | + $current_locale = 'en_US'; |
|
46 | 46 | } |
47 | 47 | putenv("LANG=$current_locale"); |
48 | 48 | setlocale(LC_ALL, $current_locale.".UTF-8"); |
49 | - setlocale(LC_MESSAGES,$current_locale); |
|
49 | + setlocale(LC_MESSAGES, $current_locale); |
|
50 | 50 | setlocale(LC_TIME, $current_locale); |
51 | - setlocale(LC_CTYPE,$current_locale); |
|
52 | - $domain='messages'; |
|
53 | - $uri_segment=''; |
|
51 | + setlocale(LC_CTYPE, $current_locale); |
|
52 | + $domain = 'messages'; |
|
53 | + $uri_segment = ''; |
|
54 | 54 | $uri_segment = $this->CI->uri->segments; |
55 | - if(isset($uri_segment[1])){ |
|
55 | + if (isset($uri_segment[1])) { |
|
56 | 56 | $filename = getcwd().'/application/modules/user/language/'.$lang.'/LC_MESSAGES/messages.mo'; |
57 | - bindtextdomain(WEBSITE_DOMAIN,getcwd().'/application/modules/'.$uri_segment[1].'/language/'); |
|
57 | + bindtextdomain(WEBSITE_DOMAIN, getcwd().'/application/modules/'.$uri_segment[1].'/language/'); |
|
58 | 58 | } |
59 | 59 | bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8'); |
60 | 60 | textdomain(WEBSITE_DOMAIN); |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class CSVReader { |
14 | 14 | |
15 | - var $fields; /** columns names retrieved after parsing */ |
|
16 | - var $separator = ','; /** separator used to explode each line */ |
|
15 | + var $fields; /** columns names retrieved after parsing */ |
|
16 | + var $separator = ','; /** separator used to explode each line */ |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Parse a text containing CSV formatted data. |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | * @param string |
35 | 35 | * @return array |
36 | 36 | */ |
37 | - function parse_file($p_Filepath,$config_variable,$check_header_flag=false) { |
|
37 | + function parse_file($p_Filepath, $config_variable, $check_header_flag = false) { |
|
38 | 38 | $lines = file($p_Filepath); |
39 | 39 | //Giving line numbers |
40 | - for($i=0;$i<sizeof($lines);$i++) |
|
40 | + for ($i = 0; $i < sizeof($lines); $i++) |
|
41 | 41 | { |
42 | 42 | |
43 | - if(trim($lines[$i]) != "") |
|
43 | + if (trim($lines[$i]) != "") |
|
44 | 44 | { |
45 | 45 | $columnname = explode($this->separator, $lines[$i]); |
46 | - for($i=0;$i<sizeof($columnname);$i++) |
|
46 | + for ($i = 0; $i < sizeof($columnname); $i++) |
|
47 | 47 | { |
48 | - $columnname[$i]=$columnname[$i]; |
|
48 | + $columnname[$i] = $columnname[$i]; |
|
49 | 49 | } |
50 | 50 | break; |
51 | 51 | } |
52 | 52 | } |
53 | - return $this->parse_lines($lines,$config_variable,$check_header_flag); |
|
53 | + return $this->parse_lines($lines, $config_variable, $check_header_flag); |
|
54 | 54 | } |
55 | 55 | /** |
56 | 56 | * Parse an array of text lines containing CSV formatted data. |
@@ -59,47 +59,47 @@ discard block |
||
59 | 59 | * @param array |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - function parse_lines($p_CSVLines,$config_variable,$check_header_flag=false) { |
|
62 | + function parse_lines($p_CSVLines, $config_variable, $check_header_flag = false) { |
|
63 | 63 | // echo "<pre>"; |
64 | - $t=0; |
|
65 | - $content=array(); |
|
66 | - $custom_array=array(); |
|
67 | - $i=0; |
|
68 | - $flag_data=false; |
|
69 | - $data_arr[0]=$config_variable; |
|
70 | - $field_name_arr=array_keys($config_variable); |
|
71 | - foreach( $p_CSVLines as $line_num => $line ) |
|
64 | + $t = 0; |
|
65 | + $content = array(); |
|
66 | + $custom_array = array(); |
|
67 | + $i = 0; |
|
68 | + $flag_data = false; |
|
69 | + $data_arr[0] = $config_variable; |
|
70 | + $field_name_arr = array_keys($config_variable); |
|
71 | + foreach ($p_CSVLines as $line_num => $line) |
|
72 | 72 | { |
73 | - $line=trim($line); |
|
74 | - if(!empty($line)){ |
|
73 | + $line = trim($line); |
|
74 | + if ( ! empty($line)) { |
|
75 | 75 | // skip empty lines |
76 | 76 | $elements = explode($this->separator, $line); |
77 | 77 | |
78 | - if(array_filter($elements,'trim')) { |
|
79 | - $custom_array[]=$elements; |
|
78 | + if (array_filter($elements, 'trim')) { |
|
79 | + $custom_array[] = $elements; |
|
80 | 80 | } |
81 | 81 | $i++; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - if($check_header_flag == 'on'){ |
|
85 | + if ($check_header_flag == 'on') { |
|
86 | 86 | unset($custom_array[0]); |
87 | 87 | } |
88 | - foreach($custom_array as $data){ |
|
89 | - $j=0; |
|
90 | - foreach($data as $key=>$value){ |
|
91 | - $value=str_replace('"', '', $value); |
|
92 | - $value=str_replace("'", '', $value); |
|
93 | - if(isset($field_name_arr[$j])){ |
|
94 | - $field_key_value =$config_variable[$field_name_arr[$j]]; |
|
95 | - $value= strip_slashes(trim($value)); |
|
88 | + foreach ($custom_array as $data) { |
|
89 | + $j = 0; |
|
90 | + foreach ($data as $key=>$value) { |
|
91 | + $value = str_replace('"', '', $value); |
|
92 | + $value = str_replace("'", '', $value); |
|
93 | + if (isset($field_name_arr[$j])) { |
|
94 | + $field_key_value = $config_variable[$field_name_arr[$j]]; |
|
95 | + $value = strip_slashes(trim($value)); |
|
96 | 96 | $value = preg_replace('#<script.*</script>#is', '', $value); |
97 | - if(isset($field_key_value) && !empty($field_key_value)) |
|
98 | - $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
|
97 | + if (isset($field_key_value) && ! empty($field_key_value)) |
|
98 | + $content[$field_key_value] = strip_tags(filter_var($value, FILTER_SANITIZE_STRING)); |
|
99 | 99 | $j++; |
100 | 100 | } |
101 | 101 | } |
102 | - $data_arr[]=$content; |
|
102 | + $data_arr[] = $content; |
|
103 | 103 | } |
104 | 104 | return $data_arr; |
105 | 105 | } |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | exit('No direct script access allowed'); |
25 | 25 | } |
26 | 26 | class Timezone { |
27 | - function __construct(){ |
|
28 | - $this->CI =& get_instance(); |
|
27 | + function __construct() { |
|
28 | + $this->CI = & get_instance(); |
|
29 | 29 | $this->CI->load->library('session'); |
30 | 30 | $this->CI->load->database(); |
31 | 31 | } |
32 | 32 | |
33 | - function uset_timezone(){ |
|
33 | + function uset_timezone() { |
|
34 | 34 | $account_data = $this->CI->session->userdata('accountinfo'); |
35 | - return $account_data['timezone_id'] ; |
|
35 | + return $account_data['timezone_id']; |
|
36 | 36 | } |
37 | - function display_GMT($currDate,$fulldate = 1) |
|
37 | + function display_GMT($currDate, $fulldate = 1) |
|
38 | 38 | { |
39 | 39 | $number = $this->uset_timezone(); |
40 | - $SERVER_GMT='0'; |
|
40 | + $SERVER_GMT = '0'; |
|
41 | 41 | |
42 | - $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
42 | + $result = $this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
43 | 43 | $timezone_offset = $result->result(); |
44 | 44 | |
45 | 45 | $USER_GMT = $timezone_offset['0']->gmtoffset; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $year = $date_time_array['year']; |
55 | 55 | $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year); |
56 | 56 | |
57 | - $timestamp = $timestamp+($USER_GMT-$SERVER_GMT); |
|
57 | + $timestamp = $timestamp + ($USER_GMT - $SERVER_GMT); |
|
58 | 58 | if ($fulldate == 1) { |
59 | 59 | $date = date("Y-m-d H:i:s", $timestamp); |
60 | 60 | } else { |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | return $date; |
65 | 65 | } |
66 | 66 | |
67 | - function convert_to_GMT($currDate,$fulldate = 1){ |
|
67 | + function convert_to_GMT($currDate, $fulldate = 1) { |
|
68 | 68 | $number = $this->uset_timezone(); |
69 | - $SERVER_GMT='0'; |
|
69 | + $SERVER_GMT = '0'; |
|
70 | 70 | |
71 | - $result=$this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
71 | + $result = $this->CI->db->query("select gmtoffset from timezone where id =".$number); |
|
72 | 72 | $timezone_offset = $result->result(); |
73 | 73 | |
74 | 74 | $USER_GMT = $timezone_offset['0']->gmtoffset; |