Passed
Pull Request — v3.0 (#146)
by
unknown
11:54
created
astpp/application/modules/rates/views/view_import_origination_rate.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
               <div class="col-md-12">
16 16
             	<div class="w-box">
17 17
                    <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
18
-                    <? if(isset($error) && !empty($error)) {
18
+                    <? if (isset($error) && ! empty($error)) {
19 19
 						echo $error;
20 20
 					}?>
21 21
                    </span>            	
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
                            <div class="col-md-12 no-padding">
32 32
                                <label class="col-md-3">Rate Group:</label>
33 33
                                <div>
34
-                               <? $pricelists = form_dropdown('pricelist_id', $this->db_model->build_dropdown("id,name", "pricelists","where_arr", array("reseller_id" => "0", "status" => "0")), '');
34
+                               <? $pricelists = form_dropdown('pricelist_id', $this->db_model->build_dropdown("id,name", "pricelists", "where_arr", array("reseller_id" => "0", "status" => "0")), '');
35 35
 									echo $pricelists;
36 36
 							   ?>
37 37
                                </div>
38 38
                            </div>
39 39
 				<?
40
-				 $logintype=$this->session->userdata('userlevel_logintype');
40
+				 $logintype = $this->session->userdata('userlevel_logintype');
41 41
 					   // $trunk=null;
42
-				 if($logintype !=1) { ?>
42
+				 if ($logintype != 1) { ?>
43 43
                            <div class="col-md-12 no-padding">
44 44
                                <label class="col-md-3">Force Trunk:</label>
45 45
                                <div>
46
-                               <? $trunklist = form_dropdown_all('trunk_id', $this->db_model->build_dropdown("id,name", "trunks","where_arr", array("status" => "0")), '');
46
+                               <? $trunklist = form_dropdown_all('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array("status" => "0")), '');
47 47
 									echo $trunklist;
48 48
 							   ?>
49 49
                                </div>
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 <?}?>    
101 101
         
102 102
 <?php
103
-	if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
103
+	if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?>
104 104
 
105 105
 <section class="slice color-three">
106 106
 	<div class="w-section inverse no-padding">
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
              <div class="col-md-12 margin-t-10">
110 110
             <form id="import_form" name="import_form" action="<?=base_url()?>rates/origination_rate_import_file/<?= $pricelistid?>/<?=$trunkid?><?=$check_header?>/" method="POST">
111 111
             <table width="100%" border="1"  class="details_table table">
112
-                <?  $cnt =7;
113
-					foreach($csv_tmp_data as $csv_key => $csv_value){
114
-						if($csv_key <  15){
112
+                <?  $cnt = 7;
113
+					foreach ($csv_tmp_data as $csv_key => $csv_value) {
114
+						if ($csv_key < 15) {
115 115
 							echo "<tr>";
116
-							foreach($csv_value as $field_name => $field_val){
117
-								if($csv_key == 0){
116
+							foreach ($csv_value as $field_name => $field_val) {
117
+								if ($csv_key == 0) {
118 118
 									echo "<th>".ucfirst($field_name)."</th>";
119
-								}else{
119
+								} else {
120 120
 									echo "<td class='portlet-content'>".$field_val."</td>";   
121 121
 								}
122 122
 							}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 							foreach($csv_value as $field_name => $field_val){
114 114
 								if($csv_key == 0){
115 115
 									echo "<th>".ucfirst($field_name)."</th>";
116
-								}else{
116
+								} else{
117 117
 									echo "<td class='portlet-content'>".$field_val."</td>";   
118 118
 								}
119 119
 							}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/models/signup_model.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -51,49 +51,49 @@
 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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 						"status"=>0,
81 81
 						"assign_date"=>date('Y-m-d H:i:s')
82 82
 						 );
83
-			}else{
83
+			} else{
84 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',
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/controllers/signup.php 1 patch
Indentation   +426 added lines, -426 removed lines patch added patch discarded remove patch
@@ -24,468 +24,468 @@
 block discarded – undo
24 24
 
25 25
 class Signup extends MX_Controller {
26 26
 
27
-    function signup() {
28
-        parent::__construct();
29
-        $this->load->model('signup_model');
30
-        $this->load->helper('captcha');
31
-        $this->load->helper('template_inheritance');
32
-        //$this->load->library('form_validation');
33
-        $this->load->library('astpp/common');
34
-        $this->load->library('astpp/email_lib');
35
-        $this->load->model('db_model');
36
-        $this->load->model('common_model');
37
-        $this->load->library('session');
38
-        $this->load->library('encrypt');
39
-        $this->load->model('Astpp_common');
40
-
41
-        error_reporting(-1);
42
-        ini_set('display_errors', 'On');
43
-
44
-        $data['row'] = $this->signup_model->get_rate();
45
-    }
46
-
47
-    function index($key = "") {
48
-
49
-        if (Common_model::$global_config['system_config']['enable_signup'] == 1)
27
+	function signup() {
28
+		parent::__construct();
29
+		$this->load->model('signup_model');
30
+		$this->load->helper('captcha');
31
+		$this->load->helper('template_inheritance');
32
+		//$this->load->library('form_validation');
33
+		$this->load->library('astpp/common');
34
+		$this->load->library('astpp/email_lib');
35
+		$this->load->model('db_model');
36
+		$this->load->model('common_model');
37
+		$this->load->library('session');
38
+		$this->load->library('encrypt');
39
+		$this->load->model('Astpp_common');
40
+
41
+		error_reporting(-1);
42
+		ini_set('display_errors', 'On');
43
+
44
+		$data['row'] = $this->signup_model->get_rate();
45
+	}
46
+
47
+	function index($key = "") {
48
+
49
+		if (Common_model::$global_config['system_config']['enable_signup'] == 1)
50 50
 		{
51
-    		redirect(base_url());
51
+			redirect(base_url());
52 52
 		}
53 53
 
54
-        $userCaptcha = $this->input->post('userCaptcha');
55
-        $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
56
-        $accountinfo = (array)$this->db->get_where('accounts', array('type'=>-1))->first_row();
57
-        $data['timezone_id'] = ( ! $accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id'];
58
-        $data['currency_id'] = ( ! $accountinfo['currency_id']) ? 1 : $accountinfo['currency_id'];
59
-        $data['country_id'] = ( ! $accountinfo['country_id']) ? 1 : $accountinfo['country_id'];
60
-
61
-        $vals = array(
62
-            'word' => $random_number,
63
-            'img_path' => getcwd().'/assets/captcha/',
64
-            'img_url' => base_url().'assets/captcha/',
65
-            //'font_path' => './fonts/impact.ttf',
66
-            'img_width' => '243',
67
-            'img_height' => '50',
68
-            'expiration' => '3600'
69
-        );
70
-
71
-        if (isset($key) && $key != '') {
72
-            $data['key_unique'] = $key;
73
-        } else {
74
-            $data['key_unique'] = "admin";
75
-        }
76
-        $unique = $data['key_unique'];
77
-
78
-        if ($unique != "admin") {
79
-            $unique = $this->common->decode_params(trim($unique));
80
-            $decoded_str = $this->common->decode($unique);
81
-            $unique = $decoded_str;
82
-            $query = $this->db_model->getSelect("*", 'accounts', array('id' => $unique, "deleted" => "0"));
83
-            if ($query->num_rows() == 0) {
84
-                redirect(base_url()."signup/signup_inactive");
85
-            }
86
-            if ($query->num_rows() > 0) {
87
-                $query = $query->result_array();
88
-                $query = $query[0];
89
-
90
-                if ($query['status'] != 0) {
91
-                    redirect(base_url()."signup/signup_inactive");
92
-                }
93
-            }
94
-        }
95
-        $data['captcha'] = create_captcha($vals);
96
-        $this->session->set_userdata('captchaWord', $data['captcha']['word']);
97
-        $this->load->view('view_signup', $data);
98
-    }
99
-
100
-    public function check_captcha($str) {
101
-        $word = $this->session->userdata('captchaWord');
102
-        if (strcmp(strtoupper($str), strtoupper($word)) == 0) {
103
-            return true;
104
-        } else {
105
-            $this->form_validation->set_message('check_captcha', 'Please enter correct words!');
106
-            return false;
107
-        }
108
-    }
109
-
110
-    function terms_check() {
111
-        if (isset($_POST['agreeCheck'])) {
112
-                    return true;
113
-        }
114
-        $this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!');
115
-        return false;
116
-    }
117
-
118
-     function signup_save($id = "") {
119
-        if (empty($_POST)) {
120
-            redirect(base_url()."signup/");
121
-        } else {
122
-            $post_values = $this->input->post();
123
-            $userCaptcha = $this->input->post('userCaptcha');
124
-            $cnt_result = $this->db_model->countQuery("*", 'accounts', array('email' => $post_values['email']));
125
-
126
-            if ($userCaptcha != $this->session->userdata('captchaWord') || ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) {
127
-                if ( ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) {
128
-                    $data['error']['email'] = "<div style='color: red;'> Please enter proper email </div>";
129
-                }
130
-                if ($userCaptcha != $this->session->userdata('captchaWord')) {
131
-                    $data['error']['userCaptcha'] = "<div style='color: red;'>Please enter valid Captcha code</div>";
132
-                }
133
-                if ($cnt_result > 0) {
134
-                    $data['error']['email'] = "<div style='color: red;'>Email Address already exists</div>";
135
-                }
136
-                $random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
137
-                $vals = array(
138
-                    'word' => $random_number,
139
-                    'img_path' => getcwd().'/assets/captcha/',
140
-                    'img_url' => base_url().'assets/captcha/',
141
-                    //'font_path' => './fonts/impact.ttf',
142
-                    'img_width' => '243',
143
-                    'img_height' => '50',
144
-                    'expiration' => '3600'
145
-                );
146
-                //echo "<pre>"; print_r($_POST); exit;
147
-                if (isset($_POST['key_unique']) && $_POST['key_unique'] == "admin") {
148
-                    $data['key_unique'] = $_POST['key_unique'];
149
-                }
54
+		$userCaptcha = $this->input->post('userCaptcha');
55
+		$random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
56
+		$accountinfo = (array)$this->db->get_where('accounts', array('type'=>-1))->first_row();
57
+		$data['timezone_id'] = ( ! $accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id'];
58
+		$data['currency_id'] = ( ! $accountinfo['currency_id']) ? 1 : $accountinfo['currency_id'];
59
+		$data['country_id'] = ( ! $accountinfo['country_id']) ? 1 : $accountinfo['country_id'];
60
+
61
+		$vals = array(
62
+			'word' => $random_number,
63
+			'img_path' => getcwd().'/assets/captcha/',
64
+			'img_url' => base_url().'assets/captcha/',
65
+			//'font_path' => './fonts/impact.ttf',
66
+			'img_width' => '243',
67
+			'img_height' => '50',
68
+			'expiration' => '3600'
69
+		);
70
+
71
+		if (isset($key) && $key != '') {
72
+			$data['key_unique'] = $key;
73
+		} else {
74
+			$data['key_unique'] = "admin";
75
+		}
76
+		$unique = $data['key_unique'];
77
+
78
+		if ($unique != "admin") {
79
+			$unique = $this->common->decode_params(trim($unique));
80
+			$decoded_str = $this->common->decode($unique);
81
+			$unique = $decoded_str;
82
+			$query = $this->db_model->getSelect("*", 'accounts', array('id' => $unique, "deleted" => "0"));
83
+			if ($query->num_rows() == 0) {
84
+				redirect(base_url()."signup/signup_inactive");
85
+			}
86
+			if ($query->num_rows() > 0) {
87
+				$query = $query->result_array();
88
+				$query = $query[0];
89
+
90
+				if ($query['status'] != 0) {
91
+					redirect(base_url()."signup/signup_inactive");
92
+				}
93
+			}
94
+		}
95
+		$data['captcha'] = create_captcha($vals);
96
+		$this->session->set_userdata('captchaWord', $data['captcha']['word']);
97
+		$this->load->view('view_signup', $data);
98
+	}
99
+
100
+	public function check_captcha($str) {
101
+		$word = $this->session->userdata('captchaWord');
102
+		if (strcmp(strtoupper($str), strtoupper($word)) == 0) {
103
+			return true;
104
+		} else {
105
+			$this->form_validation->set_message('check_captcha', 'Please enter correct words!');
106
+			return false;
107
+		}
108
+	}
109
+
110
+	function terms_check() {
111
+		if (isset($_POST['agreeCheck'])) {
112
+					return true;
113
+		}
114
+		$this->form_validation->set_message('terms_check', 'THIS IS SOOOOO REQUIRED, DUDE!');
115
+		return false;
116
+	}
117
+
118
+	 function signup_save($id = "") {
119
+		if (empty($_POST)) {
120
+			redirect(base_url()."signup/");
121
+		} else {
122
+			$post_values = $this->input->post();
123
+			$userCaptcha = $this->input->post('userCaptcha');
124
+			$cnt_result = $this->db_model->countQuery("*", 'accounts', array('email' => $post_values['email']));
125
+
126
+			if ($userCaptcha != $this->session->userdata('captchaWord') || ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL) || $cnt_result > 0) {
127
+				if ( ! filter_var($this->input->post('email'), FILTER_VALIDATE_EMAIL)) {
128
+					$data['error']['email'] = "<div style='color: red;'> Please enter proper email </div>";
129
+				}
130
+				if ($userCaptcha != $this->session->userdata('captchaWord')) {
131
+					$data['error']['userCaptcha'] = "<div style='color: red;'>Please enter valid Captcha code</div>";
132
+				}
133
+				if ($cnt_result > 0) {
134
+					$data['error']['email'] = "<div style='color: red;'>Email Address already exists</div>";
135
+				}
136
+				$random_number = substr(number_format(time() * rand(), 0, '', ''), 0, 6);
137
+				$vals = array(
138
+					'word' => $random_number,
139
+					'img_path' => getcwd().'/assets/captcha/',
140
+					'img_url' => base_url().'assets/captcha/',
141
+					//'font_path' => './fonts/impact.ttf',
142
+					'img_width' => '243',
143
+					'img_height' => '50',
144
+					'expiration' => '3600'
145
+				);
146
+				//echo "<pre>"; print_r($_POST); exit;
147
+				if (isset($_POST['key_unique']) && $_POST['key_unique'] == "admin") {
148
+					$data['key_unique'] = $_POST['key_unique'];
149
+				}
150 150
 
151 151
 				$accountinfo = (array)$this->db->get_where('accounts', array('type'=>-1))->first_row();
152 152
 				$data['timezone_id'] = ( ! $accountinfo['timezone_id']) ? 1 : $accountinfo['timezone_id'];
153 153
 				$data['currency_id'] = ( ! $accountinfo['currency_id']) ? 1 : $accountinfo['currency_id'];
154 154
 				$data['country_id'] = ( ! $accountinfo['country_id']) ? 1 : $accountinfo['country_id'];
155 155
 
156
-                $data['timezone_id'] = ( ! $data['timezone_id']) ? 1 : $data['timezone_id'];
157
-                $data['currency_id'] = ( ! $data['currency_id']) ? 1 : $data['currency_id'];
158
-                $data['country_id'] = ( ! $data['country_id']) ? 1 : $data['country_id'];
156
+				$data['timezone_id'] = ( ! $data['timezone_id']) ? 1 : $data['timezone_id'];
157
+				$data['currency_id'] = ( ! $data['currency_id']) ? 1 : $data['currency_id'];
158
+				$data['country_id'] = ( ! $data['country_id']) ? 1 : $data['country_id'];
159 159
 
160
-                $data['value'] = $post_values;
161
-                $data['captcha'] = create_captcha($vals);
160
+				$data['value'] = $post_values;
161
+				$data['captcha'] = create_captcha($vals);
162 162
 
163
-                $this->session->set_userdata('captchaWord', $data['captcha']['word']);
164
-                $data['key_unique'] = $_POST['key_unique'];
165
-                $this->load->view('view_signup', $data);
166
-            } else {
167
-                //AVTLATP		
168
-                $user_data = $this->input->post();
163
+				$this->session->set_userdata('captchaWord', $data['captcha']['word']);
164
+				$data['key_unique'] = $_POST['key_unique'];
165
+				$this->load->view('view_signup', $data);
166
+			} else {
167
+				//AVTLATP		
168
+				$user_data = $this->input->post();
169 169
                
170
-                if ( ! isset($_POST['key_unique']) || ! isset($_POST['email'])) {
171
-                    redirect(base_url()."signup/");
172
-                }
173
-                $reseller_id = 0;
174
-                if (isset($_POST['key_unique']) && $_POST['key_unique'] != "admin") {
175
-                    $_POST['key_unique'] = $this->common->decode_params(trim($_POST['key_unique']));
176
-                    $decoded_str = $this->common->decode($_POST['key_unique']);
177
-                    $_POST['key_unique'] = $decoded_str;
178
-                    $user_data['key_unique'] = $_POST['key_unique'];
179
-                    $reseller_id = $user_data['key_unique'];
180
-                }
181
-                //echo "<pre>"; print_r($_POST); exit;
182
-                //AVTLATP
183
-                //Data want to insert or update
184
-                $user_data['status'] = "1";
185
-                $user_data['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
186
-
187
-                $user_data['password'] = $this->common->encode($this->common->generate_password());
188
-                $user_data['pin'] = $this->common->generate_password();
189
-                $user_data['reseller_id'] = $reseller_id;
190
-                $user_data['posttoexternal'] = "0";
191
-
192
-                unset($user_data['userCaptcha']);
193
-                unset($user_data['action']);
194
-
195
-                $system_config = common_model::$global_config['system_config'];
196
-                $balance = $system_config["balance"];
197
-
198
-                /* $query = $this->db_model->getSelect("*", 'invoice_conf ', array('id' => $unique ,"deleted" => "0"));
170
+				if ( ! isset($_POST['key_unique']) || ! isset($_POST['email'])) {
171
+					redirect(base_url()."signup/");
172
+				}
173
+				$reseller_id = 0;
174
+				if (isset($_POST['key_unique']) && $_POST['key_unique'] != "admin") {
175
+					$_POST['key_unique'] = $this->common->decode_params(trim($_POST['key_unique']));
176
+					$decoded_str = $this->common->decode($_POST['key_unique']);
177
+					$_POST['key_unique'] = $decoded_str;
178
+					$user_data['key_unique'] = $_POST['key_unique'];
179
+					$reseller_id = $user_data['key_unique'];
180
+				}
181
+				//echo "<pre>"; print_r($_POST); exit;
182
+				//AVTLATP
183
+				//Data want to insert or update
184
+				$user_data['status'] = "1";
185
+				$user_data['number'] = $this->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
186
+
187
+				$user_data['password'] = $this->common->encode($this->common->generate_password());
188
+				$user_data['pin'] = $this->common->generate_password();
189
+				$user_data['reseller_id'] = $reseller_id;
190
+				$user_data['posttoexternal'] = "0";
191
+
192
+				unset($user_data['userCaptcha']);
193
+				unset($user_data['action']);
194
+
195
+				$system_config = common_model::$global_config['system_config'];
196
+				$balance = $system_config["balance"];
197
+
198
+				/* $query = $this->db_model->getSelect("*", 'invoice_conf ', array('id' => $unique ,"deleted" => "0"));
199 199
                   $query = $query->result_array(); */
200 200
 
201
-                $company_website = $system_config["company_website"];
202
-                $company_name = $system_config["company_name"];
201
+				$company_website = $system_config["company_website"];
202
+				$company_name = $system_config["company_name"];
203 203
 
204
-                //echo $company_name; exit;
205
-                $selection_rategroup_signup = $system_config["default_signup_rategroup"];
204
+				//echo $company_name; exit;
205
+				$selection_rategroup_signup = $system_config["default_signup_rategroup"];
206 206
 
207
-                if ($reseller_id != 0) {
208
-                    $result = $this->db_model->getSelect("*", "pricelists", array("reseller_id" => $reseller_id), "ASC");
209
-                    $result_arr = $result->result_array();
210
-                    $selection_rategroup_signup = $result_arr[0]['id'];
211
-                    $user_data['pricelist_id'] = (isset($selection_rategroup_signup) && $selection_rategroup_signup > 0) ? $selection_rategroup_signup : 0;
212
-                } else {
213
-                    $pricelist_id = $this->common->get_field_name('id', 'pricelists', array('name' => $selection_rategroup_signup));
214
-                    /* if($pricelis_id != "")
207
+				if ($reseller_id != 0) {
208
+					$result = $this->db_model->getSelect("*", "pricelists", array("reseller_id" => $reseller_id), "ASC");
209
+					$result_arr = $result->result_array();
210
+					$selection_rategroup_signup = $result_arr[0]['id'];
211
+					$user_data['pricelist_id'] = (isset($selection_rategroup_signup) && $selection_rategroup_signup > 0) ? $selection_rategroup_signup : 0;
212
+				} else {
213
+					$pricelist_id = $this->common->get_field_name('id', 'pricelists', array('name' => $selection_rategroup_signup));
214
+					/* if($pricelis_id != "")
215 215
                       $user_data['pricelist_id'] = $pricelis_id;
216 216
                       else
217 217
                       $user_data['pricelist_id'] = 0; */
218
-                    $user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0;
219
-                }
220
-                $last_id = '0';
221
-                //Insert or Update record
222
-                $signup_sipdevice_flag = $system_config['create_sipdevice'];
223
-                $last_id = $this->signup_model->add_user($user_data);
224
-                if ($last_id == "") {
225
-                    redirect(base_url()."signup/signup_inactive");
226
-                }
227
-                if ($signup_sipdevice_flag == '0') {
228
-                    $query = $this->db_model->select("*", "sip_profiles", array('name' => "default"), "id", "ASC", '1', '0');
229
-                    $sip_id = $query->result_array();
230
-                    if ($reseller_id > 0) {
218
+					$user_data['pricelist_id'] = ($pricelist_id != "") ? $pricelist_id : 0;
219
+				}
220
+				$last_id = '0';
221
+				//Insert or Update record
222
+				$signup_sipdevice_flag = $system_config['create_sipdevice'];
223
+				$last_id = $this->signup_model->add_user($user_data);
224
+				if ($last_id == "") {
225
+					redirect(base_url()."signup/signup_inactive");
226
+				}
227
+				if ($signup_sipdevice_flag == '0') {
228
+					$query = $this->db_model->select("*", "sip_profiles", array('name' => "default"), "id", "ASC", '1', '0');
229
+					$sip_id = $query->result_array();
230
+					if ($reseller_id > 0) {
231 231
 						$reseller_id = $reseller_id;
232 232
 					} else {
233 233
 						$reseller_id = '0';
234 234
 					}
235
-                    $free_switch_array = array('fs_username' => $user_data['number'],
236
-                        'fs_password' => $user_data['password'],
237
-                        'context' => 'default',
238
-                        'effective_caller_id_name' => $user_data['number'],
239
-                        'effective_caller_id_number' => $user_data['number'],
240
-                        'sip_profile_id' => $sip_id[0]['id'],
241
-                        'reseller_id' => $reseller_id,
242
-                        'pricelist_id' => $user_data['pricelist_id'],
243
-                        'accountcode' => $last_id,
244
-                        'status' => $user_data['status'],
245
-                        'voicemail_enabled'=>true,
246
-                        'voicemail_password'=>'',
247
-                        'voicemail_mail_to'=>'',
248
-                        'voicemail_attach_file'=>true,
249
-                        'vm_keep_local_after_email'=>true,
250
-                        'vm_send_all_message'=>true,
251
-                        );
252
-                    $user_custom_array = array_merge($user_data, $free_switch_array);
253
-                    $user_custom_array['id'] = $last_id;
254
-                    $user_custom_array['email'] = $user_data['email'];
235
+					$free_switch_array = array('fs_username' => $user_data['number'],
236
+						'fs_password' => $user_data['password'],
237
+						'context' => 'default',
238
+						'effective_caller_id_name' => $user_data['number'],
239
+						'effective_caller_id_number' => $user_data['number'],
240
+						'sip_profile_id' => $sip_id[0]['id'],
241
+						'reseller_id' => $reseller_id,
242
+						'pricelist_id' => $user_data['pricelist_id'],
243
+						'accountcode' => $last_id,
244
+						'status' => $user_data['status'],
245
+						'voicemail_enabled'=>true,
246
+						'voicemail_password'=>'',
247
+						'voicemail_mail_to'=>'',
248
+						'voicemail_attach_file'=>true,
249
+						'vm_keep_local_after_email'=>true,
250
+						'vm_send_all_message'=>true,
251
+						);
252
+					$user_custom_array = array_merge($user_data, $free_switch_array);
253
+					$user_custom_array['id'] = $last_id;
254
+					$user_custom_array['email'] = $user_data['email'];
255 255
                    
256
-                    $this->load->model('freeswitch/freeswitch_model');
257
-                    $this->freeswitch_model->add_freeswith($user_custom_array);
258
-                }
259
-             // echo "<pre>"; print_r ($user_data); exit;
260
-                $activation = $this->encrypt->encode($user_data['number']);
261
-                $message = base_url().'signup/signup_confirm?email='.urlencode($user_data['email'])."&key=".urlencode($activation);
262
-                $user_data['confirm'] = $message;
263
-
264
-                $this->send_mail($last_id, 'email_signup_confirmation', $user_data);
265
-                redirect(base_url()."signup/signup_success");
266
-            }
267
-        }
268
-    }
269
-
270
-    function signup_confirm() {
271
-        if ( ! empty($_GET)) {
272
-
273
-            $system_config = common_model::$global_config['system_config'];
274
-            $balance = $system_config["balance"];
275
-            $accno = $this->encrypt->decode($_GET['key']);
276
-            $email = $_GET['email'];
277
-            $success = $this->signup_model->check_user($accno, $email, $balance);
278
-            $query = $this->db_model->getSelect("*", "accounts", array('number' => $accno));
279
-            $data = $query->result_array();
280
-            $user_data = $data[0];
281
-            $user_data['accountid'] = $user_data['id'];
282
-            $user_data['success'] = $success;
283
-            $user_data['balance'] = $balance;
284
-            $user_data['confirm'] = base_url();
285
-            $this->active($user_data, $success);
286
-        } else {
287
-            redirect(base_url());
288
-        }
289
-    }
290
-
291
-    function signup_success() {
292
-        $this->load->view('view_signup_success');
293
-    }
294
-
295
-    function signup_inactive() {
296
-        $this->load->view('view_signup_inactive');
297
-    }
298
-
299
-    function active($user_data, $success) {
300
-        $data['user_data'] = $user_data;
301
-        $data['user_data']['success'] = $success;
302
-
303
-        if ($user_data['success']) {
256
+					$this->load->model('freeswitch/freeswitch_model');
257
+					$this->freeswitch_model->add_freeswith($user_custom_array);
258
+				}
259
+			 // echo "<pre>"; print_r ($user_data); exit;
260
+				$activation = $this->encrypt->encode($user_data['number']);
261
+				$message = base_url().'signup/signup_confirm?email='.urlencode($user_data['email'])."&key=".urlencode($activation);
262
+				$user_data['confirm'] = $message;
263
+
264
+				$this->send_mail($last_id, 'email_signup_confirmation', $user_data);
265
+				redirect(base_url()."signup/signup_success");
266
+			}
267
+		}
268
+	}
269
+
270
+	function signup_confirm() {
271
+		if ( ! empty($_GET)) {
272
+
273
+			$system_config = common_model::$global_config['system_config'];
274
+			$balance = $system_config["balance"];
275
+			$accno = $this->encrypt->decode($_GET['key']);
276
+			$email = $_GET['email'];
277
+			$success = $this->signup_model->check_user($accno, $email, $balance);
278
+			$query = $this->db_model->getSelect("*", "accounts", array('number' => $accno));
279
+			$data = $query->result_array();
280
+			$user_data = $data[0];
281
+			$user_data['accountid'] = $user_data['id'];
282
+			$user_data['success'] = $success;
283
+			$user_data['balance'] = $balance;
284
+			$user_data['confirm'] = base_url();
285
+			$this->active($user_data, $success);
286
+		} else {
287
+			redirect(base_url());
288
+		}
289
+	}
290
+
291
+	function signup_success() {
292
+		$this->load->view('view_signup_success');
293
+	}
294
+
295
+	function signup_inactive() {
296
+		$this->load->view('view_signup_inactive');
297
+	}
298
+
299
+	function active($user_data, $success) {
300
+		$data['user_data'] = $user_data;
301
+		$data['user_data']['success'] = $success;
302
+
303
+		if ($user_data['success']) {
304 304
 			$user_data['password'] = $this->common->decode($user_data['password']);
305
-            $this->send_mail($user_data['id'], 'email_add_user', $user_data);
306
-        }
307
-        $this->load->view('view_signup_active', $data);
308
-    }
309
-
310
-    function forgotpassword() {
311
-        $this->load->view('view_forgotpassword');
312
-    }
313
-
314
-    function confirmpassword() {
315
-        $email = $_POST['email'];       
316
-        unset($_POST['action']);        
317
-        $where = array('email' => $email);
318
-        $this->db->where($where);
319
-        $this->db->or_where('number', $email);
320
-        $cnt_result = $this->db_model->countQuery("*", 'accounts', "");
321
-        if ( ! empty($email)) {
322
-            $names = array('0', '1', '3');
323
-            $this->db->where_in('type', $names);
324
-            $where_arr = array("email" => $email);
325
-            $this->db->where($where_arr);
305
+			$this->send_mail($user_data['id'], 'email_add_user', $user_data);
306
+		}
307
+		$this->load->view('view_signup_active', $data);
308
+	}
309
+
310
+	function forgotpassword() {
311
+		$this->load->view('view_forgotpassword');
312
+	}
313
+
314
+	function confirmpassword() {
315
+		$email = $_POST['email'];       
316
+		unset($_POST['action']);        
317
+		$where = array('email' => $email);
318
+		$this->db->where($where);
319
+		$this->db->or_where('number', $email);
320
+		$cnt_result = $this->db_model->countQuery("*", 'accounts', "");
321
+		if ( ! empty($email)) {
322
+			$names = array('0', '1', '3');
323
+			$this->db->where_in('type', $names);
324
+			$where_arr = array("email" => $email);
325
+			$this->db->where($where_arr);
326 326
 			$this->db->or_where('number', $email);
327
-            $acountdata = $this->db_model->getSelect("*", "accounts", "");
328
-            if ($acountdata->num_rows() > 0) {
329
-                $user_data = $acountdata->result_array();
330
-                $user_data = $user_data[0];
331
-                if ($user_data['status'] > 0) {
332
-                    $data['error']['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>This account is not Active.</div>";
333
-                    $this->load->view('view_forgotpassword', $data);
334
-                    exit;
335
-                }
336
-            }            
337
-            if ($acountdata->num_rows() == 0 && ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
338
-                if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
339
-                    $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>";
340
-
341
-                    $this->load->view('view_forgotpassword', $data);
342
-                } else {
343
-                    $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>";
344
-
345
-                    $this->load->view('view_forgotpassword', $data);
346
-                }
347
-            } else if ($acountdata->num_rows() == 0) {
348
-                    $data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>";
349
-                    $this->load->view('view_forgotpassword', $data);
350
-            } else {
351
-                $acountdata = $acountdata->result_array();
352
-                $user_data = $acountdata[0];
327
+			$acountdata = $this->db_model->getSelect("*", "accounts", "");
328
+			if ($acountdata->num_rows() > 0) {
329
+				$user_data = $acountdata->result_array();
330
+				$user_data = $user_data[0];
331
+				if ($user_data['status'] > 0) {
332
+					$data['error']['email'] = "<div id='error_mail' style='color:red; margin: 1% 22%; float: left;'>This account is not Active.</div>";
333
+					$this->load->view('view_forgotpassword', $data);
334
+					exit;
335
+				}
336
+			}            
337
+			if ($acountdata->num_rows() == 0 && ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
338
+				if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
339
+					$data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>";
340
+
341
+					$this->load->view('view_forgotpassword', $data);
342
+				} else {
343
+					$data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left;width:100%;'>This Username or Email is not valid</div>";
344
+
345
+					$this->load->view('view_forgotpassword', $data);
346
+				}
347
+			} else if ($acountdata->num_rows() == 0) {
348
+					$data['error']['email'] = "<div id='error_mail' style='color: red; margin: 2% 22%; float: left; width:100%;'>Please enter proper Username or Email.</div>";
349
+					$this->load->view('view_forgotpassword', $data);
350
+			} else {
351
+				$acountdata = $acountdata->result_array();
352
+				$user_data = $acountdata[0];
353 353
                 
354
-                $email = $this->encrypt->encode($user_data['email']);
355
-                $activation = $this->encrypt->encode($user_data['number']);
356
-                $message = base_url().'confirm_pass?email='.urlencode($email)."&key=".urlencode($activation);
357
-                $user_data['confirm'] = $message;
358
-                $where = array("email" => $user_data['email']);
359
-                $data = array("pass_link_status" => 1);
360
-                $this->db->where($where);
361
-                $this->db->update('accounts', $data);
362
-                $system_config = common_model::$global_config['system_config'];
363
-                $balance = $system_config["balance"];
364
-                $this->send_mail($user_data['id'], 'email_forgot_confirmation', $user_data);
365
-                $this->load->view('view_forgot_success');
366
-            }
367
-        } else {
368
-            redirect(base_url());
369
-        }
370
-    }
371
-
372
-    function confirm_pass() {
373
-        $confirm_pass = $_GET;
374
-        $accno = '';
375
-        $balance = '';
376
-        $email1 = $this->encrypt->decode($confirm_pass['email']);
377
-        $success = $this->signup_model->check_user($accno, $email1, $balance);
378
-        if ( ! empty($confirm_pass)) {
379
-            $where_arr = array("email" => $email1, "status" => 0);
380
-            $acountdata = $this->db_model->getSelect("*", "accounts", $where_arr);
381
-            if ($acountdata->num_rows() > 0) {
382
-                $acountdata = $acountdata->result_array();
383
-                $user_data = $acountdata[0];
384
-                $updateArr = array("pass_link_status" => 0);
385
-                $this->db->where(array("email" => $email1));
386
-                $this->db->update("accounts", $updateArr);
387
-                if ($user_data['pass_link_status'] == '0') {
388
-                    $user_data['success'] = $success;
389
-                    $data['user_data'] = $user_data;
390
-                    $this->active($user_data, $success);
391
-                } else {
392
-                    $data['email'] = $_GET['email'];
393
-                    $this->load->view('view_confirmpassword', $data);
394
-                }
395
-            }
396
-        }
397
-    }
398
-
399
-    function confirmpass() {
400
-        $passwordconf = $_POST;
401
-        $email1 = $this->encrypt->decode($passwordconf['email']);
402
-        if ( ! empty($passwordconf)) {
403
-            $acountdata = $this->db_model->getSelect("*", "accounts", array("email" => $email1));
404
-            //echo $this->db->last_query();exit;
405
-            if ($acountdata->num_rows() > 0) {
406
-                $acountdata = $acountdata->result_array();
407
-                $user_data = $acountdata[0];
408
-            }
409
-            $user_data['password'] = $this->common->encode($passwordconf['password']);
410
-            $updateArr = array("password" => $user_data['password']);
411
-            $where_arr = array("email" => $email1, "status" => 0);
412
-            $this->db->where($where_arr);
413
-            $this->db->update("accounts", $updateArr);
414
-            //$activation = $this->encrypt->encode($user_data['number']);
415
-            $message = base_url();
416
-            $user_data['confirm'] = $message;
417
-            $user_data['password'] = $passwordconf['password'];
418
-
419
-
420
-
421
-            $system_config = common_model::$global_config['system_config'];
422
-            $balance = $system_config["balance"];
423
-
424
-            $this->send_mail($user_data['id'], 'email_forgot_user', $user_data);
425
-
426
-            $this->successpassword();
427
-        }
428
-    }
429
-
430
-    /**
431
-     * @param string $temp_name
432
-     */
433
-    function send_mail($account_id, $temp_name, $user_data) {
354
+				$email = $this->encrypt->encode($user_data['email']);
355
+				$activation = $this->encrypt->encode($user_data['number']);
356
+				$message = base_url().'confirm_pass?email='.urlencode($email)."&key=".urlencode($activation);
357
+				$user_data['confirm'] = $message;
358
+				$where = array("email" => $user_data['email']);
359
+				$data = array("pass_link_status" => 1);
360
+				$this->db->where($where);
361
+				$this->db->update('accounts', $data);
362
+				$system_config = common_model::$global_config['system_config'];
363
+				$balance = $system_config["balance"];
364
+				$this->send_mail($user_data['id'], 'email_forgot_confirmation', $user_data);
365
+				$this->load->view('view_forgot_success');
366
+			}
367
+		} else {
368
+			redirect(base_url());
369
+		}
370
+	}
371
+
372
+	function confirm_pass() {
373
+		$confirm_pass = $_GET;
374
+		$accno = '';
375
+		$balance = '';
376
+		$email1 = $this->encrypt->decode($confirm_pass['email']);
377
+		$success = $this->signup_model->check_user($accno, $email1, $balance);
378
+		if ( ! empty($confirm_pass)) {
379
+			$where_arr = array("email" => $email1, "status" => 0);
380
+			$acountdata = $this->db_model->getSelect("*", "accounts", $where_arr);
381
+			if ($acountdata->num_rows() > 0) {
382
+				$acountdata = $acountdata->result_array();
383
+				$user_data = $acountdata[0];
384
+				$updateArr = array("pass_link_status" => 0);
385
+				$this->db->where(array("email" => $email1));
386
+				$this->db->update("accounts", $updateArr);
387
+				if ($user_data['pass_link_status'] == '0') {
388
+					$user_data['success'] = $success;
389
+					$data['user_data'] = $user_data;
390
+					$this->active($user_data, $success);
391
+				} else {
392
+					$data['email'] = $_GET['email'];
393
+					$this->load->view('view_confirmpassword', $data);
394
+				}
395
+			}
396
+		}
397
+	}
398
+
399
+	function confirmpass() {
400
+		$passwordconf = $_POST;
401
+		$email1 = $this->encrypt->decode($passwordconf['email']);
402
+		if ( ! empty($passwordconf)) {
403
+			$acountdata = $this->db_model->getSelect("*", "accounts", array("email" => $email1));
404
+			//echo $this->db->last_query();exit;
405
+			if ($acountdata->num_rows() > 0) {
406
+				$acountdata = $acountdata->result_array();
407
+				$user_data = $acountdata[0];
408
+			}
409
+			$user_data['password'] = $this->common->encode($passwordconf['password']);
410
+			$updateArr = array("password" => $user_data['password']);
411
+			$where_arr = array("email" => $email1, "status" => 0);
412
+			$this->db->where($where_arr);
413
+			$this->db->update("accounts", $updateArr);
414
+			//$activation = $this->encrypt->encode($user_data['number']);
415
+			$message = base_url();
416
+			$user_data['confirm'] = $message;
417
+			$user_data['password'] = $passwordconf['password'];
418
+
419
+
420
+
421
+			$system_config = common_model::$global_config['system_config'];
422
+			$balance = $system_config["balance"];
423
+
424
+			$this->send_mail($user_data['id'], 'email_forgot_user', $user_data);
425
+
426
+			$this->successpassword();
427
+		}
428
+	}
429
+
430
+	/**
431
+	 * @param string $temp_name
432
+	 */
433
+	function send_mail($account_id, $temp_name, $user_data) {
434 434
 		
435 435
 		
436
-        $system_config = common_model::$global_config['system_config'];
437
-        //$screen_path = getcwd()."/cron";
438
-        //$screen_filename = "Email_Broadcast_".strtotime('now');
439
-        //$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
440
-        //exec($command);
436
+		$system_config = common_model::$global_config['system_config'];
437
+		//$screen_path = getcwd()."/cron";
438
+		//$screen_filename = "Email_Broadcast_".strtotime('now');
439
+		//$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
440
+		//exec($command);
441 441
         
442 442
         
443 443
      
444 444
         
445
-        $where = array('name' => $temp_name);
446
-        $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where);
447
-        $reseller_id = ($user_data['reseller_id'] > 0) ? $user_data['reseller_id'] : 1;
448
-        $where = "accountid IN ('".$reseller_id."','1')";
449
-        $this->db->where($where);
450
-        $this->db->select('*');
451
-        $this->db->order_by('accountid', 'desc');
452
-        $this->db->limit(1);
453
-        $invoiceconf = $this->db->get('invoice_conf');
454
-        $invoiceconf = (array)$invoiceconf->first_row();
455
-        $company_email = $invoiceconf['emailaddress'];
456
-        $company_website = $invoiceconf["website"];
457
-        $company_name = $invoiceconf["company_name"];
445
+		$where = array('name' => $temp_name);
446
+		$EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where);
447
+		$reseller_id = ($user_data['reseller_id'] > 0) ? $user_data['reseller_id'] : 1;
448
+		$where = "accountid IN ('".$reseller_id."','1')";
449
+		$this->db->where($where);
450
+		$this->db->select('*');
451
+		$this->db->order_by('accountid', 'desc');
452
+		$this->db->limit(1);
453
+		$invoiceconf = $this->db->get('invoice_conf');
454
+		$invoiceconf = (array)$invoiceconf->first_row();
455
+		$company_email = $invoiceconf['emailaddress'];
456
+		$company_website = $invoiceconf["website"];
457
+		$company_name = $invoiceconf["company_name"];
458 458
         
459
-        $TemplateData = array();
459
+		$TemplateData = array();
460 460
         
461 461
         
462
-        foreach ($EmailTemplate->result_array() as $value) {
463
-            $TemplateData = $value;
464
-            $TemplateData['subject'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['subject']);
465
-            $TemplateData['template'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['template']);
466
-            $TemplateData['template'] = str_replace('#NUMBER#', $user_data['number'], $TemplateData['template']);
467
-            $TemplateData['template'] = str_replace('#PASSWORD#', $user_data['password'], $TemplateData['template']);
468
-            $TemplateData['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData['template']);
469
-            $TemplateData['template'] = str_replace('#LINK#', $user_data['confirm'], $TemplateData['template']);
470
-            $TemplateData['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData['template']);
471
-            $TemplateData['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData['template']);
472
-        }
473
-        $email_array = array('accountid' => $account_id,
474
-            'subject' => $TemplateData['subject'],
475
-            'body' => $TemplateData['template'],
476
-            'from' => $invoiceconf['emailaddress'],
477
-            'to' => $user_data['email'],
478
-            'status' => "1",
479
-            //'attachment'=> $Filenm,
480
-            'template' => '');
481
-        //echo "<pre>"; print_r($TemplateData); exit;
482
-        $this->db->insert("mail_details", $email_array);
483
-        return true;
484
-    }
485
-
486
-    function successpassword() {
487
-        $this->load->view('view_successpassword');
488
-    }
462
+		foreach ($EmailTemplate->result_array() as $value) {
463
+			$TemplateData = $value;
464
+			$TemplateData['subject'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['subject']);
465
+			$TemplateData['template'] = str_replace('#NAME#', $user_data['first_name']." ".$user_data['last_name'], $TemplateData['template']);
466
+			$TemplateData['template'] = str_replace('#NUMBER#', $user_data['number'], $TemplateData['template']);
467
+			$TemplateData['template'] = str_replace('#PASSWORD#', $user_data['password'], $TemplateData['template']);
468
+			$TemplateData['template'] = str_replace('#COMPANY_WEBSITE#', $company_website, $TemplateData['template']);
469
+			$TemplateData['template'] = str_replace('#LINK#', $user_data['confirm'], $TemplateData['template']);
470
+			$TemplateData['template'] = str_replace('#COMPANY_EMAIL#', $company_email, $TemplateData['template']);
471
+			$TemplateData['template'] = str_replace('#COMPANY_NAME#', $company_name, $TemplateData['template']);
472
+		}
473
+		$email_array = array('accountid' => $account_id,
474
+			'subject' => $TemplateData['subject'],
475
+			'body' => $TemplateData['template'],
476
+			'from' => $invoiceconf['emailaddress'],
477
+			'to' => $user_data['email'],
478
+			'status' => "1",
479
+			//'attachment'=> $Filenm,
480
+			'template' => '');
481
+		//echo "<pre>"; print_r($TemplateData); exit;
482
+		$this->db->insert("mail_details", $email_array);
483
+		return true;
484
+	}
485
+
486
+	function successpassword() {
487
+		$this->load->view('view_successpassword');
488
+	}
489 489
 
490 490
 }
491 491
 ?>
Please login to merge, or discard this patch.
astpp/application/modules/signup/views/view_forgotpassword.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@
 block discarded – undo
39 39
             <div class="row">
40 40
                 <div class="col-md-4 col-md-offset-4">&nbsp;
41 41
 					<span class="login_error">
42
-                        <?php if (isset($astpp_notification)){ ?>
42
+                        <?php if (isset($astpp_notification)) { ?>
43 43
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
44
-						<?php }else{
44
+						<?php } else {
45 45
 						 echo "&nbsp;";
46 46
 						} ?>
47 47
                     </span>
Please login to merge, or discard this patch.
Braces   +11 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 					<span class="login_error">
42 42
                         <?php if (isset($astpp_notification)){ ?>
43 43
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
44
-						<?php }else{
44
+						<?php } else{
45 45
 						 echo "&nbsp;";
46 46
 						} ?>
47 47
                     </span>
@@ -78,10 +78,18 @@  discard block
 block discarded – undo
78 78
 										<div class="input-group col-md-12 margin-t-15 padding-r-32 padding-l-32">
79 79
 												<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
80 80
 
81
-												<input type="text" class="form-control" id="email" name="email" placeholder="User Name OR Email" value = "<?php if (isset($value['email'])) echo  $value['email']; else ''; ?>" style="height:40px;">
81
+												<input type="text" class="form-control" id="email" name="email" placeholder="User Name OR Email" value = "<?php if (isset($value['email'])) {
82
+	echo  $value['email'];
83
+} else {
84
+	'';
85
+}
86
+?>" style="height:40px;">
82 87
 										</div> 
83 88
 
84
-												<?php if (isset($error['email'])) echo $error['email']; ?>              
89
+												<?php if (isset($error['email'])) {
90
+	echo $error['email'];
91
+}
92
+?>              
85 93
 											<div style="width: 97.67%; float: left;text-align: left; margin: 2% 22%;">
86 94
 													<span id="e_name" style="color:red;"> </span>
87 95
 											</div>
Please login to merge, or discard this patch.
astpp/application/modules/signup/views/view_confirmpassword.php 1 patch
Braces   +20 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,16 +77,32 @@
 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'])) {
81
+	echo  $value['password'];
82
+} else {
83
+	'';
84
+}
85
+?>" id="password" size="15" maxlength="40" class="form-control"  />
86
+<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if (isset($error['password'])) {
87
+	echo $error['password'];
88
+}
89
+?></div>
82 90
 </div>
83 91
 </div>
84 92
 
85 93
 <div class="col-md-12 margin-t-10 padding-r-32 padding-l-32">
86 94
 <label class="col-md-5 no-padding" style="text-align: left;">Confirm Password</label>
87 95
 <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>
96
+<input type="text" name="confirmpassword" required value="<?php if (isset($value['confirm_password'])) {
97
+	echo  $value['confirm_password'];
98
+} else {
99
+	'';
100
+}
101
+?>" id="confirm_password" size="15" maxlength="40" class="form-control"  />
102
+<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if (isset($error['confirm_password'])) {
103
+	echo $error['confirm_password'];
104
+}
105
+?></div>
90 106
 </div>
91 107
 </div>
92 108
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/views/view_signup_active.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@
 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');
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
                         <div class="col-md-4 col-md-offset-4">&nbsp;<span class="login_error">
39 39
                         <?php if (isset($astpp_notification)){ ?>
40 40
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
41
-                    <?php }else{
41
+                    <?php } else{
42 42
                          echo "&nbsp;";
43 43
                     } ?>
44 44
                     </span></div> <br/>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/signup/views/view_signup.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,9 +95,9 @@
 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>
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 					<span class="login_error">
98 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>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/systems/models/system_model.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -39,50 +39,50 @@  discard block
 block discarded – undo
39 39
 		return $query;
40 40
 	}
41 41
 
42
-	function gettemplate_list($flag="", $start, $limit="") {
42
+	function gettemplate_list($flag = "", $start, $limit = "") {
43 43
 
44 44
          
45 45
 		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
46 46
 			$account_data = $this->session->userdata("accountinfo");
47 47
 			$reseller = $account_data['id'];
48
-			$this->db->where('reseller_id',$reseller);
49
-			$query = $this->db_model->select("*", "default_templates","","","","","");
50
-
51
-			if($query->num_rows() >0){
52
-		$result =$query->result_array();
53
-		$match_array =array();
54
-		$unmatch_array= array();
55
-		$i=0;
56
-		$str=0;
57
-		foreach($result as $value)
48
+			$this->db->where('reseller_id', $reseller);
49
+			$query = $this->db_model->select("*", "default_templates", "", "", "", "", "");
50
+
51
+			if ($query->num_rows() > 0) {
52
+		$result = $query->result_array();
53
+		$match_array = array();
54
+		$unmatch_array = array();
55
+		$i = 0;
56
+		$str = 0;
57
+		foreach ($result as $value)
58 58
 		{
59
-			$this->db->where('name',$value['name']);
60
-			$this->db->where('reseller_id',0);
61
-			$query = $this->db_model->select("id", "default_templates","", "id", "ASC", $limit, $start);		
62
-			$innerresult =$query->result_array();
63
-			foreach($innerresult as $value)
59
+			$this->db->where('name', $value['name']);
60
+			$this->db->where('reseller_id', 0);
61
+			$query = $this->db_model->select("id", "default_templates", "", "id", "ASC", $limit, $start);		
62
+			$innerresult = $query->result_array();
63
+			foreach ($innerresult as $value)
64 64
 			{                   
65
-			  $str.=$value['id'].",";
65
+			  $str .= $value['id'].",";
66 66
 			}		
67 67
 		}            
68
-		$str= rtrim($str,',');
68
+		$str = rtrim($str, ',');
69 69
 		
70 70
 		$where = "id NOT IN ($str)";		
71
-		$this->db->where('reseller_id',$reseller);
72
-		$this->db->or_where('reseller_id',0);
71
+		$this->db->where('reseller_id', $reseller);
72
+		$this->db->or_where('reseller_id', 0);
73 73
 		$this->db->where($where);
74 74
 			}
75 75
 			else
76 76
 			{
77
-			   $this->db->where('reseller_id',0);
77
+			   $this->db->where('reseller_id', 0);
78 78
 			}
79 79
               
80
-			if($flag) {
80
+			if ($flag) {
81 81
 
82
-		$query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start);
83
-		 }else {
82
+		$query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start);
83
+		 } else {
84 84
 
85
-		$query = $this->db_model->countQuery("*", "default_templates","");
85
+		$query = $this->db_model->countQuery("*", "default_templates", "");
86 86
 		
87 87
 		 }
88 88
 	  } 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 			$this->db->where($where);
93 93
 			$this->db_model->build_search('template_search');
94 94
 		if ($flag) {
95
-			$query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start);
95
+			$query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start);
96 96
 		} else {
97
-			$query = $this->db_model->countQuery("*", "default_templates","");
97
+			$query = $this->db_model->countQuery("*", "default_templates", "");
98 98
 		}
99 99
 	  }
100 100
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
                         
107 107
 		$this->db->where("name", $name);
108 108
 		$this->db->update("system", $add_array);
109
-		if($name == 'base_currency'){
109
+		if ($name == 'base_currency') {
110 110
             
111
-			$screen_path = getcwd() . "/cron";
112
-			$screen_filename = "CurrencyUpdate" . strtotime('now');
113
-			$command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S  $screen_filename php cron.php CurrencyUpdate";
111
+			$screen_path = getcwd()."/cron";
112
+			$screen_filename = "CurrencyUpdate".strtotime('now');
113
+			$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php CurrencyUpdate";
114 114
 			exec($command);
115
-			$this->db->update("currency",array("currencyrate"=>'1'),array("currency"=>"INR"));
115
+			$this->db->update("currency", array("currencyrate"=>'1'), array("currency"=>"INR"));
116 116
 		}
117 117
 	}
118 118
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	function getcurrency_list($flag, $start = 0, $limit = 0) {
180 180
 		 $this->db_model->build_search('currency_list_search');
181 181
 	
182
-	$where=array('currency <>' =>Common_model::$global_config['system_config']['base_currency']);
182
+	$where = array('currency <>' =>Common_model::$global_config['system_config']['base_currency']);
183 183
 		if ($flag) {
184 184
 			$query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start);
185 185
 		} else {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		$this->db->delete("currency");
206 206
 		return true;
207 207
 	}
208
-	function backup_insert($add_array='')
208
+	function backup_insert($add_array = '')
209 209
 	{
210 210
 	 unset($add_array["action"]);
211 211
 		$this->db->insert("backup_database", $add_array);
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 	function get_backup_data($id)
224 224
 	{
225
-	  $where=array('id'=>$id);
225
+	  $where = array('id'=>$id);
226 226
 	  $query = $this->db_model->getSelect("*", "backup_database", $where);
227 227
 	  return $query;
228 228
 	}
229
-   function import_database($filename,$target_path)
229
+   function import_database($filename, $target_path)
230 230
 	{
231
-		$this->db->insert("backup_database", array('backup_name'=>$filename , 'path'=>$target_path));
231
+		$this->db->insert("backup_database", array('backup_name'=>$filename, 'path'=>$target_path));
232 232
 			return true;
233 233
 	}
234 234
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
 		$this->db->where('reseller_id',$reseller);
72 72
 		$this->db->or_where('reseller_id',0);
73 73
 		$this->db->where($where);
74
-			}
75
-			else
74
+			} else
76 75
 			{
77 76
 			   $this->db->where('reseller_id',0);
78 77
 			}
@@ -80,13 +79,12 @@  discard block
 block discarded – undo
80 79
 			if($flag) {
81 80
 
82 81
 		$query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start);
83
-		 }else {
82
+		 } else {
84 83
 
85 84
 		$query = $this->db_model->countQuery("*", "default_templates","");
86 85
 		
87 86
 		 }
88
-	  } 
89
-	  else {
87
+	  } else {
90 88
           
91 89
 			$where = array('reseller_id' => 0);
92 90
 			$this->db->where($where);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/systems/controllers/systems.php 2 patches
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		$this->load->dbutil();
35 35
 
36 36
 		if ($this->session->userdata('user_login') == FALSE)
37
-			redirect(base_url() . '/astpp/login');
37
+			redirect(base_url().'/astpp/login');
38 38
 	}
39 39
 
40 40
 	function configuration_edit($edit_id = '') {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			$this->session->set_userdata('configuration_search', $action);
59 59
 		}
60 60
 		if (@$ajax_search != 1) {
61
-			redirect(base_url() . 'systems/configuration/');
61
+			redirect(base_url().'systems/configuration/');
62 62
 		}
63 63
 	}
64 64
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 	}
86 86
 
87
-	function configuration($group_title='') {
88
-	if($group_title==""){
89
-		redirect(base_url() . '/dashboard');
87
+	function configuration($group_title = '') {
88
+	if ($group_title == "") {
89
+		redirect(base_url().'/dashboard');
90 90
 	}
91
-	if($group_title=="email"){
91
+	if ($group_title == "email") {
92 92
 		  $data['test_email_flag'] = true;
93 93
 	}
94 94
 		$data['username'] = $this->session->userdata('user_name');
95 95
 		$data['page_title'] = ucfirst($group_title);
96
-	$data['group_title']=$group_title;
97
-	$where=array("group_title"=>$group_title);
96
+	$data['group_title'] = $group_title;
97
+	$where = array("group_title"=>$group_title);
98 98
 	$details = $this->db_model->getSelect("*", "system", $where);
99
-	$data['details']=$details->result_array();
99
+	$data['details'] = $details->result_array();
100 100
 	$add_array = $this->input->post();
101
- 	if (!empty($add_array)) {
101
+ 	if ( ! empty($add_array)) {
102 102
 
103
-		foreach($add_array as $key=>$val){
104
-			$update_array=array('value'=>$val);
103
+		foreach ($add_array as $key=>$val) {
104
+			$update_array = array('value'=>$val);
105 105
 			$this->system_model->edit_configuration($update_array, $key);
106 106
 		}
107 107
 				$this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!');
108
-			redirect(base_url() . 'systems/configuration/'.$group_title);
109
-		}else{
108
+			redirect(base_url().'systems/configuration/'.$group_title);
109
+		} else {
110 110
 	 	$this->load->view('view_systemconf', $data);
111 111
 	}
112 112
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
167 167
 			 $account_data = $this->session->userdata("accountinfo");
168 168
 			 $reseller = $account_data['id'];
169
-			 $this->resellertemplate_save($add_array,$reseller);
169
+			 $this->resellertemplate_save($add_array, $reseller);
170 170
 		}
171 171
 		else
172 172
 		{
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 		}
175 175
 	}
176 176
     
177
-	function resellertemplate_save($data,$resellerid)
177
+	function resellertemplate_save($data, $resellerid)
178 178
 	{
179
-		$where = array('name' => $data['name'],'reseller_id'=>$resellerid);
179
+		$where = array('name' => $data['name'], 'reseller_id'=>$resellerid);
180 180
 		$count = $this->db_model->countQuery("*", "default_templates", $where);
181 181
 		$data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data);
182
-		if($count >0)
182
+		if ($count > 0)
183 183
 		{
184 184
 			$data['page_title'] = 'Edit Template';
185 185
 			if ($this->form_validation->run() == FALSE) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 
189 189
 				$this->system_model->edit_resellertemplate($data, $data['id']);
190 190
 				$this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!');
191
-				redirect(base_url() . 'systems/template/');
191
+				redirect(base_url().'systems/template/');
192 192
 				exit;
193 193
 			}
194 194
 		} else {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				 $data['reseller_id'] = $resellerid;
200 200
 				$this->system_model->add_resellertemplate($data);
201 201
 				$this->session->set_flashdata('astpp_errormsg', 'Template added successfully!');
202
-				redirect(base_url() . 'systems/template/');
202
+				redirect(base_url().'systems/template/');
203 203
 				exit;
204 204
 			}
205 205
 		}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				 unset($data['page_title']);
218 218
 				$this->system_model->edit_template($data, $data['id']);
219 219
 				$this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!');
220
-				redirect(base_url() . 'systems/template/');
220
+				redirect(base_url().'systems/template/');
221 221
 				exit;
222 222
 			}
223 223
 		} else {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				 unset($data['form']);
229 229
 				$this->system_model->add_template($data);
230 230
 				$this->session->set_flashdata('astpp_errormsg', 'Template added successfully!');
231
-				redirect(base_url() . 'systems/template/');
231
+				redirect(base_url().'systems/template/');
232 232
 				exit;
233 233
 			}
234 234
 		}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			$this->session->set_userdata('template_search', $action);
