Completed
Push — v3.0 ( 23635d...e28df5 )
by Samir
23s
created
astpp/application/modules/signup/views/view_confirmpassword.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
           <div class="w-section inverse no-padding margin-t-20">                       
51 51
              <div class="w-box dark sign-in-wr box_shadow margin-b-10">
52 52
 		    	<div class="col-md-12 no-padding">
53
-			  <? if($this->session->userdata('userlevel_logintype') != '0'){?>
54
-				<a class="col-md-9" href="<?php echo base_url();?>">
55
-						<img id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png">
56
-			  <? } else{?> 
57
-						<a class="col-md-9" href="<?php echo base_url();?>">
58
-						<img id="logo" alt="user_logo" src="<?php echo base_url();?>assets/images/logo.png">
53
+			  <? if ($this->session->userdata('userlevel_logintype') != '0') {?>
54
+				<a class="col-md-9" href="<?php echo base_url(); ?>">
55
+						<img id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png">
56
+			  <? } else {?> 
57
+						<a class="col-md-9" href="<?php echo base_url(); ?>">
58
+						<img id="logo" alt="user_logo" src="<?php echo base_url(); ?>assets/images/logo.png">
59 59
 			<? }?>
60 60
 				</a>
61 61
 
62
-			<div class="col-md-3"><a href="<?php echo base_url();?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div>
62
+			<div class="col-md-3"><a href="<?php echo base_url(); ?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div>
63 63
 
64 64
 
65 65
 </div>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 <form class="form-light col-md-12 no-padding" action="<?php echo base_url(); ?>confirmpass" method="post" accept-charset="utf-8" id="customer_form" name="customer_form">
70 70
 
71
-<input type="hidden" name="email" value=<?php echo $email;?>>
71
+<input type="hidden" name="email" value=<?php echo $email; ?>>
72 72
 
73 73
 <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32">
74 74
 <h3 style="color: #173D77 !important; padding: 0 0 10px;border-bottom: 1px solid #ddd;">Enter Your Password</h3>
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32">
78 78
 <label class="col-md-5 no-padding" style="text-align: left;">Password</label>
79 79
 <div class="col-md-7 no-padding">
80
-<input type="text" name="password" required value="<?php if(isset($value['password'])) echo  $value['password']; else '';?>" id="password" size="15" maxlength="40" class="form-control"  />
81
-<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if(isset($error['password'])) echo $error['password'];?></div>
80
+<input type="text" name="password" required value="<?php if (isset($value['password'])) echo  $value['password']; else ''; ?>" id="password" size="15" maxlength="40" class="form-control"  />
81
+<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if (isset($error['password'])) echo $error['password']; ?></div>
82 82
 </div>
83 83
 </div>
84 84
 
85 85
 <div class="col-md-12 margin-t-10 padding-r-32 padding-l-32">
86 86
 <label class="col-md-5 no-padding" style="text-align: left;">Confirm Password</label>
87 87
 <div class="col-md-7 no-padding">
88
-<input type="text" name="confirmpassword" required value="<?php if(isset($value['confirm_password'])) echo  $value['confirm_password']; else '';?>" id="confirm_password" size="15" maxlength="40" class="form-control"  />
89
-<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if(isset($error['confirm_password'])) echo $error['confirm_password'];?></div>
88
+<input type="text" name="confirmpassword" required value="<?php if (isset($value['confirm_password'])) echo  $value['confirm_password']; else ''; ?>" id="confirm_password" size="15" maxlength="40" class="form-control"  />
89
+<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if (isset($error['confirm_password'])) echo $error['confirm_password']; ?></div>
90 90
 </div>
91 91
 </div>
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 <button name="action" type="submit" value="Submit" class="btn btn-line-parrot col-md-12" onclick="return check_function();" >Submit</button>
95 95
 
96 96
 
97
-<!--<div style="color:black" >Already have an account <a style="color:blue" href="<?=base_url();?>"> Log in </a> </div>-->
97
+<!--<div style="color:black" >Already have an account <a style="color:blue" href="<?=base_url(); ?>"> Log in </a> </div>-->
98 98
 
99 99
 </div></form>			     
100 100
 
Please login to merge, or discard this patch.
astpp/application/modules/signup/views/view_forgot_success.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     <link href="<?= base_url() ?>assets/css/global-style.css" rel="stylesheet" type="text/css">
12 12
     
13 13
      <!-- IE -->
14
-    <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.js"></script>
15
-    <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.src.js"></script>
14
+    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.js"></script>
15
+    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.src.js"></script>
16 16
     <noscript>
17 17
 	 <div id="noscript-warning">
18 18
 	  ASTPP work best with JavaScript enabled
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
             <div class="row">
38 38
 
39 39
 			<div class="col-md-4 col-md-offset-4">&nbsp;<span class="login_error">
40
-                        <?php if (isset($astpp_notification)){ ?>
40
+                        <?php if (isset($astpp_notification)) { ?>
41 41
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
42
-                    <?php }else{
42
+                    <?php } else {
43 43
                          echo "&nbsp;";
44 44
                     } 
45 45
 			$astpp_err_msg = $this->session->flashdata('astpp_signupmsg');
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
                             </h2>
62 62
                            
63 63
                            </div> 
64
-                            <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "We sent update password link. <br>Please check your Email!!<br>";?></div>
64
+                            <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "We sent update password link. <br>Please check your Email!!<br>"; ?></div>
65 65
 
66 66
                             <div class="margin-b-20 padding-r-32 padding-l-32">
67 67
                             <div class="col-md-12 no-padding">
68
-							<a href="<?php echo base_url();?>">
68
+							<a href="<?php echo base_url(); ?>">
69 69
 								<input type="submit" value="Go to Login Page" name="Login" style="border-radius: 3px" class="btn btn-success col-md-12 margin-t-10">
70 70
 							</a>
71 71
 			  				</div>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/views/view_signup.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
             <div class="row">
96 96
                 <div class="col-md-4 col-md-offset-4">&nbsp;
97 97
 					<span class="login_error">
98
-                        <?php if (isset($astpp_notification)){ ?>
98
+                        <?php if (isset($astpp_notification)) { ?>
99 99
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
100
-						<?php }else{
100
+						<?php } else {
101 101
                          echo "&nbsp;";
102 102
 						} ?>
103 103
                     </span>
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 								<div class="">	
114 114
 											<!-- Header Start-->
115 115
 												<div class="col-md-12">
116
-													  <? if($this->session->userdata('userlevel_logintype') != '0'){?>
117
-															<a class="col-md-10" style="padding:0px 0px 10px 0px" href="<?php echo base_url();?>">
118
-																<img style="height: 44px;" id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png">
119
-														<? } else{?> 
120
-																<a class="col-md-10" style="padding:0px 0px 20px 0px" href="<?php echo base_url();?>">
121
-																<img style="height: 44px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='ASTPP - Open Source Voip Billing Solution' src="<?php echo base_url();?>assets/images/logo.png">
116
+													  <? if ($this->session->userdata('userlevel_logintype') != '0') {?>
117
+															<a class="col-md-10" style="padding:0px 0px 10px 0px" href="<?php echo base_url(); ?>">
118
+																<img style="height: 44px;" id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png">
119
+														<? } else {?> 
120
+																<a class="col-md-10" style="padding:0px 0px 20px 0px" href="<?php echo base_url(); ?>">
121
+																<img style="height: 44px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='ASTPP - Open Source Voip Billing Solution' src="<?php echo base_url(); ?>assets/images/logo.png">
122 122
 														<? }?>
123 123
 															</a>
124 124
 												
125 125
 												<div class="col-md-2">
126
-													<a href="<?php echo base_url();?>">
126
+													<a href="<?php echo base_url(); ?>">
127 127
 														<input type="submit" value="Login" name="Login" style="border-radius: 2px" class="btn btn-success col-md-12 margin-t-10">
128 128
 													</a>
129 129
 									  				</div>
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 				<div class='col-md-9'>
197 197
 				<?
198 198
 				$js = 'id="country_id"';
199
-				$country = form_dropdown(array('id'=>'country_id','name'=>'country_id'), $this->db_model->build_dropdown("id,country", "countrycode", "", ""), '', 'id="country_id"');
199
+				$country = form_dropdown(array('id'=>'country_id', 'name'=>'country_id'), $this->db_model->build_dropdown("id,country", "countrycode", "", ""), '', 'id="country_id"');
200 200
 				echo $country;
201 201
 				?>
202 202
 				</div>
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 				<label for="Timezone" class="col-md-3 no-padding add_settings" style="text-align: left;">Timezone</label>
211 211
 				<div class='col-md-9'>
212 212
 				<?
213
-				$timezone = form_dropdown(array('id'=>'timezone_id','name'=>'timezone_id'), $this->db_model->build_dropdown("id,gmtzone", "timezone", "", ""), '', 'id="timezone_id"');
213
+				$timezone = form_dropdown(array('id'=>'timezone_id', 'name'=>'timezone_id'), $this->db_model->build_dropdown("id,gmtzone", "timezone", "", ""), '', 'id="timezone_id"');
214 214
 				echo $timezone;
215 215
 				?>
216 216
 				</div>
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				<label for="Currency" class="col-md-3  no-padding add_settings" style="text-align: left;">Currency</label>
220 220
 				<div class='col-md-9'>
221 221
 				<?
222
-				$currency = form_dropdown(array('id'=>'currency_id','name'=>'currency_id'), $this->db_model->build_dropdown("id,currencyname", "currency", "", ""), '', 'id="currency_id"');
222
+				$currency = form_dropdown(array('id'=>'currency_id', 'name'=>'currency_id'), $this->db_model->build_dropdown("id,currencyname", "currency", "", ""), '', 'id="currency_id"');
223 223
 				echo $currency;
224 224
 				?>
225 225
 				</div>
Please login to merge, or discard this patch.
astpp/application/modules/signup/views/view_signup_success.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     <link href="<?= base_url() ?>assets/css/global-style.css" rel="stylesheet" type="text/css">
12 12
     
13 13
      <!-- IE -->
14
-    <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.js"></script>
15
-    <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.src.js"></script>
14
+    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.js"></script>
15
+    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.src.js"></script>
16 16
     <noscript>
17 17
 	 <div id="noscript-warning">
18 18
 	  ASTPP work best with JavaScript enabled
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
             <div class="row">
36 36
 
37 37
 			<div class="col-md-4 col-md-offset-4">&nbsp;<span class="login_error">
38
-                        <?php if (isset($astpp_notification)){ ?>
38
+                        <?php if (isset($astpp_notification)) { ?>
39 39
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
40
-                    <?php }else{
40
+                    <?php } else {
41 41
                          echo "&nbsp;";
42 42
                     } 
43 43
 			$astpp_err_msg = $this->session->flashdata('astpp_signupmsg');
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
                            
63 63
                            </div> 
64 64
                            <div class="margin-t-15 padding-r-32 padding-l-32"><h2 class="no-padding" style="color:#79c57b;text-align:left;"><i class="fa fa-check-circle"></i> Successful!</h2></div>
65
-                            <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "Your account has been created successfully!!! <br> Please check your Email!!!";?></div>
65
+                            <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "Your account has been created successfully!!! <br> Please check your Email!!!"; ?></div>
66 66
                             <div class="margin-b-20 padding-r-32 padding-l-32">
67 67
                             <div class="col-md-12 no-padding">
68
-													<a href="<?php echo base_url();?>">
68
+													<a href="<?php echo base_url(); ?>">
69 69
 														<input type="submit" value="Go to Login Page" name="Login" style="border-radius: 3px" class="btn btn-success col-md-12 margin-t-10">
70 70
 													</a>
71 71
 									  				</div>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/views/view_signup_active.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     <link href="<?= base_url() ?>assets/css/global-style.css" rel="stylesheet" type="text/css">
12 12
     
13 13
      <!-- IE -->
14
-    <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.js"></script>
15
-    <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.src.js"></script>
14
+    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.js"></script>
15
+    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.src.js"></script>
16 16
     <noscript>
17 17
 	 <div id="noscript-warning">
18 18
 	  ASTPP work best with JavaScript enabled
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
             <div class="row">
36 36
 
37 37
 			<div class="col-md-4 col-md-offset-4">&nbsp;<span class="login_error">
38
-                        <?php if (isset($astpp_notification)){ ?>
38
+                        <?php if (isset($astpp_notification)) { ?>
39 39
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
40
-                    <?php }else{
40
+                    <?php } else {
41 41
                          echo "&nbsp;";
42 42
                     } 
43 43
 			$astpp_err_msg = $this->session->flashdata('astpp_signupmsg');
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                            	<img alt="login" src="<?= base_url() ?>assets/images/logo.png">
61 61
                            </div>
62 62
                            <div class="col-md-3">
63
-							   <a class="btn btn-success col-md-12 margin-t-10" href="<?php echo base_url();?>">Login</a>
63
+							   <a class="btn btn-success col-md-12 margin-t-10" href="<?php echo base_url(); ?>">Login</a>
64 64
 
65 65
 						   </div>
66 66
                            
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	echo "<div <div class=\"col-md-12 margin-t-10 margin-b-10 padding-r-32 padding-l-32\" style=\"color: #232222;\">Password : ".$this->common->decode($user_data['password'])."</div>";
80 80
 	echo "<br><br>";
81 81
 	  
82
-	 }else
82
+	 } else
83 83
 	 {
84 84
 	echo "<div class=\"col-md-12 margin-t-10 margin-b-20 padding-r-32 padding-l-32\" style=\"color: #232222;\">Link is Expire Please Try Again</div><br>";
85 85
 echo "";
Please login to merge, or discard this patch.
astpp/application/modules/signup/views/view_successpassword.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 		    	<div class="col-md-12 no-padding">
53 53
 
54 54
 
55
-	      <? if($this->session->userdata('userlevel_logintype') != '0'){?>
56
-			<a class="col-md-9" href="<?php echo base_url();?>">
57
-                	<img id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png">
58
-	      <? } else{?> 
59
-                	<a class="col-md-9" href="<?php echo base_url();?>">
60
-                	<img id="logo" alt="user_logo" src="<?php echo base_url();?>assets/images/logo.png">
55
+	      <? if ($this->session->userdata('userlevel_logintype') != '0') {?>
56
+			<a class="col-md-9" href="<?php echo base_url(); ?>">
57
+                	<img id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png">
58
+	      <? } else {?> 
59
+                	<a class="col-md-9" href="<?php echo base_url(); ?>">
60
+                	<img id="logo" alt="user_logo" src="<?php echo base_url(); ?>assets/images/logo.png">
61 61
 		<? }?>
62 62
                 </a>
63 63
       
64 64
 	
65
-		<div class="col-md-3"><a href="<?php echo base_url();?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12"></a></div>
65
+		<div class="col-md-3"><a href="<?php echo base_url(); ?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12"></a></div>
66 66
 	
67 67
 </div>
68 68
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 <form class="form-light col-md-12 no-padding" action="<?php echo base_url(); ?>signup/successpassword/" method="post" accept-charset="utf-8" id="customer_form" name="customer_form">
73 73
 
74
-<input type="hidden" name="email" value=<?php echo $email;?>>
74
+<input type="hidden" name="email" value=<?php echo $email; ?>>
75 75
 <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32">
76 76
 <h3 style="color: #37A137 !important; padding: 0 0 10px;"><i class="fa fa-check-circle" style="color:#37A137;"></i> Your password successfully changed</h3>
77 77
 </div> 
Please login to merge, or discard this patch.
astpp/application/modules/signup/views/view_signup_inactive.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
           <div class="w-section inverse no-padding margin-t-20">                       
52 52
              <div class="w-box dark sign-in-wr box_shadow margin-b-10">
53 53
 		    	<div class="col-md-12 no-padding">
54
-					  <? if($this->session->userdata('userlevel_logintype') != '0'){?>
55
-						<a class="col-md-9" href="<?php echo base_url();?>">
56
-								<img id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png">
57
-					  <? } else{?> 
58
-								<a class="col-md-9" href="<?php echo base_url();?>">
59
-								<img id="logo" alt="user_logo" src="<?php echo base_url();?>assets/images/logo.png">
54
+					  <? if ($this->session->userdata('userlevel_logintype') != '0') {?>
55
+						<a class="col-md-9" href="<?php echo base_url(); ?>">
56
+								<img id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png">
57
+					  <? } else {?> 
58
+								<a class="col-md-9" href="<?php echo base_url(); ?>">
59
+								<img id="logo" alt="user_logo" src="<?php echo base_url(); ?>assets/images/logo.png">
60 60
 					<? }?>
61 61
 							</a>
62 62
 
63 63
 			
64
-					<div class="col-md-3"><a href="<?php echo base_url();?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div>
64
+					<div class="col-md-3"><a href="<?php echo base_url(); ?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div>
65 65
 		
66 66
 		</div>
67 67
 	
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 <br>
71 71
 
72 72
 <form class="form-light col-md-12 no-padding" action="<?php echo base_url(); ?>signup/successpassword/" method="post" accept-charset="utf-8" id="customer_form" name="customer_form">
73
-<input type="hidden" name="email" value=<?php echo $email;?>>
73
+<input type="hidden" name="email" value=<?php echo $email; ?>>
74 74
 <div class="col-md-12 margin-t-20 margin-b-10 padding-r-32 padding-l-32" style="color:#232222;">
75 75
 <br/>	Sorry, we cannot process for singup at this time.<br>Please contact administrator for more information<br><br>
76 76
 </div>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/models/signup_model.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 		$this->db->select("id,name");
43 43
 		$this->db->from('pricelists');
44
-		$this->db->where("status","0");
44
+		$this->db->where("status", "0");
45 45
 		$query = $this->db->get();
46 46
 		return $query->row();
47 47
 
@@ -51,49 +51,49 @@  discard block
 block discarded – undo
51 51
 		$data['reseller_id'] = $data['key_unique'];	
52 52
 		unset($data['agreeCheck']);
53 53
 		unset($data['key_unique']);
54
-		$data['creation']=gmdate('Y-m-d H:i:s');
54
+		$data['creation'] = gmdate('Y-m-d H:i:s');
55 55
 		$data['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years'));
56
-		$this->db->insert("accounts",$data);
56
+		$this->db->insert("accounts", $data);
57 57
 		return   $this->db->insert_id();
58 58
 	    }
59 59
 
60
-	function check_user($accno,$email,$balance)
60
+	function check_user($accno, $email, $balance)
61 61
 	{
62
-		$info = array("number"=>$accno,"email"=>$email,"status"=>1);
62
+		$info = array("number"=>$accno, "email"=>$email, "status"=>1);
63 63
                         $this->db->where($info);
64 64
                         $this->db->select('*');
65
-		$acc_res=$this->db->get('accounts');
66
-		if($acc_res->num_rows() > 0)	
65
+		$acc_res = $this->db->get('accounts');
66
+		if ($acc_res->num_rows() > 0)	
67 67
 		{         
68
-                        $acc_res=$acc_res->result_array();
69
-                        $acc_res=$acc_res[0];
70
-                        $this->db->where('pricelist_id',$acc_res['pricelist_id']);
68
+                        $acc_res = $acc_res->result_array();
69
+                        $acc_res = $acc_res[0];
70
+                        $this->db->where('pricelist_id', $acc_res['pricelist_id']);
71 71
                         $this->db->select("*");
72
-                        $charge_res=$this->db->get('charges');
72
+                        $charge_res = $this->db->get('charges');
73 73
                         
74
-			if($charge_res->num_rows() > 0){
75
-			$charge_res=$charge_res->result_array();
76
-                        $charge_res=$charge_res[0];
77
-                        $charge_acc_arr=array(
74
+			if ($charge_res->num_rows() > 0) {
75
+			$charge_res = $charge_res->result_array();
76
+                        $charge_res = $charge_res[0];
77
+                        $charge_acc_arr = array(
78 78
 						"charge_id"=>$charge_res['id'],
79 79
 						"accountid"=>$acc_res['id'],
80 80
 						"status"=>0,
81 81
 						"assign_date"=>date('Y-m-d H:i:s')
82 82
 					     );
83
-			}else{
84
-			$charge_res=$charge_res->result_array();
83
+			} else {
84
+			$charge_res = $charge_res->result_array();
85 85
 			//echo "<pre>"; print_r($charge_res); exit;
86 86
 			$charge_acc_arr = array("charge_id"=>'id',
87 87
 						"accountid"=>$acc_res['id'],
88 88
 						"assign_date"=>date('Y-m-d H:i:s'));
89 89
 			}
90
-                        $result=$this->db->insert("charge_to_account",$charge_acc_arr);
91
-			$update = array("status" => 0,"balance" => $balance );
90
+                        $result = $this->db->insert("charge_to_account", $charge_acc_arr);
91
+			$update = array("status" => 0, "balance" => $balance);
92 92
 			$this->db->where($info);
93 93
 			$result = $this->db->update('accounts', $update);
94
-			$sip_device_update = array('username'=>$accno,"status"=>1);
94
+			$sip_device_update = array('username'=>$accno, "status"=>1);
95 95
 			return 1;
96
-		}else{
96
+		} else {
97 97
 			return 0;
98 98
 		}
99 99
 	}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/user/controllers/user.php 1 patch
Spacing   +393 added lines, -393 removed lines patch added patch discarded remove patch
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
 
38 38
     function index() {
39 39
         if ($this->session->userdata('user_login') == FALSE)
40
-            redirect(base_url() . 'login/login');
40
+            redirect(base_url().'login/login');
41 41
         $data['page_title'] = 'Dashboard';
42 42
         $this->load->view('view_user_dashboard', $data);
43 43
     }
44 44
 
45 45
     function user_dashboard_recent_payments() {
46
-        $result=$this->user_model->user_dashboard_recent_recharge_info();
47
-	$gmtoffset=$this->common->get_timezone_offset();
48
-        $i=0;
49
-        $json_data=array();
50
-        if($result->num_rows() > 0)
46
+        $result = $this->user_model->user_dashboard_recent_recharge_info();
47
+	$gmtoffset = $this->common->get_timezone_offset();
48
+        $i = 0;
49
+        $json_data = array();
50
+        if ($result->num_rows() > 0)
51 51
 	{
52
-		 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts','');
53
-		 $json_data[0]['accountid']='Accounts';
54
-		 $json_data[0]['credit']='Amount';
55
-		 $json_data[0]['payment_date']='Date';
56
-		 $json_data[0]['notes']='Notes';
57
-		 foreach($result->result_array() as $key=>$data){
58
-		      $current_timestamp=strtotime($data['payment_date']);
59
-		      $modified_date=$current_timestamp+$gmtoffset;
60
-          	      $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous";
61
-		      $json_data[$i]['accountid']=$data['accountid'];
62
-		      $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false);
63
-		      $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset);
64
-		       $json_data[$i]['notes']=$data['notes'];
52
+		 $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', '');
53
+		 $json_data[0]['accountid'] = 'Accounts';
54
+		 $json_data[0]['credit'] = 'Amount';
55
+		 $json_data[0]['payment_date'] = 'Date';
56
+		 $json_data[0]['notes'] = 'Notes';
57
+		 foreach ($result->result_array() as $key=>$data) {
58
+		      $current_timestamp = strtotime($data['payment_date']);
59
+		      $modified_date = $current_timestamp + $gmtoffset;
60
+          	      $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous";
61
+		      $json_data[$i]['accountid'] = $data['accountid'];
62
+		      $json_data[$i]['credit'] = $this->common_model->calculate_currency($data['credit'], '', '', true, false);
63
+		      $json_data[$i]['payment_date'] = date('Y-m-d H:i:s', strtotime($data['payment_date']) + $gmtoffset);
64
+		       $json_data[$i]['notes'] = $data['notes'];
65 65
 		      $i++;
66 66
           	}
67 67
           }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     }   
92 92
     function user_dashboard_invoices_data() {
93 93
         $accountinfo = $this->session->userdata('accountinfo');
94
-        $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id']));
94
+        $currency = $this->common->get_field_name('currency', 'currency', array("id"=>$accountinfo['currency_id']));
95 95
         $this->db->where('accountid', $accountinfo['id']);
96 96
         $this->db->where('confirm', 1);
97 97
         $this->db->select('*');
@@ -109,20 +109,20 @@  discard block
 block discarded – undo
109 109
             $json_data[0]['inv_type'] = 'Recharge Type';
110 110
             $i = 1;
111 111
             foreach ($result as $key => $data) {
112
-	        $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$data['id']));
112
+	        $invoice_prefix = $entity_type = $this->common->get_field_name('invoice_prefix', 'invoices', array('id'=>$data['id']));
113 113
 
114
-	        $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$data['id']));
115
-			$invoice_num=$invoice_prefix.$invoiceid;
116
-			$inv_type=$this->common->get_invoice_total('item_type', '', $data['id']);
117
-			if($inv_type == ''){
118
-			  $inv_type='Automatically';
114
+	        $invoiceid = $entity_type = $this->common->get_field_name('invoiceid', 'invoices', array('id'=>$data['id']));
115
+			$invoice_num = $invoice_prefix.$invoiceid;
116
+			$inv_type = $this->common->get_invoice_total('item_type', '', $data['id']);
117
+			if ($inv_type == '') {
118
+			  $inv_type = 'Automatically';
119 119
 			}
120
-			if($inv_type == 'manual_inv'){
121
-			  $inv_type='Manually';
120
+			if ($inv_type == 'manual_inv') {
121
+			  $inv_type = 'Manually';
122 122
 			}
123
-			$inv_debit=$this->common->get_invoice_total('debit', '', $data['id']);
124
-			if($inv_debit == ''){
125
-			  $inv_debit=$this->common->convert_to_currency('', '',0);
123
+			$inv_debit = $this->common->get_invoice_total('debit', '', $data['id']);
124
+			if ($inv_debit == '') {
125
+			  $inv_debit = $this->common->convert_to_currency('', '', 0);
126 126
 			}
127 127
 			$json_data[$i]['type'] = $data['type'];
128 128
 			$json_data[$i]['id'] = $invoice_num;
@@ -136,54 +136,54 @@  discard block
 block discarded – undo
136 136
         echo json_encode($json_data);
137 137
     }
138 138
     
139
-    function user_dashboard_subscription_data(){
140
-		$accountinfo=$this->session->userdata('accountinfo');
141
-		$this->db->where('accountid',$accountinfo['id']);
139
+    function user_dashboard_subscription_data() {
140
+		$accountinfo = $this->session->userdata('accountinfo');
141
+		$this->db->where('accountid', $accountinfo['id']);
142 142
 		$this->db->select('*');
143
-		$this->db->order_by('assign_date','desc');
144
-		$result=$this->db->get('charge_to_account',10);
145
-		$json_data=array();
143
+		$this->db->order_by('assign_date', 'desc');
144
+		$result = $this->db->get('charge_to_account', 10);
145
+		$json_data = array();
146 146
       
147
-		$gmtoffset=$this->common->get_timezone_offset();
148
-		if($result->num_rows()> 0 ){
149
-		$result=$result->result_array();
150
-		$charge_str=null;
151
-		$charges_arr=array();
152
-		foreach($result as $charges_data){
153
-			$charge_str.=$charges_data['charge_id'].",";
147
+		$gmtoffset = $this->common->get_timezone_offset();
148
+		if ($result->num_rows() > 0) {
149
+		$result = $result->result_array();
150
+		$charge_str = null;
151
+		$charges_arr = array();
152
+		foreach ($result as $charges_data) {
153
+			$charge_str .= $charges_data['charge_id'].",";
154 154
 		}
155
-		$charge_str=rtrim($charge_str,",");
155
+		$charge_str = rtrim($charge_str, ",");
156 156
 		$where = "id IN ($charge_str)";
157 157
 		$this->db->where($where);
158 158
 		$this->db->select('id,description,sweep_id');
159
-		$charge_result=$this->db->get('charges');
160
-		foreach($charge_result->result_array() as $data){
161
-			$charges_arr[$data['id']]['description']=$data['description'];
162
-			$charges_arr[$data['id']]['sweep_id']=$data['sweep_id'];
159
+		$charge_result = $this->db->get('charges');
160
+		foreach ($charge_result->result_array() as $data) {
161
+			$charges_arr[$data['id']]['description'] = $data['description'];
162
+			$charges_arr[$data['id']]['sweep_id'] = $data['sweep_id'];
163 163
 		}
164
-		$json_data[0]['charge_id']='Charge Name';
165
-		$json_data[0]['assign_date']='Assign Date';
166
-		$json_data[0]['sweep_id']='Billing Cycle';
167
-		$i=1;
168
-		foreach($result as $key=>$data){
169
-		if(isset($charges_arr[$data['charge_id']]['sweep_id'])){
170
-			$sweep_id= $charges_arr[$data['charge_id']]['sweep_id'];
164
+		$json_data[0]['charge_id'] = 'Charge Name';
165
+		$json_data[0]['assign_date'] = 'Assign Date';
166
+		$json_data[0]['sweep_id'] = 'Billing Cycle';
167
+		$i = 1;
168
+		foreach ($result as $key=>$data) {
169
+		if (isset($charges_arr[$data['charge_id']]['sweep_id'])) {
170
+			$sweep_id = $charges_arr[$data['charge_id']]['sweep_id'];
171 171
 		}
172
-		$data['charge_id'] =isset($charges_arr[$data['charge_id']]['description']) ? $charges_arr[$data['charge_id']]['description'] :"Anonymous";
173
-		$json_data[$i]['charge_id']=$data['charge_id'];
174
-		if($data['assign_date'] != '0000-00-00 00:00:00'){
175
-			$json_data[$i]['assign_date']=date('Y-m-d H:i:s',strtotime($data['assign_date'])+$gmtoffset);
176
-		}else{
177
-			$json_data[$i]['assign_date']=$data['assign_date'];
172
+		$data['charge_id'] = isset($charges_arr[$data['charge_id']]['description']) ? $charges_arr[$data['charge_id']]['description'] : "Anonymous";
173
+		$json_data[$i]['charge_id'] = $data['charge_id'];
174
+		if ($data['assign_date'] != '0000-00-00 00:00:00') {
175
+			$json_data[$i]['assign_date'] = date('Y-m-d H:i:s', strtotime($data['assign_date']) + $gmtoffset);
176
+		} else {
177
+			$json_data[$i]['assign_date'] = $data['assign_date'];
178 178
 		}
179
-		if(isset($sweep_id)){
180
-			if($sweep_id ==0){
181
-				$json_data[$i]['sweep_id']='Daily';
182
-			}else{
183
-				$json_data[$i]['sweep_id']='Monthly';			
179
+		if (isset($sweep_id)) {
180
+			if ($sweep_id == 0) {
181
+				$json_data[$i]['sweep_id'] = 'Daily';
182
+			} else {
183
+				$json_data[$i]['sweep_id'] = 'Monthly';			
184 184
 			}
185
-		}else{
186
-			$json_data[$i]['sweep_id']='Anonymous';
185
+		} else {
186
+			$json_data[$i]['sweep_id'] = 'Anonymous';
187 187
 		}
188 188
 		$i++;
189 189
 		}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     function user_edit_account() {
195 195
         if ($add_array['id'] != '') {
196 196
             $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($add_array['id']), $add_array);
197
-            $data['page_title'] = 'Edit ' . $entity_name;
197
+            $data['page_title'] = 'Edit '.$entity_name;
198 198
             if ($this->form_validation->run() == FALSE) {
199 199
                 $data['validation_errors'] = validation_errors();
200 200
             } else {
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
                 $this->accounts->accounts_model->edit_account($add_array, $add_array['id']);
204 204
                 $accountinfo = $this->session->userdata('accountinfo');
205 205
                 if ($add_array['id'] == $accountinfo['id']) {
206
-                    $this->session->set_userdata('accountinfo',(array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row());
206
+                    $this->session->set_userdata('accountinfo', (array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row());
207 207
                 }
208
-                $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!');
209
-                redirect(base_url() . 'user/user/');
208
+                $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' updated successfully!');
209
+                redirect(base_url().'user/user/');
210 210
             }
211 211
             $this->load->view('view_user_details', $data);
212 212
         } else {
213
-            $data['page_title'] = 'Edit ' . $entity_name;
213
+            $data['page_title'] = 'Edit '.$entity_name;
214 214
             $where = array('id' => $account_data["id"]);
215 215
             $account = $this->db_model->getSelect("*", "accounts", $where);
216 216
             $data["account_data"] = $account->result_array();
@@ -227,52 +227,52 @@  discard block
 block discarded – undo
227 227
     function user_did_edit($edit_id = '') {
228 228
         $data['page_title'] = 'Edit DIDs';
229 229
         $account_data = $this->session->userdata("accountinfo");
230
-        $this->db->where('id',$edit_id);
230
+        $this->db->where('id', $edit_id);
231 231
         $this->db->select('id,call_type,extensions,number');
232
-        $did_info=(array)$this->db->get('dids')->first_row();
233
-        $did_info['free_didlist']=$did_info['id'];
234
-        $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(),$did_info);
232
+        $did_info = (array)$this->db->get('dids')->first_row();
233
+        $did_info['free_didlist'] = $did_info['id'];
234
+        $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(), $did_info);
235 235
         $this->load->view('view_user_did_edit', $data);
236 236
     }
237 237
 
238
-    function user_dids_action($action,$did_id = "") {
238
+    function user_dids_action($action, $did_id = "") {
239 239
         $accountinfo = $this->session->userdata('accountinfo');
240 240
         $reseller_id = $accountinfo['reseller_id'];
241 241
         $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id;
242 242
           
243
-        if($did_id !=''){
244
-            $account_query = $this->db_model->getSelect("*", "accounts",array('id' => $accountinfo['id']));
245
-            $account_arr = (array) $account_query->first_row();
243
+        if ($did_id != '') {
244
+            $account_query = $this->db_model->getSelect("*", "accounts", array('id' => $accountinfo['id']));
245
+            $account_arr = (array)$account_query->first_row();
246 246
             $did_query = $this->db_model->getSelect("*", "dids", array("id" => $did_id));
247
-            $did_arr = (array) $did_query->first_row();
248
-        if ($action == "add"){
249
-            if($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id ) {
250
-             $setup_cost=$did_arr['setup'];
247
+            $did_arr = (array)$did_query->first_row();
248
+        if ($action == "add") {
249
+            if ($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id) {
250
+             $setup_cost = $did_arr['setup'];
251 251
                 if ($accountinfo["reseller_id"] > 0) {
252
-                    $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'],"reseller_id"=>$accountinfo['reseller_id']));
252
+                    $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'], "reseller_id"=>$accountinfo['reseller_id']));
253 253
                     $reseller_pricing_arr = (array)$reseller_pricing_res->first_row();
254
-                    $setup_cost=$reseller_pricing_arr['setup'];
254
+                    $setup_cost = $reseller_pricing_arr['setup'];
255 255
                 }
256 256
                 $available_bal = $this->db_model->get_available_bal($account_arr);
257 257
                 if ($available_bal >= $setup_cost) {
258
-                    $available_bal = $this->db_model->update_balance($setup_cost,$accountinfo["id"], "debit");
259
-                    $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row();
260
-                    $this->common->add_invoice_details($accountinfo,"DIDCHRG",$setup_cost,$did_arr['number']);
261
-                    $this->db_model->update("dids", array("accountid" => $accountinfo["id"],"assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id));
262
-                    $this->common->mail_to_users('email_add_did', $account_arr,"",$did_arr['number']);
258
+                    $available_bal = $this->db_model->update_balance($setup_cost, $accountinfo["id"], "debit");
259
+                    $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$accountinfo['id']))->first_row();
260
+                    $this->common->add_invoice_details($accountinfo, "DIDCHRG", $setup_cost, $did_arr['number']);
261
+                    $this->db_model->update("dids", array("accountid" => $accountinfo["id"], "assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id));
262
+                    $this->common->mail_to_users('email_add_did', $account_arr, "", $did_arr['number']);
263 263
                     $this->session->set_flashdata('astpp_errormsg', 'Did added successfully.');
264
-                    redirect(base_url() . "user/user_didlist/");
264
+                    redirect(base_url()."user/user_didlist/");
265 265
                 } else {
266 266
                     $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did');
267
-                    redirect(base_url() . "user/user_didlist/");
267
+                    redirect(base_url()."user/user_didlist/");
268 268
                 }
269
-        }else{
269
+        } else {
270 270
                 $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.');
271
-                redirect(base_url() . "user/user_didlist/");
271
+                redirect(base_url()."user/user_didlist/");
272 272
         }
273 273
         }
274 274
         if ($action == "edit") {
275
-            $add_array=$this->input->post();
275
+            $add_array = $this->input->post();
276 276
 	    $data['form'] = $this->form->build_form($this->user_form->build_user_did_form($add_array['free_didlist']), $add_array);
277 277
 	    if ($this->form_validation->run() == FALSE) {
278 278
                 $data['validation_errors'] = validation_errors();
@@ -280,27 +280,27 @@  discard block
 block discarded – undo
280 280
                 exit;
281 281
             } else {
282 282
 	      $update_arr = array("call_type" => $add_array['call_type'],
283
-		  "extensions" => $add_array['extensions'],"last_modified_date"=>gmdate("Y-m-d H:i:s")
283
+		  "extensions" => $add_array['extensions'], "last_modified_date"=>gmdate("Y-m-d H:i:s")
284 284
 	      );
285 285
 	      $this->db->update("dids", $update_arr, array("id" => $did_id));
286
-	      if($accountinfo['reseller_id'] > 0 ){
286
+	      if ($accountinfo['reseller_id'] > 0) {
287 287
 		  
288
-		  $this->db->update('reseller_pricing',$update_arr,array('note'=>$did_arr['number']));
288
+		  $this->db->update('reseller_pricing', $update_arr, array('note'=>$did_arr['number']));
289 289
 	      }
290
-	      echo json_encode(array("SUCCESS" => $did_arr['number'] . " DID Updated Successfully!"));
290
+	      echo json_encode(array("SUCCESS" => $did_arr['number']." DID Updated Successfully!"));
291 291
 	      exit;
292 292
             }
293 293
             $this->load->view('view_user_did_edit', $data);
294 294
         }
295 295
         if ($action == "delete") {
296
-            $this->db->update("dids", array("accountid" =>0,"assign_date" =>"0000-00-00 00:00:00" , 'charge_upto'=>"0000-00-00 00:00:00"),array("id" => $did_id));
297
-            $this->common->mail_to_users('email_remove_did', $account_arr,"",$did_arr['number']);
296
+            $this->db->update("dids", array("accountid" =>0, "assign_date" =>"0000-00-00 00:00:00", 'charge_upto'=>"0000-00-00 00:00:00"), array("id" => $did_id));
297
+            $this->common->mail_to_users('email_remove_did', $account_arr, "", $did_arr['number']);
298 298
             $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.');
299
-            redirect(base_url() . "user/user_didlist/");
299
+            redirect(base_url()."user/user_didlist/");
300 300
         }
301
-        }else{
301
+        } else {
302 302
 	  $this->session->set_flashdata('astpp_notification', 'DID not found.');
303
-	  redirect(base_url() . "user/user_didlist/");
303
+	  redirect(base_url()."user/user_didlist/");
304 304
         }
305 305
     }
306 306
 
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
         $query = $this->user_model->get_user_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
327 327
         $grid_fields = json_decode($this->user_form->user_rates_list());
328 328
         foreach ($query->result_array() as $key => $value) {
329
-            $cost=$account_data['type']!=3 ? ($value['cost'] + (($value['cost']*$markup)/100)) : $value['cost'];
329
+            $cost = $account_data['type'] != 3 ? ($value['cost'] + (($value['cost'] * $markup) / 100)) : $value['cost'];
330 330
             $json_data['rows'][] = array('cell' => array(
331
-                    $this->common->get_only_numeric_val("","",$value["pattern"]),
331
+                    $this->common->get_only_numeric_val("", "", $value["pattern"]),
332 332
                     $value['comment'],
333
-                    $this->common_model->calculate_currency($value['connectcost'],'','',true,false),
333
+                    $this->common_model->calculate_currency($value['connectcost'], '', '', true, false),
334 334
                     $value['includedseconds'],
335
-                    $this->common_model->calculate_currency(($cost),'','',true,false),
335
+                    $this->common_model->calculate_currency(($cost), '', '', true, false),
336 336
                     $value['init_inc'],
337 337
                     $value['inc']                   
338 338
             ));
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
         if ($this->input->post('advance_search', TRUE) == 1) {
347 347
             $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
348 348
             $action = $this->input->post();
349
-            unset($action['action'],$action['advance_search']);
349
+            unset($action['action'], $action['advance_search']);
350 350
             if (isset($action['connectcost']['connectcost']) && $action['connectcost']['connectcost'] != '') {
351 351
                 $action['connectcost']['connectcost'] = $this->common_model->add_calculate_currency($action['connectcost']['connectcost'], "", '', true, false);
352 352
             }
353 353
             if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') {
354 354
                 $account_data = $this->session->userdata("accountinfo");
355 355
                 $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
356
-                $markup = ($markup > 0)?$markup:1;
356
+                $markup = ($markup > 0) ? $markup : 1;
357 357
                 $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false);
358
-                if($account_data['type']!=3)
359
-                    $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100);
358
+                if ($account_data['type'] != 3)
359
+                    $action['cost']['cost'] = ($action['cost']['cost'] - ($action['cost']['cost'] * $markup) / 100);
360 360
             }
361 361
             $this->session->set_userdata('user_rates_list_search', $action);
362 362
         }
363 363
         if ($ajax_search != 1) {
364
-            redirect(base_url() . 'user/user_rates_list/');
364
+            redirect(base_url().'user/user_rates_list/');
365 365
         }
366 366
     }
367 367
 
@@ -371,34 +371,34 @@  discard block
 block discarded – undo
371 371
     }
372 372
     
373 373
     function user_rates_list_export() {
374
-	$account_data=$this->session->userdata('accountinfo');
375
-        $currency_id=$account_data['currency_id'];
376
-        $currency=$this->common->get_field_name('currency', 'currency', $currency_id);
374
+	$account_data = $this->session->userdata('accountinfo');
375
+        $currency_id = $account_data['currency_id'];
376
+        $currency = $this->common->get_field_name('currency', 'currency', $currency_id);
377 377
         $query = $this->user_model->get_user_rates_list(true, '', '', false);
378 378
         $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
379 379
         ob_clean();
380
-        $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Initital Increment","Increment");
380
+        $inbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initital Increment", "Increment");
381 381
         if ($query->num_rows() > 0) {
382 382
             foreach ($query->result_array() as $row) {
383
-		$cost=$account_data['type']!=3 ? ($row['cost'] + ($row['cost']*$markup)/100) :$row['cost'];
383
+		$cost = $account_data['type'] != 3 ? ($row['cost'] + ($row['cost'] * $markup) / 100) : $row['cost'];
384 384
 		$inbound_array[] = array(
385
-                        $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
385
+                        $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
386 386
                         $row['comment'],
387
-                        $this->common_model->calculate_currency($row['connectcost'],'','',true,false),
387
+                        $this->common_model->calculate_currency($row['connectcost'], '', '', true, false),
388 388
                         $row['includedseconds'],
389
-			$this->common_model->calculate_currency($cost,'','',true,false),
389
+			$this->common_model->calculate_currency($cost, '', '', true, false),
390 390
 			$row['init_inc'],
391 391
                         $row['inc']
392 392
                     );
393 393
             }
394 394
         }
395 395
         $this->load->helper('csv');
396
-        array_to_csv($inbound_array, 'Rates_' . date("Y-m-d") . '.csv');
396
+        array_to_csv($inbound_array, 'Rates_'.date("Y-m-d").'.csv');
397 397
     } 
398 398
 
399 399
     function user_refill($action = "") {
400 400
         if (common_model::$global_config['system_config']['paypal_status'] == 1) {
401
-            redirect(base_url() . 'user/user/');
401
+            redirect(base_url().'user/user/');
402 402
         }
403 403
         $this->load->module("user/refill");
404 404
         if ($action == "GET_AMT") {
@@ -440,14 +440,14 @@  discard block
 block discarded – undo
440 440
                 $this->load->model('user_model');
441 441
                 $this->user_model->change_db_password($update, $id);
442 442
                 $this->session->set_flashdata('astpp_errormsg', "Password changed Sucessfully....!!!");
443
-                redirect(base_url() . 'user/user/changepassword/');
443
+                redirect(base_url().'user/user/changepassword/');
444 444
             } else {
445 445
                 $this->session->set_flashdata('astpp_notification', "New Password & Conformpassword not match.");
446
-                redirect(base_url() . 'user/user/changepassword/');
446
+                redirect(base_url().'user/user/changepassword/');
447 447
             }
448 448
         } else {
449 449
             $this->session->set_flashdata('astpp_notification', "Invalid old passwword.");
450
-            redirect(base_url() . 'user/user/changepassword/');
450
+            redirect(base_url().'user/user/changepassword/');
451 451
         }
452 452
     }
453 453
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         $acc_data = $this->session->userdata("accountinfo");
474 474
         $reseller_id = $acc_data['reseller_id'];
475 475
 
476
-        $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='" . $reseller_id . "'");
476
+        $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='".$reseller_id."'");
477 477
         $reseller_data = array();
478 478
         $data['refill_coupon_list'] = form_dropdown_all('refill_coupon_list', $reseller_data, '');
479 479
         $this->load->view('view_refill_coupon_list', $data);
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
                 echo json_encode(2);
504 504
             } else {
505 505
                 $this->db->select('balance');
506
-                $result = (array)$this->db->get_where('accounts',array('id'=>$customer_id))->first_row();
507
-                $user_balance=$this->db_model->get_available_bal($accountinfo);
508
-                $original_balance=$refill_coupon_result['amount'];
509
-                $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance,'','',TRUE,TRUE);
510
-                $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance+$original_balance,'','',TRUE,TRUE);
506
+                $result = (array)$this->db->get_where('accounts', array('id'=>$customer_id))->first_row();
507
+                $user_balance = $this->db_model->get_available_bal($accountinfo);
508
+                $original_balance = $refill_coupon_result['amount'];
509
+                $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance, '', '', TRUE, TRUE);
510
+                $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance + $original_balance, '', '', TRUE, TRUE);
511 511
                 echo json_encode($refill_coupon_result);
512 512
             }
513 513
         } else {
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
             $this->db->where('number', $refill_coupon_no);
542 542
             $refill_coupon_data = array('status' => 2, "account_id" => $customer_id, 'firstused' => $date);
543 543
             $this->db->update('refill_coupon', $refill_coupon_data);
544
-            $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. ' . $refill_coupon_no . '');
544
+            $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. '.$refill_coupon_no.'');
545 545
             $this->db->insert('payments', $payment_arr);
546 546
         }
547
-        redirect(base_url() . "user/user_refill_coupon_list/");
547
+        redirect(base_url()."user/user_refill_coupon_list/");
548 548
     }
549 549
 
550 550
     function user_packages() {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
     function user_packages_json() {
557 557
         $json_data = array();
558
-        $count_all = $this->user_model->get_user_packages_list(false,'','');
558
+        $count_all = $this->user_model->get_user_packages_list(false, '', '');
559 559
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
560 560
         $json_data = $paging_data["json_paging"];
561 561
         $query = $this->user_model->get_user_packages_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
@@ -598,19 +598,19 @@  discard block
 block discarded – undo
598 598
         $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
599 599
         echo json_encode($json_data);
600 600
     }
601
-    function user_emails_search(){
601
+    function user_emails_search() {
602 602
         $ajax_search = $this->input->post('ajax_search', 0);
603 603
         if ($this->input->post('advance_search', TRUE) == 1) {
604 604
             $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
605 605
             $action = $this->input->post();
606
-            unset($action['action'],$action['advance_search']);
606
+            unset($action['action'], $action['advance_search']);
607 607
             $this->session->set_userdata('user_emails_search', $action);
608 608
         }
609 609
         if (@$ajax_search != 1) {
610
-            redirect(base_url() . 'user/user_emails/');
610
+            redirect(base_url().'user/user_emails/');
611 611
         }
612 612
     }
613
-    function user_emails_clearsearchfilter(){
613
+    function user_emails_clearsearchfilter() {
614 614
         $this->session->set_userdata('advance_search', 0);
615 615
         $this->session->set_userdata('user_emails_search', "");
616 616
     }
@@ -622,30 +622,30 @@  discard block
 block discarded – undo
622 622
         if (isset($add_array['submit'])) {
623 623
             if ($_FILES['file']['name'] == '') {
624 624
                 $invoiceconf = $this->user_model->get_invoiceconf();
625
-                $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : '';
625
+                $file_name = ($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : '';
626 626
             }
627 627
             if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
628 628
                 $files = $_FILES['file'];
629 629
                 if ($files['size'] < 0) {
630 630
                     $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file');
631
-	            redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
631
+	            redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
632 632
                 }
633 633
                 $file = $_FILES['file'];
634 634
                 $uploadedFile = $file["tmp_name"];
635 635
                 $file_name = $file['name'];
636 636
                 $file_type = $file['type'];
637 637
                 if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') {
638
-                    $dir_path = FCPATH. "upload/";
639
-                    $path = $dir_path . $add_array['accountid']."_".$file['name'];
638
+                    $dir_path = FCPATH."upload/";
639
+                    $path = $dir_path.$add_array['accountid']."_".$file['name'];
640 640
                     if (move_uploaded_file($uploadedFile, $path)) {
641 641
                         $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!'));
642 642
                     } else {
643 643
                         $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again");
644
-                        redirect(base_url() . 'user/user_invoice_config/');
644
+                        redirect(base_url().'user/user_invoice_config/');
645 645
                     }
646 646
                 } else {
647 647
                     $this->session->set_flashdata('astpp_notification', 'Please upload only image!');
648
-                    redirect(base_url() . 'user/user_invoice_config/');
648
+                    redirect(base_url().'user/user_invoice_config/');
649 649
                 }
650 650
             }
651 651
             $add_array['logo'] = $file_name;
@@ -657,24 +657,24 @@  discard block
 block discarded – undo
657 657
                 $this->user_model->edit_invoice_config($add_array, $add_array['id']);
658 658
             }
659 659
             $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!');
660
-            redirect(base_url() . 'user/user_invoice_config/');
660
+            redirect(base_url().'user/user_invoice_config/');
661 661
         } else {
662
-            $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$accountinfo['id']))->first_row();
663
-            if(isset($data["account_data"]['logo'])){
664
-	            $data["account_data"]['file']=$accountinfo['id']."_".$data["account_data"]['logo'];
662
+            $data["account_data"] = (array)$this->db->get_where('invoice_conf', array("accountid"=>$accountinfo['id']))->first_row();
663
+            if (isset($data["account_data"]['logo'])) {
664
+	            $data["account_data"]['file'] = $accountinfo['id']."_".$data["account_data"]['logo'];
665 665
 	    }
666 666
             $this->load->view('view_user_invoices_config', $data);
667 667
         }
668 668
     }
669 669
 
670
-     function user_invoice_logo_delete($accountid){
671
-	$invoiceconf  = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
672
-	$result=$invoiceconf->result_array();
673
-	$logo=$result[0]['logo'];
674
-	$post_arr=array('logo'=>'');
675
-	$where_arr=array('logo'=>$logo);
670
+     function user_invoice_logo_delete($accountid) {
671
+	$invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
672
+	$result = $invoiceconf->result_array();
673
+	$logo = $result[0]['logo'];
674
+	$post_arr = array('logo'=>'');
675
+	$where_arr = array('logo'=>$logo);
676 676
 	$this->db->where($where_arr);
677
-	$this->db->update('invoice_conf',$post_arr);
677
+	$this->db->update('invoice_conf', $post_arr);
678 678
      }
679 679
     
680 680
     function user_myprofile() {
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
                     $result = $this->db->get_where('accounts', array('id' => $add_array['id']));
694 694
                     $result = $result->result_array();
695 695
                     $this->session->set_userdata('accountinfo', $result[0]);
696
-                    $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!');
697
-                    redirect(base_url() . 'user/user_myprofile/');
698
-                }else{
696
+                    $this->session->set_flashdata('astpp_errormsg', ' Your profile updated successfully!');
697
+                    redirect(base_url().'user/user_myprofile/');
698
+                } else {
699 699
                     $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.');
700 700
                 }
701 701
             }
@@ -717,35 +717,35 @@  discard block
 block discarded – undo
717 717
         $accountinfo = $this->session->userdata("accountinfo");
718 718
         $data['page_title'] = "Change Password";
719 719
         $add_array = $this->input->post();    
720
-        if(!empty($add_array)) {
720
+        if ( ! empty($add_array)) {
721 721
             $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $add_array);
722 722
             if ($this->form_validation->run() == FALSE) {
723 723
                 $data['validation_errors'] = validation_errors();
724 724
             } else {
725 725
                 $password_encode = $this->common->encode($add_array['new_password']);
726 726
                 $data = array('password' => $password_encode);
727
-                $this->db->where('id',$add_array['id']);
727
+                $this->db->where('id', $add_array['id']);
728 728
                 $this->db->update('accounts', $data);
729 729
                 $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!');
730
-                redirect(base_url() . 'user/user_change_password/');
730
+                redirect(base_url().'user/user_change_password/');
731 731
             }
732
-        }else{
733
-            $data_array['id']=$accountinfo['id'];
734
-            $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array);
732
+        } else {
733
+            $data_array['id'] = $accountinfo['id'];
734
+            $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $data_array);
735 735
         }
736 736
         $this->load->view('view_user_change_password', $data);
737 737
     }
738 738
 
739 739
     function user_refill_report() {
740
-        $accountinfo=$this->session->userdata('accountinfo');
740
+        $accountinfo = $this->session->userdata('accountinfo');
741 741
         $data['page_title'] = 'Refill Report';
742 742
         $data['search_flag'] = true;
743 743
         $this->session->set_userdata('advance_search', 0);
744 744
         $data['grid_fields'] = $this->user_form->build_user_refill_report();
745 745
         $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search());
746
-        if($accountinfo['type'] == 1){
746
+        if ($accountinfo['type'] == 1) {
747 747
             $this->load->view('view_reseller_refill_report', $data);
748
-        }else{
748
+        } else {
749 749
             $this->load->view('view_user_refill_report', $data);
750 750
         }
751 751
     }
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
     function user_refill_report_json() {
754 754
         $json_data = array();
755 755
         $count_all = $this->user_model->get_user_refill_list(false);
756
-        $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']);
756
+        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
757 757
         $json_data = $paging_data["json_paging"];
758 758
         $query = $this->user_model->get_user_refill_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
759 759
         $grid_fields = json_decode($this->user_form->build_user_refill_report());
@@ -766,14 +766,14 @@  discard block
 block discarded – undo
766 766
         if ($this->input->post('advance_search', TRUE) == 1) {
767 767
             $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
768 768
             $action = $this->input->post();
769
-            unset($action['action'],$action['advance_search']);
769
+            unset($action['action'], $action['advance_search']);
770 770
             if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') {
771 771
              $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false);
772 772
             }
773 773
             $this->session->set_userdata('user_refill_report_search', $action);
774 774
         }
775 775
         if (@$ajax_search != 1) {
776
-            redirect(base_url() . 'user/user_refill_report/');
776
+            redirect(base_url().'user/user_refill_report/');
777 777
         }
778 778
     }
779 779
     
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $count_all = $this->user_model->get_user_invoice_list(false, '', '', $where);
797 797
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
798 798
         $json_data = $paging_data["json_paging"];
799
-        $user_currency=$this->common->get_field_name('currency','currency',$accountinfo['currency_id']);
799
+        $user_currency = $this->common->get_field_name('currency', 'currency', $accountinfo['currency_id']);
800 800
         $invoices_query = $this->user_model->get_user_invoice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $where);
801 801
         $invoices_result = $invoices_query->result_array();
802 802
         $ountstanding_value = 0;
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
         $total_credit = (array)$invoice_details_result->first_row();
808 808
         $total_credit = $total_credit['total_credit'];
809 809
         foreach ($invoices_result as $key => $value) {
810
-            $total_amount+=$value['amount'];
810
+            $total_amount += $value['amount'];
811 811
             $invoice_date = date("Y-m-d", strtotime($value['invoice_date']));
812 812
             $from_date = date("Y-m-d", strtotime($value['from_date']));
813 813
             $due_date = date("Y-m-d", strtotime($value['due_date']));
@@ -822,23 +822,23 @@  discard block
 block discarded – undo
822 822
             if ($invoice_total_query->num_rows() > 0) {
823 823
                 $invoice_total_result = $invoice_total_query->result_array();
824 824
             }
825
-            $download = '<a href="' . base_url() . '/user/user_invoice_download/' . $value['id'] . '/00' . $value['invoice_prefix'] . $value['invoiceid'] . '" class="btn btn-royelblue btn-sm"  title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a>&nbsp';
826
-          if($value['type'] == 'I'){
825
+            $download = '<a href="'.base_url().'/user/user_invoice_download/'.$value['id'].'/00'.$value['invoice_prefix'].$value['invoiceid'].'" class="btn btn-royelblue btn-sm"  title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a>&nbsp';
826
+          if ($value['type'] == 'I') {
827 827
             if ($outstanding > 0) {
828
-                $payment = ' <a style="padding: 0 8px;" href="' . base_url() . 'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning"  title="Payment">Unpaid</a>';
828
+                $payment = ' <a style="padding: 0 8px;" href="'.base_url().'user/user_invoice_payment/'.$value['id'].'" class="btn btn-warning"  title="Payment">Unpaid</a>';
829 829
             } else {
830 830
                 $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>';
831 831
             }
832
-	   }else{
832
+	   } else {
833 833
                 $payment = '';
834 834
 	   }
835
-            if($value['generate_type'] == 1){
836
-		$invoice_type='Manually';
837
-	   }else{
838
-		$invoice_type='Automatically';
835
+            if ($value['generate_type'] == 1) {
836
+		$invoice_type = 'Manually';
837
+	   } else {
838
+		$invoice_type = 'Automatically';
839 839
 	   } 
840 840
 	   
841
-	   if($value['type'] == 'R'){
841
+	   if ($value['type'] == 'R') {
842 842
 		$icon = '<div class="flx_font flx_magenta">R</div>';
843 843
 		}
844 844
 		else
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 			$payment_last,
857 857
 			$this->common->currency_decimal($this->common_model->calculate_currency($value['amount'])),
858 858
 			$this->common->currency_decimal($this->common_model->calculate_currency($outstanding)),
859
-			$download . $payment,
859
+			$download.$payment,
860 860
 			));
861 861
 			$ountstanding_value = $ountstanding_value + $outstanding;
862 862
         }
@@ -871,13 +871,13 @@  discard block
 block discarded – undo
871 871
 			print_r($action);
872 872
             unset($action['action']);
873 873
             unset($action['advance_search']);
874
-            $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0] . " 00:00:00" : '';
875
-            $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1] . " 23:59:59" : '';
876
-            $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0] . " 00:00:00" : '';
874
+            $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0]." 00:00:00" : '';
875
+            $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1]." 23:59:59" : '';
876
+            $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0]." 00:00:00" : '';
877 877
             $this->session->set_userdata('user_invoice_list_search', $action);
