Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
freeswitch/fs/lib/astpp.db.php 1 patch
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,12 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function cleanup($bind) {
51 51
 		if (! is_array ( $bind )) {
52
-			if (! empty ( $bind ))
53
-				$bind = array (
52
+			if (! empty ( $bind )) {
53
+							$bind = array (
54 54
 						$bind 
55 55
 				);
56
-			else
57
-				$bind = array ();
56
+			} else {
57
+							$bind = array ();
58
+			}
58 59
 		}
59 60
 		return $bind;
60 61
 	}
@@ -70,14 +71,15 @@  discard block
 block discarded – undo
70 71
 						"select",
71 72
 						"describe",
72 73
 						"pragma" 
73
-				) ) . ") /i", $this->sql ))
74
-					return $pdostmt->fetchAll ( PDO::FETCH_ASSOC );
75
-				elseif (preg_match ( "/^(" . implode ( "|", array (
74
+				) ) . ") /i", $this->sql )) {
75
+									return $pdostmt->fetchAll ( PDO::FETCH_ASSOC );
76
+				} elseif (preg_match ( "/^(" . implode ( "|", array (
76 77
 						"delete",
77 78
 						"insert",
78 79
 						"update" 
79
-				) ) . ") /i", $this->sql ))
80
-					return $pdostmt->rowCount ();
80
+				) ) . ") /i", $this->sql )) {
81
+									return $pdostmt->rowCount ();
82
+				}
81 83
 			}
82 84
 		} catch ( PDOException $e ) {
83 85
 			$this->error = $e->getMessage ();
Please login to merge, or discard this patch.
freeswitch/fs/lib/astpp.xml.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -147,8 +147,9 @@
 block discarded – undo
147 147
 			
148 148
 			$sp_gw_settings = json_decode ( $sp_gw_value ['gateway_data'], true );
149 149
 			foreach ( $sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value ) {
150
-				if ($sp_gw_settings_value != "")
151
-					$xml .= "           <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n";
150
+				if ($sp_gw_settings_value != "") {
151
+									$xml .= "           <param name=\"" . $sp_gw_settings_key . "\" value=\"" . $sp_gw_settings_value . "\"/>\n";
152
+				}
152 153
 			}
153 154
 			$xml .= "       </gateway>\n";
154 155
 		}
Please login to merge, or discard this patch.
freeswitch/fs/lib/astpp.logger.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,15 +33,17 @@
 block discarded – undo
33 33
 	}
34 34
 	function log($log) {
35 35
 		if ($this->config ['debug'] == '0') {
36
-			if (is_array ( $log ))
37
-				fwrite ( $this->fp, "[" . date ( 'Y-m-d H:i:s' ) . "] " . print_r ( $log, TRUE ) );
38
-			else
39
-				fwrite ( $this->fp, "[" . date ( 'Y-m-d H:i:s' ) . "] " . $log . "\n" );
36
+			if (is_array ( $log )) {
37
+							fwrite ( $this->fp, "[" . date ( 'Y-m-d H:i:s' ) . "] " . print_r ( $log, TRUE ) );
38
+			} else {
39
+							fwrite ( $this->fp, "[" . date ( 'Y-m-d H:i:s' ) . "] " . $log . "\n" );
40
+			}
40 41
 		}
41 42
 	}
42 43
 	function close() {
43
-		if ($this->config ['debug'] == '0')
44
-			fclose ( $this->fp );
44
+		if ($this->config ['debug'] == '0') {
45
+					fclose ( $this->fp );
46
+		}
45 47
 	}
46 48
 }
47 49
 
Please login to merge, or discard this patch.
freeswitch/fs/lib/astpp.cdr.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -82,10 +82,12 @@  discard block
 block discarded – undo
82 82
 	$actual_calltype = $dataVariable ['calltype'];
83 83
 	
84 84
 	// Normalize origination and termination rates array
85
-	if (isset ( $dataVariable ['origination_rates'] ))
86
-		$origination_rate = normalize_origination_rate ( $dataVariable ['origination_rates'] );
87
-	if (isset ( $dataVariable ['termination_rates'] ))
88
-		$termination_rate = normalize_rate ( $dataVariable ['termination_rates'] );
85
+	if (isset ( $dataVariable ['origination_rates'] )) {
86
+			$origination_rate = normalize_origination_rate ( $dataVariable ['origination_rates'] );
87
+	}
88
+	if (isset ( $dataVariable ['termination_rates'] )) {
89
+			$termination_rate = normalize_rate ( $dataVariable ['termination_rates'] );
90
+	}
89 91
 		