246 246
 		}
247 247
 		if (@$ajax_search != 1) {
248
-			redirect(base_url() . 'systems/template/');
248
+			redirect(base_url().'systems/template/');
249 249
 		}
250 250
 	}
251 251
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			$this->session->set_userdata('country_list_search', $action);
294 294
 		}
295 295
 		if (@$ajax_search != 1) {
296
-			redirect(base_url() . 'systems/country_list/');
296
+			redirect(base_url().'systems/country_list/');
297 297
 		}
298 298
 	}
299 299
 
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
     
353 353
 	function country_remove($id) {
354 354
 		$this->system_model->remove_country($id);
355
-		$country=$this->common->get_field_name('country','countrycode',$id);
355
+		$country = $this->common->get_field_name('country', 'countrycode', $id);
356 356
 		$this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!');
357
-		redirect(base_url() . 'systems/country_list/');
357
+		redirect(base_url().'systems/country_list/');
358 358
 	}
359 359
 
360 360
 	function country_delete_multiple() {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			$this->session->set_userdata('currency_list_search', $action);
406 406
 		}
407 407
 		if (@$ajax_search != 1) {
408
-			redirect(base_url() . 'systems/currency_list/');
408
+			redirect(base_url().'systems/currency_list/');
409 409
 		}
410 410
 	}