878 878
         }
879 879
         if (@$ajax_search != 1) {
880
-            redirect(base_url() . 'user/user_invoice_list/');
880
+            redirect(base_url().'user/user_invoice_list/');
881 881
         }
882 882
     }
883 883
 
@@ -890,25 +890,25 @@  discard block
 block discarded – undo
890 890
         $this->load->module('invoices/invoices');
891 891
         $this->invoices->invoice_main_download($invoiceid);
892 892
     }
893
-    function user_list_responce(){
893
+    function user_list_responce() {
894 894
 	$this->load->module('invoices/invoices');
895 895
         $this->invoices->invoice_list_responce();
896 896
     }
897
-     function user_invoice_payment($invoiceid){
897
+     function user_invoice_payment($invoiceid) {
898 898
 	$this->load->module('invoices/invoices');
899 899
         $this->invoices->invoice_summary($invoiceid);
900 900
     }	
901
-    function user_invoice_payment_pay($action=""){
901
+    function user_invoice_payment_pay($action = "") {
902 902
         $this->load->module("user/payment");
903
-        if($action=="GET_AMT"){
904
-            $amount = $this->input->post("value",true);
905
-       $amount = $this->common_model->add_calculate_currency($amount,"","",true,false);
906
-       echo number_format($amount,2);
907
-        }else{
903
+        if ($action == "GET_AMT") {
904
+            $amount = $this->input->post("value", true);
905
+       $amount = $this->common_model->add_calculate_currency($amount, "", "", true, false);
906
+       echo number_format($amount, 2);
907
+        } else {
908 908
             $this->payment->index();
909 909
         }
910 910
     }
911
-    function user_invoice_download($invoiceid){
911
+    function user_invoice_download($invoiceid) {
912 912
 	$this->load->module('invoices/invoices');
913 913
         $this->invoices->invoice_download($invoiceid);
914 914
     }    
@@ -927,43 +927,43 @@  discard block
 block discarded – undo
927 927
         $json_data = $paging_data["json_paging"];
928 928
         $query = $this->user_model->get_user_charge_history(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
929 929
 
930
-	$result= $query->result_array();
931
-        $query1 = $this->user_model->get_user_charge_history(true,'','');
932
-	$res= $query1->result_array();
933
-	$debit=0;
934
-	$credit=0;
935
-	$before_balance=0;
936
-	$after_balance=0;
937
-	$i=0;
930
+	$result = $query->result_array();
931
+        $query1 = $this->user_model->get_user_charge_history(true, '', '');
932
+	$res = $query1->result_array();
933
+	$debit = 0;
934
+	$credit = 0;
935
+	$before_balance = 0;
936
+	$after_balance = 0;
937
+	$i = 0;
938 938
         foreach ($result as $key => $value) {
939
-   	     $date=$this->common->convert_GMT_to('','',$value['created_date']);
939
+   	     $date = $this->common->convert_GMT_to('', '', $value['created_date']);
940 940
  	     $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']);	    
941
-	        $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid']));
942
-	        $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid']));
943
-		$invoice_num=$invoice_prefix.$invoiceid;
944
-		$account=$this->common->get_field_name_coma_new('first_name,last_name,number','accounts',$value['accountid']);
945
-		$reseller=$this->common->reseller_select_value('first_name,last_name,number','accounts',$value['reseller_id']);
946
-		$item_type=$value['item_type'];
947
-		if($value['before_balance'] == '-'){
948
-			$before_balance='-';
949
-		}else{		
950
-			$before_balance=$this->common->convert_to_currency('','',$value['before_balance']);
941
+	        $invoice_prefix = $entity_type = $this->common->get_field_name('invoice_prefix', 'invoices', array('id'=>$value['invoiceid']));
942
+	        $invoiceid = $entity_type = $this->common->get_field_name('invoiceid', 'invoices', array('id'=>$value['invoiceid']));
943
+		$invoice_num = $invoice_prefix.$invoiceid;
944
+		$account = $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', $value['accountid']);
945
+		$reseller = $this->common->reseller_select_value('first_name,last_name,number', 'accounts', $value['reseller_id']);
946
+		$item_type = $value['item_type'];
947
+		if ($value['before_balance'] == '-') {
948
+			$before_balance = '-';
949
+		} else {		
950
+			$before_balance = $this->common->convert_to_currency('', '', $value['before_balance']);
951 951
 		}
952
-		if($value['debit'] == '-'){
953
-			$debit='-';
954
-		}else{		
955
-			$debit=$this->common->convert_to_currency('','',$value['debit']);
952
+		if ($value['debit'] == '-') {
953
+			$debit = '-';
954
+		} else {		
955
+			$debit = $this->common->convert_to_currency('', '', $value['debit']);
956 956
 		}
957
-		$credit=$this->common->convert_to_currency('','',$value['credit']);
958
-    	     if($cust_type == 0 && $value['item_type'] == 'INVPAY'){
957
+		$credit = $this->common->convert_to_currency('', '', $value['credit']);
958
+    	     if ($cust_type == 0 && $value['item_type'] == 'INVPAY') {
959 959
 		$credit = '(-) '.$credit;
960 960
 	     }
961
-		if($value['after_balance'] == '-'){
962
-			$after_balance='-';
963
-		}else{		
964
-			$after_balance=$this->common->convert_to_currency('','',$value['after_balance']);
961
+		if ($value['after_balance'] == '-') {
962
+			$after_balance = '-';
963
+		} else {		
964
+			$after_balance = $this->common->convert_to_currency('', '', $value['after_balance']);
965 965
 		}
966
-		$description=$value['description'];
966
+		$description = $value['description'];
967 967
 	        $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']);	    
968 968
             $json_data['rows'][] = array('cell' => array(
969 969
 							$date,
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         }
980 980
 	$debit_sum = 0;
981 981
 	$credit_sum = 0;
982
-	foreach($res as $value){
982
+	foreach ($res as $value) {
983 983
  	     $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']);	    
984 984
  	     $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']);	    
985 985
 		$debit_sum += $value['debit'];
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		$before_balance += $value['before_balance'];
988 988
 		$after_balance += $value['after_balance'];
989 989
 	}
990
-	        $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-');
990
+	        $json_data['rows'][$count_all]['cell'] = array('<b>Total</b>', '-', '-', '-', '<b>'.$this->common->convert_to_currency('', '', $debit_sum).'</b>', '<b>'.$this->common->convert_to_currency('', '', $credit_sum).'</b>', '-', '-');
991 991
       echo json_encode($json_data);
992 992
 
993 993
 
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
             $action = $this->input->post();
1000 1000
             unset($action['action']);
1001 1001
             unset($action['advance_search']);
1002
-            $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0] . " 00:00:00" : '';
1003
-            $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1] . " 23:59:59" : '';
1002
+            $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0]." 00:00:00" : '';
1003
+            $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1]." 23:59:59" : '';
1004 1004
             if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') {
1005 1005
                 $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false);
1006 1006
             }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
             $this->session->set_userdata('user_charge_history_search', $action);
1011 1011
         }
1012 1012
         if (@$ajax_search != 1) {
1013
-            redirect(base_url() . 'user/user_charges_history/');
1013
+            redirect(base_url().'user/user_charges_history/');
1014 1014
         }
1015 1015
     }
1016 1016
 
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
     function user_subscriptions_json() {
1030 1030
         
1031
-        $accountinfo=$this->session->userdata('accountinfo');
1031
+        $accountinfo = $this->session->userdata('accountinfo');
1032 1032
         $json_data = array();
1033 1033
         $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id";
1034 1034
         $table = "charges";
@@ -1059,14 +1059,14 @@  discard block
 block discarded – undo
1059 1059
             if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') {
1060 1060
                 $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false);
1061 1061
             }
1062
-            if(isset($action['sweep_id']) && $action['sweep_id'] != ''){
1063
-                $action['charges.sweep_id']=$action['sweep_id'];
1062
+            if (isset($action['sweep_id']) && $action['sweep_id'] != '') {
1063
+                $action['charges.sweep_id'] = $action['sweep_id'];
1064 1064
                 unset($action['sweep_id']);
1065 1065
             }
1066 1066
             $this->session->set_userdata('user_subscription_search', $action);
1067 1067
         }
1068 1068
         if (@$ajax_search != 1) {
1069
-            redirect(base_url() . 'user/user_subscriptions/');
1069
+            redirect(base_url().'user/user_subscriptions/');
1070 1070
         }
1071 1071
     }
1072 1072
 
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
     }
1077 1077
 
1078 1078
     function user_didlist() {
1079
-        $accountinfo=$this->session->userdata('accountinfo');
1079
+        $accountinfo = $this->session->userdata('accountinfo');
1080 1080
         $data['page_title'] = 'Purchase DIDs';
1081 1081
         $data['search_flag'] = true;
1082 1082
         $data['grid_fields'] = $this->user_form->build_user_didlist();
@@ -1084,38 +1084,38 @@  discard block
 block discarded – undo
1084 1084
         $data["grid_buttons"] = array();
1085 1085
         $acc_data = $this->session->userdata("accountinfo");
1086 1086
         $data['accountid'] = $acc_data['id'];
1087
-        $data['country_id']=$acc_data['country_id'];
1087
+        $data['country_id'] = $acc_data['country_id'];
1088 1088
         $result_did_final = array();
1089
-        if($accountinfo['reseller_id'] > 0){
1089
+        if ($accountinfo['reseller_id'] > 0) {
1090 1090
 	  $this->db->select('dids.id, dids.number, reseller_pricing.setup, reseller_pricing.monthlycost');
1091
-	  $this->db->where('dids.accountid',0);
1092
-	  $this->db->where('reseller_pricing.note','dids.number',false);
1093
-	  $this->db->where('reseller_pricing.reseller_id',$accountinfo['reseller_id']);
1091
+	  $this->db->where('dids.accountid', 0);
1092
+	  $this->db->where('reseller_pricing.note', 'dids.number', false);
1093
+	  $this->db->where('reseller_pricing.reseller_id', $accountinfo['reseller_id']);
1094 1094
 	  $this->db->from('dids,reseller_pricing');
1095
-        }else{
1096
-	  $this->db->where('parent_id',0);
1097
-	  $this->db->where('accountid',0);
1095
+        } else {
1096
+	  $this->db->where('parent_id', 0);
1097
+	  $this->db->where('accountid', 0);
1098 1098
 	  $this->db->select('id,number,setup,monthlycost');
1099 1099
 	  $this->db->from('dids');
1100 1100
         }
1101
-        $dids_array=(array)$this->db->get()->result_array();
1102
-        $drp_list=array();
1103
-        if(!empty($dids_array)){
1101
+        $dids_array = (array)$this->db->get()->result_array();
1102
+        $drp_list = array();
1103
+        if ( ! empty($dids_array)) {
1104 1104
 	  foreach ($dids_array as $drp_value) {
1105
-	    if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) {
1106
-	      $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'],'','',true,true);
1105
+	    if ( ! empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) {
1106
+	      $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'], '', '', true, true);
1107 1107
 	    } else {
1108 1108
 		$did_cost = 0;
1109 1109
 	    }
1110
-	    if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) {
1111
-		$did_setup = $this->common_model->to_calculate_currency($drp_value['setup'],'','',true,true);
1110
+	    if ( ! empty($drp_value['setup']) && $drp_value['setup'] != 0) {
1111
+		$did_setup = $this->common_model->to_calculate_currency($drp_value['setup'], '', '', true, true);
1112 1112
 	    } else {
1113 1113
 		$did_setup = 0;
1114 1114
 	    }
1115
-	    $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )';
1115
+	    $drp_list[$drp_value['id']] = $drp_value['number'].' ( Setup : '.$did_setup.')'.'( Monthly : '.$did_cost.' )';
1116 1116
 	  }
1117 1117
         }
1118
-        $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist","id"=>"free_didlist","class"=>"did_dropdown"), $drp_list, '');
1118
+        $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist", "id"=>"free_didlist", "class"=>"did_dropdown"), $drp_list, '');
1119 1119
         $this->load->view('view_user_did_list', $data);
1120 1120
     }
1121 1121
 
@@ -1155,9 +1155,9 @@  discard block
 block discarded – undo
1155 1155
         if ($this->input->post('advance_search', TRUE) == 1) {
1156 1156
             $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
1157 1157
             $action = $this->input->post();
1158
-            $accountinfo=$this->session->userdata('accountinfo');
1159
-            if($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0){
1160
-	      $action['dids.call_type']=$action['call_type'];
1158
+            $accountinfo = $this->session->userdata('accountinfo');
1159
+            if ($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0) {
1160
+	      $action['dids.call_type'] = $action['call_type'];
1161 1161
 	      unset($action['call_type']);
1162 1162
             }
1163 1163
             unset($action['action']);
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
             $this->session->set_userdata('user_did_search', $action);
1166 1166
         }
1167 1167
         if (@$ajax_search != 1) {
1168
-            redirect(base_url() . 'user/user_didlist/');
1168
+            redirect(base_url().'user/user_didlist/');
1169 1169
         }
1170 1170
     }
1171 1171
 
@@ -1174,14 +1174,14 @@  discard block
 block discarded – undo
1174 1174
         $this->session->set_userdata('user_did_search', "");
1175 1175
     }
1176 1176
     
1177
-    function user_ipmap(){
1177
+    function user_ipmap() {
1178 1178
         $this->session->set_userdata('advance_search', 0);
1179 1179
         $data['grid_fields'] = $this->user_form->build_user_ipmap();
1180 1180
         $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_ipmap_search());
1181 1181
         $this->load->view('view_user_ipmap_list', $data);
1182 1182
     }
1183 1183
     
1184
-    function user_ipmap_json(){
1184
+    function user_ipmap_json() {
1185 1185
         $json_data = array();
1186 1186
         $account_data = $this->session->userdata("accountinfo");
1187 1187
         $count_all = $this->user_model->user_ipmap_list(false);
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
         echo json_encode($json_data);
1194 1194
     }
1195 1195
 
1196
-    function user_ipmap_search(){
1196
+    function user_ipmap_search() {
1197 1197
         $ajax_search = $this->input->post('ajax_search', 0);
1198 1198
         if ($this->input->post('advance_search', TRUE) == 1) {
1199 1199
             $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
@@ -1203,24 +1203,24 @@  discard block
 block discarded – undo
1203 1203
             $this->session->set_userdata('user_ipmap_search', $action);
1204 1204
         }
1205 1205
         if (@$ajax_search != 1) {
1206
-            redirect(base_url() . 'user/user_ipmap/');
1206
+            redirect(base_url().'user/user_ipmap/');
1207 1207
         }
1208 1208
     }
1209 1209
     
1210
-    function user_ipmap_clearsearchfilter(){
1210
+    function user_ipmap_clearsearchfilter() {
1211 1211
         $this->session->set_userdata('advance_search', 0);
1212 1212
         $this->session->set_userdata('user_ipmap_search', "");
1213 1213
     }
1214 1214
     
1215
-    function user_ipmap_action($action='delete',$id=false){
1216
-        $add_array=$this->input->post();
1217
-        $accountinfo=$this->session->userdata('accountinfo');
1218
-        if($action == 'add'){
1215
+    function user_ipmap_action($action = 'delete', $id = false) {
1216
+        $add_array = $this->input->post();
1217
+        $accountinfo = $this->session->userdata('accountinfo');
1218
+        if ($action == 'add') {
1219 1219
               $ip = $add_array['ip'];
1220 1220
               if (strpos($ip, '/') !== false) {
1221 1221
                  $add_array['ip'] = $add_array['ip'];
1222 1222
               } else {
1223
-                $add_array['ip'] = $add_array['ip'] . '/32';
1223
+                $add_array['ip'] = $add_array['ip'].'/32';
1224 1224
               }
1225 1225
               $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix']));
1226 1226
               $getdata = $this->db_model->countQuery("*", "ip_map", $where);
@@ -1241,8 +1241,8 @@  discard block
 block discarded – undo
1241 1241
                 $this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.');
1242 1242
             }
1243 1243
             }
1244
-        if($action =='delete'){
1245
-            $this->db->delete('ip_map',array('id'=>$id));
1244
+        if ($action == 'delete') {
1245
+            $this->db->delete('ip_map', array('id'=>$id));
1246 1246
             $this->session->set_flashdata('astpp_notification', 'IP Removed Sucessfully.');
1247 1247
         }
1248 1248
         redirect(base_url()."user/user_ipmap/");
@@ -1263,23 +1263,23 @@  discard block
 block discarded – undo
1263 1263
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
1264 1264
         $json_data = $paging_data["json_paging"];
1265 1265
         $devices_result = array();
1266
-        $query = $this->user_model->user_sipdevices_list(true,$account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
1266
+        $query = $this->user_model->user_sipdevices_list(true, $account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
1267 1267
         foreach ($query as $key => $value) {
1268 1268
 	$path_true = base_url().'/assets/images/true.png';
1269 1269
 	$path_false = base_url().'/assets/images/false.png';
1270
-	$voicemail_enabled = $value['voicemail_enabled'] == 'true'? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
1270
+	$voicemail_enabled = $value['voicemail_enabled'] == 'true' ? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
1271 1271
         $json_data['rows'][] = array('cell' => array(
1272
-		    '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>',
1272
+		    '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>',
1273 1273
                     $value['username'],
1274 1274
                     $value['password'],
1275 1275
                     $value['effective_caller_id_name'],
1276 1276
                     $value['effective_caller_id_number'],
1277
-                    $this->common->get_status('status', 'sip_devices',$value),
1278
-                    $this->common->convert_GMT_to('','',$value['creation_date']),
1279
-                    $this->common->convert_GMT_to('','',$value['last_modified_date']),
1277
+                    $this->common->get_status('status', 'sip_devices', $value),
1278
+                    $this->common->convert_GMT_to('', '', $value['creation_date']),
1279
+                    $this->common->convert_GMT_to('', '', $value['last_modified_date']),
1280 1280
                     $voicemail_enabled,
1281
-                    '<a href="'. base_url() .'user/user_sipdevices_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;'.
1282
-                    '<a href="'. base_url() .'user/user_sipdevices_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>'
1281
+                    '<a href="'.base_url().'user/user_sipdevices_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;'.
1282
+                    '<a href="'.base_url().'user/user_sipdevices_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>'
1283 1283
                     ));
1284 1284
         }
1285 1285
         echo json_encode($json_data);
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
             $this->session->set_userdata('user_sipdevices_search', $action);
1295 1295
         }
1296 1296
         if (@$ajax_search != 1) {
1297
-            redirect(base_url() . 'user/user_sipdevices/');
1297
+            redirect(base_url().'user/user_sipdevices/');
1298 1298
         }
1299 1299
     }
1300 1300
     
@@ -1303,12 +1303,12 @@  discard block
 block discarded – undo
1303 1303
         $this->session->set_userdata('user_sipdevices_search', "");
1304 1304
     }
1305 1305
         
1306
-    function user_sipdevices_add(){
1306
+    function user_sipdevices_add() {
1307 1307
         $data['page_title'] = 'Create SIP Device';
1308
-        $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(),"");
1308
+        $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(), "");
1309 1309
         $this->load->view('view_user_sipdevices_add_edit', $data);
1310 1310
     }
1311
-    function user_sipdevices_edit($edit_id=''){
1311
+    function user_sipdevices_edit($edit_id = '') {
1312 1312
         $account_data = $this->session->userdata("accountinfo");
1313 1313
         $data['page_title'] = 'Edit SIP Device';
1314 1314
         $where = array('id' => $edit_id);
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
         $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($edit_id), $sipdevice_info);
1317 1317
         $this->load->view('view_user_sipdevices_add_edit', $data);
1318 1318
     }
1319
-    function user_sipdevices_save(){
1319
+    function user_sipdevices_save() {
1320 1320
         $add_array = $this->input->post();
1321 1321
         $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($add_array['id']), $add_array);
1322 1322
         if ($add_array['id'] != '') {
@@ -1344,15 +1344,15 @@  discard block
 block discarded – undo
1344 1344
         }
1345 1345
     }
1346 1346
     function user_sipdevices_delete($id) {
1347
-        $this->db->delete('sip_devices',array('id'=>$id));
1347
+        $this->db->delete('sip_devices', array('id'=>$id));
1348 1348
         $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Sucessfully!');
1349
-        redirect(base_url() . "user/user_sipdevices/");
1349
+        redirect(base_url()."user/user_sipdevices/");
1350 1350
     }
1351 1351
     
1352
-    function user_sipdevices_delete_multiple(){
1352
+    function user_sipdevices_delete_multiple() {
1353 1353
         $ids = $this->input->post("selected_ids", true);
1354 1354
         $where = "id IN ($ids)";
1355
-        $this->db->delete("sip_devices",$where);
1355
+        $this->db->delete("sip_devices", $where);
1356 1356
         echo TRUE;    
1357 1357
     }
1358 1358
     
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
             $cnt_result = $cnt_result->result_array();
1386 1386
             $count = $cnt_result[0]['count'];
1387 1387
             if ($count == 0) {
1388
-				if($add_array['number'] != ""){
1388
+				if ($add_array['number'] != "") {
1389 1389
                 $accountinfo = $this->session->userdata("accountinfo");
1390 1390
                 $insert_arr = array("number" => $add_array['number'],
1391 1391
                                     "accountid" => $accountinfo['id'],
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
                                     );
1394 1394
                 $this->db->insert("ani_map", $insert_arr);
1395 1395
                 $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!');
1396
-				}else{
1396
+				} else {
1397 1397
 					 $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.');
1398 1398
 				}
1399 1399
             } else {
@@ -1405,28 +1405,28 @@  discard block
 block discarded – undo
1405 1405
             $this->db_model->delete("ani_map", array("id" => $aniid));
1406 1406
             
1407 1407
         }
1408
-        redirect(base_url() . "user/user_animap_list/");
1408
+        redirect(base_url()."user/user_animap_list/");
1409 1409
     }
1410 1410
     
1411 1411
     function user_alert_threshold() {
1412 1412
         $data['page_title'] = 'Alert Threshold';
1413 1413
         $accountinfo = $this->session->userdata("accountinfo");
1414 1414
         $add_array = $this->input->post();
1415
-        if (!empty($add_array)) {
1416
-            unset($add_array['action'],$add_array['id']);
1415
+        if ( ! empty($add_array)) {
1416
+            unset($add_array['action'], $add_array['id']);
1417 1417
             $this->user_model->edit_alert_threshold($add_array, $accountinfo['id']);
1418 1418
             $this->session->set_flashdata('astpp_errormsg', 'Alert Threshold updated successfully!');
1419
-            redirect(base_url() . 'user/user_alert_threshold/');
1419
+            redirect(base_url().'user/user_alert_threshold/');
1420 1420
         } else {
1421 1421
             $where = array('id' => $accountinfo["id"]);
1422 1422
             $account = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email", "accounts", $where);
1423
-            $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(),(array)$account->first_row());
1423
+            $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(), (array)$account->first_row());
1424 1424
             $this->load->view('view_user_alert_threshold', $data);
1425 1425
         }
1426 1426
     }
1427 1427
     
1428 1428
     function user_cdrs_report() {
1429
-        $accountinfo=$this->session->userdata('accountinfo');
1429
+        $accountinfo = $this->session->userdata('accountinfo');
1430 1430
         $data['page_title'] = 'CDRs';
1431 1431
         $data['search_flag'] = true;
1432 1432
         $data["grid_buttons"] = $this->user_form->build_cdrs_report_buttons();
@@ -1436,10 +1436,10 @@  discard block
 block discarded – undo
1436 1436
     }
1437 1437
 
1438 1438
     function user_cdrs_report_json() {
1439
-        $accountinfo=$this->session->userdata('accountinfo');
1440
-        $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost';
1439
+        $accountinfo = $this->session->userdata('accountinfo');
1440
+        $variable = $accountinfo['type'] != 3 ? 'total_debit' : 'total_cost';
1441 1441
         $count_res = $this->user_model->getuser_cdrs_list(false, "", "");
1442
-        $count_all = (array) $count_res->first_row();
1442
+        $count_all = (array)$count_res->first_row();
1443 1443
         $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']);
1444 1444
         $json_data = $paging_data["json_paging"];
1445 1445
         $query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false);
@@ -1447,16 +1447,16 @@  discard block
 block discarded – undo
1447 1447
         $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
1448 1448
         if ($count_all['count'] > 0) {
1449 1449
             $search_arr = $this->session->userdata('user_cdrs_report_search');
1450
-            $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1451
-            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ?
1452
-            floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00"  : $count_all['billseconds'];
1450
+            $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1451
+            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ?
1452
+            floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds'];
1453 1453
             $json_data['rows'][] = array("cell" => array(
1454 1454
                     "<b>Grand Total</b>",
1455 1455
                     "",
1456 1456
                     "",
1457 1457
                     "",
1458 1458
                     $duration,
1459
-                    "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>",
1459
+                    "<b>".$this->common_model->calculate_currency($count_all[$variable], "", "", true, false)."</b>",
1460 1460
                     "",
1461 1461
                     "",
1462 1462
                     ));
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
             $this->session->set_userdata('user_cdrs_report_search', $action);
1478 1478
         }
1479 1479
         if (@$ajax_search != 1) {
1480
-            redirect(base_url() . 'user/user_cdrs_report/');
1480
+            redirect(base_url().'user/user_cdrs_report/');
1481 1481
         }
1482 1482
     }
1483 1483
 
@@ -1488,20 +1488,20 @@  discard block
 block discarded – undo
1488 1488
 
1489 1489
     function user_cdrreport_export() {
1490 1490
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
1491
-		$currency_id=$account_info['currency_id'];
1492
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
1491
+		$currency_id = $account_info['currency_id'];
1492
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
1493 1493
         $count_res = $this->user_model->getuser_cdrs_list(false, "", "");
1494
-        $count_all = (array) $count_res->first_row();
1494
+        $count_all = (array)$count_res->first_row();
1495 1495
         ob_clean();
1496
-        $customer_array[] = array("Date", "CallerID", "Called Number","Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type");
1496
+        $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type");
1497 1497
         if ($count_all['count'] > 0) {
1498 1498
             $query = $this->user_model->getuser_cdrs_list(true, '', '', true);
1499 1499
             $currency_info = $this->common->get_currency_info();
1500 1500
             $search_arr = $this->session->userdata('user_cdrs_report_search');
1501
-            $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1501
+            $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1502 1502
             foreach ($query->result_array() as $value) {
1503
-                $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ?
1504
-                                floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00"  : $value['billseconds'];
1503
+                $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ?
1504
+                                floor($value['billseconds'] / 60).":".sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds'];
1505 1505
                 $customer_array[] = array(
1506 1506
                     $this->common->convert_GMT_to('', '', $value['callstart']),
1507 1507
                     $value['callerid'],
@@ -1509,13 +1509,13 @@  discard block
 block discarded – undo
1509 1509
                     filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT),
1510 1510
                     $value['notes'],
1511 1511
                     $duration,
1512
-                    $this->common->calculate_currency_manually($currency_info, $value['debit'],false),
1512
+                    $this->common->calculate_currency_manually($currency_info, $value['debit'], false),
1513 1513
                     $value['disposition'],
1514 1514
                     $value['calltype']
1515 1515
                 );
1516 1516
             }
1517
-            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ?
1518
-                            floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00"  : $count_all['billseconds'];
1517
+            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ?
1518
+                            floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds'];
1519 1519
             $customer_array[] = array("Grand Total",
1520 1520
                 "",
1521 1521
                 "",
@@ -1528,26 +1528,26 @@  discard block
 block discarded – undo
1528 1528
             );
1529 1529
         }
1530 1530
         $this->load->helper('csv');
1531
-        array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv');
1531
+        array_to_csv($customer_array, 'Customer_CDR_'.date("Y-m-d").'.csv');
1532 1532
     }
1533
-    function user_payment($action=""){
1534
-      if(common_model::$global_config['system_config']['paypal_status'] == 1){
1535
-        redirect(base_url() . 'user/user/');  
1533
+    function user_payment($action = "") {
1534
+      if (common_model::$global_config['system_config']['paypal_status'] == 1) {
1535
+        redirect(base_url().'user/user/');  
1536 1536
       }
1537 1537
         $this->load->module("user/payment");
1538
-        if($action=="GET_AMT"){
1539
-            $amount = $this->input->post("value",true);
1538
+        if ($action == "GET_AMT") {
1539
+            $amount = $this->input->post("value", true);
1540 1540
             $this->payment->convert_amount($amount);
1541
-        }else{
1541
+        } else {
1542 1542
             $this->payment->index();
1543 1543
         }
1544 1544
     }
1545 1545
     
1546
-    function user_fund_transfer(){
1546
+    function user_fund_transfer() {
1547 1547
         $data['page_title'] = 'Fund Transfer';
1548 1548
         $accountinfo = $this->session->userdata('accountinfo');
1549
-        $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row();
1550
-        $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row();
1549
+        $account = (array)$this->db->get_where('accounts', array("id"=>$accountinfo['id']))->first_row();
1550
+        $currency = (array)$this->db->get_where('currency', array("id"=>$account['currency_id']))->first_row();
1551 1551
         $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), '');
1552 1552
         $this->load->view('view_user_fund_transfer', $data);
1553 1553
     }
@@ -1556,8 +1556,8 @@  discard block
 block discarded – undo
1556 1556
         $data['page_title'] = 'Fund Transfer';
1557 1557
         $post_array = $this->input->post();
1558 1558
         $accountinfo = $this->session->userdata('accountinfo');
1559
-        $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row();
1560
-        $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row();
1559
+        $account = (array)$this->db->get_where('accounts', array("id"=>$accountinfo['id']))->first_row();
1560
+        $currency = (array)$this->db->get_where('currency', array("id"=>$account['currency_id']))->first_row();
1561 1561
         $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), $post_array);
1562 1562
         if ($this->form_validation->run() == FALSE) {
1563 1563
             $data['validation_errors'] = validation_errors();
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
                 $account_info = $this->session->userdata('accountinfo');
1567 1567
                 $balance = $this->common->get_field_name('balance', 'accounts', array('id' => $account_info['id'], 'status' => 0, 'type' => 0, 'deleted' => 0));                
1568 1568
                 $toid = $this->common->get_field_name('id', 'accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0));
1569
-                $toaccountinfo=(array)$this->db->get_where('accounts',array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0),1)->first_row();
1570
-                if($toaccountinfo){
1569
+                $toaccountinfo = (array)$this->db->get_where('accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0), 1)->first_row();
1570
+                if ($toaccountinfo) {
1571 1571
                 $reseller_id = $toaccountinfo['reseller_id'];
1572 1572
                 $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], '', '', false, false);
1573
-                $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row();
1573
+                $minimum_fund = (array)$this->db->get_where('system', array("name"=>"minimum_fund_transfer"), 1)->first_row();
1574 1574
                 if ($post_array['toaccountid'] == $account_info['number']) {
1575 1575
                     $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.');
1576 1576
                 }
@@ -1586,21 +1586,21 @@  discard block
 block discarded – undo
1586 1586
                 elseif ($post_array['credit'] > $balance) {
1587 1587
                     $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.');
1588 1588
                 }
1589
-                elseif ($toid <= 0 || !isset($post_array['toaccountid'])) {
1589
+                elseif ($toid <= 0 || ! isset($post_array['toaccountid'])) {
1590 1590
                     $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.');
1591 1591
                 }
1592 1592
                 elseif ($post_array['credit'] < 0) {
1593 1593
                     $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.');
1594 1594
                 }
1595 1595
                 elseif ($minimum_fund['value'] >= $post_array['credit']) {
1596
-                    $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .');
1596
+                    $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer '.$minimum_fund['value'].' .');
1597 1597
                 }
1598
-                elseif (!isset($toid) || !isset($post_array['toaccountid'])) {
1598
+                elseif ( ! isset($toid) || ! isset($post_array['toaccountid'])) {
1599 1599
                     $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!');
1600 1600
                 }
1601 1601
                 elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) {
1602 1602
                     $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !');
1603
-                }else{
1603
+                } else {
1604 1604
                     $from['id'] = $post_array['id'];
1605 1605
                     $from['account_currency'] = $post_array['account_currency'];
1606 1606
                     $from['accountid'] = $post_array['fromaccountid'];
@@ -1635,13 +1635,13 @@  discard block
 block discarded – undo
1635 1635
                         $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.');
1636 1636
                     }
1637 1637
                 }
1638
-            }else{
1638
+            } else {
1639 1639
 		$this->session->set_flashdata('astpp_notification', 'Account number not found.');
1640 1640
             }
1641 1641
             } else {
1642 1642
                 $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.');
1643 1643
             }
1644
-            redirect(base_url() . 'user/user_fund_transfer/');
1644
+            redirect(base_url().'user/user_fund_transfer/');
1645 1645
         }
1646 1646
         $this->load->view('view_user_fund_transfer', $data);
1647 1647
     }
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
         $accountinfo = $this->session->userdata("accountinfo");
1660 1660
         $json_data = array();
1661 1661
         $count_all = $this->user_model->get_user_opensips(false, $accountinfo['number']);
1662
-        $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'],$_GET['page']);
1662
+        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
1663 1663
         $json_data = $paging_data["json_paging"];
1664 1664
         $query = $this->user_model->get_user_opensips(true, $accountinfo['number'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
1665 1665
         $grid_fields = json_decode($this->user_form->build_user_opensips());
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
             $this->session->set_userdata('user_opensips_search', $action);
1684 1684
         }
1685 1685
         if ($ajax_search != 1) {
1686
-            redirect(base_url() . 'user/user_opensips/');
1686
+            redirect(base_url().'user/user_opensips/');
1687 1687
         }
1688 1688
     }
1689 1689
 
@@ -1696,10 +1696,10 @@  discard block
 block discarded – undo
1696 1696
         $this->load->view('view_opensips_add_edit', $data);
1697 1697
     }
1698 1698
     
1699
-    function user_opensips_edit($edit_id){
1699
+    function user_opensips_edit($edit_id) {
1700 1700
 	$data['page_title'] = 'Edit Opensips';
1701 1701
         $db_config = Common_model::$global_config['system_config'];
1702
-        $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=";
1702
+        $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=";
1703 1703
         $this->opensips_db = $this->load->database($opensipdsn, true);
1704 1704
         $where = array('id' => $edit_id);
1705 1705
         $this->opensips_db->where($where);
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
     
1713 1713
     }
1714 1714
     
1715
-    function user_opensips_save(){
1715
+    function user_opensips_save() {
1716 1716
 	$add_array = $this->input->post();
1717 1717
         $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), $add_array);
1718 1718
         if ($add_array['id'] != '') {
@@ -1723,11 +1723,11 @@  discard block
 block discarded – undo
1723 1723
                 exit;
1724 1724
             } else {
1725 1725
                 $auth_flag = $this->validate_device_data($add_array);
1726
-                if($auth_flag == "TRUE"){
1726
+                if ($auth_flag == "TRUE") {
1727 1727
                         $this->user_model->user_opensips_edit($add_array, $add_array['id']);
1728 1728
                         echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!"));
1729 1729
                         exit;
1730
-                }else{
1730
+                } else {
1731 1731
                        echo json_encode($auth_flag);
1732 1732
                        exit;
1733 1733
                 }
@@ -1740,48 +1740,48 @@  discard block
 block discarded – undo
1740 1740
                 exit;
1741 1741
             } else {
1742 1742
                 $auth_flag = $this->validate_device_data($add_array);
1743
-                if($auth_flag == "TRUE"){
1743
+                if ($auth_flag == "TRUE") {
1744 1744
                         $this->user_model->user_opensips_add($add_array);
1745 1745
                         echo json_encode(array("SUCCESS"=> "OpenSips added successfully!"));
1746 1746
                         exit;
1747
-                }else{
1747
+                } else {
1748 1748
                        echo json_encode($auth_flag);
1749 1749
                         exit;
1750 1750
                 }
1751 1751
             }
1752 1752
         }
1753 1753
     }
1754
-    function validate_device_data($data){
1755
-        if(isset($data["username"]) && $data["username"] != ""){
1754
+    function validate_device_data($data) {
1755
+        if (isset($data["username"]) && $data["username"] != "") {
1756 1756
                 $db_config = Common_model::$global_config['system_config'];
1757
-                $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=";
1757
+                $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=";
1758 1758
                 $this->opensips_db = $this->load->database($opensipdsn, true);
1759 1759
                 $where = array("username"=>$data["username"]);
1760
-                if($data['id'] != ""){
1761
-                    $this->opensips_db->where("id <>",$data['id']);
1760
+                if ($data['id'] != "") {
1761
+                    $this->opensips_db->where("id <>", $data['id']);
1762 1762
                 }
1763 1763
                 $this->opensips_db->where($where);
1764 1764
                 $auth_flag = $this->opensips_db->get("subscriber");
1765 1765
                 $auth_flag = $auth_flag->num_rows();
1766
-                if($auth_flag == 0){
1766
+                if ($auth_flag == 0) {
1767 1767
                     return "TRUE";
1768
-                }else{
1768
+                } else {
1769 1769
                     return array("username_error"=>"Duplicate Username Found.Username Must be Unique");
1770 1770
                 }
1771
-        }else{
1771
+        } else {
1772 1772
           return array("username_error"=>"User name is required field.");
1773 1773
         }
1774 1774
         return "0";
1775 1775
     }
1776 1776
     
1777
-    function user_opensips_delete($id){
1777
+    function user_opensips_delete($id) {
1778 1778
       $this->user_model->user_opensips_delete($id);
1779 1779
       $this->session->set_flashdata('astpp_errormsg', 'Opensips Device Removed Successfully!.');
1780
-      redirect(base_url() . "user/user_opensips/");
1780
+      redirect(base_url()."user/user_opensips/");
1781 1781
     }
1782
-    function user_opensips_delete_multiple(){
1782
+    function user_opensips_delete_multiple() {
1783 1783
       $db_config = Common_model::$global_config['system_config'];
1784
-      $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=";
1784
+      $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=";
1785 1785
       $this->opensips_db = $this->load->database($opensipdsn, true);
1786 1786
       $ids = $this->input->post("selected_ids", true);
1787 1787
       $where = "id IN ($ids)";
@@ -1790,27 +1790,27 @@  discard block
 block discarded – undo
1790 1790
       echo TRUE;
1791 1791
     }
1792 1792
     
1793
-    function user_cdrs(){
1793
+    function user_cdrs() {
1794 1794
       $data['username'] = $this->session->userdata('user_name');
1795
-      $accountinfo=$this->session->userdata('accountinfo');
1795
+      $accountinfo = $this->session->userdata('accountinfo');
1796 1796
       $data['page_title'] = 'CDRs';
1797 1797
       $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type']));
1798 1798
       $this->load->module('reports/reports');
1799 1799
       $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype);
1800 1800
       $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search());
1801
-      $data['accounttype']=$accounttype;
1801
+      $data['accounttype'] = $accounttype;
1802 1802
       $this->load->view('view_user_cdrs', $data);    
1803 1803
     }
1804
-    function user_cdrs_json(){
1805
-      $accountinfo=$this->session->userdata('accountinfo');
1804
+    function user_cdrs_json() {
1805
+      $accountinfo = $this->session->userdata('accountinfo');
1806 1806
       $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type']));
1807 1807
       $this->load->module('reports/reports');
1808 1808
       $this->reports->customer_cdrreport($accountinfo['id'], $accounttype);     
1809 1809
     }
1810
-    function user_details_search($module_name){
1810
+    function user_details_search($module_name) {
1811 1811
         $action = $this->input->post();
1812
-        $this->session->set_userdata('left_panel_search_'.$module_name,"");
1813
-        if(!empty($action['left_panel_search'])){
1812
+        $this->session->set_userdata('left_panel_search_'.$module_name, "");
1813
+        if ( ! empty($action['left_panel_search'])) {
1814 1814
             $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']);
1815 1815
 	}
1816 1816
     }
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
     
1823 1823
     
1824 1824
     function user_provider_cdrs_report() {
1825
-        $accountinfo=$this->session->userdata('accountinfo');
1825
+        $accountinfo = $this->session->userdata('accountinfo');
1826 1826
         $data['page_title'] = 'Provider CDRs Report';
1827 1827
         $data['search_flag'] = true;
1828 1828
         $data["grid_buttons"] = $this->user_form->build_provider_report_buttons();
@@ -1832,10 +1832,10 @@  discard block
 block discarded – undo
1832 1832
     }
1833 1833
 
1834 1834
     function user_provider_cdrs_report_json() {
1835
-        $accountinfo=$this->session->userdata('accountinfo');
1836
-        $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost';
1835
+        $accountinfo = $this->session->userdata('accountinfo');
1836
+        $variable = $accountinfo['type'] != 3 ? 'total_debit' : 'total_cost';
1837 1837
         $count_res = $this->user_model->getprovider_cdrs_list(false, "", "");
1838
-        $count_all = (array) $count_res->first_row();
1838
+        $count_all = (array)$count_res->first_row();
1839 1839
         $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']);
1840 1840
         $json_data = $paging_data["json_paging"];
1841 1841
         $query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false);
@@ -1843,16 +1843,16 @@  discard block
 block discarded – undo
1843 1843
         $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
1844 1844
         if ($count_all['count'] > 0) {
1845 1845
             $search_arr = $this->session->userdata('user_provider_cdrs_report_search');
1846
-            $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1847
-            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ?
1848
-            floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00"  : $count_all['billseconds'];
1846
+            $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1847
+            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ?
1848
+            floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds'];
1849 1849
             $json_data['rows'][] = array("cell" => array(
1850 1850
                     "<b>Grand Total</b>",
1851 1851
                     "",
1852 1852
                     "",
1853 1853
                     "",
1854 1854
                     $duration,
1855
-                    "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>",
1855
+                    "<b>".$this->common_model->calculate_currency($count_all[$variable], "", "", true, false)."</b>",
1856 1856
                     "",
1857 1857
                     "",
1858 1858
                     ));
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
             $this->session->set_userdata('user_provider_cdrs_report_search', $action);
1874 1874
         }
1875 1875
         if ($ajax_search != 1) {
1876
-            redirect(base_url() . 'user/user_provider_cdrs_report/');
1876
+            redirect(base_url().'user/user_provider_cdrs_report/');
1877 1877
         }
1878 1878
     }
1879 1879
 
@@ -1884,53 +1884,53 @@  discard block
 block discarded – undo
1884 1884
 
1885 1885
     function user_provider_cdrreport_export() {
1886 1886
 	$account_info = $accountinfo = $this->session->userdata('accountinfo');
1887
-	$currency_id=$account_info['currency_id'];
1888
-	$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
1887
+	$currency_id = $account_info['currency_id'];
1888
+	$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
1889 1889
         $count_res = $this->user_model->getprovider_cdrs_list(false, "", "");
1890
-        $count_all = (array) $count_res->first_row();
1890
+        $count_all = (array)$count_res->first_row();
1891 1891
         ob_clean();
1892 1892
         $customer_array[] = array("Date", "CallerID", "Called Number", "Destination", "Duration", "Cost($currency)", "Disposition", "Call Type");
1893 1893
         if ($count_all['count'] > 0) {
1894 1894
             $query = $this->user_model->getuser_cdrs_list(true, '', '', true);
1895 1895
             $currency_info = $this->common->get_currency_info();
1896 1896
             $search_arr = $this->session->userdata('user_provider_cdrs_report_search');
1897
-            $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1897
+            $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes';
1898 1898
             foreach ($query->result_array() as $value) {
1899
-                $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ?
1900
-                floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00"  : $value['billseconds'];
1899
+                $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ?
1900
+                floor($value['billseconds'] / 60).":".sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds'];
1901 1901
                 $customer_array[] = array(
1902 1902
                     $this->common->convert_GMT_to('', '', $value['callstart']),
1903 1903
                     $value['callerid'],
1904 1904
                     $value['callednum'],
1905 1905
                     filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT),
1906 1906
                     $duration,
1907
-                    $this->common->calculate_currency_manually($currency_info, $value['cost'],false),
1907
+                    $this->common->calculate_currency_manually($currency_info, $value['cost'], false),
1908 1908
                     $value['disposition'],
1909 1909
                     $value['calltype']
1910 1910
                 );
1911 1911
             }
1912
-            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ?
1913
-            floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00"  : $count_all['billseconds'];
1912
+            $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ?
1913
+            floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds'];
1914 1914
             $customer_array[] = array("Grand Total",
1915 1915
                 "",
1916 1916
                 "",
1917 1917
                 "",
1918 1918
                 $duration,
1919
-                $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,true),
1919
+                $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false, true),
1920 1920
                 "",
1921 1921
                 ""
1922 1922
             );
1923 1923
         }
1924 1924
         $this->load->helper('csv');
1925
-        array_to_csv($customer_array, 'Provider_CDR_' . date("Y-m-d") . '.csv');
1925
+        array_to_csv($customer_array, 'Provider_CDR_'.date("Y-m-d").'.csv');
1926 1926
     }
1927
-    function user_speeddial(){
1927
+    function user_speeddial() {
1928 1928
         $data['page_title'] = "Speed Dial";
1929 1929
         $accountinfo = $this->session->userdata('accountinfo');
1930 1930
         $where = array('id' => $accountinfo['id'], "reseller_id" => $accountinfo['reseller_id']);
1931 1931
         $account = $this->db_model->getSelect("*", "accounts", $where);
1932 1932
 	if ($account->num_rows() > 0) {
1933
-	$account_data = (array) $account->first_row();
1933
+	$account_data = (array)$account->first_row();
1934 1934
 	$speeddial_res = $this->db->get_where("speed_dial", array("accountid" => $accountinfo['id']));
1935 1935
 	$speeddial_info = array();
1936 1936
         if ($speeddial_res->num_rows() > 0) {
@@ -1941,14 +1941,14 @@  discard block
 block discarded – undo
1941 1941
         }
1942 1942
         $data['speeddial'] = $speeddial_info;
1943 1943
 	$this->load->view('view_user_speeddial', $data);
1944
-	}else{
1944
+	} else {
1945 1945
 	 redirect(base_url.'user/user/');
1946 1946
 	}
1947 1947
       }
1948 1948
       
1949
-      function user_speeddial_save(){
1950
-          $add_array= $this->input->post();
1951
-          $accountinfo=$this->session->userdata('accountinfo');
1949
+      function user_speeddial_save() {
1950
+          $add_array = $this->input->post();
1951
+          $accountinfo = $this->session->userdata('accountinfo');
1952 1952
           $where = array("accountid" => $accountinfo['id']);
1953 1953
 	  $this->db->select('count(id) as count');
1954 1954
 	  $this->db->where($where);
@@ -1966,8 +1966,8 @@  discard block
 block discarded – undo
1966 1966
 	  }
1967 1967
     }
1968 1968
     function user_speeddial_remove() {
1969
-	$accountinfo=$this->session->userdata('accountinfo');
1970
-	$add_array=$this->input->post();
1969
+	$accountinfo = $this->session->userdata('accountinfo');
1970
+	$add_array = $this->input->post();
1971 1971
         $updateinfo = array('number' => '');
1972 1972
         $this->db->where('speed_num', $add_array['number']);
1973 1973
         $this->db->where('accountid', $accountinfo['id']);
Please login to merge, or discard this patch.