Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
web_interface/astpp/application/modules/signup/views/view_signup.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@  discard block
 block discarded – undo
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
 	Signup | <?php echo $invoiceconf['website_title']; ?>
18 18
 	<?php
19
-		}else{ 
19
+		} else { 
20 20
 	?>
21 21
 	Signup | ASTPP - Open Source Voip Billing Solution
22 22
 	<?php
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
             <div class="row">
128 128
                 <div class="col-md-4 col-md-offset-4">&nbsp;
129 129
 					<span class="login_error">
130
-                        <?php if (isset($astpp_notification)){ ?>
130
+                        <?php if (isset($astpp_notification)) { ?>
131 131
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
132
-						<?php }else{
132
+						<?php } else {
133 133
 						 echo "&nbsp;";
134 134
 						} ?>
135 135
                     </span>
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 											<!-- Header Start-->
147 147
 												<div class="col-md-12">
148 148
 													 <?php
149
-														if(isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != ""){
149
+														if (isset($this->session->userdata['user_logo']) && $this->session->userdata['user_logo'] != "") {
150 150
 															$logo = $this->session->userdata['user_logo'];
151
-														}else{
151
+														} else {
152 152
 															$logo = 'logo.png';
153 153
 														}
154 154
 														
155 155
 													if ($this->session->userdata('userlevel_logintype') != '0') {?>
156 156
 															<a class="col-md-10" style="padding:0px 0px 10px 0px" href="<?php echo base_url(); ?>">
157
-																<img style="height: 53px; width:216px;" id="logo" alt="dashboard" src="<?php echo base_url(); ?>upload/<?php echo$logo;?>">
157
+																<img style="height: 53px; width:216px;" id="logo" alt="dashboard" src="<?php echo base_url(); ?>upload/<?php echo$logo; ?>">
158 158
 														<? } else {?> 
159 159
 																<a class="col-md-10" style="padding:0px 0px 20px 0px" href="<?php echo base_url(); ?>">
160
-																<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;?>">
160
+																<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; ?>">
161 161
 														<? }?>
162 162
 															</a>
163 163
 												<div class="col-md-2">
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/models/ipmap_model.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -23,41 +23,41 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class IPMAP_model extends CI_Model {
25 25
 	function IPMAP_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 	}
28 28
 	function ipmap_list($flag, $start = 0, $limit = 0) {
29
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
30
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
31
-			$qry = $this->db_model->getselect ( 'id', 'accounts', array (
29
+		$accountinfo = $this->session->userdata('accountinfo');
30
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
31
+			$qry = $this->db_model->getselect('id', 'accounts', array(
32 32
 					'reseller_id' => $accountinfo ['id'] 
33
-			) );
34
-			$result = $qry->result_array ();
35
-			foreach ( $result as $value1 ) {
33
+			));
34
+			$result = $qry->result_array();
35
+			foreach ($result as $value1) {
36 36
 				$value [] = $value1 ['id'];
37 37
 			}
38
-			if (! empty ( $value )) {
39
-				$this->db->where_in ( 'accountid', $value );
38
+			if ( ! empty ($value)) {
39
+				$this->db->where_in('accountid', $value);
40 40
 			} else {
41
-				$this->db->where_in ( 'accountid', '0' );
41
+				$this->db->where_in('accountid', '0');
42 42
 			}
43 43
 		} else {
44 44
 			
45
-			$qry = $this->db_model->getselect ( 'id', 'accounts', array (
45
+			$qry = $this->db_model->getselect('id', 'accounts', array(
46 46
 					'reseller_id' => 0 
47
-			) );
48
-			$result = $qry->result_array ();
47
+			));
48
+			$result = $qry->result_array();
49 49
 			
50
-			foreach ( $result as $value1 ) {
50
+			foreach ($result as $value1) {
51 51
 				$value [] = $value1 ['id'];
52 52
 			}
53 53
 			// $this->db->where_in('accountid', $value);
54
-			if (! empty ( $value )) {
55
-				$this->db->where_in ( 'accountid', $value );
54
+			if ( ! empty ($value)) {
55
+				$this->db->where_in('accountid', $value);
56 56
 			} else {
57
-				$this->db->where_in ( 'accountid', '0' );
57
+				$this->db->where_in('accountid', '0');
58 58
 			}
59 59
 		}
60
-		$this->db_model->build_search ( 'ipmap_list_search' );
60
+		$this->db_model->build_search('ipmap_list_search');
61 61
 		/**
62 62
 		 * *****
63 63
 		 * ASTPP 3.0
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		 * *****
66 66
 		 */
67 67
 		if ($accountinfo ['type'] == '0') {
68
-			$where = array (
68
+			$where = array(
69 69
 					'accountid' => $accountinfo ['id'] 
70 70
 			);
71 71
 		} else {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			 * in customer login show ipmap (ACL) module
82 82
 			 * *****
83 83
 			 */
84
-			$query = $this->db_model->select ( "*", "ip_map", $where, "id", "ASC", $limit, $start );
84
+			$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start);
85 85
 		/**
86 86
 		 * ****************************************************************************************
87 87
 		 */
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			 * in customer login show ipmap (ACL) module
93 93
 			 * *****
94 94
 			 */
95
-			$query = $this->db_model->countQuery ( "*", "ip_map", $where );
95
+			$query = $this->db_model->countQuery("*", "ip_map", $where);
96 96
 		/**
97 97
 		 * **********************************************************************************************************
98 98
 		 */
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 		 * in customer login show ipmap (ACL) module
108 108
 		 * *****
109 109
 		 */
110
-		$account_data = $this->session->userdata ( "accountinfo" );
110
+		$account_data = $this->session->userdata("accountinfo");
111 111
 		if ($account_data ['type'] == '0') {
112 112
 			$add_array ['accountid'] = $account_data ['id'];
113 113
 		}
114 114
 		/**
115 115
 		 * ****************************************************************
116 116
 		 */
117
-		$data = array (
118
-				'created_date' => gmdate ( 'Y-m-d H:i:s' ),
117
+		$data = array(
118
+				'created_date' => gmdate('Y-m-d H:i:s'),
119 119
 				'name' => $add_array ['name'],
120 120
 				'ip' => $add_array ['ip'],
121 121
 				'prefix' => $add_array ['prefix'],
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 				'status' => $add_array ['status'],
124 124
 				'context' => 'default' 
125 125
 		);
126
-		$this->db->insert ( "ip_map", $data );
127
-		return $this->db->insert_id ();
126
+		$this->db->insert("ip_map", $data);
127
+		return $this->db->insert_id();
128 128
 	}
129 129
 	function edit_ipmap($add_array, $id) {
130 130
 		/**
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 		 * in customer login show ipmap (ACL) module
134 134
 		 * *****
135 135
 		 */
136
-		$account_data = $this->session->userdata ( "accountinfo" );
136
+		$account_data = $this->session->userdata("accountinfo");
137 137
 		if ($account_data ['type'] == '0') {
138 138
 			$add_array ['accountid'] = $account_data ['id'];
139 139
 		}
140 140
 		/**
141 141
 		 * *********************************************************************************************
142 142
 		 */
143
-		$data = array (
144
-				'last_modified_date' => gmdate ( 'Y-m-d H:i:s' ),
143
+		$data = array(
144
+				'last_modified_date' => gmdate('Y-m-d H:i:s'),
145 145
 				'name' => $add_array ['name'],
146 146
 				'ip' => $add_array ['ip'],
147 147
 				'prefix' => $add_array ['prefix'],
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 				'status' => $add_array ['status'],
150 150
 				'context' => 'default' 
151 151
 		);
152
-		$this->db->where ( "id", $id );
153
-		return $this->db->update ( "ip_map", $data );
152
+		$this->db->where("id", $id);
153
+		return $this->db->update("ip_map", $data);
154 154
 	}
155 155
 	function remove_ipmap($id) {
156
-		$this->db->where ( "id", $id );
157
-		$this->db->delete ( "ip_map" );
156
+		$this->db->where("id", $id);
157
+		$this->db->delete("ip_map");
158 158
 		return true;
159 159
 	}
160 160
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/controllers/ipmap.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -23,30 +23,30 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class IPMAP extends MX_Controller {
25 25
 	function IPMAP() {
26
-		parent::__construct ();
27
-		$this->load->helper ( 'template_inheritance' );
28
-		$this->load->library ( 'session' );
29
-		$this->load->library ( "ipmap_form" );
30
-		$this->load->library ( 'astpp/form' );
31
-		$this->load->model ( 'ipmap_model' );
32
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
33
-			redirect ( base_url () . '/astpp/login' );
26
+		parent::__construct();
27
+		$this->load->helper('template_inheritance');
28
+		$this->load->library('session');
29
+		$this->load->library("ipmap_form");
30
+		$this->load->library('astpp/form');
31
+		$this->load->model('ipmap_model');
32
+		if ($this->session->userdata('user_login') == FALSE)
33
+			redirect(base_url().'/astpp/login');
34 34
 	}
35 35
 	function ipmap_add() {
36
-		$data ['username'] = $this->session->userdata ( 'user_name' );
36
+		$data ['username'] = $this->session->userdata('user_name');
37 37
 		$data ['flag'] = 'create';
38
-		$data ['page_title'] = gettext ( 'Add IP Map' );
39
-		$data ['form'] = $this->form->build_form ( $this->ipmap_form->get_ipmap_form_fields (), '' );
40
-		$this->load->view ( 'ipmap_add_edit', $data );
38
+		$data ['page_title'] = gettext('Add IP Map');
39
+		$data ['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), '');
40
+		$this->load->view('ipmap_add_edit', $data);
41 41
 	}
42 42
 	function ipmap_edit($edit_id = '') {
43
-		$data ['page_title'] = gettext ( 'Edit IP Map' );
44
-		$where = array (
43
+		$data ['page_title'] = gettext('Edit IP Map');
44
+		$where = array(
45 45
 				'id' => $edit_id 
46 46
 		);
47
-		$account = $this->db_model->getSelect ( "*", "ip_map", $where );
47
+		$account = $this->db_model->getSelect("*", "ip_map", $where);
48 48
 		// echo $this->db->last_query(); exit;
49
-		foreach ( $account->result_array () as $key => $value ) {
49
+		foreach ($account->result_array() as $key => $value) {
50 50
 			/**
51 51
 			 * *******************
52 52
 			 * ASTPP 3.0
@@ -58,100 +58,100 @@  discard block
 block discarded – undo
58 58
 		/**
59 59
 		 * **********************************************************************************************
60 60
 		 */
61
-		$data ['form'] = $this->form->build_form ( $this->ipmap_form->get_ipmap_form_fields (), $edit_data );
62
-		$this->load->view ( 'ipmap_add_edit', $data );
61
+		$data ['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $edit_data);
62
+		$this->load->view('ipmap_add_edit', $data);
63 63
 	}
64 64
 	function ipmap_save() {
65
-		$add_array = $this->input->post ();
65
+		$add_array = $this->input->post();
66 66
 		$ip = $add_array ['ip'];
67
-		if (strpos ( $ip, '/' ) !== false) {
67
+		if (strpos($ip, '/') !== false) {
68 68
 			$add_array ['ip'] = $add_array ['ip'];
69 69
 		} else {
70
-			$add_array ['ip'] = $add_array ['ip'] . '/32';
70
+			$add_array ['ip'] = $add_array ['ip'].'/32';
71 71
 		}
72
-		$data ['form'] = $this->form->build_form ( $this->ipmap_form->get_ipmap_form_fields (), $add_array );
72
+		$data ['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array);
73 73
 		if ($add_array ['id'] != '') {
74
-			$data ['page_title'] = gettext ( 'Add IP Map' );
75
-			if ($this->form_validation->run () == FALSE) {
76
-				$data ['validation_errors'] = validation_errors ();
74
+			$data ['page_title'] = gettext('Add IP Map');
75
+			if ($this->form_validation->run() == FALSE) {
76
+				$data ['validation_errors'] = validation_errors();
77 77
 				echo $data ['validation_errors'];
78 78
 				exit ();
79 79
 			}
80
-			$this->db->select ( 'prefix,ip' );
81
-			$this->db->where ( [ 
80
+			$this->db->select('prefix,ip');
81
+			$this->db->where([ 
82 82
 					'prefix' => $add_array ['prefix'],
83 83
 					'ip' => $add_array ['ip'],
84 84
 					'id <>' => $add_array ['id'] 
85
-			] );
86
-			$ip_prefix = ( array ) $this->db->get ( 'ip_map' )->first_row ();
87
-			if (! empty ( $ip_prefix )) {
88
-				echo json_encode ( array (
85
+			]);
86
+			$ip_prefix = (array)$this->db->get('ip_map')->first_row();
87
+			if ( ! empty ($ip_prefix)) {
88
+				echo json_encode(array(
89 89
 						"prefix_error" => "The Prefix field must contain a unique value.
90 90
 ",
91 91
 						"ip_error" => "The IP field must contain a unique value." 
92
-				) );
92
+				));
93 93
 				exit ();
94 94
 			} else {
95
-				$ip_free = $this->ipmap_model->edit_ipmap ( $add_array, $add_array ['id'] );
95
+				$ip_free = $this->ipmap_model->edit_ipmap($add_array, $add_array ['id']);
96 96
 				if ($ip_free) {
97
-					$this->load->library ( 'freeswitch_lib' );
98
-					$this->load->module ( 'freeswitch/freeswitch' );
97
+					$this->load->library('freeswitch_lib');
98
+					$this->load->module('freeswitch/freeswitch');
99 99
 					$command = "api reloadacl";
100
-					$response = $this->freeswitch_model->reload_freeswitch ( $command );
101
-					$this->session->set_userdata ( 'astpp_notification', $response );
100
+					$response = $this->freeswitch_model->reload_freeswitch($command);
101
+					$this->session->set_userdata('astpp_notification', $response);
102 102
 				}
103
-				echo json_encode ( array (
103
+				echo json_encode(array(
104 104
 						"SUCCESS" => " IP Map updated successfully!" 
105
-				) );
105
+				));
106 106
 				exit ();
107 107
 			}
108 108
 		} else {
109 109
 			
110
-			if ($this->form_validation->run () == FALSE) {
111
-				$data ['validation_errors'] = validation_errors ();
110
+			if ($this->form_validation->run() == FALSE) {
111
+				$data ['validation_errors'] = validation_errors();
112 112
 				echo $data ['validation_errors'];
113 113
 				exit ();
114 114
 			}
115
-			$this->db->select ( 'prefix,ip' );
116
-			$this->db->where ( [ 
115
+			$this->db->select('prefix,ip');
116
+			$this->db->where([ 
117 117
 					'prefix' => $add_array ['prefix'],
118 118
 					'ip' => $add_array ['ip'] 
119
-			] );
120
-			$ip_prefix = ( array ) $this->db->get ( 'ip_map' )->first_row ();
119
+			]);
120
+			$ip_prefix = (array)$this->db->get('ip_map')->first_row();
121 121
 			
122
-			if (! empty ( $ip_prefix )) {
123
-				echo json_encode ( array (
122
+			if ( ! empty ($ip_prefix)) {
123
+				echo json_encode(array(
124 124
 						"prefix_error" => "The Prefix field must contain a unique value.
125 125
 ",
126 126
 						"ip_error" => "The IP field must contain a unique value." 
127
-				) );
127
+				));
128 128
 				exit ();
129 129
 			} else {
130
-				$ip_free = $this->ipmap_model->add_ipmap ( $add_array );
130
+				$ip_free = $this->ipmap_model->add_ipmap($add_array);
131 131
 				if ($ip_free) {
132
-					$this->load->library ( 'freeswitch_lib' );
133
-					$this->load->module ( 'freeswitch/freeswitch' );
132
+					$this->load->library('freeswitch_lib');
133
+					$this->load->module('freeswitch/freeswitch');
134 134
 					$command = "api reloadacl";
135
-					$response = $this->freeswitch_model->reload_freeswitch ( $command );
136
-					$this->session->set_userdata ( 'astpp_notification', $response );
135
+					$response = $this->freeswitch_model->reload_freeswitch($command);
136
+					$this->session->set_userdata('astpp_notification', $response);
137 137
 				}
138
-				echo json_encode ( array (
138
+				echo json_encode(array(
139 139
 						"SUCCESS" => " IP Map added successfully!" 
140
-				) );
140
+				));
141 141
 				exit ();
142 142
 			}
143 143
 		}
144 144
 	}
145 145
 	function ipmap_delete($id) {
146
-		$ip_free = $this->ipmap_model->remove_ipmap ( $id );
146
+		$ip_free = $this->ipmap_model->remove_ipmap($id);
147 147
 		if ($ip_free) {
148
-			$this->load->library ( 'freeswitch_lib' );
149
-			$this->load->module ( 'freeswitch/freeswitch' );
148
+			$this->load->library('freeswitch_lib');
149
+			$this->load->module('freeswitch/freeswitch');
150 150
 			$command = "api reloadacl";
151
-			$response = $this->freeswitch_model->reload_freeswitch ( $command );
152
-			$this->session->set_userdata ( 'astpp_notification', $response );
151
+			$response = $this->freeswitch_model->reload_freeswitch($command);
152
+			$this->session->set_userdata('astpp_notification', $response);
153 153
 		}
154
-		$this->session->set_flashdata ( 'astpp_notification', 'IP Map removed successfully!' );
154
+		$this->session->set_flashdata('astpp_notification', 'IP Map removed successfully!');
155 155
 		/**
156 156
 		 * *******************
157 157
 		 * ASTPP 3.0
@@ -160,40 +160,40 @@  discard block
 block discarded – undo
160 160
 		 */
161 161
 		$accountdata = $this->session->userdata ['accountinfo'];
162 162
 		if ($accountdata ['type'] == '0') {
163
-			redirect ( base_url () . 'user/user_ipmap_detail/' );
163
+			redirect(base_url().'user/user_ipmap_detail/');
164 164
 		} else {
165
-			redirect ( base_url () . 'ipmap/ipmap_detail/' );
165
+			redirect(base_url().'ipmap/ipmap_detail/');
166 166
 		}
167 167
 	/**
168 168
 	 * ******************************************************************
169 169
 	 */
170 170
 	}
171 171
 	function ipmap_detail_search() {
172
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
173
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
174
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
175
-			$action = $this->input->post ();
176
-			unset ( $action ['action'] );
177
-			unset ( $action ['advance_search'] );
178
-			$this->session->set_userdata ( 'ipmap_list_search', $action );
172
+		$ajax_search = $this->input->post('ajax_search', 0);
173
+		if ($this->input->post('advance_search', TRUE) == 1) {
174
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
175
+			$action = $this->input->post();
176
+			unset ($action ['action']);
177
+			unset ($action ['advance_search']);
178
+			$this->session->set_userdata('ipmap_list_search', $action);
179 179
 		}
180 180
 		if (@$ajax_search != 1) {
181
-			redirect ( base_url () . 'ipmap/ipmap_list/' );
181
+			redirect(base_url().'ipmap/ipmap_list/');
182 182
 		}
183 183
 	}
184 184
 	function ipmap_detail_clearsearchfilter() {
185
-		$this->session->set_userdata ( 'advance_search', 0 );
186
-		$this->session->set_userdata ( 'ipmap_list_search', "" );
185
+		$this->session->set_userdata('advance_search', 0);
186
+		$this->session->set_userdata('ipmap_list_search', "");
187 187
 	}
188 188
 	function ipmap_detail() {
189
-		$data ['username'] = $this->session->userdata ( 'user_name' );
190
-		$data ['page_title'] = gettext ( 'IP Map(ACL)' );
189
+		$data ['username'] = $this->session->userdata('user_name');
190
+		$data ['page_title'] = gettext('IP Map(ACL)');
191 191
 		$data ['search_flag'] = true;
192
-		$this->session->set_userdata ( 'advance_search', 0 );
193
-		$data ['grid_fields'] = $this->ipmap_form->build_ipmap_list_for_admin ();
194
-		$data ["grid_buttons"] = $this->ipmap_form->build_grid_buttons ();
195
-		$data ['form_search'] = $this->form->build_serach_form ( $this->ipmap_form->get_ipmap_search_form () );
196
-		$this->load->view ( 'ipmap_view', $data );
192
+		$this->session->set_userdata('advance_search', 0);
193
+		$data ['grid_fields'] = $this->ipmap_form->build_ipmap_list_for_admin();
194
+		$data ["grid_buttons"] = $this->ipmap_form->build_grid_buttons();
195
+		$data ['form_search'] = $this->form->build_serach_form($this->ipmap_form->get_ipmap_search_form());
196
+		$this->load->view('ipmap_view', $data);
197 197
 	}
198 198
 	
199 199
 	/**
@@ -203,44 +203,44 @@  discard block
 block discarded – undo
203 203
 	 * ***************************************
204 204
 	 */
205 205
 	function ipmap_detail_json() {
206
-		$json_data = array ();
207
-		$account_data = $this->session->userdata ( "accountinfo" );
208
-		$count_all = $this->ipmap_model->ipmap_list ( false );
209
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
206
+		$json_data = array();
207
+		$account_data = $this->session->userdata("accountinfo");
208
+		$count_all = $this->ipmap_model->ipmap_list(false);
209
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
210 210
 		$json_data = $paging_data ["json_paging"];
211
-		$query = $this->ipmap_model->ipmap_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
212
-		$query = $query->result_array ();
213
-		foreach ( $query as $key => $value ) {
214
-			$ipmap_checkbox = '<input type="checkbox" name="chkAll" id="' . $value ['id'] . '" class="ace chkRefNos" onclick="clickchkbox(' . $value ['id'] . ')" value=' . $value ['id'] . '><lable class="lbl"></lable>';
211
+		$query = $this->ipmap_model->ipmap_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
212
+		$query = $query->result_array();
213
+		foreach ($query as $key => $value) {
214
+			$ipmap_checkbox = '<input type="checkbox" name="chkAll" id="'.$value ['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value ['id'].')" value='.$value ['id'].'><lable class="lbl"></lable>';
215 215
 			if ($account_data ['type'] == '0') {
216
-				$ret_url = '<a href="' . base_url () . 'user/user_ipmap_edit/' . $value ['id'] . '" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="' . base_url () . 'user/user_ipmap_delete/' . $value ['id'] . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
216
+				$ret_url = '<a href="'.base_url().'user/user_ipmap_edit/'.$value ['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'.base_url().'user/user_ipmap_delete/'.$value ['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
217 217
 				$account_name = '';
218
-				$json_data ['rows'] [] = array (
219
-						'cell' => array (
218
+				$json_data ['rows'] [] = array(
219
+						'cell' => array(
220 220
 								$ipmap_checkbox,
221 221
 								$value ['name'],
222 222
 								$value ['ip'],
223 223
 								$value ['prefix'],
224
-								$this->common->get_status ( 'status', 'ip_map', $value ),
225
-								$this->common->convert_GMT_to ( '', '', $value ['created_date'] ),
226
-								$this->common->convert_GMT_to ( '', '', $value ['last_modified_date'] ),
224
+								$this->common->get_status('status', 'ip_map', $value),
225
+								$this->common->convert_GMT_to('', '', $value ['created_date']),
226
+								$this->common->convert_GMT_to('', '', $value ['last_modified_date']),
227 227
 								$ret_url 
228 228
 						)
229 229
 						 
230 230
 				);
231 231
 			} else {
232
-				$ret_url = '<a href="' . base_url () . 'ipmap/ipmap_edit/' . $value ['id'] . '" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="' . base_url () . 'ipmap/ipmap_delete/' . $value ['id'] . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
233
-				$account_name = $this->common->build_concat_string ( "first_name,last_name,number", "accounts", $value ['accountid'] );
234
-				$json_data ['rows'] [] = array (
235
-						'cell' => array (
232
+				$ret_url = '<a href="'.base_url().'ipmap/ipmap_edit/'.$value ['id'].'" class="btn btn-royelblue btn-sm"  rel="facebox" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="'.base_url().'ipmap/ipmap_delete/'.$value ['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
233
+				$account_name = $this->common->build_concat_string("first_name,last_name,number", "accounts", $value ['accountid']);
234
+				$json_data ['rows'] [] = array(
235
+						'cell' => array(
236 236
 								$ipmap_checkbox,
237 237
 								$account_name,
238 238
 								$value ['name'],
239 239
 								$value ['ip'],
240 240
 								$value ['prefix'],
241
-								$this->common->get_status ( 'status', 'ip_map', $value ),
242
-								$this->common->convert_GMT_to ( '', '', $value ['created_date'] ),
243
-								$this->common->convert_GMT_to ( '', '', $value ['last_modified_date'] ),
241
+								$this->common->get_status('status', 'ip_map', $value),
242
+								$this->common->convert_GMT_to('', '', $value ['created_date']),
243
+								$this->common->convert_GMT_to('', '', $value ['last_modified_date']),
244 244
 								$ret_url 
245 245
 						)
246 246
 						 
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
 			}
249 249
 		}
250 250
 		
251
-		echo json_encode ( $json_data );
251
+		echo json_encode($json_data);
252 252
 	}
253 253
 	/**
254 254
 	 * **********************************************************
255 255
 	 */
256 256
 	function ipmap_delete_multiple() {
257
-		$ids = $this->input->post ( "selected_ids", true );
257
+		$ids = $this->input->post("selected_ids", true);
258 258
 		$where = "id IN ($ids)";
259
-		$this->db->where ( $where );
260
-		echo $this->db->delete ( "ip_map" );
259
+		$this->db->where($where);
260
+		echo $this->db->delete("ip_map");
261 261
 	}
262 262
 }
263 263
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/libraries/ipmap_form.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 // You should have received a copy of the GNU Affero General Public License
21 21
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 22
 // ##############################################################################
23
-if (! defined ( 'BASEPATH' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class Ipmap_form {
26 26
 	function __construct($library_name = '') {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	
30 30
 	/**
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		 * in customer login show ipmap (ACL) module
44 44
 		 * ***************************************
45 45
 		 */
46
-		$logintype = $this->CI->session->userdata ( 'logintype' );
46
+		$logintype = $this->CI->session->userdata('logintype');
47 47
 		if ($account_type == '0' || $logintype == '0') {
48 48
 			$account = null;
49
-			$form ['forms'] = array (
50
-					base_url () . 'user/user_ipmap_save/',
51
-					array (
49
+			$form ['forms'] = array(
50
+					base_url().'user/user_ipmap_save/',
51
+					array(
52 52
 							'id' => 'ipmap_form',
53 53
 							'method' => 'POST',
54 54
 							'name' => 'ipmap_form' 
55 55
 					) 
56 56
 			);
57 57
 		} else {
58
-			$account = array (
58
+			$account = array(
59 59
 					'Account',
60 60
 					'accountid',
61 61
 					'SELECT',
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
 					'accounts',
69 69
 					'build_concat_dropdown',
70 70
 					'where_arr',
71
-					array (
71
+					array(
72 72
 							"reseller_id" => "0",
73 73
 							"type" => "0,3",
74 74
 							"deleted" => "0",
75 75
 							"status" => "0" 
76 76
 					) 
77 77
 			);
78
-			$form ['forms'] = array (
79
-					base_url () . 'ipmap/ipmap_save/',
80
-					array (
78
+			$form ['forms'] = array(
79
+					base_url().'ipmap/ipmap_save/',
80
+					array(
81 81
 							'id' => 'ipmap_form',
82 82
 							'method' => 'POST',
83 83
 							'name' => 'ipmap_form' 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 		/**
88 88
 		 * ********************************************************************************************
89 89
 		 */
90
-		$form ['IP map'] = array (
91
-				array (
90
+		$form ['IP map'] = array(
91
+				array(
92 92
 						'',
93 93
 						'HIDDEN',
94
-						array (
94
+						array(
95 95
 								'name' => 'id' 
96 96
 						),
97 97
 						'',
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				/**
110 110
 				 * *******************************************************************************************
111 111
 				 */
112
-				array (
113
-						gettext ( 'Name' ),
112
+				array(
113
+						gettext('Name'),
114 114
 						'INPUT',
115
-						array (
115
+						array(
116 116
 								'name' => 'name',
117 117
 								'size' => '20',
118 118
 								'class' => "text field medium" 
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 		   /*ASTPP  3.0 
125 125
    	    in customer login show ipmap (ACL) module
126 126
    	    *****************************************/
127
-			array (
128
-						gettext ( 'IP' ),
127
+			array(
128
+						gettext('IP'),
129 129
 						'INPUT',
130
-						array (
130
+						array(
131 131
 								'name' => 'ip',
132 132
 								'size' => '20',
133 133
 								'class' => "text field medium" 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 				/**
140 140
 				 * *************************************************************************************************
141 141
 				 */
142
-				array (
143
-						gettext ( 'Prefix' ),
142
+				array(
143
+						gettext('Prefix'),
144 144
 						'INPUT',
145
-						array (
145
+						array(
146 146
 								'name' => 'prefix',
147 147
 								'size' => '20',
148 148
 								'class' => "text field medium" 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 						'tOOL TIP',
152 152
 						'Please Enter prefix number' 
153 153
 				),
154
-				array (
155
-						gettext ( 'Status' ),
154
+				array(
155
+						gettext('Status'),
156 156
 						'status',
157 157
 						'SELECT',
158 158
 						'',
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 				) 
167 167
 		)
168 168
 		;
169
-		$form ['button_cancel'] = array (
169
+		$form ['button_cancel'] = array(
170 170
 				'name' => 'action',
171
-				'content' => gettext ( 'Close' ),
171
+				'content' => gettext('Close'),
172 172
 				'value' => 'cancel',
173 173
 				'type' => 'button',
174 174
 				'class' => 'btn btn-line-sky margin-x-10',
175 175
 				'onclick' => 'return redirect_page(\'NULL\')' 
176 176
 		);
177
-		$form ['button_save'] = array (
177
+		$form ['button_save'] = array(
178 178
 				'name' => 'action',
179
-				'content' => gettext ( 'Save' ),
179
+				'content' => gettext('Save'),
180 180
 				'value' => 'save',
181 181
 				'id' => 'submit',
182 182
 				'type' => 'button',
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		return $form;
186 186
 	}
187 187
 	function get_ipmap_search_form($account_data = '') {
188
-		$accountinfo = $this->CI->session->userdata ( 'accountinfo' );
188
+		$accountinfo = $this->CI->session->userdata('accountinfo');
189 189
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
190 190
 		/**
191 191
 		 * *******************
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 		if ($account_data == '0') {
197 197
 			$account = null;
198 198
 		} else {
199
-			$account = array (
200
-					gettext ( 'Account' ),
199
+			$account = array(
200
+					gettext('Account'),
201 201
 					'accountid',
202 202
 					'SELECT',
203 203
 					'',
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 					'accounts',
210 210
 					'build_concat_dropdown',
211 211
 					'where_arr',
212
-					array (
212
+					array(
213 213
 							"reseller_id" => $reseller_id,
214 214
 							"type" => "0",
215 215
 							"deleted" => "0" 
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 		/**
220 220
 		 * ************************************************************************************
221 221
 		 */
222
-		$form ['forms'] = array (
222
+		$form ['forms'] = array(
223 223
 				"",
224
-				array (
224
+				array(
225 225
 						'id' => "ipmap_search" 
226 226
 				) 
227 227
 		);
228
-		$form ['Search'] = array (
228
+		$form ['Search'] = array(
229 229
 				$account,
230
-				array (
231
-						gettext ( 'Name' ),
230
+				array(
231
+						gettext('Name'),
232 232
 						'INPUT',
233
-						array (
233
+						array(
234 234
 								'name' => 'name[name]',
235 235
 								'',
236 236
 								'size' => '20',
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 						'search_string_type',
247 247
 						'' 
248 248
 				),
249
-				array (
250
-						gettext ( 'IP' ),
249
+				array(
250
+						gettext('IP'),
251 251
 						'INPUT',
252
-						array (
252
+						array(
253 253
 								'name' => 'ip[ip]',
254 254
 								'',
255 255
 								'size' => '20',
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 						'search_string_type',
266 266
 						'' 
267 267
 				),
268
-				array (
269
-						gettext ( 'Prefix' ),
268
+				array(
269
+						gettext('Prefix'),
270 270
 						'INPUT',
271
-						array (
271
+						array(
272 272
 								'name' => 'prefix[prefix]',
273 273
 								'',
274 274
 								'size' => '20',
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 				 * ***************************************
292 292
 				 */
293 293
 				
294
-				array (
295
-						gettext ( 'Status' ),
294
+				array(
295
+						gettext('Status'),
296 296
 						'status',
297 297
 						'SELECT',
298 298
 						'',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 				/**
308 308
 				 * ************************************************************************************
309 309
 				 */
310
-				array (
310
+				array(
311 311
 						'',
312 312
 						'HIDDEN',
313 313
 						'ajax_search',
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 						'',
317 317
 						'' 
318 318
 				),
319
-				array (
319
+				array(
320 320
 						'',
321 321
 						'HIDDEN',
322 322
 						'advance_search',
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
 						'' 
327 327
 				) 
328 328
 		);
329
-		$form ['button_search'] = array (
329
+		$form ['button_search'] = array(
330 330
 				'name' => 'action',
331 331
 				'id' => "ipmap_search_btn",
332
-				'content' => gettext ( 'Search' ),
332
+				'content' => gettext('Search'),
333 333
 				'value' => 'save',
334 334
 				'type' => 'button',
335 335
 				'class' => 'btn btn-line-parrot pull-right' 
336 336
 		);
337
-		$form ['button_reset'] = array (
337
+		$form ['button_reset'] = array(
338 338
 				'name' => 'action',
339 339
 				'id' => "id_reset",
340
-				'content' => gettext ( 'Clear' ),
340
+				'content' => gettext('Clear'),
341 341
 				'value' => 'cancel',
342 342
 				'type' => 'reset',
343 343
 				'class' => "btn btn-line-sky pull-right margin-x-10" 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	function build_ipmap_list_for_admin($account_data = '') {
356 356
 		if ($account_data == '0') {
357
-			$grid_field_arr = json_encode ( array (
358
-					array (
357
+			$grid_field_arr = json_encode(array(
358
+					array(
359 359
 							"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
360 360
 							"30",
361 361
 							"",
@@ -366,24 +366,24 @@  discard block
 block discarded – undo
366 366
 							"false",
367 367
 							"center" 
368 368
 					),
369
-					array (
370
-							gettext ( "Name" ),
369
+					array(
370
+							gettext("Name"),
371 371
 							"100",
372 372
 							"name",
373 373
 							"",
374 374
 							"",
375 375
 							"" 
376 376
 					),
377
-					array (
378
-							gettext ( "IP" ),
377
+					array(
378
+							gettext("IP"),
379 379
 							"240",
380 380
 							"ip",
381 381
 							"",
382 382
 							"",
383 383
 							"" 
384 384
 					),
385
-					array (
386
-							gettext ( "Prefix" ),
385
+					array(
386
+							gettext("Prefix"),
387 387
 							"240",
388 388
 							"prefix",
389 389
 							"",
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 			 /*
394 394
             ASTPP  3.0  creation field show in grid
395 395
             */
396
-			array (
397
-							gettext ( "Status" ),
396
+			array(
397
+							gettext("Status"),
398 398
 							"180",
399 399
 							"status",
400 400
 							"status",
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 							"true",
405 405
 							"center" 
406 406
 					),
407
-					array (
408
-							gettext ( "Created Date" ),
407
+					array(
408
+							gettext("Created Date"),
409 409
 							"150",
410 410
 							"creation_date",
411 411
 							"creation_date",
412 412
 							"creation_date",
413 413
 							"convert_GMT_to" 
414 414
 					),
415
-					array (
416
-							gettext ( "Modified Date Date" ),
415
+					array(
416
+							gettext("Modified Date Date"),
417 417
 							"170",
418 418
 							"last_modified_date",
419 419
 							"last_modified_date",
@@ -424,28 +424,28 @@  discard block
 block discarded – undo
424 424
 					/**
425 425
 					 * *****************************************************************
426 426
 					 */
427
-					array (
427
+					array(
428 428
 							"Action",
429 429
 							"205",
430 430
 							"",
431 431
 							"",
432 432
 							"",
433
-							array (
434
-									"EDIT" => array (
433
+							array(
434
+									"EDIT" => array(
435 435
 											"url" => "ipmap/ipmap_edit/",
436 436
 											"mode" => "popup",
437 437
 											'popup' 
438 438
 									),
439
-									"DELETE" => array (
439
+									"DELETE" => array(
440 440
 											"url" => "ipmap/ipmap_delete/",
441 441
 											"mode" => "single" 
442 442
 									) 
443 443
 							) 
444 444
 					) 
445
-			) );
445
+			));
446 446
 		} else {
447
-			$grid_field_arr = json_encode ( array (
448
-					array (
447
+			$grid_field_arr = json_encode(array(
448
+					array(
449 449
 							"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
450 450
 							"30",
451 451
 							"",
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 							"false",
457 457
 							"center" 
458 458
 					),
459
-					array (
460
-							gettext ( "Account" ),
459
+					array(
460
+							gettext("Account"),
461 461
 							"200",
462 462
 							"accountid",
463 463
 							"first_name,last_name,number",
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
 							"true",
468 468
 							"center" 
469 469
 					),
470
-					array (
471
-							gettext ( "Name" ),
470
+					array(
471
+							gettext("Name"),
472 472
 							"190",
473 473
 							"name",
474 474
 							"",
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 							"true",
479 479
 							"center" 
480 480
 					),
481
-					array (
482
-							gettext ( "IP" ),
481
+					array(
482
+							gettext("IP"),
483 483
 							"170",
484 484
 							"ip",
485 485
 							"",
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 							"true",
490 490
 							"center" 
491 491
 					),
492
-					array (
493
-							gettext ( "Prefix" ),
492
+					array(
493
+							gettext("Prefix"),
494 494
 							"100",
495 495
 							"prefix",
496 496
 							"",
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 			/*
504 504
             ASTPP  3.0  creation field show in grid
505 505
             */
506
-			array (
507
-							gettext ( "Status" ),
506
+			array(
507
+							gettext("Status"),
508 508
 							"160",
509 509
 							"status",
510 510
 							"status",
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 							"true",
515 515
 							"center" 
516 516
 					),
517
-					array (
518
-							gettext ( "Created Date" ),
517
+					array(
518
+							gettext("Created Date"),
519 519
 							"150",
520 520
 							"creation_date",
521 521
 							"creation_date",
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
 							"true",
526 526
 							"center" 
527 527
 					),
528
-					array (
529
-							gettext ( "Modified Date" ),
528
+					array(
529
+							gettext("Modified Date"),
530 530
 							"170",
531 531
 							"last_modified_date",
532 532
 							"last_modified_date",
@@ -539,25 +539,25 @@  discard block
 block discarded – undo
539 539
 					/**
540 540
 					 * *****************************************************************
541 541
 					 */
542
-					array (
543
-							gettext ( "Action" ),
542
+					array(
543
+							gettext("Action"),
544 544
 							"100",
545 545
 							"",
546 546
 							"",
547 547
 							"",
548
-							array (
549
-									"EDIT" => array (
548
+							array(
549
+									"EDIT" => array(
550 550
 											"url" => "ipmap/ipmap_edit/",
551 551
 											"mode" => "popup",
552 552
 											'popup' 
553 553
 									),
554
-									"DELETE" => array (
554
+									"DELETE" => array(
555 555
 											"url" => "ipmap/ipmap_delete/",
556 556
 											"mode" => "single" 
557 557
 									) 
558 558
 							) 
559 559
 					) 
560
-			) );
560
+			));
561 561
 		}
562 562
 		return $grid_field_arr;
563 563
 	}
@@ -565,23 +565,23 @@  discard block
 block discarded – undo
565 565
 	 * *******************************************************************************************************
566 566
 	 */
567 567
 	function build_grid_buttons() {
568
-		$buttons_json = json_encode ( array (
569
-				array (
570
-						gettext ( "Add" ),
568
+		$buttons_json = json_encode(array(
569
+				array(
570
+						gettext("Add"),
571 571
 						"btn btn-line-warning btn",
572 572
 						"fa fa-plus-circle fa-lg",
573 573
 						"button_action",
574 574
 						"/ipmap/ipmap_add/",
575 575
 						"popup" 
576 576
 				),
577
-				array (
578
-						gettext ( "Delete" ),
577
+				array(
578
+						gettext("Delete"),
579 579
 						"btn btn-line-danger",
580 580
 						"fa fa-times-circle fa-lg",
581 581
 						"button_action",
582 582
 						"/ipmap/ipmap_delete_multiple/" 
583 583
 				) 
584
-		) );
584
+		));
585 585
 		return $buttons_json;
586 586
 	}
587 587
 	
@@ -592,23 +592,23 @@  discard block
 block discarded – undo
592 592
 	 * *****
593 593
 	 */
594 594
 	function build_grid_buttons_user() {
595
-		$buttons_json = json_encode ( array (
596
-				array (
597
-						gettext ( "Create" ),
595
+		$buttons_json = json_encode(array(
596
+				array(
597
+						gettext("Create"),
598 598
 						"btn btn-line-warning btn",
599 599
 						"fa fa-plus-circle fa-lg",
600 600
 						"button_action",
601 601
 						"/user/user_ipmap_add/",
602 602
 						"popup" 
603 603
 				),
604
-				array (
605
-						gettext ( "Delete" ),
604
+				array(
605
+						gettext("Delete"),
606 606
 						"btn btn-line-danger",
607 607
 						"fa fa-times-circle fa-lg",
608 608
 						"button_action",
609 609
 						"/user/user_ipmap_delete_multiple/" 
610 610
 				) 
611
-		) );
611
+		));
612 612
 		return $buttons_json;
613 613
 	}
614 614
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/ipmap/views/ipmap_view.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                         <form method="POST" action="del/0/" enctype="multipart/form-data" id="ListForm">
48 48
                             <table id="ipmap_grid" align="left" style="display:none;"></table>
49 49
                         </form>
50
-<h6><font color="#375c7c"><b><?=gettext("NOTE");?></b> : <?=gettext("Changing status (Active/Inactive) from here will not reload FreeSwitch ACL. That means FreeSwitch will still be able to accept the calls request from disabled IP but as the IP is disabled, their call will be failed with authentication error.");?> </font></h6>
50
+<h6><font color="#375c7c"><b><?=gettext("NOTE"); ?></b> : <?=gettext("Changing status (Active/Inactive) from here will not reload FreeSwitch ACL. That means FreeSwitch will still be able to accept the calls request from disabled IP but as the IP is disabled, their call will be failed with authentication error."); ?> </font></h6>
51 51
                 </div>  
52 52
             </div>
53 53
         </div>
Please login to merge, or discard this patch.
astpp/application/modules/refill_coupon/models/refill_coupon_model.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,87 +23,87 @@
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Refill_coupon_model extends CI_Model {
25 25
 	function refill_coupon_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 	}
28 28
 	function get_refill_coupon_list($flag, $start = 0, $limit = 0, $export = false) {
29
-		$this->db_model->build_search ( 'refill_coupon_list_search' );
30
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
29
+		$this->db_model->build_search('refill_coupon_list_search');
30
+		$accountinfo = $this->session->userdata('accountinfo');
31 31
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
32
-		$where = array (
32
+		$where = array(
33 33
 				'reseller_id' => $reseller_id 
34 34
 		);
35 35
 		if ($flag) {
36 36
 			if ($export)
37
-				$query = $this->db_model->select ( "*", "refill_coupon", $where, "id", "ASC", '', '' );
37
+				$query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", '', '');
38 38
 			else
39
-				$query = $this->db_model->select ( "*", "refill_coupon", $where, "id", "ASC", $limit, $start );
39
+				$query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start);
40 40
 		} else {
41
-			$query = $this->db_model->countQuery ( "*", "refill_coupon", $where );
41
+			$query = $this->db_model->countQuery("*", "refill_coupon", $where);
42 42
 		}
43 43
 		return $query;
44 44
 	}
45 45
 	function get_customer_refill_coupon_list($flag, $start = 0, $limit = 0, $accountid) {
46
-		$this->db_model->build_search ( 'refill_coupon_list_search' );
47
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
46
+		$this->db_model->build_search('refill_coupon_list_search');
47
+		$accountinfo = $this->session->userdata('accountinfo');
48 48
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : ($accountinfo ['type'] == 0 ? $accountinfo ['reseller_id'] : 0);
49
-		$where = array (
49
+		$where = array(
50 50
 				'reseller_id' => $reseller_id,
51 51
 				"account_id" => $accountid 
52 52
 		);
53 53
 		if ($flag) {
54
-			$query = $this->db_model->select ( "*", "refill_coupon", $where, "id", "ASC", $limit, $start );
54
+			$query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start);
55 55
 		} else {
56
-			$query = $this->db_model->countQuery ( "*", "refill_coupon", $where );
56
+			$query = $this->db_model->countQuery("*", "refill_coupon", $where);
57 57
 		}
58 58
 		return $query;
59 59
 	}
60 60
 	function add_refill_coupon($add_array) {
61 61
 		$count = $add_array ['count'];
62
-		unset ( $add_array ['action'] );
63
-		unset ( $add_array ['count'] );
62
+		unset ($add_array ['action']);
63
+		unset ($add_array ['count']);
64 64
 		$prefix = $add_array ['prefix'];
65
-		unset ( $add_array ['prefix'] );
66
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
65
+		unset ($add_array ['prefix']);
66
+		$accountinfo = $this->session->userdata('accountinfo');
67 67
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
68
-		$insert_arr = array ();
68
+		$insert_arr = array();
69 69
 		$account_length = Common_model::$global_config ['system_config'] ['refill_coupon_length'];
70
-		$length = strlen ( $prefix );
70
+		$length = strlen($prefix);
71 71
 		if ($length != 0) {
72 72
 			$number_length = $account_length - $length;
73 73
 		} else {
74 74
 			$number_length = $account_length;
75 75
 		}
76
-		$add_array ['amount'] = $this->common_model->add_calculate_currency ( $add_array ['amount'], '', '', false, false );
77
-		$number = $this->common->find_uniq_rendno_accno ( $number_length, 'number', 'refill_coupon', $prefix, $count );
78
-		$date = gmdate ( 'Y-m-d H:i:s' );
79
-		for($i = 0; $i < $count; $i ++) {
80
-			$add_array ['number'] = trim ( $number [$i] );
76
+		$add_array ['amount'] = $this->common_model->add_calculate_currency($add_array ['amount'], '', '', false, false);
77
+		$number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon', $prefix, $count);
78
+		$date = gmdate('Y-m-d H:i:s');
79
+		for ($i = 0; $i < $count; $i++) {
80
+			$add_array ['number'] = trim($number [$i]);
81 81
 			$add_array ['currency_id'] = $accountinfo ['currency_id'];
82 82
 			$add_array ['reseller_id'] = $reseller_id;
83 83
 			$add_array ['creation_date'] = $date;
84 84
 			$insert_arr [$i] = $add_array;
85 85
 		}
86
-		$this->db->insert_batch ( "refill_coupon", $insert_arr );
86
+		$this->db->insert_batch("refill_coupon", $insert_arr);
87 87
 		return true;
88 88
 	}
89 89
 	function remove_refill_coupon($id) {
90
-		$this->db->where ( "id", $id );
91
-		$this->db->delete ( "refill_coupon" );
90
+		$this->db->where("id", $id);
91
+		$this->db->delete("refill_coupon");
92 92
 		return true;
93 93
 	}
94 94
 	function get_refill_coupon_details($id) {
95
-		$this->db->where ( "id", $id );
96
-		$result = $this->db->get ( 'refill_coupon' );
95
+		$this->db->where("id", $id);
96
+		$result = $this->db->get('refill_coupon');
97 97
 		return $result;
98 98
 	}
99 99
 	function refill_coupon_count($add_array) {
100 100
 		$account_length = Common_model::$global_config ['system_config'] ['refill_coupon_length'];
101
-		$this->db->where ( "length(number)", $account_length );
102
-		$this->db->like ( 'number', $add_array ['prefix'], 'after' );
103
-		$this->db->select ( "count(id) as count" );
104
-		$this->db->from ( 'refill_coupon' );
105
-		$result = $this->db->get ();
106
-		$result = $result->result_array ();
101
+		$this->db->where("length(number)", $account_length);
102
+		$this->db->like('number', $add_array ['prefix'], 'after');
103
+		$this->db->select("count(id) as count");
104
+		$this->db->from('refill_coupon');
105
+		$result = $this->db->get();
106
+		$result = $result->result_array();
107 107
 		return $result;
108 108
 	}
109 109
 }
Please login to merge, or discard this patch.
astpp/application/modules/refill_coupon/controllers/refill_coupon.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -23,176 +23,176 @@
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Refill_coupon extends MX_Controller {
25 25
 	function Refill_coupon() {
26
-		parent::__construct ();
27
-		$this->load->helper ( 'template_inheritance' );
28
-		$this->load->helper ( 'form' );
29
-		$this->load->model ( 'refill_coupon_model' );
30
-		$this->load->library ( "refill_coupon_form" );
31
-		$this->load->library ( "astpp/form" );
32
-		$this->load->library ( "session" );
33
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
34
-			redirect ( base_url () . 'login/login' );
26
+		parent::__construct();
27
+		$this->load->helper('template_inheritance');
28
+		$this->load->helper('form');
29
+		$this->load->model('refill_coupon_model');
30
+		$this->load->library("refill_coupon_form");
31
+		$this->load->library("astpp/form");
32
+		$this->load->library("session");
33
+		if ($this->session->userdata('user_login') == FALSE)
34
+			redirect(base_url().'login/login');
35 35
 	}
36 36
 	function refill_coupon_list() {
37
-		if ($this->session->userdata ( 'logintype' ) == 0 || $this->session->userdata ( 'logintype' ) == 3) {
38
-			redirect ( base_url () . 'user/user/' );
37
+		if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) {
38
+			redirect(base_url().'user/user/');
39 39
 		}
40
-		$data ['username'] = $this->session->userdata ( 'user_name' );
41
-		$data ['page_title'] = gettext ( 'Refill Coupon' );
40
+		$data ['username'] = $this->session->userdata('user_name');
41
+		$data ['page_title'] = gettext('Refill Coupon');
42 42
 		$data ['search_flag'] = true;
43
-		$this->session->set_userdata ( 'advance_search', 0 );
44
-		$this->session->set_userdata ( 'refill_coupon_list_search', 0 );
45
-		$data ['grid_fields'] = $this->refill_coupon_form->build_refill_coupon_grid ();
46
-		$data ["grid_buttons"] = $this->refill_coupon_form->build_grid_buttons_refill_coupon ();
47
-		$data ['form_search'] = $this->form->build_serach_form ( $this->refill_coupon_form->get_refill_coupon_search_form () );
48
-		$this->load->view ( 'view_refill_coupon_list', $data );
43
+		$this->session->set_userdata('advance_search', 0);
44
+		$this->session->set_userdata('refill_coupon_list_search', 0);
45
+		$data ['grid_fields'] = $this->refill_coupon_form->build_refill_coupon_grid();
46
+		$data ["grid_buttons"] = $this->refill_coupon_form->build_grid_buttons_refill_coupon();
47
+		$data ['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form());
48
+		$this->load->view('view_refill_coupon_list', $data);
49 49
 	}
50 50
 	function refill_coupon_list_json() {
51
-		$json_data = array ();
52
-		$count_all = $this->refill_coupon_model->get_refill_coupon_list ( false, "", "" );
53
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
51
+		$json_data = array();
52
+		$count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", "");
53
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
54 54
 		$json_data = $paging_data ["json_paging"];
55
-		$query = $this->refill_coupon_model->get_refill_coupon_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
56
-		$grid_fields = json_decode ( $this->refill_coupon_form->build_refill_coupon_grid () );
57
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
58
-		echo json_encode ( $json_data );
55
+		$query = $this->refill_coupon_model->get_refill_coupon_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
56
+		$grid_fields = json_decode($this->refill_coupon_form->build_refill_coupon_grid());
57
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
58
+		echo json_encode($json_data);
59 59
 	}
60 60
 	function refill_coupon_list_search() {
61
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
62
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
63
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
64
-			$action = $this->input->post ();
65
-			unset ( $action ['action'] );
66
-			unset ( $action ['advance_search'] );
67
-			if (isset ( $action ['amount'] ['amount'] ) && $action ['amount'] ['amount'] != '') {
68
-				$action ['amount'] ['amount'] = $this->common_model->add_calculate_currency ( $action ['amount'] ['amount'], "", '', true, false );
61
+		$ajax_search = $this->input->post('ajax_search', 0);
62
+		if ($this->input->post('advance_search', TRUE) == 1) {
63
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
64
+			$action = $this->input->post();
65
+			unset ($action ['action']);
66
+			unset ($action ['advance_search']);
67
+			if (isset ($action ['amount'] ['amount']) && $action ['amount'] ['amount'] != '') {
68
+				$action ['amount'] ['amount'] = $this->common_model->add_calculate_currency($action ['amount'] ['amount'], "", '', true, false);
69 69
 			}
70
-			$this->session->set_userdata ( 'refill_coupon_list_search', $action );
70
+			$this->session->set_userdata('refill_coupon_list_search', $action);
71 71
 		}
72 72
 		if (@$ajax_search != 1) {
73
-			redirect ( base_url () . 'refill_coupon/refill_coupon_list/' );
73
+			redirect(base_url().'refill_coupon/refill_coupon_list/');
74 74
 		}
75 75
 	}
76 76
 	function refill_coupon_clearsearchfilter() {
77
-		$this->session->set_userdata ( 'advance_search', 0 );
78
-		$this->session->set_userdata ( 'refill_coupon_list_search', "" );
77
+		$this->session->set_userdata('advance_search', 0);
78
+		$this->session->set_userdata('refill_coupon_list_search', "");
79 79
 	}
80 80
 	function refill_coupon_list_view($id) {
81
-		$data ['username'] = $this->session->userdata ( 'user_name' );
82
-		$data ['page_title'] = gettext ( 'View Refill Coupon' );
83
-		if ($cc = $this->refill_coupon_model->get_refill_coupon_details ( $id )) {
84
-			$refill_coupon_details = $cc->result_array ();
81
+		$data ['username'] = $this->session->userdata('user_name');
82
+		$data ['page_title'] = gettext('View Refill Coupon');
83
+		if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) {
84
+			$refill_coupon_details = $cc->result_array();
85 85
 			$data ['refill_coupon_details'] = $refill_coupon_details [0];
86
-			$data ['refill_coupon_details'] ['callingcard'] = $this->common->get_field_name ( 'cardnumber', 'callingcards', $refill_coupon_details [0] ['callingcard_id'] );
87
-			$data ['refill_coupon_details'] ['currency'] = $this->common->build_concat_string ( 'currencyname,currency', 'currency', $refill_coupon_details [0] ['currency_id'] );
86
+			$data ['refill_coupon_details'] ['callingcard'] = $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details [0] ['callingcard_id']);
87
+			$data ['refill_coupon_details'] ['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details [0] ['currency_id']);
88 88
 		} else {
89 89
 			echo "This card is not available.";
90 90
 			return;
91 91
 		}
92
-		$this->load->view ( 'view_refill_coupon_details', $data );
92
+		$this->load->view('view_refill_coupon_details', $data);
93 93
 	}
94 94
 	function refill_coupon_add() {
95
-		if ($this->session->userdata ( 'logintype' ) == 0 || $this->session->userdata ( 'logintype' ) == 3) {
96
-			redirect ( base_url () . 'user/user/' );
95
+		if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) {
96
+			redirect(base_url().'user/user/');
97 97
 		}
98
-		$data ['username'] = $this->session->userdata ( 'user_name' );
98
+		$data ['username'] = $this->session->userdata('user_name');
99 99
 		$data ['flag'] = 'create';
100
-		$data ['page_title'] = gettext ( 'Create Refill Coupon' );
101
-		$data ['form'] = $this->form->build_form ( $this->refill_coupon_form->get_refill_coupon_form_fields (), '' );
102
-		$this->load->view ( 'view_refill_coupon_add', $data );
100
+		$data ['page_title'] = gettext('Create Refill Coupon');
101
+		$data ['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), '');
102
+		$this->load->view('view_refill_coupon_add', $data);
103 103
 	}
104 104
 	function refill_coupon_save() {
105 105
 		$account_length = Common_model::$global_config ['system_config'] ['refill_coupon_length'];
106
-		$add_array = $this->input->post ();
106
+		$add_array = $this->input->post();
107 107
 		$add_array ['status'] = 0;
108
-		$data ['form'] = $this->form->build_form ( $this->refill_coupon_form->get_refill_coupon_form_fields (), $add_array );
109
-		$result = $this->refill_coupon_model->refill_coupon_count ( $add_array );
108
+		$data ['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array);
109
+		$result = $this->refill_coupon_model->refill_coupon_count($add_array);
110 110
 		$count = $result [0] ['count'];
111 111
 		$remaining_length = 0;
112
-		$remaining_length = $account_length - strlen ( $add_array ['prefix'] );
113
-		$currentlength = pow ( 5, $remaining_length );
112
+		$remaining_length = $account_length - strlen($add_array ['prefix']);
113
+		$currentlength = pow(5, $remaining_length);
114 114
 		$currentlength = $currentlength - $count;
115
-		$data ['page_title'] = gettext ( 'Add Refill Coupon' );
116
-		if ($this->form_validation->run () == FALSE) {
117
-			$data ['validation_errors'] = validation_errors ();
115
+		$data ['page_title'] = gettext('Add Refill Coupon');
116
+		if ($this->form_validation->run() == FALSE) {
117
+			$data ['validation_errors'] = validation_errors();
118 118
 			echo $data ['validation_errors'];
119 119
 			exit ();
120 120
 		} else {
121
-			if ($account_length <= strlen ( $add_array ['prefix'] )) {
122
-				echo json_encode ( array (
123
-						"count_error" => "You can not create " . $add_array ['count'] . " Refill coupon with " . $add_array ['prefix'] . " prefix." 
124
-				) );
121
+			if ($account_length <= strlen($add_array ['prefix'])) {
122
+				echo json_encode(array(
123
+						"count_error" => "You can not create ".$add_array ['count']." Refill coupon with ".$add_array ['prefix']." prefix." 
124
+				));
125 125
 				exit ();
126 126
 			}
127 127
 			if ($currentlength <= 0) {
128
-				echo json_encode ( array (
129
-						"count_error" => "You can not create " . $add_array ['count'] . " Refill coupon with " . $add_array ['prefix'] . " prefix" 
130
-				) );
128
+				echo json_encode(array(
129
+						"count_error" => "You can not create ".$add_array ['count']." Refill coupon with ".$add_array ['prefix']." prefix" 
130
+				));
131 131
 				exit ();
132 132
 			}
133 133
 			if ($currentlength > 0 && $add_array ['count'] > $currentlength) {
134
-				echo json_encode ( array (
135
-						"count_error" => "You can create maximum " . $currentlength . " Refill coupon with " . $add_array ['prefix'] . " prefix" 
136
-				) );
134
+				echo json_encode(array(
135
+						"count_error" => "You can create maximum ".$currentlength." Refill coupon with ".$add_array ['prefix']." prefix" 
136
+				));
137 137
 				exit ();
138 138
 			} else {
139
-				$this->refill_coupon_model->add_refill_coupon ( $add_array );
140
-				echo json_encode ( array (
139
+				$this->refill_coupon_model->add_refill_coupon($add_array);
140
+				echo json_encode(array(
141 141
 						"SUCCESS" => "Refill coupon created successfully!" 
142
-				) );
142
+				));
143 143
 				exit ();
144 144
 			}
145 145
 		}
146 146
 	}
147 147
 	function refill_coupon_list_delete($id) {
148
-		$this->refill_coupon_model->remove_refill_coupon ( $id );
149
-		$this->session->set_flashdata ( 'astpp_notification', 'Refill coupon removed successfully!' );
150
-		redirect ( base_url () . 'refill_coupon/refill_coupon_list/' );
148
+		$this->refill_coupon_model->remove_refill_coupon($id);
149
+		$this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!');
150
+		redirect(base_url().'refill_coupon/refill_coupon_list/');
151 151
 	}
152 152
 	function refill_coupon_export() {
153
-		$account_info = $accountinfo = $this->session->userdata ( 'accountinfo' );
153
+		$account_info = $accountinfo = $this->session->userdata('accountinfo');
154 154
 		$currency_id = $account_info ['currency_id'];
155
-		$currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id );
156
-		$query = $this->refill_coupon_model->get_refill_coupon_list ( true, '', '', true );
157
-		$cc_array = array ();
158
-		ob_clean ();
159
-		$cc_array [] = array (
160
-				gettext ( 'Coupon Number' ),
161
-				gettext ( 'Description' ),
162
-				gettext ( 'Account' ),
163
-				gettext ( 'Amount(' . $currency . ')' ),
164
-				gettext ( 'Created Date' ),
165
-				gettext ( "Used?" ),
166
-				gettext ( 'Used Date' ) 
155
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
156
+		$query = $this->refill_coupon_model->get_refill_coupon_list(true, '', '', true);
157
+		$cc_array = array();
158
+		ob_clean();
159
+		$cc_array [] = array(
160
+				gettext('Coupon Number'),
161
+				gettext('Description'),
162
+				gettext('Account'),
163
+				gettext('Amount('.$currency.')'),
164
+				gettext('Created Date'),
165
+				gettext("Used?"),
166
+				gettext('Used Date') 
167 167
 		);
168
-		if ($query->num_rows () > 0) {
169
-			foreach ( $query->result_array () as $row ) {
170
-				$row ['currency'] = $this->common->build_concat_string ( 'currencyname,currency', 'currency', $row ['currency_id'] );
171
-				$row ['acc_name'] = $row ['account_id'] > 0 ? $this->common->get_field_name ( 'number', 'accounts', $row ['account_id'] ) : "";
172
-				$row ['status'] = $this->common->get_refill_coupon_status ( '', '', $row ['status'] );
173
-				$cc_array [] = array (
168
+		if ($query->num_rows() > 0) {
169
+			foreach ($query->result_array() as $row) {
170
+				$row ['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row ['currency_id']);
171
+				$row ['acc_name'] = $row ['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row ['account_id']) : "";
172
+				$row ['status'] = $this->common->get_refill_coupon_status('', '', $row ['status']);
173
+				$cc_array [] = array(
174 174
 						$row ['number'],
175 175
 						$row ['description'],
176 176
 						$row ['acc_name'],
177
-						$this->common->convert_to_currency ( '', '', $row ['amount'] ),
177
+						$this->common->convert_to_currency('', '', $row ['amount']),
178 178
 						$row ['creation_date'],
179 179
 						$row ['status'],
180 180
 						$row ['firstused'] 
181 181
 				);
182 182
 			}
183 183
 		}
184
-		$this->load->helper ( 'csv' );
185
-		array_to_csv ( $cc_array, 'refill_coupon_' . date ( "Y-m-d" ) . '.csv' );
184
+		$this->load->helper('csv');
185
+		array_to_csv($cc_array, 'refill_coupon_'.date("Y-m-d").'.csv');
186 186
 	}
187 187
 	function refill_coupon_customer_json($accountid) {
188
-		$json_data = array ();
189
-		$count_all = $this->refill_coupon_model->get_customer_refill_coupon_list ( false, "", "", $accountid );
190
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
188
+		$json_data = array();
189
+		$count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "", $accountid);
190
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
191 191
 		$json_data = $paging_data ["json_paging"];
192
-		$query = $this->refill_coupon_model->get_customer_refill_coupon_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $accountid );
193
-		$grid_fields = json_decode ( $this->refill_coupon_form->build_user_refill_coupon_grid () );
194
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
195
-		echo json_encode ( $json_data );
192
+		$query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $accountid);
193
+		$grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid());
194
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
195
+		echo json_encode($json_data);
196 196
 	}
197 197
 }
198 198
 ?>
Please login to merge, or discard this patch.
astpp/application/modules/refill_coupon/libraries/refill_coupon_form.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
20 20
 // You should have received a copy of the GNU Affero General Public License
21 21
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 22
 // ##############################################################################
23
-if (! defined ( 'BASEPATH' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class Refill_coupon_form {
26 26
 	function __construct($library_name = '') {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	function get_refill_coupon_form_fields() {
30
-		$form ['forms'] = array (
31
-				base_url () . 'refill_coupon/refill_coupon_save/',
32
-				array (
30
+		$form ['forms'] = array(
31
+				base_url().'refill_coupon/refill_coupon_save/',
32
+				array(
33 33
 						"id" => "refill_coupon_form",
34 34
 						"name" => "refill_coupon_form" 
35 35
 				) 
36 36
 		);
37
-		$form [gettext ( 'Coupon Information' )] = array (
38
-				array (
39
-						gettext ( 'Description' ),
37
+		$form [gettext('Coupon Information')] = array(
38
+				array(
39
+						gettext('Description'),
40 40
 						'INPUT',
41
-						array (
41
+						array(
42 42
 								'name' => 'description',
43 43
 								'size' => '20',
44 44
 								'class' => "text field medium" 
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 						'tOOL TIP',
48 48
 						'Please Enter account number' 
49 49
 				),
50
-				array (
51
-						gettext ( 'Start prefix' ),
50
+				array(
51
+						gettext('Start prefix'),
52 52
 						'INPUT',
53
-						array (
53
+						array(
54 54
 								'name' => 'prefix',
55 55
 								'size' => '20',
56 56
 								'class' => "text field medium" 
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 						'tOOL TIP',
60 60
 						'' 
61 61
 				),
62
-				array (
63
-						gettext ( 'Quantity' ),
62
+				array(
63
+						gettext('Quantity'),
64 64
 						'INPUT',
65
-						array (
65
+						array(
66 66
 								'name' => 'count',
67 67
 								'size' => '20',
68 68
 								'maxlength' => '5',
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 						'tOOL TIP',
73 73
 						'Please Enter account number' 
74 74
 				),
75
-				array (
76
-						gettext ( 'Amount' ),
75
+				array(
76
+						gettext('Amount'),
77 77
 						'INPUT',
78
-						array (
78
+						array(
79 79
 								'name' => 'amount',
80 80
 								'size' => '20',
81 81
 								'class' => "text field medium" 
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 						'Please Enter account number' 
86 86
 				) 
87 87
 		);
88
-		$form ['button_cancel'] = array (
88
+		$form ['button_cancel'] = array(
89 89
 				'name' => 'action',
90
-				'content' => gettext ( 'Close' ),
90
+				'content' => gettext('Close'),
91 91
 				'value' => 'cancel',
92 92
 				'type' => 'button',
93 93
 				'class' => 'btn btn-line-sky margin-x-10',
94 94
 				'onclick' => 'return redirect_page(\'NULL\')' 
95 95
 		);
96
-		$form ['button_save'] = array (
96
+		$form ['button_save'] = array(
97 97
 				'name' => 'action',
98
-				'content' => gettext ( 'Save' ),
98
+				'content' => gettext('Save'),
99 99
 				'value' => 'save',
100 100
 				'id' => 'submit',
101 101
 				'type' => 'button',
@@ -105,50 +105,50 @@  discard block
 block discarded – undo
105 105
 		return $form;
106 106
 	}
107 107
 	function build_grid_buttons_refill_coupon() {
108
-		$buttons_json = json_encode ( array (
109
-				array (
110
-						gettext ( "Create" ),
108
+		$buttons_json = json_encode(array(
109
+				array(
110
+						gettext("Create"),
111 111
 						"btn btn-line-warning btn",
112 112
 						"fa fa-plus-circle fa-lg",
113 113
 						"button_action",
114 114
 						"/refill_coupon/refill_coupon_add/",
115 115
 						"popup" 
116 116
 				),
117
-				array (
118
-						gettext ( "Export" ),
117
+				array(
118
+						gettext("Export"),
119 119
 						"btn btn-xing",
120 120
 						" fa fa-download fa-lg",
121 121
 						"button_action",
122 122
 						"/refill_coupon/refill_coupon_export/",
123 123
 						'single' 
124 124
 				) 
125
-		) );
125
+		));
126 126
 		return $buttons_json;
127 127
 	}
128 128
 	function build_user_grid_buttons_refill_coupon() {
129
-		$buttons_json = json_encode ( array (
130
-				array (
129
+		$buttons_json = json_encode(array(
130
+				array(
131 131
 						"Refresh",
132 132
 						"reload",
133 133
 						"/refill_coupon/refill_coupon_clearsearchfilter/" 
134 134
 				) 
135
-		) );
135
+		));
136 136
 		return $buttons_json;
137 137
 	}
138 138
 	function get_refill_coupon_search_form() {
139
-		$accountinfo = $this->CI->session->userdata ( 'accountinfo' );
139
+		$accountinfo = $this->CI->session->userdata('accountinfo');
140 140
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
141
-		$form ['forms'] = array (
141
+		$form ['forms'] = array(
142 142
 				"",
143
-				array (
143
+				array(
144 144
 						'id' => "refill_coupon_list_search" 
145 145
 				) 
146 146
 		);
147
-		$form [gettext ( 'Search' )] = array (
148
-				array (
149
-						gettext ( 'Coupon Number' ),
147
+		$form [gettext('Search')] = array(
148
+				array(
149
+						gettext('Coupon Number'),
150 150
 						'INPUT',
151
-						array (
151
+						array(
152 152
 								'name' => 'number[number]',
153 153
 								'',
154 154
 								'id' => 'number',
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 						'search_string_type',
166 166
 						'' 
167 167
 				),
168
-				array (
169
-						gettext ( 'Description' ),
168
+				array(
169
+						gettext('Description'),
170 170
 						'INPUT',
171
-						array (
171
+						array(
172 172
 								'name' => 'description[description]',
173 173
 								'',
174 174
 								'id' => 'description',
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 						'search_string_type',
186 186
 						'' 
187 187
 				),
188
-				array (
189
-						gettext ( 'Account' ),
188
+				array(
189
+						gettext('Account'),
190 190
 						'account_id',
191 191
 						'SELECT',
192 192
 						'',
@@ -198,15 +198,15 @@  discard block
 block discarded – undo
198 198
 						'accounts',
199 199
 						'build_dropdown_deleted',
200 200
 						'where_arr',
201
-						array (
201
+						array(
202 202
 								"reseller_id" => $reseller_id,
203 203
 								"type" => "GLOBAL" 
204 204
 						) 
205 205
 				),
206
-				array (
207
-						gettext ( 'Amount' ),
206
+				array(
207
+						gettext('Amount'),
208 208
 						'INPUT',
209
-						array (
209
+						array(
210 210
 								'name' => 'amount[amount]',
211 211
 								'',
212 212
 								'id' => 'amount',
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 						'search_int_type',
224 224
 						'' 
225 225
 				),
226
-				array (
227
-						gettext ( 'Used?' ),
226
+				array(
227
+						gettext('Used?'),
228 228
 						'status',
229 229
 						'SELECT',
230 230
 						'',
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 						'' 
240 240
 				),
241 241
 				
242
-				array (
242
+				array(
243 243
 						'',
244 244
 						'HIDDEN',
245 245
 						'ajax_search',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 						'',
249 249
 						'' 
250 250
 				),
251
-				array (
251
+				array(
252 252
 						'',
253 253
 						'HIDDEN',
254 254
 						'advance_search',
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
 						'' 
259 259
 				) 
260 260
 		);
261
-		$form ['button_search'] = array (
261
+		$form ['button_search'] = array(
262 262
 				'name' => 'action',
263 263
 				'id' => "refill_coupon_search_btn",
264
-				'content' => gettext ( 'Search' ),
264
+				'content' => gettext('Search'),
265 265
 				'value' => 'save',
266 266
 				'type' => 'button',
267 267
 				'class' => 'btn btn-line-parrot pull-right' 
268 268
 		);
269
-		$form ['button_reset'] = array (
269
+		$form ['button_reset'] = array(
270 270
 				'name' => 'action',
271 271
 				'id' => "id_reset",
272
-				'content' => gettext ( 'Clear' ),
272
+				'content' => gettext('Clear'),
273 273
 				'value' => 'cancel',
274 274
 				'type' => 'reset',
275 275
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -278,17 +278,17 @@  discard block
 block discarded – undo
278 278
 		return $form;
279 279
 	}
280 280
 	function get_user_refill_coupon_search_form() {
281
-		$form ['forms'] = array (
281
+		$form ['forms'] = array(
282 282
 				"",
283
-				array (
283
+				array(
284 284
 						'id' => "user_refill_coupon_list_search" 
285 285
 				) 
286 286
 		);
287
-		$form [gettext ( 'Search Refill Coupon' )] = array (
288
-				array (
289
-						gettext ( 'Coupon Number' ),
287
+		$form [gettext('Search Refill Coupon')] = array(
288
+				array(
289
+						gettext('Coupon Number'),
290 290
 						'INPUT',
291
-						array (
291
+						array(
292 292
 								'name' => 'number[number]',
293 293
 								'',
294 294
 								'id' => 'number',
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 						'search_string_type',
306 306
 						'' 
307 307
 				),
308
-				array (
309
-						gettext ( 'Description' ),
308
+				array(
309
+						gettext('Description'),
310 310
 						'INPUT',
311
-						array (
311
+						array(
312 312
 								'name' => 'description[description]',
313 313
 								'',
314 314
 								'id' => 'description',
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 						'search_string_type',
326 326
 						'' 
327 327
 				),
328
-				array (
329
-						gettext ( 'Amount' ),
328
+				array(
329
+						gettext('Amount'),
330 330
 						'INPUT',
331
-						array (
331
+						array(
332 332
 								'name' => 'amount[amount]',
333 333
 								'',
334 334
 								'id' => 'amount',
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 						'search_int_type',
346 346
 						'' 
347 347
 				),
348
-				array (
349
-						gettext ( 'Status' ),
348
+				array(
349
+						gettext('Status'),
350 350
 						'status',
351 351
 						'SELECT',
352 352
 						'',
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 						'',
361 361
 						'' 
362 362
 				),
363
-				array (
363
+				array(
364 364
 						'',
365 365
 						'HIDDEN',
366 366
 						'ajax_search',
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'',
370 370
 						'' 
371 371
 				),
372
-				array (
372
+				array(
373 373
 						'',
374 374
 						'HIDDEN',
375 375
 						'advance_search',
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 						'' 
380 380
 				) 
381 381
 		);
382
-		$form ['button_search'] = array (
382
+		$form ['button_search'] = array(
383 383
 				'name' => 'action',
384 384
 				'id' => "user_refill_coupon_search_btn",
385
-				'content' => gettext ( 'Search' ),
385
+				'content' => gettext('Search'),
386 386
 				'value' => 'save',
387 387
 				'type' => 'button',
388 388
 				'class' => 'ui-state-default float-right ui-corner-all ui-button' 
389 389
 		);
390
-		$form ['button_reset'] = array (
390
+		$form ['button_reset'] = array(
391 391
 				'name' => 'action',
392 392
 				'id' => "id_reset",
393
-				'content' => gettext ( 'Clear Search Filter' ),
393
+				'content' => gettext('Clear Search Filter'),
394 394
 				'value' => 'cancel',
395 395
 				'type' => 'reset',
396 396
 				'class' => 'ui-state-default float-right ui-corner-all ui-button' 
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 		return $form;
399 399
 	}
400 400
 	function build_refill_coupon_grid() {
401
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
401
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
402 402
 		$currency_id = $account_info ['currency_id'];
403
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
403
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
404 404
 		
405
-		$grid_field_arr = json_encode ( array (
406
-				array (
407
-						gettext ( "Coupon Number" ),
405
+		$grid_field_arr = json_encode(array(
406
+				array(
407
+						gettext("Coupon Number"),
408 408
 						"150",
409 409
 						"number",
410 410
 						"",
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 						"true",
415 415
 						"center" 
416 416
 				),
417
-				array (
418
-						gettext ( "Description" ),
417
+				array(
418
+						gettext("Description"),
419 419
 						"165",
420 420
 						"description",
421 421
 						"",
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 						"true",
426 426
 						"center" 
427 427
 				),
428
-				array (
429
-						gettext ( "Account" ),
428
+				array(
429
+						gettext("Account"),
430 430
 						"165",
431 431
 						"account_id",
432 432
 						"first_name,last_name,number",
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 						"true",
437 437
 						"center" 
438 438
 				),
439
-				array (
440
-						gettext ( "Amount($currency)" ),
439
+				array(
440
+						gettext("Amount($currency)"),
441 441
 						"150",
442 442
 						"amount",
443 443
 						"amount",
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 						"true",
448 448
 						"right" 
449 449
 				),
450
-				array (
451
-						gettext ( "Created Date" ),
450
+				array(
451
+						gettext("Created Date"),
452 452
 						"200",
453 453
 						"creation_date",
454 454
 						"",
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
 						"true",
459 459
 						"center" 
460 460
 				),
461
-				array (
462
-						gettext ( "Used?" ),
461
+				array(
462
+						gettext("Used?"),
463 463
 						"135",
464 464
 						"status",
465 465
 						'status',
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 						"true",
470 470
 						"center" 
471 471
 				),
472
-				array (
473
-						gettext ( "Used Date" ),
472
+				array(
473
+						gettext("Used Date"),
474 474
 						"180",
475 475
 						"firstused",
476 476
 						"firstused",
@@ -480,29 +480,29 @@  discard block
 block discarded – undo
480 480
 						"true",
481 481
 						"center" 
482 482
 				),
483
-				array (
484
-						gettext ( "Action" ),
483
+				array(
484
+						gettext("Action"),
485 485
 						"120",
486 486
 						"",
487 487
 						"",
488 488
 						"",
489
-						array (
490
-								"DELETE" => array (
489
+						array(
490
+								"DELETE" => array(
491 491
 										"url" => "refill_coupon/refill_coupon_list_delete/",
492 492
 										"mode" => "single" 
493 493
 								) 
494 494
 						) 
495 495
 				) 
496
-		) );
496
+		));
497 497
 		return $grid_field_arr;
498 498
 	}
499 499
 	function build_user_refill_coupon_grid() {
500
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
500
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
501 501
 		$currency_id = $account_info ['currency_id'];
502
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
503
-		$grid_field_arr = json_encode ( array (
504
-				array (
505
-						gettext ( "Coupon Number" ),
502
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
503
+		$grid_field_arr = json_encode(array(
504
+				array(
505
+						gettext("Coupon Number"),
506 506
 						"230",
507 507
 						"number",
508 508
 						"",
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
 						"true",
513 513
 						"center" 
514 514
 				),
515
-				array (
516
-						gettext ( "Description" ),
515
+				array(
516
+						gettext("Description"),
517 517
 						"210",
518 518
 						"description",
519 519
 						"",
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 						"true",
524 524
 						"center" 
525 525
 				),
526
-				array (
527
-						gettext ( "Amount($currency)" ),
526
+				array(
527
+						gettext("Amount($currency)"),
528 528
 						"190",
529 529
 						"amount",
530 530
 						"amount",
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 						"true",
535 535
 						"right" 
536 536
 				),
537
-				array (
538
-						gettext ( "Created Date" ),
537
+				array(
538
+						gettext("Created Date"),
539 539
 						"250",
540 540
 						"creation_date",
541 541
 						"",
@@ -545,8 +545,8 @@  discard block
 block discarded – undo
545 545
 						"true",
546 546
 						"center" 
547 547
 				),
548
-				array (
549
-						gettext ( "Used Date" ),
548
+				array(
549
+						gettext("Used Date"),
550 550
 						"250",
551 551
 						"firstused",
552 552
 						"firstused",
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 						"true",
557 557
 						"center" 
558 558
 				) 
559
-		) );
559
+		));
560 560
 		return $grid_field_arr;
561 561
 	}
562 562
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/user/models/user_model.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -23,86 +23,86 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class user_model extends CI_Model {
25 25
 	function user_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 		if (Common_model::$global_config ['system_config'] ['opensips'] == 0) {
28 28
 			$db_config = Common_model::$global_config ['system_config'];
29
-			$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=";
30
-			$this->opensips_db = $this->load->database ( $opensipdsn, true );
29
+			$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=";
30
+			$this->opensips_db = $this->load->database($opensipdsn, true);
31 31
 		}
32 32
 	}
33 33
 	function validate_password($pass, $id) {
34
-		$this->db->select ( 'password' );
35
-		$this->db->where ( 'number', $id );
36
-		$query = $this->db->get ( 'accounts' );
37
-		$count = $query->num_rows ();
34
+		$this->db->select('password');
35
+		$this->db->where('number', $id);
36
+		$query = $this->db->get('accounts');
37
+		$count = $query->num_rows();
38 38
 		return $count;
39 39
 	}
40 40
 	function update_password($newpass, $id) {
41
-		$this->db->update ( 'password', $newpass );
42
-		$this->db->where ( 'number', $id );
43
-		$result = $this->db->get ( 'accounts' );
44
-		return $result->result ();
41
+		$this->db->update('password', $newpass);
42
+		$this->db->where('number', $id);
43
+		$result = $this->db->get('accounts');
44
+		return $result->result();
45 45
 	}
46 46
 	function change_password($id) {
47
-		$this->db->select ( 'password' );
48
-		$this->db->where ( 'id', $id );
49
-		$query = $this->db->get ( 'accounts' );
50
-		$result = $query->result ();
47
+		$this->db->select('password');
48
+		$this->db->where('id', $id);
49
+		$query = $this->db->get('accounts');
50
+		$result = $query->result();
51 51
 		return $result;
52 52
 	}
53 53
 	function change_db_password($update, $id) {
54
-		$this->db->where ( 'id', $id );
55
-		$this->db->update ( 'accounts', array (
54
+		$this->db->where('id', $id);
55
+		$this->db->update('accounts', array(
56 56
 				'password' => $update 
57
-		) );
57
+		));
58 58
 	}
59 59
 	function edit_account($accountinfo, $edit_id) {
60
-		unset ( $accountinfo ['action'] );
61
-		$this->db->where ( 'id', $edit_id );
62
-		$result = $this->db->update ( 'accounts', $accountinfo );
60
+		unset ($accountinfo ['action']);
61
+		$this->db->where('id', $edit_id);
62
+		$result = $this->db->update('accounts', $accountinfo);
63 63
 		return true;
64 64
 	}
65 65
 	function get_user_packages_list($flag, $start = 0, $limit = 0) {
66
-		$this->db_model->build_search ( 'package_list_search' );
67
-		$account_data = $this->session->userdata ( "accountinfo" );
68
-		$where = array (
66
+		$this->db_model->build_search('package_list_search');
67
+		$account_data = $this->session->userdata("accountinfo");
68
+		$where = array(
69 69
 				"pricelist_id" => $account_data ['pricelist_id'] 
70 70
 		);
71 71
 		if ($flag) {
72
-			$query = $this->db_model->getSelect ( "*", "packages", $where, "id", "ASC", $limit, $start );
72
+			$query = $this->db_model->getSelect("*", "packages", $where, "id", "ASC", $limit, $start);
73 73
 		} else {
74
-			$query = $this->db_model->countQuery ( "*", "packages", $where );
74
+			$query = $this->db_model->countQuery("*", "packages", $where);
75 75
 		}
76 76
 		return $query;
77 77
 	}
78 78
 	function get_user_invoices_list($flag, $start = 0, $limit = 0) {
79
-		$this->db_model->build_search ( 'user_invoice_list_search' );
80
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
79
+		$this->db_model->build_search('user_invoice_list_search');
80
+		$accountinfo = $this->session->userdata('accountinfo');
81 81
 		$reseller_id = $accountinfo ['id'];
82
-		$this->db->where ( 'accountid', $reseller_id );
82
+		$this->db->where('accountid', $reseller_id);
83 83
 		if ($flag) {
84
-			$this->db->select ( '*' );
84
+			$this->db->select('*');
85 85
 		} else {
86
-			$this->db->select ( 'count(id) as count' );
86
+			$this->db->select('count(id) as count');
87 87
 		}
88 88
 		if ($flag) {
89
-			if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
90
-				$this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
89
+			if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') {
90
+				$this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']);
91 91
 			} else {
92
-				$this->db->order_by ( 'invoice_date', 'desc' );
92
+				$this->db->order_by('invoice_date', 'desc');
93 93
 			}
94 94
 		}
95
-		$result = $this->db->get ( 'invoices' );
96
-		if ($result->num_rows () > 0) {
95
+		$result = $this->db->get('invoices');
96
+		if ($result->num_rows() > 0) {
97 97
 			if ($flag) {
98 98
 				return $result;
99 99
 			} else {
100
-				$result = $result->result_array ();
100
+				$result = $result->result_array();
101 101
 				return $result [0] ['count'];
102 102
 			}
103 103
 		} else {
104 104
 			if ($flag) {
105
-				$query = ( object ) array (
105
+				$query = (object)array(
106 106
 						'num_rows' => 0 
107 107
 				);
108 108
 			} else {
@@ -112,88 +112,88 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 	}
114 114
 	function get_user_charge_history($flag, $start = 0, $limit = 0) {
115
-		$this->db_model->build_search ( 'user_charge_history_search' );
116
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
115
+		$this->db_model->build_search('user_charge_history_search');
116
+		$accountinfo = $this->session->userdata('accountinfo');
117 117
 		$where ['accountid'] = $accountinfo ['id'];
118
-		if ($this->session->userdata ( 'advance_search' ) != 1) {
119
-			$where ['created_date >='] = gmdate ( "Y-m-1 00:00:00" );
120
-			$where ['created_date <='] = gmdate ( "Y-m-d 23:59:59" );
118
+		if ($this->session->userdata('advance_search') != 1) {
119
+			$where ['created_date >='] = gmdate("Y-m-1 00:00:00");
120
+			$where ['created_date <='] = gmdate("Y-m-d 23:59:59");
121 121
 		}
122 122
 		$where ['item_type <>'] = 'STANDARD';
123 123
 		if ($flag) {
124
-			$query = $this->db_model->select ( "*", "invoice_details", $where, "id", "DESC", $limit, $start );
124
+			$query = $this->db_model->select("*", "invoice_details", $where, "id", "DESC", $limit, $start);
125 125
 		} else {
126
-			$query = $this->db_model->countQuery ( "*", "invoice_details", $where );
126
+			$query = $this->db_model->countQuery("*", "invoice_details", $where);
127 127
 		}
128 128
 		return $query;
129 129
 	}
130 130
 	function get_user_refill_list($flag, $start = '', $limit = '') {
131
-		$this->db_model->build_search ( 'user_refill_report_search' );
131
+		$this->db_model->build_search('user_refill_report_search');
132 132
 		$accountinfo = $this->session->userdata ['accountinfo'];
133
-		$where = array (
133
+		$where = array(
134 134
 				"accountid" => $accountinfo ["id"] 
135 135
 		);
136 136
 		if ($flag) {
137
-			$query = $this->db_model->select ( "*", "payments", $where, "payment_date", "DESC", $limit, $start );
137
+			$query = $this->db_model->select("*", "payments", $where, "payment_date", "DESC", $limit, $start);
138 138
 		} else {
139
-			$query = $this->db_model->countQuery ( "*", "payments", $where );
139
+			$query = $this->db_model->countQuery("*", "payments", $where);
140 140
 		}
141 141
 		return $query;
142 142
 	}
143 143
 	function get_user_emails_list($flag, $start = 0, $limit = 0) {
144
-		$account_data = $this->session->userdata ( "accountinfo" );
145
-		$this->db_model->build_search ( 'user_emails_search' );
144
+		$account_data = $this->session->userdata("accountinfo");
145
+		$this->db_model->build_search('user_emails_search');
146 146
 		
147
-		$where = array (
147
+		$where = array(
148 148
 				'accountid' => $account_data ['id'] 
149 149
 		);
150 150
 		if ($flag) {
151
-			$query = $this->db_model->select ( "*", "mail_details", $where, "id", "DESC", $limit, $start );
151
+			$query = $this->db_model->select("*", "mail_details", $where, "id", "DESC", $limit, $start);
152 152
 		} else {
153
-			$query = $this->db_model->countQuery ( "*", "mail_details", $where );
153
+			$query = $this->db_model->countQuery("*", "mail_details", $where);
154 154
 		}
155 155
 		return $query;
156 156
 	}
157 157
 	function add_invoice_config($add_array) {
158
-		$result = $this->db->insert ( 'invoice_conf', $add_array );
158
+		$result = $this->db->insert('invoice_conf', $add_array);
159 159
 		return true;
160 160
 	}
161 161
 	function edit_invoice_config($add_array, $edit_id) {
162
-		$this->db->where ( 'id', $edit_id );
163
-		$result = $this->db->update ( 'invoice_conf', $add_array );
162
+		$this->db->where('id', $edit_id);
163
+		$result = $this->db->update('invoice_conf', $add_array);
164 164
 		return true;
165 165
 	}
166 166
 	function edit_alert_threshold($add_array, $edit_id) {
167
-		$this->db->where ( 'id', $edit_id );
168
-		$result = $this->db->update ( 'accounts', $add_array );
167
+		$this->db->where('id', $edit_id);
168
+		$result = $this->db->update('accounts', $add_array);
169 169
 		return true;
170 170
 	}
171 171
 	function user_ipmap_list($flag, $limit = '', $start = '') {
172
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
172
+		$accountinfo = $this->session->userdata('accountinfo');
173 173
 		$where ['accountid'] = $accountinfo ['id'];
174
-		$this->db_model->build_search ( 'user_ipmap_search' );
174
+		$this->db_model->build_search('user_ipmap_search');
175 175
 		if ($flag) {
176
-			$query = $this->db_model->select ( "*", "ip_map", $where, "id", "ASC", $limit, $start );
176
+			$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $limit, $start);
177 177
 		} else {
178
-			$query = $this->db_model->countQuery ( "*", "ip_map", $where );
178
+			$query = $this->db_model->countQuery("*", "ip_map", $where);
179 179
 		}
180 180
 		return $query;
181 181
 	}
182 182
 	function user_sipdevices_list($flag, $accountid = "", $start = "", $limit = "") {
183
-		$where = array (
183
+		$where = array(
184 184
 				"accountid" => $accountid 
185 185
 		);
186
-		$this->db_model->build_search ( 'user_sipdevices_search' );
187
-		$query = array ();
186
+		$this->db_model->build_search('user_sipdevices_search');
187
+		$query = array();
188 188
 		if ($flag) {
189
-			$deviceinfo = $this->db_model->select ( "*", "sip_devices", $where, "id", "ASC", $limit, $start );
189
+			$deviceinfo = $this->db_model->select("*", "sip_devices", $where, "id", "ASC", $limit, $start);
190 190
 			if ($deviceinfo->num_rows > 0) {
191
-				$add_array = $deviceinfo->result_array ();
192
-				foreach ( $add_array as $key => $value ) {
193
-					$vars = json_decode ( $value ['dir_vars'] );
194
-					$vars_new = json_decode ( $value ['dir_params'], true );
195
-					$passowrds = json_decode ( $value ['dir_params'] );
196
-					$query [] = array (
191
+				$add_array = $deviceinfo->result_array();
192
+				foreach ($add_array as $key => $value) {
193
+					$vars = json_decode($value ['dir_vars']);
194
+					$vars_new = json_decode($value ['dir_params'], true);
195
+					$passowrds = json_decode($value ['dir_params']);
196
+					$query [] = array(
197 197
 							'id' => $value ['id'],
198 198
 							'username' => $value ['username'],
199 199
 							'accountid' => $value ['accountid'],
@@ -206,24 +206,24 @@  discard block
 block discarded – undo
206 206
 							'vm_keep_local_after_email' => $vars_new ['vm-keep-local-after-email'],
207 207
 							'effective_caller_id_number' => $vars->effective_caller_id_number,
208 208
 							'password' => $passowrds->password,
209
-							'creation_date' => gmdate ( 'Y-m-d H:i:s' ),
210
-							'last_modified_date' => gmdate ( 'Y-m-d H:i:s' ) 
209
+							'creation_date' => gmdate('Y-m-d H:i:s'),
210
+							'last_modified_date' => gmdate('Y-m-d H:i:s') 
211 211
 					);
212 212
 				}
213 213
 			}
214 214
 		} else {
215
-			$query = $this->db_model->countQuery ( "*", "sip_devices", $where );
215
+			$query = $this->db_model->countQuery("*", "sip_devices", $where);
216 216
 		}
217 217
 		return $query;
218 218
 	}
219 219
 	function user_sipdevice_info($edit_id) {
220
-		$sipdevice_info = $this->db_model->getSelect ( "*", "sip_devices", array (
220
+		$sipdevice_info = $this->db_model->getSelect("*", "sip_devices", array(
221 221
 				'id' => $edit_id 
222
-		) );
223
-		$sipdevice_arr = ( array ) $sipdevice_info->first_row ();
224
-		$vars = ( array ) json_decode ( $sipdevice_arr ['dir_vars'] );
225
-		$params = ( array ) json_decode ( $sipdevice_arr ['dir_params'], true );
226
-		$query = array (
222
+		));
223
+		$sipdevice_arr = (array)$sipdevice_info->first_row();
224
+		$vars = (array)json_decode($sipdevice_arr ['dir_vars']);
225
+		$params = (array)json_decode($sipdevice_arr ['dir_params'], true);
226
+		$query = array(
227 227
 				'id' => $sipdevice_arr ['id'],
228 228
 				'fs_username' => $sipdevice_arr ['username'],
229 229
 				'accountcode' => $sipdevice_arr ['accountid'],
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		return $query;
242 242
 	}
243 243
 	function user_sipdevice_add($add_array) {
244
-		$account_data = $this->session->userdata ( "accountinfo" );
245
-		$parms_array = array (
244
+		$account_data = $this->session->userdata("accountinfo");
245
+		$parms_array = array(
246 246
 				'password' => $add_array ['fs_password'],
247 247
 				'vm-enabled' => $add_array ['voicemail_enabled'],
248 248
 				'vm-password' => $add_array ['voicemail_password'],
@@ -251,30 +251,30 @@  discard block
 block discarded – undo
251 251
 				'vm-keep-local-after-email' => $add_array ['vm_keep_local_after_email'],
252 252
 				'vm-email-all-messages' => $add_array ['vm_send_all_message'] 
253 253
 		);
254
-		$add_array ['status'] = isset ( $add_array ['status'] ) ? $add_array ['status'] : "0";
255
-		$parms_array_vars = array (
254
+		$add_array ['status'] = isset ($add_array ['status']) ? $add_array ['status'] : "0";
255
+		$parms_array_vars = array(
256 256
 				'effective_caller_id_name' => $add_array ['effective_caller_id_name'],
257 257
 				'effective_caller_id_number' => $add_array ['effective_caller_id_number'],
258 258
 				'user_context' => 'default' 
259 259
 		);
260 260
 		
261
-		$new_array = array (
262
-				'creation_date' => gmdate ( 'Y-m-d H:i:s' ),
261
+		$new_array = array(
262
+				'creation_date' => gmdate('Y-m-d H:i:s'),
263 263
 				'username' => $add_array ['fs_username'],
264 264
 				'accountid' => $account_data ['id'],
265 265
 				'status' => $add_array ['status'],
266
-				'dir_params' => json_encode ( $parms_array ),
267
-				'dir_vars' => json_encode ( $parms_array_vars ),
268
-				'sip_profile_id' => $this->common->get_field_name ( 'id', 'sip_profiles', array (
266
+				'dir_params' => json_encode($parms_array),
267
+				'dir_vars' => json_encode($parms_array_vars),
268
+				'sip_profile_id' => $this->common->get_field_name('id', 'sip_profiles', array(
269 269
 						'name' => 'default' 
270
-				) ) 
270
+				)) 
271 271
 		);
272
-		$this->db->insert ( 'sip_devices', $new_array );
273
-		$this->common->mail_to_users ( 'add_sip_device', $account_data );
272
+		$this->db->insert('sip_devices', $new_array);
273
+		$this->common->mail_to_users('add_sip_device', $account_data);
274 274
 		return true;
275 275
 	}
276 276
 	function user_sipdevice_edit($add_array) {
277
-		$parms_array = array (
277
+		$parms_array = array(
278 278
 				'password' => $add_array ['fs_password'],
279 279
 				'vm-enabled' => $add_array ['voicemail_enabled'],
280 280
 				'vm-password' => $add_array ['voicemail_password'],
@@ -283,33 +283,33 @@  discard block
 block discarded – undo
283 283
 				'vm-keep-local-after-email' => $add_array ['vm_keep_local_after_email'],
284 284
 				'vm-email-all-messages' => $add_array ['vm_send_all_message'] 
285 285
 		);
286
-		$parms_array_vars = array (
286
+		$parms_array_vars = array(
287 287
 				'effective_caller_id_name' => $add_array ['effective_caller_id_name'],
288 288
 				'effective_caller_id_number' => $add_array ['effective_caller_id_number'] 
289 289
 		);
290
-		$log_type = $this->session->userdata ( "logintype" );
290
+		$log_type = $this->session->userdata("logintype");
291 291
 		if ($log_type == 0 || $log_type == 3 || $log_type == 1) {
292
-			$add_array ['sip_profile_id'] = $this->common->get_field_name ( 'id', 'sip_profiles', array (
292
+			$add_array ['sip_profile_id'] = $this->common->get_field_name('id', 'sip_profiles', array(
293 293
 					'name' => 'default' 
294
-			) );
294
+			));
295 295
 		}
296
-		$add_array ['status'] = isset ( $add_array ['status'] ) ? $add_array ['status'] : "0";
297
-		$new_array = array (
298
-				'last_modified_date' => gmdate ( 'Y-m-d H:i:s' ),
296
+		$add_array ['status'] = isset ($add_array ['status']) ? $add_array ['status'] : "0";
297
+		$new_array = array(
298
+				'last_modified_date' => gmdate('Y-m-d H:i:s'),
299 299
 				'username' => $add_array ['fs_username'],
300 300
 				'status' => $add_array ['status'],
301
-				'dir_params' => json_encode ( $parms_array ),
302
-				'dir_vars' => json_encode ( $parms_array_vars ),
301
+				'dir_params' => json_encode($parms_array),
302
+				'dir_vars' => json_encode($parms_array_vars),
303 303
 				'sip_profile_id' => $add_array ['sip_profile_id'] 
304 304
 		);
305
-		$this->db->update ( 'sip_devices', $new_array, array (
305
+		$this->db->update('sip_devices', $new_array, array(
306 306
 				'id' => $add_array ['id'] 
307
-		) );
307
+		));
308 308
 		return true;
309 309
 	}
310 310
 	function getuser_cdrs_list($flag, $start, $limit, $export = true) {
311
-		$this->db_model->build_search ( 'user_cdrs_report_search' );
312
-		$account_data = $this->session->userdata ( "accountinfo" );
311
+		$this->db_model->build_search('user_cdrs_report_search');
312
+		$account_data = $this->session->userdata("accountinfo");
313 313
 		$field_name = 'debit';
314 314
 		if ($account_data ['type'] == 0 || $account_data ['type'] == 1) {
315 315
 			$where ['accountid'] = $account_data ['id'];
@@ -319,39 +319,39 @@  discard block
 block discarded – undo
319 319
 			$field_name = 'cost';
320 320
 		}
321 321
 		$table_name = $account_data ['type'] != 1 ? 'cdrs' : 'reseller_cdrs';
322
-		if ($this->session->userdata ( 'advance_search' ) != 1) {
323
-			$where ['callstart >= '] = date ( "Y-m-d" ) . " 00:00:00";
324
-			$where ['callstart <='] = date ( "Y-m-d" ) . " 23:59:59";
322
+		if ($this->session->userdata('advance_search') != 1) {
323
+			$where ['callstart >= '] = date("Y-m-d")." 00:00:00";
324
+			$where ['callstart <='] = date("Y-m-d")." 23:59:59";
325 325
 		}
326
-		$this->db->where ( $where );
327
-		$this->db->order_by ( "callstart desc" );
326
+		$this->db->where($where);
327
+		$this->db->order_by("callstart desc");
328 328
 		if ($flag) {
329
-			if (! $export)
330
-				$this->db->limit ( $limit, $start );
331
-			$this->db->select ( 'callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid' );
329
+			if ( ! $export)
330
+				$this->db->limit($limit, $start);
331
+			$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,debit,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid');
332 332
 		} else {
333
-			$this->db->select ( 'count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids' );
333
+			$this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(debit) as total_debit,sum(cost) as total_cost,group_concat(distinct(pricelist_id)) as pricelist_ids,group_concat(distinct(trunk_id)) as trunk_ids');
334 334
 		}
335
-		$result = $this->db->get ( $table_name );
335
+		$result = $this->db->get($table_name);
336 336
 		return $result;
337 337
 	}
338
-	function user_fund_transfer($data,$accountinfo){
338
+	function user_fund_transfer($data, $accountinfo) {
339 339
 //	$accountinfo = $this->session->userdata['accountinfo'];
340
-		$data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1 ;
340
+		$data["payment_by"] = $accountinfo['reseller_id'] > 0 ? $accountinfo['reseller_id'] : -1;
341 341
 		$data['accountid'] = $data['id'];
342 342
 		$data['payment_mode'] = $data['payment_type'];
343
-		unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']);
343
+		unset($data['action'], $data['id'], $data['account_currency'], $data['payment_type']);
344 344
 		if (isset($data)) {
345
-			$data['credit']=$data['credit'] =='' ?  0 : $data['credit'];
345
+			$data['credit'] = $data['credit'] == '' ? 0 : $data['credit'];
346 346
 			$date = gmdate('Y-m-d H:i:s');
347
-			$accountid=$data['accountid'];
348
-			while($accountid > 0 ){
349
-				$customer_id=$accountid;
350
-				$accountid=$this->common_model->get_parent_info($accountid);
351
-				$parent_id=$accountid > 0 ? $accountid : -1;
347
+			$accountid = $data['accountid'];
348
+			while ($accountid > 0) {
349
+				$customer_id = $accountid;
350
+				$accountid = $this->common_model->get_parent_info($accountid);
351
+				$parent_id = $accountid > 0 ? $accountid : -1;
352 352
 
353 353
 
354
-				if($data['payment_mode'] == 0){
354
+				if ($data['payment_mode'] == 0) {
355 355
 					$insert_arr = array("accountid" => $customer_id,
356 356
 					"credit" => $data['credit'],
357 357
 					'payment_mode'=>$data['payment_mode'],
@@ -366,59 +366,59 @@  discard block
 block discarded – undo
366 366
 		}
367 367
 	}
368 368
 	function user_dashboard_recent_recharge_info() {
369
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
370
-		$userlevel_logintype = $this->session->userdata ( 'userlevel_logintype' );
369
+		$accountinfo = $this->session->userdata('accountinfo');
370
+		$userlevel_logintype = $this->session->userdata('userlevel_logintype');
371 371
 		
372
-		$where_arr = array (
373
-				'payment_by' => - 1 
372
+		$where_arr = array(
373
+				'payment_by' => -1 
374 374
 		);
375 375
 		if ($userlevel_logintype == 1) {
376
-			$where_arr = array (
376
+			$where_arr = array(
377 377
 					'payment_by' => $accountinfo ['id'] 
378 378
 			);
379 379
 		}
380 380
 		if ($userlevel_logintype == 0 || $userlevel_logintype == 3) {
381
-			$where_arr = array (
381
+			$where_arr = array(
382 382
 					'accountid' => $accountinfo ['id'] 
383 383
 			);
384 384
 		}
385
-		$this->db->where ( $where_arr );
386
-		$this->db->select ( 'id,accountid,credit,payment_date,notes' );
387
-		$this->db->from ( 'payments' );
388
-		$this->db->limit ( 10 );
389
-		$this->db->order_by ( 'payment_date', 'desc' );
390
-		return $this->db->get ();
385
+		$this->db->where($where_arr);
386
+		$this->db->select('id,accountid,credit,payment_date,notes');
387
+		$this->db->from('payments');
388
+		$this->db->limit(10);
389
+		$this->db->order_by('payment_date', 'desc');
390
+		return $this->db->get();
391 391
 	}
392 392
 	function get_user_rates_list($flag, $start = 0, $limit = 0) {
393
-		$this->db_model->build_search ( 'user_rates_list_search' );
394
-		$account_data = $this->session->userdata ( "accountinfo" );
395
-		$where = array (
393
+		$this->db_model->build_search('user_rates_list_search');
394
+		$account_data = $this->session->userdata("accountinfo");
395
+		$where = array(
396 396
 				"pricelist_id" => $account_data ["pricelist_id"],
397 397
 				"status" => '0' 
398 398
 		);
399 399
 		if ($flag) {
400
-			$query = $this->db_model->select ( "*", "routes", $where, "id", "ASC", $limit, $start );
400
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
401 401
 		} else {
402
-			$query = $this->db_model->countQuery ( "*", "routes", $where );
402
+			$query = $this->db_model->countQuery("*", "routes", $where);
403 403
 		}
404 404
 		return $query;
405 405
 	}
406 406
 	function get_user_opensips($flag, $account_number = "", $start = "0", $limit = "0") {
407
-		$this->db_model->build_search_opensips ( $this->opensips_db, 'user_opensips_search' );
408
-		$this->opensips_db->where ( 'accountcode', $account_number );
407
+		$this->db_model->build_search_opensips($this->opensips_db, 'user_opensips_search');
408
+		$this->opensips_db->where('accountcode', $account_number);
409 409
 		if ($flag) {
410
-			$this->opensips_db->limit ( $limit, $start );
410
+			$this->opensips_db->limit($limit, $start);
411 411
 		}
412
-		$result = $this->opensips_db->get ( "subscriber" );
413
-		if ($result->num_rows () > 0) {
412
+		$result = $this->opensips_db->get("subscriber");
413
+		if ($result->num_rows() > 0) {
414 414
 			if ($flag) {
415 415
 				return $result;
416 416
 			} else {
417
-				return $result->num_rows ();
417
+				return $result->num_rows();
418 418
 			}
419 419
 		} else {
420 420
 			if ($flag) {
421
-				$result = ( object ) array (
421
+				$result = (object)array(
422 422
 						'num_rows' => 0 
423 423
 				);
424 424
 			} else {
@@ -428,91 +428,91 @@  discard block
 block discarded – undo
428 428
 		}
429 429
 	}
430 430
 	function user_opensips_add($data) {
431
-		unset ( $data ["action"] );
432
-		$data ['creation_date'] = gmdate ( "Y-m-d H:i:s" );
433
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
431
+		unset ($data ["action"]);
432
+		$data ['creation_date'] = gmdate("Y-m-d H:i:s");
433
+		$accountinfo = $this->session->userdata('accountinfo');
434 434
 		$data ['reseller_id'] = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
435
-		$this->opensips_db->insert ( "subscriber", $data );
435
+		$this->opensips_db->insert("subscriber", $data);
436 436
 	}
437 437
 	function user_opensips_edit($data, $id) {
438
-		unset ( $data ["action"] );
439
-		$data = array (
438
+		unset ($data ["action"]);
439
+		$data = array(
440 440
 				"username" => $data ['username'],
441 441
 				"password" => $data ['password'],
442 442
 				"accountcode" => $data ['accountcode'],
443 443
 				"domain" => $data ['domain'] 
444 444
 		);
445
-		$this->opensips_db->where ( "id", $id );
446
-		$data ['last_modified_date'] = gmdate ( "Y-m-d H:i:s" );
447
-		$this->opensips_db->update ( "subscriber", $data );
445
+		$this->opensips_db->where("id", $id);
446
+		$data ['last_modified_date'] = gmdate("Y-m-d H:i:s");
447
+		$this->opensips_db->update("subscriber", $data);
448 448
 	}
449 449
 	function user_opensips_delete($id) {
450
-		$this->opensips_db->where ( "id", $id );
451
-		$this->opensips_db->delete ( "subscriber" );
450
+		$this->opensips_db->where("id", $id);
451
+		$this->opensips_db->delete("subscriber");
452 452
 		return true;
453 453
 	}
454 454
 	function get_user_invoice_list($flag, $start = 0, $limit = 0) {
455
-		$this->db_model->build_search ( 'user_invoice_list_search' );
456
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
457
-		$where = array (
455
+		$this->db_model->build_search('user_invoice_list_search');
456
+		$accountinfo = $this->session->userdata('accountinfo');
457
+		$where = array(
458 458
 				"accountid" => $accountinfo ['id'],
459 459
 				'confirm' => 1 
460 460
 		);
461
-		$this->db->where ( $where );
461
+		$this->db->where($where);
462 462
 		$or_where = "(type='I' OR type='R')";
463
-		$this->db->where ( $or_where );
463
+		$this->db->where($or_where);
464 464
 		if ($flag) {
465
-			$query = $this->db_model->select ( "*", "invoices", "", "invoice_date", "desc", $limit, $start );
465
+			$query = $this->db_model->select("*", "invoices", "", "invoice_date", "desc", $limit, $start);
466 466
 		} else {
467
-			$query = $this->db_model->countQuery ( "*", "invoices", "" );
467
+			$query = $this->db_model->countQuery("*", "invoices", "");
468 468
 		}
469 469
 		
470 470
 		return $query;
471 471
 	}
472 472
 	function get_user_cdrs_info($flag, $accountid, $start = 0, $limit = 0) {
473 473
 		if ($flag) {
474
-			$query = $this->db_model->select ( "*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start );
474
+			$query = $this->db_model->select("*", "reseller_cdrs", "", "invoice_date", "desc", $limit, $start);
475 475
 		} else {
476
-			$query = $this->db_model->countQuery ( "*", "invoices", "" );
476
+			$query = $this->db_model->countQuery("*", "invoices", "");
477 477
 		}
478 478
 	}
479 479
 	function get_invoiceconf($accountid) {
480
-		$return_array = array ();
481
-		$logintype = $this->session->userdata ( 'logintype' );
480
+		$return_array = array();
481
+		$logintype = $this->session->userdata('logintype');
482 482
 		if ($logintype == 1 || $logintype == 5) {
483 483
 			
484
-			$where = array (
484
+			$where = array(
485 485
 					"accountid" => $this->session->userdata ["accountinfo"] ['id'] 
486 486
 			);
487 487
 		} else {
488
-			$where = array (
488
+			$where = array(
489 489
 					'id' => $accountid 
490 490
 			);
491 491
 		}
492
-		$query = $this->db_model->getSelect ( "*", "invoice_conf", $where );
493
-		foreach ( $query->result_array () as $key => $value ) {
492
+		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
493
+		foreach ($query->result_array() as $key => $value) {
494 494
 			$return_array = $value;
495 495
 		}
496 496
 		return $return_array;
497 497
 	}
498 498
 	function getprovider_cdrs_list($flag, $start, $limit, $export = true) {
499
-		$this->db_model->build_search ( 'user_provider_cdrs_report_search' );
500
-		$account_data = $this->session->userdata ( "accountinfo" );
499
+		$this->db_model->build_search('user_provider_cdrs_report_search');
500
+		$account_data = $this->session->userdata("accountinfo");
501 501
 		$where ['provider_id'] = $account_data ['id'];
502
-		if ($this->session->userdata ( 'advance_search' ) != 1) {
503
-			$where ['callstart >= '] = date ( "Y-m-d" ) . " 00:00:00";
504
-			$where ['callstart <='] = date ( "Y-m-d" ) . " 23:59:59";
502
+		if ($this->session->userdata('advance_search') != 1) {
503
+			$where ['callstart >= '] = date("Y-m-d")." 00:00:00";
504
+			$where ['callstart <='] = date("Y-m-d")." 23:59:59";
505 505
 		}
506
-		$this->db->where ( $where );
507
-		$this->db->order_by ( "callstart", "desc" );
506
+		$this->db->where($where);
507
+		$this->db->order_by("callstart", "desc");
508 508
 		if ($flag) {
509
-			if (! $export)
510
-				$this->db->limit ( $limit, $start );
511
-			$this->db->select ( 'callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid' );
509
+			if ( ! $export)
510
+				$this->db->limit($limit, $start);
511
+			$this->db->select('callstart,callerid,callednum,pattern,notes,billseconds,disposition,cost,accountid,pricelist_id,calltype,is_recording,trunk_id,uniqueid');
512 512
 		} else {
513
-			$this->db->select ( 'count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids' );
513
+			$this->db->select('count(*) as count,sum(billseconds) as billseconds,sum(cost) as total_cost,group_concat(distinct(trunk_id)) as trunk_ids');
514 514
 		}
515
-		$result = $this->db->get ( 'cdrs' );
515
+		$result = $this->db->get('cdrs');
516 516
 		return $result;
517 517
 	}
518 518
 }
Please login to merge, or discard this patch.