411 411
 
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 	}
465 465
     
466 466
 	 function currency_remove($id) {
467
-		$currencyname=$this->common->get_field_name('currencyname','currency',$id);
467
+		$currencyname = $this->common->get_field_name('currencyname', 'currency', $id);
468 468
 		$this->system_model->remove_currency($id);
469
-		$this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!');
470
-		redirect(base_url() . 'systems/currency_list/');
469
+		$this->session->set_flashdata('astpp_notification', $currencyname.' Currency removed successfully!');
470
+		redirect(base_url().'systems/currency_list/');
471 471
 	}
472 472
 
473 473
 	function currency_delete_multiple() {
@@ -478,53 +478,53 @@  discard block
 block discarded – undo
478 478
 	}
479 479
 	function database_backup()
480 480
 	{
481
-		$data=array();
481
+		$data = array();
482 482
 		$data['username'] = $this->session->userdata('user_name');
483 483
 		$data['page_title'] = 'Database Backup';
484
-		$filename=$this->db->database."_".date("YmdHms").".sql.gz";
484
+		$filename = $this->db->database."_".date("YmdHms").".sql.gz";
485 485
 		$data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), '');
486 486
 		$this->load->view('view_database_backup', $data);
487 487
 	}
488 488
 	function database_backup_save()
