Passed
Pull Request — v3.0 (#169)
by
unknown
11:45
created
web_interface/astpp/application/controllers/newmail.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@
 block discarded – undo
29 29
 		parent::__construct();
30 30
 	}
31 31
 	
32
-	function index(){
32
+	function index() {
33 33
 		$data['account_info'] = $this->session->userdata['accountinfo'];
34 34
 		$data['username'] = $this->session->userdata('user_name');
35 35
 		$data['page_title'] = "Test Mail";
36
-		$this->load->view('view_newmail',$data);
36
+		$this->load->view('view_newmail', $data);
37 37
 	}
38
-	function customer_mail_result($flag=FALSE){
38
+	function customer_mail_result($flag = FALSE) {
39 39
 	$account_info = $this->session->userdata['accountinfo'];
40 40
         $post_array = $this->input->post();
41
-	$post_array['accountid']=$account_info['id'];
42
-	$post_array['history_id']=0;
43
-	$post_array['email']=$post_array['to'];
41
+	$post_array['accountid'] = $account_info['id'];
42
+	$post_array['history_id'] = 0;
43
+	$post_array['email'] = $post_array['to'];
44 44
 	unset($post_array['to']);
45
-	$this->email_lib->send_email($post_array,$post_array,'','',0,0);
45
+	$this->email_lib->send_email($post_array, $post_array, '', '', 0, 0);
46 46
 		$this->thanks();
47 47
 	}
48
-	function thanks(){
48
+	function thanks() {
49 49
             $this->load->view('view_mail_response');
50 50
 	}	
51 51
 
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/global_locale.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,19 +21,19 @@
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 /**
28 28
  * Dynamically build forms for display
29 29
  */
30
-class Global_locale{
30
+class Global_locale {
31 31
 
32 32
     function __construct($library_name = '') {
33 33
 
34 34
         $this->CI = & get_instance();
35 35
 	header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
36
-	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
36
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
37 37
 	header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
38 38
 	header("Cache-Control: post-check=0, pre-check=0", false);
39 39
 	header("Pragma: no-cache");
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/locale_menu.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 /**
28 28
  * Dynamically build forms for display
29 29
  */
30
-class locale_Menu{
30
+class locale_Menu {
31 31
 
32 32
     function __construct($library_name = '') {
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->CI->load->model('db_model');
36 36
         $this->CI->load->library('email');
37 37
         $this->CI->load->library('session');
38
-	$current_locale=$this->CI->session->userdata('user_language');
38
+	$current_locale = $this->CI->session->userdata('user_language');
39 39
 	putenv("LC_ALL=$current_locale");
40 40
 	setlocale(LC_ALL, $current_locale); 
41 41
 	bindtextdomain(WEBSITE_DOMAIN, FCPATH.'/application/modules/dashboard/language');
Please login to merge, or discard this patch.
web_interface/astpp/application/libraries/freeswitch_lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 ###############################################################################
23 23
 
24 24
 if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
25
-class freeswitch_lib{
25
+class freeswitch_lib {
26 26
 	
27
-	function event_socket_create($host='127.0.0.1', $port='8021', $password='ClueCon') {
27
+	function event_socket_create($host = '127.0.0.1', $port = '8021', $password = 'ClueCon') {
28 28
 	    $fp = @fsockopen($host, $port, $errno, $errdesc);
29 29
 // 	    or die("Connection to $host failed");
30 30
 // 	    socket_set_blocking($fp,false);
31 31
 	    
32 32
 	    if ($fp) {
33
-		socket_set_blocking($fp,false);
34
-		while (!feof($fp)) {
33
+		socket_set_blocking($fp, false);
34
+		while ( ! feof($fp)) {
35 35
 		    $buffer = fgets($fp, 1024);
36 36
 		    usleep(100); //allow time for reponse
37 37
 		    if (trim($buffer) == "Content-Type: auth/request") {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$response = "";
55 55
 		$i = 0;
56 56
 		$contentlength = 0;
57
-		while (!feof($fp)) {
57
+		while ( ! feof($fp)) {
58 58
 		    $buffer = fgets($fp, 4096);
59 59
 		    if ($contentlength > 0) {
60 60
 		      $response .= $buffer;
Please login to merge, or discard this patch.
web_interface/astpp/application/config/cron.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 */
8 8
 
9 9
 $astpp_config = parse_ini_file("/var/lib/astpp/astpp-config.conf");
10
-$config['SERVER_NAME'] 		= $astpp_config['base_url'];	// Your web site url
11
-$config['CRON_TIME_LIMIT']	= 0;								// 0 = no time limit
12
-$config['argv']			= array("LowBalance"=>"lowbalance/low_balance",
10
+$config['SERVER_NAME'] = $astpp_config['base_url']; // Your web site url
11
+$config['CRON_TIME_LIMIT'] = 0; // 0 = no time limit
12
+$config['argv'] = array("LowBalance"=>"lowbalance/low_balance",
13 13
 					"Lowcredit"=>"lowcreditlimit/low_creditlimit",
14 14
 					"UpdateBalance" => "updateBalance/GetUpdateBalance",
15 15
 				        "CurrencyUpdate" => "currencyupdate/update_currency",
16 16
 					"GenerateInvoice" => "generateInvoice/getInvoiceData",
17 17
 					"FeedBack"=>"feedback/customer_feedback_result/TRUE",
18 18
 					"BroadcastEmail" => "broadcastemail/broadcast_email");
19
-$config['CRON_BETA_MODE']	= false;							// Beta Mode (useful for blocking submissions for testing)
19
+$config['CRON_BETA_MODE'] = false; // Beta Mode (useful for blocking submissions for testing)
20 20
 
21 21
 ?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/did/views/view_did_import.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
               <div class="col-md-12">
17 17
             	<div class="w-box">
18 18
             	 <span  style="margin-left:10px; text-align: center;background-color: none;color:#1c8400;">
19
-                    <? if(isset($error) && !empty($error)) {
19
+                    <? if (isset($error) && ! empty($error)) {
20 20
                         echo $error;
21 21
                     }?>
22 22
                  </span>
Please login to merge, or discard this patch.
freeswitch/fs/scripts/astpp.directory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     if ($xml == "")
32 32
         xml_not_found();
33 33
     echo $xml;
34
-}else {
34
+} else {
35 35
     xml_not_found();
36 36
 }
37 37
 $logger->log("*************************** Directory Ends **********************************");
Please login to merge, or discard this patch.
web_interface/astpp/application/models/system_model.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 			$amount_operator = $taxes_search['amount_operator'];
126 126
 
127
-			if (!empty($taxes_search['amount'])) {
127
+			if ( ! empty($taxes_search['amount'])) {
128 128
 				switch ($amount_operator) {
129 129
 					case "1":
130 130
 						$this->db->where('taxes_amount ', $taxes_search['amount']);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 			$rate_operator = $taxes_search['rate_operator'];
151 151
 
152
-			if (!empty($taxes_search['rate'])) {
152
+			if ( ! empty($taxes_search['rate'])) {
153 153
 				switch ($rate_operator) {
154 154
 					case "1":
155 155
 						$this->db->where('taxes_rate ', $taxes_search['rate']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			}
174 174
 
175 175
 			$description_operator = $taxes_search['description_operator'];
176
-			if (!empty($taxes_search['description'])) {
176
+			if ( ! empty($taxes_search['description'])) {
177 177
 				switch ($description_operator) {
178 178
 					case "1":
179 179
 						$this->db->like('taxes_description', $taxes_search['description']);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 			$amount_operator = $taxes_search['amount_operator'];
204 204
 
205
-			if (!empty($taxes_search['amount'])) {
205
+			if ( ! empty($taxes_search['amount'])) {
206 206
 				switch ($amount_operator) {
207 207
 					case "1":
208 208
 						$this->db->where('taxes_amount =', $taxes_search['amount']);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 			$rate_operator = $taxes_search['rate_operator'];
229 229
 
230
-			if (!empty($taxes_search['rate'])) {
230
+			if ( ! empty($taxes_search['rate'])) {
231 231
 				switch ($rate_operator) {
232 232
 					case "1":
233 233
 						$this->db->where('taxes_rate == ', $taxes_search['rate']);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			}
252 252
 
253 253
 			$description_operator = $taxes_search['description_operator'];
254
-			if (!empty($taxes_search['description'])) {
254
+			if ( ! empty($taxes_search['description'])) {
255 255
 				switch ($description_operator) {
256 256
 					case "1":
257 257
 						$this->db->like('taxes_description', $taxes_search['description']);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			$template_name_operator = $templatesearch['template_name_operator'];
300 300
 
301 301
 
302
-			if (!empty($templatesearch['template_name'])) {
302
+			if ( ! empty($templatesearch['template_name'])) {
303 303
 				switch ($template_name_operator) {
304 304
 					case "1":
305 305
 						$this->db->like('name', $templatesearch['template_name']);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			}
318 318
 
319 319
 			$template_subject = $templatesearch['subject_operator'];
320
-			if (!empty($templatesearch['subject'])) {
320
+			if ( ! empty($templatesearch['subject'])) {
321 321
 				switch ($template_subject) {
322 322
 					case "1":
323 323
 						$this->db->like('subject', $templatesearch['subject']);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 				}
335 335
 			}
336 336
 			$template_op = $templatesearch['template_operator'];
337
-			if (!empty($templatesearch['template_desc'])) {
337
+			if ( ! empty($templatesearch['template_desc'])) {
338 338
 
339 339
 				switch ($template_op) {
340 340
 					case "1":
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			}
354 354
 
355 355
 
356
-			if (!empty($templatesearch['accountid'])) {
356
+			if ( ! empty($templatesearch['accountid'])) {
357 357
 				$this->db->like('accountid', $templatesearch['accountid']);
358 358
 			}
359 359
 		}
@@ -395,19 +395,19 @@  discard block
 block discarded – undo
395 395
 		if ($this->session->userdata('advance_search') == 1) {
396 396
 			$configuration_search = $this->session->userdata('configuration_search');
397 397
 
398
-			if (!empty($configuration_search['reseller'])) {
398
+			if ( ! empty($configuration_search['reseller'])) {
399 399
 				$this->db->where('reseller ', $configuration_search['reseller']);
400 400
 			}
401
-			if (!empty($configuration_search['brand'])) {
401
+			if ( ! empty($configuration_search['brand'])) {
402 402
 				$this->db->where('brand', $configuration_search['brand']);
403 403
 			}
404
-			if (!empty($configuration_search['group_title'])) {
404
+			if ( ! empty($configuration_search['group_title'])) {
405 405
 				$this->db->where('group_title', $configuration_search['group_title']);
406 406
 			}
407 407
 
408 408
 			$name_operator = $configuration_search['name_operator'];
409 409
 
410
-			if (!empty($configuration_search['name'])) {
410
+			if ( ! empty($configuration_search['name'])) {
411 411
 				switch ($name_operator) {
412 412
 					case "1":
413 413
 						$this->db->like('name', $configuration_search['name']);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
 			$value_operator = $configuration_search['value_operator'];
428 428
 
429
-			if (!empty($configuration_search['value'])) {
429
+			if ( ! empty($configuration_search['value'])) {
430 430
 				switch ($value_operator) {
431 431
 					case "1":
432 432
 						$this->db->like('value', $configuration_search['value']);
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
 			$comment_operator = $configuration_search['comment_operator'];
447 447
 
448
-			if (!empty($configuration_search['comment'])) {
448
+			if ( ! empty($configuration_search['comment'])) {
449 449
 				switch ($comment_operator) {
450 450
 					case "1":
451 451
 						$this->db->like('comment', $configuration_search['comment']);
Please login to merge, or discard this patch.
web_interface/astpp/application/models/db_model.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$this->db->select($select);
87 87
 		$this->db->from($tableName);
88 88
 		$this->db->where($where);
89
-		$this->db->order_by($order_by,$order_type);
89
+		$this->db->order_by($order_by, $order_type);
90 90
 		$query = $this->db->get();
91 91
 		return $query;
92 92
 	}
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         
137 137
 		if ($paging_limit)
138 138
 			$this->db->limit($paging_limit, $start_limit);
139
-		if (!empty($groupby))
139
+		if ( ! empty($groupby))
140 140
 			$this->db->group_by($groupby);
141
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
142
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
143
-		}else{
144
-		   if($order_by)
141
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
142
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
143
+		} else {
144
+		   if ($order_by)
145 145
 			$this->db->order_by($order_by, $order_type);
146 146
 		}        
147 147
 		$query = $this->db->get();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		$this->db->order_by($order_by, $order_type);
163 163
 		if ($paging_limit)
164 164
 			$this->db->limit($paging_limit, $start_limit);
165
-		if (!empty($groupby))
165
+		if ( ! empty($groupby))
166 166
 			$this->db->groupby($groupby);
167 167
 		$query = $this->db->get();
168 168
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		if ($where != "") {
193 193
 			$this->db->where($where);
194 194
 		}
195
-		if (!empty($where_in)) {
195
+		if ( ! empty($where_in)) {
196 196
 			$this->db->where_in($key, $where_in);
197 197
 		}
198 198
 		$this->db->from($table);
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
      * ******************************************************** */
245 245
 
246 246
 	function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
247
-		$start = (int) $start;
248
-		$end = (int) $end;
247
+		$start = (int)$start;
248
+		$end = (int)$end;
249 249
 		$this->db->select($feild);
250 250
 		$this->db->from($table);
251 251
 		$this->db->join($jionTable, $jionCondition, $type);
252 252
 		if ($where != "") {
253 253
 			$this->db->where($where);
254 254
 		}
255
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
256
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
257
-		}else{
258
-		   if($order_by)
255
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
256
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
257
+		} else {
258
+		   if ($order_by)
259 259
 			$this->db->order_by($order_by, $order_type);
260 260
 		}
261 261
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	}
270 270
 
271 271
 	function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
272
-		$start = (int) $start;
273
-		$end = (int) $end;
272
+		$start = (int)$start;
273
+		$end = (int)$end;
274 274
 		$this->db->select($feild);
275 275
 		$this->db->from($table);
276 276
 		$this->db->join($jionTable, $jionCondition, $type);
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	}
293 293
 
294 294
 	function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
295
-		$start = (int) $start;
296
-		$end = (int) $end;
295
+		$start = (int)$start;
296
+		$end = (int)$end;
297 297
 		$this->db->select($feild);
298 298
 		$this->db->from($table);
299 299
 		$jion_table_count = count($jionTable);
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		if ($where != "") {
305 305
 			$this->db->where($where);
306 306
 		}
307
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
308
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
309
-		}else{
310
-		   if($order_by)
307
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
308
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
309
+		} else {
310
+		   if ($order_by)
311 311
 			$this->db->order_by($order_by, $order_type);
312 312
 		}
313 313
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 			$string = '';
407 407
 			if ($query->num_rows() > 0) {
408 408
 				foreach ($query->result() as $rows) {
409
-					$string .= $rows->$select . ',';
409
+					$string .= $rows->$select.',';
410 410
 				}
411 411
 
412 412
 				return substr($string, '', -1);
@@ -429,13 +429,13 @@  discard block
 block discarded – undo
429 429
 		} else {
430 430
 			$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
431 431
 		}
432
-		$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
432
+		$select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
433 433
 		$logintype = $this->session->userdata('logintype');
434 434
 		if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
435 435
 			$account_data = $this->session->userdata("accountinfo");
436 436
 			$id_value['reseller_id'] = $account_data['id'];
437 437
 		}
438
-		if(isset($id_value['type']) && $id_value['type'] == '0,3'){
438
+		if (isset($id_value['type']) && $id_value['type'] == '0,3') {
439 439
 			$twhere = "type IN (".$id_value["type"].")";
440 440
 			$this->db->where($twhere);
441 441
 			unset($id_value['type']);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		} else {
489 489
 			$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
490 490
 		}
491
-		$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
491
+		$select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
492 492
 	$where = $id_value;
493 493
 		$drp_array = $this->getSelect($select, $table, $id_value);
494 494
 		$drp_array = $drp_array->result();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	function build_dropdown($select, $table, $id_where = '', $id_value = '') {
504 504
 		$select_params = explode(',', $select);
505 505
 		$where = '';
506
-		if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){
506
+		if (isset($id_value["type"]) && $id_value["type"] == "GLOBAL") {
507 507
 			$where = "type IN ('0','3')";
508 508
 			$this->db->where($where);
509 509
 			unset($id_value["type"]);
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				$this->db->group_by($id_value);
514 514
 			} else if ($id_where == "where_arr") {
515 515
 				$logintype = $this->session->userdata('logintype');
516
-				if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) {
516
+				if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id', $table)) {
517 517
 					$id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
518 518
 				}
519 519
 				$where = $id_value;
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 	}
539 539
   function build_dropdown_deleted($select, $table, $id_where = '', $id_value = '') {
540 540
 		$select_params = explode(',', $select);
541
-		if(isset($id_value["type"]) ){
542
-			$where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")";
541
+		if (isset($id_value["type"])) {
542
+			$where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')" : "type IN (".$id_value["type"].")";
543 543
 			$this->db->where($where);
544 544
 			unset($id_value["type"]);
545 545
 		}
@@ -569,21 +569,21 @@  discard block
 block discarded – undo
569 569
 
570 570
 		$drp_array = $drp_array->result();
571 571
 
572
-		$name=explode("as",$select);
573
-		if(isset($name[3])){
574
-			$name=trim($name[3]);
575
-		}else{
576
-			$name=trim($name[1]);
572
+		$name = explode("as", $select);
573
+		if (isset($name[3])) {
574
+			$name = trim($name[3]);
575
+		} else {
576
+			$name = trim($name[1]);
577 577
 		}
578 578
 
579 579
 		$drp_list = array();
580
-		$dele =array();
580
+		$dele = array();
581 581
 		foreach ($drp_array as $drp_value) {
582
-			$dele=explode("^",$drp_value->$name);
583
-			if(isset($dele[1]))
582
+			$dele = explode("^", $drp_value->$name);
583
+			if (isset($dele[1]))
584 584
 			{
585
-			   $drp_list['Deleted'][$drp_value->$select_params[0]] =  str_replace("^","",$drp_value->$name);
586
-			}else{
585
+			   $drp_list['Deleted'][$drp_value->$select_params[0]] = str_replace("^", "", $drp_value->$name);
586
+			} else {
587 587
 			   $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name;
588 588
 			}
589 589
 		}
@@ -599,32 +599,32 @@  discard block
 block discarded – undo
599 599
 			/* ASTPP  3.0 
600 600
              Display Records in
601 601
             */
602
-			unset($account_search['search_in'],$account_search['time']);
603
-			if (!empty($account_search)) {
602
+			unset($account_search['search_in'], $account_search['time']);
603
+			if ( ! empty($account_search)) {
604 604
 				foreach ($account_search as $key => $value) {
605 605
 					if ($value != "") {
606 606
 						if (is_array($value)) {
607
-							if (array_key_exists($key . "-integer", $value)) {
608
-								$this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
607
+							if (array_key_exists($key."-integer", $value)) {
608
+								$this->get_interger_array($key, $value[$key."-integer"], $value[$key]);
609 609
 							}
610
-							if (array_key_exists($key . "-string", $value)) {
611
-								$this->get_string_array($key, $value[$key . "-string"], $value[$key]);
610
+							if (array_key_exists($key."-string", $value)) {
611
+								$this->get_string_array($key, $value[$key."-string"], $value[$key]);
612 612
 							}
613 613
                             
614 614
 							/**
615 615
                             ASTPP  3.0 
616 616
                             first used,creation,expiry search date picker
617 617
 							 **/ 
618
-							if ($key == 'callstart'||
619
-								$key == 'date'||
620
-								$key =='payment_date' ||
621
-								$key == 'first_used'  ||
622
-								$key == 'creation'  ||
623
-								$key =='from_date'||
624
-								$key =='invoice_date' ||
625
-								$key =='expiry' ||
626
-								$key =='created_date' ||
627
-								$key=='to_date') {
618
+							if ($key == 'callstart' ||
619
+								$key == 'date' ||
620
+								$key == 'payment_date' ||
621
+								$key == 'first_used' ||
622
+								$key == 'creation' ||
623
+								$key == 'from_date' ||
624
+								$key == 'invoice_date' ||
625
+								$key == 'expiry' ||
626
+								$key == 'created_date' ||
627
+								$key == 'to_date') {
628 628
 							/***********************************************/
629 629
 								$this->get_date_array($key, $value);
630 630
 							}
@@ -641,16 +641,16 @@  discard block
 block discarded – undo
641 641
 
642 642
 	function get_date_array($field, $value) {
643 643
 		if ($value != '') {
644
-			 if (!empty($value[0])) {
645
-				if($field == 'invoice_date'){
646
-					$this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647
-					$this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
-				}else{
649
-				$this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0])));
644
+			 if ( ! empty($value[0])) {
645
+				if ($field == 'invoice_date') {
646
+					$this->db->where($field.' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647
+					$this->db->where($field.' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
+				} else {
649
+				$this->db->where($field.' >= ', gmdate('Y-m-d H:i:s', strtotime($value[0])));
650 650
 				}
651 651
 			}
652
-			if (!empty($value[1])) {
653
-				$this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1])));
652
+			if ( ! empty($value[1])) {
653
+				$this->db->where($field.' <= ', gmdate('Y-m-d H:i:s', strtotime($value[1])));
654 654
 			}
655 655
 		}
656 656
 	}
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 					$this->db->where($field, $search_array);
663 663
 					break;
664 664
 				case "2":
665
-					$this->db->where($field . ' <>', $search_array);
665
+					$this->db->where($field.' <>', $search_array);
666 666
 					break;
667 667
 				case "3":
668
-					$this->db->where($field . ' > ', $search_array);
668
+					$this->db->where($field.' > ', $search_array);
669 669
 					break;
670 670
 				case "4":
671
-					$this->db->where($field . ' < ', $search_array);
671
+					$this->db->where($field.' < ', $search_array);
672 672
 					break;
673 673
 				case "5":
674
-					$this->db->where($field . ' >= ', $search_array);
674
+					$this->db->where($field.' >= ', $search_array);
675 675
 					break;
676 676
 				case "6":
677
-					$this->db->where($field . ' <= ', $search_array);
677
+					$this->db->where($field.' <= ', $search_array);
678 678
 					break;
679 679
 			}
680 680
 		}
@@ -684,35 +684,35 @@  discard block
 block discarded – undo
684 684
 		if ($search_array != '') {
685 685
 			switch ($value) {
686 686
 				case "1":
687
-					$str1 = $field . " LIKE '%$search_array%'";
687
+					$str1 = $field." LIKE '%$search_array%'";
688 688
 					$this->db->where($str1);
689 689
 					break;
690 690
 				case "2":
691
-					$str1 = $field . " NOT LIKE '%$search_array%'";
691
+					$str1 = $field." NOT LIKE '%$search_array%'";
692 692
 					$this->db->where($str1);
693 693
 					break;
694 694
 				case "3":
695 695
 					$this->db->where($field, $search_array);
696 696
 					break;
697 697
 				case "4":
698
-					$this->db->where($field . ' <>', $search_array);
698
+					$this->db->where($field.' <>', $search_array);
699 699
 					break;
700 700
 				case "5":
701
-					if($field == "pattern"){
702
-							$str1 = $field . " LIKE '^".$search_array."%'";
701
+					if ($field == "pattern") {
702
+							$str1 = $field." LIKE '^".$search_array."%'";
703 703
 							$this->db->where($str1);
704
-					} else{
705
-							$str1 = $field . " LIKE '".$search_array."%'";
704
+					} else {
705
+							$str1 = $field." LIKE '".$search_array."%'";
706 706
 							$this->db->where($str1);
707 707
 					}
708 708
 
709 709
 					break;
710 710
 				case "6":
711
-					if($field == "pattern"){
712
-							$str1 = $field . " LIKE '%".$search_array.".*'";
711
+					if ($field == "pattern") {
712
+							$str1 = $field." LIKE '%".$search_array.".*'";
713 713
 							$this->db->where($str1);
714
-					} else{
715
-							$str1 = $field . " LIKE '%".$search_array."'";
714
+					} else {
715
+							$str1 = $field." LIKE '%".$search_array."'";
716 716
 							$this->db->where($str1);
717 717
 					}		
718 718
 
@@ -722,46 +722,46 @@  discard block
 block discarded – undo
722 722
 	}
723 723
   function build_search_string($accounts_list_search) {
724 724
 	 $where = null;
725
-	 $search=$this->session->userdata($accounts_list_search);
725
+	 $search = $this->session->userdata($accounts_list_search);
726 726
 		if ($this->session->userdata('advance_search') == 1) {
727 727
 			$account_search = $this->session->userdata($accounts_list_search);
728 728
 			unset($account_search["ajax_search"]);
729 729
 			unset($account_search["advance_search"]);
730
-			if (!empty($account_search)) {
730
+			if ( ! empty($account_search)) {
731 731
 				foreach ($account_search as $key => $value) {
732 732
 					if ($value != "") {
733 733
 						if (is_array($value)) {
734
-							if (array_key_exists($key . "-integer", $value)) {
735
-				$string=null;
736
-								$string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]);
737
-								if($string)
738
-								$where.= "$string AND ";
734
+							if (array_key_exists($key."-integer", $value)) {
735
+				$string = null;
736
+								$string = $this->build_interger_where($key, $value[$key."-integer"], $value[$key]);
737
+								if ($string)
738
+								$where .= "$string AND ";
739 739
 							}
740
-							if (array_key_exists($key . "-string", $value)) {
741
-				$string=null;
742
-								$string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]);
743
-								if($string)
744
-								$where.= "$string AND ";
740
+							if (array_key_exists($key."-string", $value)) {
741
+				$string = null;
742
+								$string = $this->build_string_where($key, $value[$key."-string"], $value[$key]);
743
+								if ($string)
744
+								$where .= "$string AND ";
745 745
 							}
746
-							if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') {
747
-				$string=null;
748
-								$string=$this->build_date_where($key, $value);
749
-								if($string)
750
-								$where.= "$string AND ";
746
+							if ($key == 'callstart' || $key == 'date' || $key == 'log_time') {
747
+				$string = null;
748
+								$string = $this->build_date_where($key, $value);
749
+								if ($string)
750
+								$where .= "$string AND ";
751 751
 							}
752 752
 						} else {
753
-				  $where.="$key = '$value'AND ";
753
+				  $where .= "$key = '$value'AND ";
754 754
 						}
755 755
 					}
756 756
 				}
757 757
 			}
758 758
 		}
759
-		$where =rtrim($where ," AND ");
759
+		$where = rtrim($where, " AND ");
760 760
 		return $where;
761 761
 	}
762 762
 	// This function using by reports module don't delete it
763
-	function build_string_where($field, $value, $search_array){
764
-	$where=null;
763
+	function build_string_where($field, $value, $search_array) {
764
+	$where = null;
765 765
 		 if ($search_array != '') {
766 766
 			switch ($value) {
767 767
 				case "1":
@@ -777,17 +777,17 @@  discard block
 block discarded – undo
777 777
 					$where = "$field <> '$search_array'";
778 778
 					break;
779 779
 				case "5":
780
-			if($field == "pattern"){
781
-			  $where = $field . " LIKE '^".$search_array."%'";
782
-			}else{
783
-			  $where = $field . " LIKE '".$search_array."%'";
780
+			if ($field == "pattern") {
781
+			  $where = $field." LIKE '^".$search_array."%'";
782
+			} else {
783
+			  $where = $field." LIKE '".$search_array."%'";
784 784
 			}
785 785
 					break;
786 786
 				case "6":
787
-			if($field == "pattern"){
788
-			   $str1 = $field . " LIKE '%".$search_array.".*'";
789
-			}else{
790
-			   $str1 = $field . " LIKE '%".$search_array."'";
787
+			if ($field == "pattern") {
788
+			   $str1 = $field." LIKE '%".$search_array.".*'";
789
+			} else {
790
+			   $str1 = $field." LIKE '%".$search_array."'";
791 791
 			}
792 792
 			break;
793 793
 			}
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
 	}
797 797
     
798 798
 	function build_interger_where($field, $value, $search_array) {
799
-	$where=null;
799
+	$where = null;
800 800
 		if ($search_array != '') {
801
-		if(is_numeric($search_array))
801
+		if (is_numeric($search_array))
802 802
 		{
803 803
 		switch ($value) {
804 804
 			case "1":
@@ -824,29 +824,29 @@  discard block
 block discarded – undo
824 824
 			else
825 825
 			{
826 826
 		  $this->db->where("$field IS NULL");
827
-		  $where= "$field IS NULL";
827
+		  $where = "$field IS NULL";
828 828
 			}
829 829
 		}
830 830
 		return $where;
831 831
 	}
832 832
 	function build_date_where($field, $value) {
833
-	$where =null;
833
+	$where = null;
834 834
 		if ($value != '') {
835
-			if (!empty($value[0])) {
836
-		$string=null;
837
-				$string="$field >= '$value[0]'";
838
-				if($string)
839
-				$where.=$string." AND ";
835
+			if ( ! empty($value[0])) {
836
+		$string = null;
837
+				$string = "$field >= '$value[0]'";
838
+				if ($string)
839
+				$where .= $string." AND ";
840 840
 			}
841
-			if (!empty($value[1])) {
842
-		$string=null;
843
-				$string="$field <= '$value[1]'";
844
-				if($string)
845
-				$where.=$string." AND ";
841
+			if ( ! empty($value[1])) {
842
+		$string = null;
843
+				$string = "$field <= '$value[1]'";
844
+				if ($string)
845
+				$where .= $string." AND ";
846 846
 			}
847 847
 		}
848
-		if($where){
849
-	  $where =rtrim($where," AND ");
848
+		if ($where) {
849
+	  $where = rtrim($where, " AND ");
850 850
 		}
851 851
 		return $where;
852 852
 	}
@@ -858,10 +858,10 @@  discard block
 block discarded – undo
858 858
 
859 859
 	function update_balance($amount, $accountid, $payment_type) {
860 860
 		if ($payment_type == "debit") {
861
-			$query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
861
+			$query = 'UPDATE `accounts` SET `balance` = (balance - '.$amount.') WHERE `id` = '.$accountid;
862 862
 			return $this->db->query($query);
863 863
 		} else {
864
-			$query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
864
+			$query = 'UPDATE `accounts` SET `balance` = (balance + '.$amount.') WHERE `id` = '.$accountid;
865 865
 			return $this->db->query($query);
866 866
 		}
867 867
 	}
@@ -875,30 +875,30 @@  discard block
 block discarded – undo
875 875
 						//                        $this->db->where($field, $search_array);
876 876
 						break;
877 877
 					case "2":
878
-						if($update_fields[$key] != ''){
878
+						if ($update_fields[$key] != '') {
879 879
 							$updateflg = true;
880
-							$this->db->set($key,$update_fields[$key]);    
880
+							$this->db->set($key, $update_fields[$key]);    
881 881
 						}
882 882
 						break;
883 883
 					case "3":
884
-						$this->db->set($key, $key . "+" . $update_fields[$key], FALSE);
884
+						$this->db->set($key, $key."+".$update_fields[$key], FALSE);
885 885
 						$updateflg = true;
886 886
 						break;
887 887
 					case "4":
888
-						$this->db->set($key, $key . "-" . $update_fields[$key], FALSE);
888
+						$this->db->set($key, $key."-".$update_fields[$key], FALSE);
889 889
 						$updateflg = true;
890 890
 						break;
891 891
 				}
892 892
 			} else {
893
-				if ($update_fields != ""){
894
-					$this->db->set($key,$update_fields);
893
+				if ($update_fields != "") {
894
+					$this->db->set($key, $update_fields);
895 895
 					$updateflg = true;
896 896
 				}
897 897
 			}
898 898
 		}
899 899
 		return $updateflg;
900 900
 	}
901
-	function build_search_opensips($opensips_db_obj,$accounts_list_search) {
901
+	function build_search_opensips($opensips_db_obj, $accounts_list_search) {
902 902
 		if ($this->session->userdata('advance_search') == 1) {
903 903
 			$account_search = $this->session->userdata($accounts_list_search);
904 904
 			unset($account_search["ajax_search"]);
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
 			foreach ($account_search as $key => $value) {
907 907
 				if ($value != "") {
908 908
 					if (is_array($value)) {
909
-						if (array_key_exists($key . "-integer", $value)) {
910
-							$this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]);
909
+						if (array_key_exists($key."-integer", $value)) {
910
+							$this->get_opensips_interger_array($opensips_db_obj, $key, $value[$key."-integer"], $value[$key]);
911 911
 						}
912
-						if (array_key_exists($key . "-string", $value)) {
913
-							$this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]);
912
+						if (array_key_exists($key."-string", $value)) {
913
+							$this->get_opensips_string_array($opensips_db_obj, $key, $value[$key."-string"], $value[$key]);
914 914
 						}
915 915
 					} else {
916 916
 						$opensips_db_obj->where($key, $value);
@@ -920,32 +920,32 @@  discard block
 block discarded – undo
920 920
 		}
921 921
 	}
922 922
 
923
-	function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) {
923
+	function get_opensips_interger_array($opensips_db_obj, $field, $value, $search_array) {
924 924
 		if ($search_array != '') {
925 925
 			switch ($value) {
926 926
 				case "1":
927 927
 					$opensips_db_obj->where($field, $search_array);
928 928
 					break;
929 929
 				case "2":
930
-					$opensips_db_obj->where($field . ' <>', $search_array);
930
+					$opensips_db_obj->where($field.' <>', $search_array);
931 931
 					break;
932 932
 				case "3":
933
-					$opensips_db_obj->where($field . ' > ', $search_array);
933
+					$opensips_db_obj->where($field.' > ', $search_array);
934 934
 					break;
935 935
 				case "4":
936
-					$opensips_db_obj->where($field . ' < ', $search_array);
936
+					$opensips_db_obj->where($field.' < ', $search_array);
937 937
 					break;
938 938
 				case "5":
939
-					$opensips_db_obj->where($field . ' >= ', $search_array);
939
+					$opensips_db_obj->where($field.' >= ', $search_array);
940 940
 					break;
941 941
 				case "6":
942
-					$opensips_db_obj->where($field . ' <= ', $search_array);
942
+					$opensips_db_obj->where($field.' <= ', $search_array);
943 943
 					break;
944 944
 			}
945 945
 		}
946 946
 	}
947 947
 
948
-	function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) {
948
+	function get_opensips_string_array($opensips_db_obj, $field, $value, $search_array) {
949 949
 		if ($search_array != '') {
950 950
 			switch ($value) {
951 951
 				case "1":
@@ -958,14 +958,14 @@  discard block
 block discarded – undo
958 958
 					$opensips_db_obj->where($field, $search_array);
959 959
 					break;
960 960
 				case "4":
961
-					$opensips_db_obj->where($field . ' <>', $search_array);
961
+					$opensips_db_obj->where($field.' <>', $search_array);
962 962
 					break;
963 963
 				case "5":
964
-			$str1 = $field . " LIKE '".$search_array."%'";
964
+			$str1 = $field." LIKE '".$search_array."%'";
965 965
 			$opensips_db_obj->where($str1);
966 966
 			break;
967 967
 		case "6":
968
-			$str1 = $field . " LIKE '%".$search_array."'";
968
+			$str1 = $field." LIKE '%".$search_array."'";
969 969
 			$opensips_db_obj->where($str1);
970 970
 			break;
971 971
 			}
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 		} else {
981 981
 			$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
982 982
 		}
983
-		$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ;
983
+		$select = $select_params[0].", concat($cnt_str) as $select_params[1] ,".$select_params[4];
984 984
 		$logintype = $this->session->userdata('logintype');
985 985
 		if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
986 986
 			$account_data = $this->session->userdata("accountinfo");
@@ -991,12 +991,12 @@  discard block
 block discarded – undo
991 991
 		$drp_array = $drp_array->result();
992 992
 		$drp_list = array();
993 993
 		foreach ($drp_array as $drp_value) {
994
-			if($drp_value->type == 3)
994
+			if ($drp_value->type == 3)
995 995
 			{
996 996
 			   $drp_list['Provider'][$drp_value->id] = $drp_value->first_name;
997
-			}elseif($drp_value->type == 1){
997
+			}elseif ($drp_value->type == 1) {
998 998
 			   $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name;
999
-			}else{
999
+			} else {
1000 1000
 			   $drp_list['Customer'][$drp_value->id] = $drp_value->first_name;
1001 1001
 			}
1002 1002
 		}
Please login to merge, or discard this patch.