90 92
 		// If receiver account id found then explicitly set call direction and call type
91 93
 	if (isset ( $dataVariable ['receiver_accid'] )) {
@@ -421,11 +423,12 @@  discard block
 block discarded – undo
421 423
 	$query_counter = "SELECT id,seconds FROM counters  WHERE  accountid = " . $accountid . " AND package_id = " . $package_id . " AND status=1 LIMIT 1";
422 424
 	$counter = $db->run ( $query_counter );
423 425
 	$logger->log ( "GET Counters  : " . $query_counter );
424
-	if ($counter)
425
-		return $counter [0];
426
-	else
427
-		return "";
428
-}
426
+	if ($counter) {
427
+			return $counter [0];
428
+	} else {
429
+			return "";
430
+	}
431
+	}
429 432
 
430 433
 // Get user info
431 434
 function get_accounts($parent_id, $logger, $db) {
Please login to merge, or discard this patch.
freeswitch/fs/lib/astpp.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@
 block discarded – undo
25 25
 	function get_configurations($db) {
26 26
 		$query = "SELECT * FROM system WHERE group_title IN ('global','opensips')";
27 27
 		$res_conf = $db->run ( $query );
28
-		foreach ( $res_conf as $res_conf_key => $res_conf_value )
29
-			$this->config [$res_conf_value ['name']] = $res_conf_value ['value'];
28
+		foreach ( $res_conf as $res_conf_key => $res_conf_value ) {
29
+					$this->config [$res_conf_value ['name']] = $res_conf_value ['value'];
30
+		}
30 31
 		
31 32
 		return $this->config;
32 33
 	}
Please login to merge, or discard this patch.
freeswitch/fs/scripts/astpp.directory.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@
 block discarded – undo
30 30
 
31 31
 if (isset ( $_REQUEST ['user'] ) && isset ( $_REQUEST ['domain'] )) {
32 32
 	$xml = load_directory ( $logger, $db );
33
-	if ($xml == "")
34
-		xml_not_found ();
33
+	if ($xml == "") {
34
+			xml_not_found ();
35
+	}
35 36
 	echo $xml;
36 37
 } else {
37 38
 	xml_not_found ();
Please login to merge, or discard this patch.
web_interface/astpp/cron/cron.php 1 patch
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,21 +11,24 @@  discard block
 block discarded – undo
11 11
 define ( 'CRON_BETA_MODE', $config ['CRON_BETA_MODE'] );
12 12
 
13 13
 // Set index.php location
14
-if (isset ( $config ['CRON_CI_INDEX'] ) && $config ['CRON_CI_INDEX'])
14
+if (isset ( $config ['CRON_CI_INDEX'] ) && $config ['CRON_CI_INDEX']) {
15 15
 	define ( 'CRON_CI_INDEX', $config ['CRON_CI_INDEX'] );
16
-else
16
+} else {
17 17
 	define ( 'CRON_CI_INDEX', '../index.php' );
18
+}
18 19
 
19
-if (count ( $argv ) <= 2)
20
+if (count ( $argv ) <= 2) {
20 21
 	if (count ( $config ['argv'] )) {
21 22
 		$path = $argv [1];
23
+}
22 24
 		unset ( $argv [1] );
23 25
 		// $argv = array_merge($argv, $config["argv"][$path]);
24 26
 		$argv [0] = $argv [0];
25 27
 		$argv [1] = $config ["argv"] [$path];
26 28
 		$_SERVER ['argv'] = $argv;
27
-	} else
28
-		die ( 'Use: php cron.php controller/method' );
29
+	} else {
30
+			die ( 'Use: php cron.php controller/method' );
31
+	}
29 32
 	
30 33
 	// Simulate an HTTP request
31 34
 $_SERVER ['PATH_INFO'] = $argv [1];
@@ -44,11 +47,14 @@  discard block
 block discarded – undo
44 47
 require (CRON_CI_INDEX); // main CI index.php file
45 48
 $output = ob_get_contents ();
46 49
 
47
-if (CRON_FLUSH_BUFFERS === TRUE)
50
+if (CRON_FLUSH_BUFFERS === TRUE) {
48 51
 	while ( @ob_end_flush () )
49
-		; // display buffer contents
50
-else
52
+		;
53
+}
54
+// display buffer contents
55
+else {
51 56
 	ob_end_clean ();
57
+}
52 58
 
53 59
 echo "\n";
54 60
 ?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/models/accounts_model.php 1 patch
Braces   +34 added lines, -26 removed lines patch added patch discarded remove patch
@@ -619,8 +619,9 @@  discard block
 block discarded – undo
619 619
 			$data ['credit'] = $data ['credit'] == '' ? 0 : $data ['credit'];
620 620
 			$date = gmdate ( 'Y-m-d H:i:s' );
621 621
 			if ($data ['payment_mode'] == 1) {
622
-				if ($update_balance_flag == 'true')
623
-					$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
622
+				if ($update_balance_flag == 'true') {
623
+									$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
624
+				}
624 625
 				$insert_arr = array (
625 626
 						"accountid" => $data ['accountid'],
626 627
 						"credit" => "-" . $data ['credit'],
@@ -632,8 +633,9 @@  discard block
 block discarded – undo
632 633
 				);
633 634
 				$this->db->insert ( "payments", $insert_arr );
634 635
 			} else {
635
-				if ($update_balance_flag == 'true')
636
-					$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
636
+				if ($update_balance_flag == 'true') {
637
+									$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
638
+				}
637 639
 				$insert_arr = array (
638 640
 						"accountid" => $data ['accountid'],
639 641
 						"credit" => $data ['credit'],
@@ -708,8 +710,9 @@  discard block
 block discarded – undo
708 710
 		}
709 711
 		$this->db->where ( $type );
710 712
 		if ($flag) {
711
-			if (! $export)
712
-				$this->db->limit ( $limit, $start );
713
+			if (! $export) {
714
+							$this->db->limit ( $limit, $start );
715
+			}
713 716
 		}
714 717
 		if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
715 718
 			$this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
@@ -796,10 +799,11 @@  discard block
 block discarded – undo
796 799
 		$query = $this->db_model->getSelect ( "number", "accounts", array (
797 800
 				"id" => $accountid 
798 801
 		) );
799
-		if ($query->num_rows () > 0)
800
-			return $query->row_array ();
801
-		else
802
-			return false;
802
+		if ($query->num_rows () > 0) {
803
+					return $query->row_array ();
804
+		} else {
805
+					return false;
806
+		}
803 807
 	}
804 808
 	function add_callerid($data) {
805 809
 		unset ( $data ['action'], $data ['flag'] );
@@ -846,10 +850,11 @@  discard block
 block discarded – undo
846 850
 	function get_accounttax_by_id($account_id) {
847 851
 		$this->db->where ( "accountid", trim ( $account_id ) );
848 852
 		$query = $this->db->get ( "taxes_to_accounts" );
849
-		if ($query->num_rows () > 0)
850
-			return $query->result_array ();
851
-		else
852
-			return false;
853
+		if ($query->num_rows () > 0) {
854
+					return $query->result_array ();
855
+		} else {
856
+					return false;
857
+		}
853 858
 	}
854 859
 	
855 860
 	/**
@@ -862,28 +867,31 @@  discard block
 block discarded – undo
862 867
 		$this->db->where ( "number", $acc_num );
863 868
 		$query = $this->db->get ( "accounts" );
864 869
 		
865
-		if ($query->num_rows () > 0)
866
-			return $query->row_array ();
867
-		else
868
-			return false;
870
+		if ($query->num_rows () > 0) {
871
+					return $query->row_array ();
872
+		} else {
873
+					return false;
874
+		}
869 875
 	}
870 876
 	function get_account_by_number($id) {
871 877
 		$this->db->where ( "id", $id );
872 878
 		$query = $this->db->get ( "accounts" );
873 879
 		
874
-		if ($query->num_rows () > 0)
875
-			return $query->row_array ();
876
-		else
877
-			return false;
880
+		if ($query->num_rows () > 0) {
881
+					return $query->row_array ();
882
+		} else {
883
+					return false;
884
+		}
878 885
 	}
879 886
 	function get_currency_by_id($currency_id) {
880 887
 		$query = $this->db_model->getSelect ( "*", 'currency', array (
881 888
 				'id' => $currency_id 
882 889
 		) );
883
-		if ($query->num_rows () > 0)
884
-			return $query->row_array ();
885
-		else
886
-			return false;
890
+		if ($query->num_rows () > 0) {
891
+					return $query->row_array ();
892
+		} else {
893
+					return false;
894
+		}
887 895
 	}
888 896
 	function update_balance($amount, $accountid, $payment_type) {
889 897
 		if ($payment_type == 0) {
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/controllers/accounts.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 		$this->protected_pages = array (
38 38
 				'account_list' 
39 39
 		);
40
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
41
-			redirect ( base_url () . '/login/login' );
40
+		if ($this->session->userdata ( 'user_login' ) == FALSE) {
41
+					redirect ( base_url () . '/login/login' );
42
+		}
42 43
 	}
43 44
 	function customer_list() {
44 45
 		$data ['username'] = $this->session->userdata ( 'user_name' );
@@ -450,13 +451,15 @@  discard block
 block discarded – undo
450 451
 		);
451 452
 		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_ipmap' );
452 453
 		$like_str = ! empty ( $instant_search ) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" : null;
453
-		if (! empty ( $like_str ))
454
-			$this->db->where ( $like_str );
454
+		if (! empty ( $like_str )) {
455
+					$this->db->where ( $like_str );
456
+		}
455 457
 		$count_all = $this->db_model->countQuery ( "*", "ip_map", $where );
456 458
 		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
457 459
 		$json_data = $paging_data ["json_paging"];
458
-		if (! empty ( $like_str ))
459
-			$this->db->where ( $like_str );
460
+		if (! empty ( $like_str )) {
461
+					$this->db->where ( $like_str );
462
+		}
460 463
 		$query = $this->db_model->select ( "*", "ip_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
461 464
 		$grid_fields = json_decode ( $this->accounts_form->build_ip_list_for_customer ( $accountid, $accounttype ) );
462 465
 		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
@@ -550,8 +553,9 @@  discard block
 block discarded – undo
550 553
 		$json_data = array ();
551 554
 		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_animap' );
552 555
 		$like_str = ! empty ( $instant_search ) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" : null;
553
-		if (! empty ( $like_str ))
554
-			$this->db->where ( $like_str );
556
+		if (! empty ( $like_str )) {
557
+					$this->db->where ( $like_str );
558
+		}
555 559
 		$where = array (
556 560
 				"accountid" => $accountid 
557 561
 		);
@@ -559,8 +563,9 @@  discard block
 block discarded – undo
559 563
 		
560 564
 		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
561 565
 		$json_data = $paging_data ["json_paging"];
562
-		if (! empty ( $like_str ))
563
-			$this->db->where ( $like_str );
566
+		if (! empty ( $like_str )) {
567
+					$this->db->where ( $like_str );
568
+		}
564 569
 		$query = $this->db_model->select ( "*", "ani_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
565 570
 		
566 571
 		$grid_fields = json_decode ( $this->accounts_form->build_animap_list_for_customer ( $accountid, $accounttype ) );
@@ -2032,8 +2037,9 @@  discard block
 block discarded – undo
2032 2037
 		$json_data ['total'] = $config ['total_rows'];
2033 2038
 		$perpage = $config ['per_page'];
2034 2039
 		$start = ($page_no - 1) * $perpage;
2035
-		if ($start < 0)
2036
-			$start = 0;
2040
+		if ($start < 0) {
2041
+					$start = 0;
2042
+		}
2037 2043
 		
2038 2044
 		$account_charge_list = $this->db_model->getAllJionQuery ( $table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, "" );
2039 2045
 		if ($account_charge_list->num_rows > 0) {
@@ -2380,8 +2386,9 @@  discard block
 block discarded – undo
2380 2386
 		$data ['username'] = $this->session->userdata ( 'user_name' );
2381 2387
 		$data ['page_title'] = gettext ( 'Account Taxes' );
2382 2388
 		
2383
-		if ($action == false)
2384
-			$action = "list";
2389
+		if ($action == false) {
2390
+					$action = "list";
2391
+		}
2385 2392
 		
2386 2393
 		if ($action == 'list') {
2387 2394
 			$this->load->view ( 'view_account_taxes_list', $data );
Please login to merge, or discard this patch.