489 489
 	{ 
490 490
 
491
-	  $add_array=$this->input->post();
491
+	  $add_array = $this->input->post();
492 492
       
493
-	  $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array);
493
+	  $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'], $add_array['id']), $add_array);
494 494
 	  $data['page_title'] = 'Database Backup';
495
-	  if($add_array['id'] != ''){
495
+	  if ($add_array['id'] != '') {
496 496
       
497
-	  }else{
498
-		   if($this->form_validation->run() == FALSE) {
497
+	  } else {
498
+		   if ($this->form_validation->run() == FALSE) {
499 499
 				$data['validation_errors'] = validation_errors();
500 500
 				echo $data['validation_errors'];
501 501
 				exit;
502
-		  }else{
502
+		  } else {
503 503
 			 $db_name     = $this->db->database;
504 504
 			 $db_username = $this->db->username;
505 505
 			 $db_password = $this->db->password;
506 506
 			 $db_hostname = $this->db->hostname;
507 507
 			 $filename = $add_array['path'];
508
-			 $backup_file=DATABASE_DIRECTORY.$filename;
509
-			if (substr($backup_file,-3)=='.gz'){
510
-				  $backup_file = substr($backup_file,0,-3);
511
-				  $do_gzip=1;
508
+			 $backup_file = DATABASE_DIRECTORY.$filename;
509
+			if (substr($backup_file, -3) == '.gz') {
510
+				  $backup_file = substr($backup_file, 0, -3);
511
+				  $do_gzip = 1;
512 512
 			}
513 513
 
514
-		   $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'";
515
-		   $error_zip=0;
516
-		   exec($run_backup,$output,$error);
517
-		   if ($do_gzip){
514
+		   $run_backup = "/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'";
515
+		   $error_zip = 0;
516
+		   exec($run_backup, $output, $error);
517
+		   if ($do_gzip) {
518 518
 			  $gzip = $this->config->item('gzip-path');
519 519
 			  $run_gzip = $gzip." ".$backup_file;
520
-			  exec($run_gzip,$output,$error_zip);
520
+			  exec($run_gzip, $output, $error_zip);
521 521
 		   }
522 522
           
523
-		   if($error == 0 && $error_zip == 0 ){      
523
+		   if ($error == 0 && $error_zip == 0) {      
524 524
 			  $this->system_model->backup_insert($add_array);
525 525
 			  echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!"));
526 526
 			  exit;
527
-		   }else{
527
+		   } else {
528 528
 				echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section';
529 529
 				exit;
530 530
 		   }
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	{
542 542
 	$json_data = array();
543 543
 		$count_all = $this->system_model->getbackup_list(false, "", "");
544
-		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']);
544
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
545 545
 		$json_data = $paging_data["json_paging"];
546 546
 
547 547
 		$query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
@@ -551,56 +551,56 @@  discard block
 block discarded – undo
551 551
 		echo json_encode($json_data);
552 552
 	exit;
553 553
 	}
554
-	function database_restore_one($id='')
554
+	function database_restore_one($id = '')
555 555
 	{
556 556
 	   $result = $this->system_model->get_backup_data($id);
557
-	   $result_array=$result->result_array();
558
-	   if($result->num_rows() > 0)
557
+	   $result_array = $result->result_array();
558
+	   if ($result->num_rows() > 0)
559 559
 	   {
560 560
 			$db_name     = $this->db->database;
561 561
 			$db_username = $this->db->username;
562 562
 			$db_password = $this->db->password;
563 563
 			$db_hostname = $this->db->hostname;            
564
-			$path=DATABASE_DIRECTORY.$result_array[0]['path'];
565
-			if(file_exists($path)){
566
-			  if (substr($path,-3)=='.gz') {
564
+			$path = DATABASE_DIRECTORY.$result_array[0]['path'];
565
+			if (file_exists($path)) {
566
+			  if (substr($path, -3) == '.gz') {
567 567
 							$GUNZIP_EXE = $this->config->item('gunzip-path');
568 568
 							$run_gzip = $GUNZIP_EXE." < ".$path." | ";
569 569
 			  }
570
-			  $MYSQL="/usr/bin/mysql";
570
+			  $MYSQL = "/usr/bin/mysql";
571 571
 			  $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name;
572 572
 			  exec($run_restore);
573 573
 			  $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.');
574
-			  redirect(base_url() . 'systems/database_restore/');
575
-			}else{
574
+			  redirect(base_url().'systems/database_restore/');
575
+			} else {
576 576
 			  $this->session->set_flashdata('astpp_notification', 'File not exists!');
577
-			  redirect(base_url() . 'systems/database_restore/');
577
+			  redirect(base_url().'systems/database_restore/');
578 578
 			}
579 579
 	  }
580
-	  redirect(base_url() . 'systems/database_restore/');
580
+	  redirect(base_url().'systems/database_restore/');
581 581
 	}
582 582
 
583
- function database_download($id=''){
583
+ function database_download($id = '') {
584 584
     
585 585
 	$result = $this->system_model->get_backup_data($id);
586
-	$result_array=$result->result_array();
587
-	if($result->num_rows() > 0)
586
+	$result_array = $result->result_array();
587
+	if ($result->num_rows() > 0)
588 588
 	{
589
-	  $path=$result_array[0]['path'];
589
+	  $path = $result_array[0]['path'];
590 590
 	  $filename = basename($path);
591 591
 	  $len = filesize($path);
592 592
       
593 593
 	  header("Content-Encoding: binary");
594 594
 	  header("Content-Type: application/octet-stream");
595
-	  header( "content-length: " . $len );
596
-	  header( "content-disposition: attachment; filename=" . $filename );
595
+	  header("content-length: ".$len);
596
+	  header("content-disposition: attachment; filename=".$filename);
597 597
 	  header("Expires: 0");
598 598
 	  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
599 599
 	  header("Cache-Control: private");
600 600
 	  header("Pragma: public");
601 601
 	  ob_clean();
602
-	  $fp=fopen( $path, "r" );
603
-	  fpassthru( $fp );
602
+	  $fp = fopen($path, "r");
603
+	  fpassthru($fp);
604 604
 	  exit;
605 605
 	}
606 606
 	}
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
    function database_import_file()
615 615
 	{
616 616
 		$filename = $_POST['fname'];
617
-		$upload_greeting_file= $_FILES['userfile']['name'];
618
-		$db_file = explode(".",$upload_greeting_file); 
619
-		if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){
620
-			$target_path = basename( $_FILES['userfile']['name']);
621
-			move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path );
617
+		$upload_greeting_file = $_FILES['userfile']['name'];
618
+		$db_file = explode(".", $upload_greeting_file); 
619
+		if ($db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql') {
620
+			$target_path = basename($_FILES['userfile']['name']);
621
+			move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path);
622 622
           
623
-			$query = $this->system_model->import_database($filename,$_FILES['userfile']['name']);
624
-			$this->session->set_flashdata('astpp_errormsg',"The file ".  basename( $_FILES['userfile']['name'])." has been uploaded");
623
+			$query = $this->system_model->import_database($filename, $_FILES['userfile']['name']);
624
+			$this->session->set_flashdata('astpp_errormsg', "The file ".basename($_FILES['userfile']['name'])." has been uploaded");
625 625
 			redirect(base_url()."systems/database_restore/");            
626
-		}else{
627
-			$this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format.");
626
+		} else {
627
+			$this->session->set_flashdata('astpp_notification', "There is a some issue or invalid file format.");
628 628
 			redirect(base_url()."systems/database_restore/");            
629 629
 		}
630 630
 	}
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 	  $this->db->where($where);
635 635
 	  $this->db->delete("backup_database");
636 636
 	  $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.');      
637
-	  redirect(base_url() . 'systems/database_restore/');
637
+	  redirect(base_url().'systems/database_restore/');
638 638
 	  return true;
639 639
 	}
640 640
 	function database_backup_delete_multiple() {
Please login to merge, or discard this patch.
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
 		$this->load->model('system_model');
34 34
 		$this->load->dbutil();
35 35
 
36
-		if ($this->session->userdata('user_login') == FALSE)
37
-			redirect(base_url() . '/astpp/login');
36
+		if ($this->session->userdata('user_login') == FALSE) {
37
+					redirect(base_url() . '/astpp/login');
38
+		}
38 39
 	}
39 40
 
40 41
 	function configuration_edit($edit_id = '') {
@@ -106,7 +107,7 @@  discard block
 block discarded – undo
106 107
 		}
107 108
 				$this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!');
108 109
 			redirect(base_url() . 'systems/configuration/'.$group_title);
109
-		}else{
110
+		} else{
110 111
 	 	$this->load->view('view_systemconf', $data);
111 112
 	}
112 113
 	}
@@ -167,8 +168,7 @@  discard block
 block discarded – undo
167 168
 			 $account_data = $this->session->userdata("accountinfo");
168 169
 			 $reseller = $account_data['id'];
169 170
 			 $this->resellertemplate_save($add_array,$reseller);
170
-		}
171
-		else
171
+		} else
172 172
 		{
173 173
 			$this->admintemplate_save($add_array);
174 174
 		}
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 	  $data['page_title'] = 'Database Backup';
495 495
 	  if($add_array['id'] != ''){
496 496
       
497
-	  }else{
497
+	  } else{
498 498
 		   if($this->form_validation->run() == FALSE) {
499 499
 				$data['validation_errors'] = validation_errors();
500 500
 				echo $data['validation_errors'];
501 501
 				exit;
502
-		  }else{
502
+		  } else{
503 503
 			 $db_name     = $this->db->database;
504 504
 			 $db_username = $this->db->username;
505 505
 			 $db_password = $this->db->password;
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 			  $this->system_model->backup_insert($add_array);
525 525
 			  echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!"));
526 526
 			  exit;
527
-		   }else{
527
+		   } else{
528 528
 				echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section';
529 529
 				exit;
530 530
 		   }
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 			  exec($run_restore);
573 573
 			  $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.');
574 574
 			  redirect(base_url() . 'systems/database_restore/');
575
-			}else{
575
+			} else{
576 576
 			  $this->session->set_flashdata('astpp_notification', 'File not exists!');
577 577
 			  redirect(base_url() . 'systems/database_restore/');
578 578
 			}
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 			$query = $this->system_model->import_database($filename,$_FILES['userfile']['name']);
624 624
 			$this->session->set_flashdata('astpp_errormsg',"The file ".  basename( $_FILES['userfile']['name'])." has been uploaded");
625 625
 			redirect(base_url()."systems/database_restore/");            
626
-		}else{
626
+		} else{
627 627
 			$this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format.");
628 628
 			redirect(base_url()."systems/database_restore/");            
629 629
 		}
Please login to merge, or discard this patch.