Completed
Pull Request — v3.0 (#146)
by
unknown
23:15 queued 10:50
created
web_interface/astpp/application/modules/email/controllers/email.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$this->load->library('csvreader');
37 37
 	$this->load->library('astpp/email_lib');
38 38
 		if ($this->session->userdata('user_login') == FALSE)
39
-			redirect(base_url() . '/astpp/login');
39
+			redirect(base_url().'/astpp/login');
40 40
 	}
41 41
 
42 42
 	function email_edit($edit_id = '') {
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 			$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), $edit_data);
57 57
 			$this->load->view('view_email_add_edit', $data);
58 58
 		} else {
59
-			redirect(base_url() . 'email/email_history_list/');
59
+			redirect(base_url().'email/email_history_list/');
60 60
 		}
61
-			redirect(base_url() . 'email/email_history_list/');
61
+			redirect(base_url().'email/email_history_list/');
62 62
 	}
63 63
 
64 64
 	function email_resend() {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			foreach ($account->result_array() as $key => $value) {
79 79
 				$edit_data = $value;
80 80
 			}
81
-		$add_array=array('accountid'=>$edit_data['accountid'],
81
+		$add_array = array('accountid'=>$edit_data['accountid'],
82 82
 				 'subject'=>$add_array['subject'],
83 83
 				 'body'=>$add_array['body'],
84 84
 				 'from'=>$edit_data['from'],
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				$this->email_re_send($add_array);		
92 92
         
93 93
 		$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!');
94
-			redirect(base_url() . 'email/email_history_list/');
94
+			redirect(base_url().'email/email_history_list/');
95 95
 	}
96 96
 	function email_resend_edit($edit_id = '') {
97 97
 	$data['page_title'] = 'Resend Email';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 			$this->load->view('view_email_add_edit', $data);
108 108
 		} else {
109
-			redirect(base_url() . 'email/email_history_list/');
109
+			redirect(base_url().'email/email_history_list/');
110 110
 		}
111 111
 
112 112
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 			$this->load->view('view_email_add_edit', $data);
125 125
 		} else {
126
-			redirect(base_url() . 'email/email_history_list/');
126
+			redirect(base_url().'email/email_history_list/');
127 127
 		}
128 128
 
129 129
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			foreach ($account->result_array() as $key => $value) {
137 137
 				$edit_data = $value;
138 138
 			}
139
-		$add_array=array('accountid'=>$edit_data['accountid'],
139
+		$add_array = array('accountid'=>$edit_data['accountid'],
140 140
 				 'subject'=>$add_array['subject'],
141 141
 				 'body'=>$add_array['body'],
142 142
 				 'from'=>$edit_data['from'],
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 				 'attachment'=>$edit_data['attachment'],
147 147
 				);
148 148
 			$this->email_model->add_email($add_array);
149
-			$this->email_lib->send_email('',$add_array,'','',1);
149
+			$this->email_lib->send_email('', $add_array, '', '', 1);
150 150
 
151 151
 			$this->load->module('accounts/accounts');
152 152
 		$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!');
153
-			redirect(base_url() . 'accounts/customer_edit/'.$value["accountid"]);
153
+			redirect(base_url().'accounts/customer_edit/'.$value["accountid"]);
154 154
 	}
155 155
 	function email_add($type = "") {
156 156
 
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
 		}
190 190
 	}
191 191
 	function email_re_send($edit_data) {
192
-	$this->email_lib->send_email('',$edit_data,'',$edit_data['attachment'],1);
192
+	$this->email_lib->send_email('', $edit_data, '', $edit_data['attachment'], 1);
193 193
 	$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!');
194
-		redirect(base_url() . '/email/email_history_list/');
194
+		redirect(base_url().'/email/email_history_list/');
195 195
 	}
196 196
 	function email_view($edit_id = '') {
197 197
 	$data['page_title'] = 'View Email';
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 			foreach ($account->result_array() as $key => $value) {
202 202
 				$edit_data = $value;
203 203
 			}  
204
-			if($edit_data['status'] == 1){
205
-				$edit_data['status']='Not Sent';
206
-			} else{
207
-				$edit_data['status']='Sent';
204
+			if ($edit_data['status'] == 1) {
205
+				$edit_data['status'] = 'Not Sent';
206
+			} else {
207
+				$edit_data['status'] = 'Sent';
208 208
 			}
209 209
 			$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view(), $edit_data);
210 210
 
211 211
 			$this->load->view('view_email_add_edit', $data);
212 212
 		} else {
213
-			redirect(base_url() . 'email/email_history_list/');
213
+			redirect(base_url().'email/email_history_list/');
214 214
 		}
215 215
 	}
216 216
 	function email_view_customer($edit_id = '') {
@@ -224,140 +224,140 @@  discard block
 block discarded – undo
224 224
 			$data['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view_cus(), $edit_data);
225 225
 			$this->load->view('view_email_add_edit', $data);
226 226
 		} else {
227
-			redirect(base_url() . 'email/email_history_list/'.$edit_id);
227
+			redirect(base_url().'email/email_history_list/'.$edit_id);
228 228
 		}
229 229
 	}
230 230
 	function email_delete($id) {
231 231
 		$this->email_model->remove_email($id);
232 232
 		$this->session->set_flashdata('astpp_notification', 'Email removed successfully!');
233
-		redirect(base_url() . '/email/email_history_list/');
233
+		redirect(base_url().'/email/email_history_list/');
234 234
 	}
235
-	function email_delete_customer($accounttype,$accountid,$id) {
235
+	function email_delete_customer($accounttype, $accountid, $id) {
236 236
 		$this->email_model->remove_email($id);
237 237
 		$where = array('id' => $id);
238 238
 		$account = $this->db_model->getSelect("*", "mail_details", $where);
239 239
 	foreach ($account->result_array() as $key => $value) {
240 240
 		$edit_data = $value;
241 241
 	}
242
-		$url ="accounts/".$accounttype."_emailhistory/$accountid/";
242
+		$url = "accounts/".$accounttype."_emailhistory/$accountid/";
243 243
 		$this->session->set_flashdata('astpp_notification', 'Email removed successfully!');
244 244
 	$this->load->module('accounts/accounts');
245
-		redirect(base_url() . $url);
245
+		redirect(base_url().$url);
246 246
 	}
247 247
 	function email_mass() {
248 248
 		$account_data = $this->session->userdata("accountinfo");
249
-		if ($account_data['type'] == '1' || $account_data['type']== 0 || $account_data['type']==3)
250
-			redirect(base_url() . '/astpp/dashboard/');
249
+		if ($account_data['type'] == '1' || $account_data['type'] == 0 || $account_data['type'] == 3)
250
+			redirect(base_url().'/astpp/dashboard/');
251 251
 	$data['username'] = $this->session->userdata('user_name');	
252 252
 		$data['page_title'] = 'Email Mass';
253 253
 		$data['form'] = $this->form->build_form($this->email_form->build_list_for_email_client_area(), '');
254
-	$this->load->view('view_email_client_area',$data); 
254
+	$this->load->view('view_email_client_area', $data); 
255 255
 	}
256 256
  /*Mass Email*/
257
-   function attachment_icons($select = "", $table = "", $attachement="") {
258
-	if($attachement!="")
257
+   function attachment_icons($select = "", $table = "", $attachement = "") {
258
+	if ($attachement != "")
259 259
 	{
260
-		$array=explode(",", $attachement);
261
-		$str='';
262
-		foreach($array as $key =>$val){
263
-			$link = base_url() . "email/email_history_list_attachment/".$val;
264
-			$str.="<a href='".$link."' title='".$val."' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a>&nbsp;&nbsp;";
260
+		$array = explode(",", $attachement);
261
+		$str = '';
262
+		foreach ($array as $key =>$val) {
263
+			$link = base_url()."email/email_history_list_attachment/".$val;
264
+			$str .= "<a href='".$link."' title='".$val."' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a>&nbsp;&nbsp;";
265 265
 		}
266 266
 		return $str;
267
-	} else{
267
+	} else {
268 268
 		return "";
269 269
 	}
270 270
 	}
271 271
 	function email_client_get()
272 272
 	  {
273
-		   $files=$_FILES;
273
+		   $files = $_FILES;
274 274
 		   $add_array = $this->input->post();
275 275
 		   $add_array['page_title'] = 'Compose email';
276
-		   $nooffile= $files['file']['name'];
277
-		   $count=count($nooffile);
278
-		   $add_array['attachment']='';
279
-		   $add_array['file']='';
280
-		   for($i=0;$i<$count;$i++){
281
-			   $tmp_name[]= $files['file']['tmp_name'][$i];
282
-			   if($files['file']['error'][$i]==0){
276
+		   $nooffile = $files['file']['name'];
277
+		   $count = count($nooffile);
278
+		   $add_array['attachment'] = '';
279
+		   $add_array['file'] = '';
280
+		   for ($i = 0; $i < $count; $i++) {
281
+			   $tmp_name[] = $files['file']['tmp_name'][$i];
282
+			   if ($files['file']['error'][$i] == 0) {
283 283
 				   $cur_name = $files['file']['name'][$i];
284 284
 				   $parts = explode(".", $cur_name);
285
-				   $add_array['attachment'].=date('ymdhis').$i.'.'.$parts[1].',';
286
-				   $add_array['file'].=date('ymdhis').$i.'.'.$parts[1].',';
285
+				   $add_array['attachment'] .= date('ymdhis').$i.'.'.$parts[1].',';
286
+				   $add_array['file'] .= date('ymdhis').$i.'.'.$parts[1].',';
287 287
 			 		   $uploadedFile1 = $files['file']['tmp_name'][$i];
288
-				   $user_name='inextrix';
289
-				   $actual_file_name=date('ymdhis').$i.'.'.$parts[1];
290
-				   $dir_path=  getcwd()."/attachments/";
291
-				   $path =$dir_path.$actual_file_name;
292
-				   if (move_uploaded_file($uploadedFile1,$path)) {
288
+				   $user_name = 'inextrix';
289
+				   $actual_file_name = date('ymdhis').$i.'.'.$parts[1];
290
+				   $dir_path = getcwd()."/attachments/";
291
+				   $path = $dir_path.$actual_file_name;
292
+				   if (move_uploaded_file($uploadedFile1, $path)) {
293 293
 				   $this->session->set_flashdata('astpp_errormsg', 'files added successfully!');
294 294
 				   }
295
-				   else{
295
+				   else {
296 296
 					$this->session->set_flashdata('astpp_errormsg', 'Please try again   !');
297 297
 				   }
298 298
 			   }
299 299
 		   }
300
-		   $add_array['attachment']=trim($add_array['attachment'],',');
301
-		   $add_array['file']=trim($add_array['file'],',');
302
-			   $add_array['email']= explode(",",$add_array['to']);   
300
+		   $add_array['attachment'] = trim($add_array['attachment'], ',');
301
+		   $add_array['file'] = trim($add_array['file'], ',');
302
+			   $add_array['email'] = explode(",", $add_array['to']);   
303 303
 			   $this->email_model->multipal_email($add_array);
304 304
 			   $screen_path = getcwd()."/cron";
305 305
 			   $screen_filename = "Email_Broadcast_".strtotime('now');
306 306
 			   $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
307 307
 			   exec($command);
308 308
 			   $this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!');
309
-			   redirect(base_url() . 'email/email_history_list/');
309
+			   redirect(base_url().'email/email_history_list/');
310 310
 			   exit; 
311 311
 		}
312 312
     
313 313
 	   function email_client_area() {
314 314
 		$add_array = $this->input->post();
315
-		if($add_array['temp'] == ''){
315
+		if ($add_array['temp'] == '') {
316 316
 	 	$subject = '';
317
-		$body ='';	
317
+		$body = '';	
318 318
 			 }
319
-		else{
319
+		else {
320 320
 				$where = array('id' => $add_array['temp']);
321 321
 		$account = $this->db_model->getSelect("subject,template", "default_templates", $where);
322
-		$account_data =$account->result_array();
323
-				$subject = isset($account_data[0]['subject'])?$account_data[0]['subject']:'';
324
-		$body = isset($account_data[0]['template'])?$account_data[0]['template']:'';	
322
+		$account_data = $account->result_array();
323
+				$subject = isset($account_data[0]['subject']) ? $account_data[0]['subject'] : '';
324
+		$body = isset($account_data[0]['template']) ? $account_data[0]['template'] : '';	
325 325
 	
326 326
             
327 327
 		}
328 328
 	   	$count_all = $this->email_model->get_email_client_data($add_array);
329 329
 	$email_arr = array();
330 330
 	$id_arr = array();
331
-	foreach($count_all as $key=>$value){
331
+	foreach ($count_all as $key=>$value) {
332 332
 		$value = $value;
333
-		if($value['email']!=''){
334
-		$email_arr[$value['email']]= $value['email'];
335
-		$id_arr[]= $value['id'];}
333
+		if ($value['email'] != '') {
334
+		$email_arr[$value['email']] = $value['email'];
335
+		$id_arr[] = $value['id']; }
336 336
 	} 
337 337
 	if (empty($email_arr))
338 338
 	{
339 339
 			$this->session->set_flashdata('astpp_notification', 'No record found! ');
340
-			redirect(base_url() . 'email/email_mass/');
340
+			redirect(base_url().'email/email_mass/');
341 341
 	}
342 342
 	$to_email = $email_arr;
343 343
 	
344 344
 	$to_id = $id_arr;
345
-	$to_send_mail = implode(",",$to_email);
346
-	if($to_send_mail != ''){
347
-		$add_arr['email']= $email_arr;
345
+	$to_send_mail = implode(",", $to_email);
346
+	if ($to_send_mail != '') {
347
+		$add_arr['email'] = $email_arr;
348 348
 	}
349 349
 	$data['username'] = $this->session->userdata('user_name');	
350 350
 	$data['page_title'] = 'Compose Email';
351 351
 	$send_id = $this->db_model->getSelect("emailaddress", "invoice_conf", array());
352
-	$send_id =$send_id->result_array();
353
-	$send_id =$send_id[0]['emailaddress'];
352
+	$send_id = $send_id->result_array();
353
+	$send_id = $send_id[0]['emailaddress'];
354 354
 	$add_arr['template'] = $body;
355 355
 	$add_arr['subject'] = $subject;
356 356
 		$add_arr['accountid'] = $id_arr;
357 357
 	$add_arr['from'] = $send_id;
358 358
 	$add_arr['temp'] = $add_array['temp'];
359
-	$add_arr['to']=$to_send_mail;
360
-	$add_arr['temp']=$add_array['temp'];
359
+	$add_arr['to'] = $to_send_mail;
360
+	$add_arr['temp'] = $add_array['temp'];
361 361
 		$this->load->view('view_email_brod', $add_arr);
362 362
 	}
363 363
 
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
 				$edit_data = $value;
371 371
 			}
372 372
 		$this->load->module('accounts/accounts');
373
-			redirect(base_url() . 'accounts/customer_edit/'.$value['accountid']);
373
+			redirect(base_url().'accounts/customer_edit/'.$value['accountid']);
374 374
 	}
375 375
 	function email_history_list() {
376
-	$data['logintype']=$this->session->userdata('logintype');
376
+	$data['logintype'] = $this->session->userdata('logintype');
377 377
 		$data['username'] = $this->session->userdata('user_name');
378 378
 		$data['search_flag'] = true;
379 379
 		$this->session->set_userdata('advance_search', 0);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	$this->load->view('view_email_list', $data);
385 385
 	}
386 386
 	function email_history_list_json() {
387
-	$data['logintype']=$this->session->userdata('logintype');
387
+	$data['logintype'] = $this->session->userdata('logintype');
388 388
 		$json_data = array();
389 389
 		$count_all = $this->email_model->get_email_list(false);
390 390
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 		echo json_encode($json_data);
396 396
 	}
397 397
 
398
-	function customer_mail_record($accountid,$accounttype){
398
+	function customer_mail_record($accountid, $accounttype) {
399 399
 		$json_data = array();
400
-		$count_all = $this->email_model->customer_get_email_list(false,$accountid,"","");
400
+		$count_all = $this->email_model->customer_get_email_list(false, $accountid, "", "");
401 401
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
402 402
 		$json_data = $paging_data["json_paging"];
403
-		$query = $this->email_model->customer_get_email_list(true,$accountid,$paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
404
-	$grid_fields = json_decode($this->email_form->build_list_for_email_customer($accountid,$accounttype));
403
+		$query = $this->email_model->customer_get_email_list(true, $accountid, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
404
+	$grid_fields = json_decode($this->email_form->build_list_for_email_customer($accountid, $accounttype));
405 405
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
406 406
 		echo json_encode($json_data);
407 407
 	}    
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 		echo $this->db->delete("email");
413 413
 	}
414 414
 
415
-	function email_send_multipal(){
415
+	function email_send_multipal() {
416 416
 	$add_array = $this->input->post();
417
-	if($add_array['email'] == '' || $add_array['subject'] == '' || $add_array['template'] == ''){
417
+	if ($add_array['email'] == '' || $add_array['subject'] == '' || $add_array['template'] == '') {
418 418
 		$this->session->set_flashdata('astpp_notification', 'Email address not found!');
419
-			redirect(base_url() . '/email/email_client_area/');
419
+			redirect(base_url().'/email/email_client_area/');
420 420
 	}
421 421
 		$this->email_model->multipal_email($add_array);
422 422
 	$screen_path = "/var/www/html/ITPLATP/cron";
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
425 425
 		exec($command);
426 426
 	$this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!');
427
-		redirect(base_url() . 'email/email_history_list/');
427
+		redirect(base_url().'email/email_history_list/');
428 428
 
429 429
 	}
430 430
 	function email_history_list_search() {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			$this->session->set_userdata('email_search_list', $action);
439 439
 		}
440 440
 		if (@$ajax_search != 1) {
441
-			redirect(base_url() . 'email/email_history_list/');
441
+			redirect(base_url().'email/email_history_list/');
442 442
 		}
443 443
 	}
444 444
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	* Version 2.1
452 452
     */
453 453
 	function email_history_list_attachment($file_name) {
454
-	if(file_exists(getcwd().'/attachments/'.$file_name)){
454
+	if (file_exists(getcwd().'/attachments/'.$file_name)) {
455 455
 		header('Content-Type: application/octet-stream');
456 456
 		header('Content-Disposition: attachment; filename='.$file_name);
457 457
 		ob_clean();
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/email/libraries/email_form.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
25
+if ( ! defined('BASEPATH'))
26 26
 	exit('No direct script access allowed');
27 27
 
28 28
 class Email_form {
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 
33 33
   function get_form_fields_email() {
34
-		 $form['forms'] = array(base_url() . 'email/email_re_send/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
34
+		 $form['forms'] = array(base_url().'email/email_re_send/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
35 35
 		$form['Resend Email'] = array(
36 36
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
37
-			array('To', 'INPUT', array('name' => 'to', 'size' => '20',  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
38
-			array('From', 'INPUT', array('name' => 'from', 'size' => '20',  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
39
-			array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20',  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
40
-			array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20',  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
37
+			array('To', 'INPUT', array('name' => 'to', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
38
+			array('From', 'INPUT', array('name' => 'from', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
39
+			array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
40
+			array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
41 41
             
42 42
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'email_search_status', '', ''),
43 43
 	           
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	function get_form_fields_email_edit() {
52
-	 $readable='disabled';
53
-		 $form['forms'] = array(base_url() . 'email/email_resend/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
52
+	 $readable = 'disabled';
53
+		 $form['forms'] = array(base_url().'email/email_resend/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
54 54
 	 $form['Resent Email'] = array(
55 55
 		   array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
56 56
 		   array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''),
57
-		   array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true,  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
58
-		   array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "margin-t-10 text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
59
-		   array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1,  'class' => "margin-t-10 text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
60
-		   array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15,  'class' => "margin-t-10 text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
57
+		   array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
58
+		   array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "margin-t-10 text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
59
+		   array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'class' => "margin-t-10 text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
60
+		   array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'class' => "margin-t-10 text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
61 61
 	           
62 62
 	 );
63 63
 	 $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
 	}
67 67
     
68 68
 	function get_form_fields_email_view() {
69
-		$readable='disabled';
70
-		 $form['forms'] = array(base_url() . 'email/email_history_list/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
69
+		$readable = 'disabled';
70
+		 $form['forms'] = array(base_url().'email/email_history_list/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
71 71
 		$form['View Email'] = array(
72 72
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
73 73
 			array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''),
74
-			array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true,  'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''),
75
-			array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true,'style'=>'margin-top: 3px;' ,'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''),
76
-			array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''),
77
-			array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"),'trim|required|xss_clean', 'tOOL TIP', ''),
78
-			array('Status', 'INPUT', array('name' => 'status', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'style'=>'width: 18% !important;margin-top: 3px;' , 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),   
74
+			array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''),
75
+			array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''),
76
+			array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''),
77
+			array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'readonly' => true, 'style'=>'margin-top: 3px;', 'class' => "text field medium col-md-5"), 'trim|required|xss_clean', 'tOOL TIP', ''),
78
+			array('Status', 'INPUT', array('name' => 'status', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'style'=>'width: 18% !important;margin-top: 3px;', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),   
79 79
 	           
80 80
 );
81 81
 		$form['button_save'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
82 82
 		return $form;
83 83
 	}
84 84
 	function get_form_fields_email_view_cus() {
85
-	 $readable='disabled';
86
-		 $form['forms'] = array(base_url() . 'email/email_history_list_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
85
+	 $readable = 'disabled';
86
+		 $form['forms'] = array(base_url().'email/email_history_list_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
87 87
 		 $form['View Email'] = array(
88 88
 		   array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
89 89
 		   array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''),
90
-		   array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
91
-		   array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
92
-	   array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true,  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
93
-		   array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'readonly' => true,  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
90
+		   array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
91
+		   array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
92
+	   array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
93
+		   array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
94 94
             
95
-		array('Status', array('name' => 'status', 'disabled' => $readable, 'style' => 'width:20% !important;','class' => "text field medium"), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'email_search_status', '', ''),
95
+		array('Status', array('name' => 'status', 'disabled' => $readable, 'style' => 'width:20% !important;', 'class' => "text field medium"), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'email_search_status', '', ''),
96 96
 	           
97 97
 );
98 98
 		$form['button_save'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
99 99
 		return $form;
100 100
 	}
101 101
 	function get_form_fields_email_view_cus_edit() {
102
-		$readable='disabled';
103
-		 $form['forms'] = array(base_url() . 'email/email_resend_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
102
+		$readable = 'disabled';
103
+		 $form['forms'] = array(base_url().'email/email_resend_customer/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
104 104
 		$form['Resent Email'] = array(
105 105
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
106 106
 			array('', 'HIDDEN', array('name' => 'status'), '', '', '', ''),
107
-			array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true,  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
108
-			array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20','cols'=>50,'rows'=>1, 'readonly' => true, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
109
-			array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20','cols'=>50,'rows'=>1, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
110
-			array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20','cols'=>50,'rows'=>15, 'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),           
107
+			array('From', 'TEXTAREA', array('name' => 'from', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
108
+			array('To', 'TEXTAREA', array('name' => 'to', 'size' => '20', 'cols'=>50, 'rows'=>1, 'readonly' => true, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
109
+			array('Subject', 'TEXTAREA', array('name' => 'subject', 'size' => '20', 'cols'=>50, 'rows'=>1, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
110
+			array('Body', 'TEXTAREA', array('name' => 'body', 'size' => '20', 'cols'=>50, 'rows'=>15, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),           
111 111
 );
112 112
 		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
113 113
 		 $form['button_save'] = array('name' => 'action', 'content' => 'Sent', 'value' => 'save', 'id' => 'button', 'type' => 'submit', 'class' => 'btn btn-line-parrot');
@@ -117,49 +117,49 @@  discard block
 block discarded – undo
117 117
 	function build_list_for_email() {
118 118
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
119 119
 		$grid_field_arr = json_encode(array(
120
-			array("Date", "100", "date", "", "", "","","true","center"),
121
-			array("Account", "99", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"),
122
-			array("From", "145", "from", "", "", "","","true","center"),
123
-			array("To", "140", "to", "", "", "","","true","center"),
124
-			array("Subject", "180", "subject", "", "", "","","true","center"),
125
-			array("Body", "320", "body", "", "", "","","true","center"),
126
-			array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons","","true","center"),
127
-			array("Status", "70", "status", "status", "status", "email_status","","true","center"),
120
+			array("Date", "100", "date", "", "", "", "", "true", "center"),
121
+			array("Account", "99", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"),
122
+			array("From", "145", "from", "", "", "", "", "true", "center"),
123
+			array("To", "140", "to", "", "", "", "", "true", "center"),
124
+			array("Subject", "180", "subject", "", "", "", "", "true", "center"),
125
+			array("Body", "320", "body", "", "", "", "", "true", "center"),
126
+			array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons", "", "true", "center"),
127
+			array("Status", "70", "status", "status", "status", "email_status", "", "true", "center"),
128 128
 			array("Action", "100", "", "", "", array("RESEND" => array("url" => "email/email_resend_edit/", "mode" => "popup"),
129
-			"VIEW" => array("url" => "email/email_view/", "mode" => "popup","layout"=>"medium"),
129
+			"VIEW" => array("url" => "email/email_view/", "mode" => "popup", "layout"=>"medium"),
130 130
 					"DELETE" => array("url" => "/email/email_delete/", "mode" => "single")))
131 131
 				));
132 132
 		return $grid_field_arr;
133 133
 	}
134 134
 
135
-	function build_list_for_email_customer($accountid,$accounttype) {
135
+	function build_list_for_email_customer($accountid, $accounttype) {
136 136
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
137 137
 			   $grid_field_arr = json_encode(array(
138
-					array("Date", "140", "date", "", "", "","","true","center"),
139
-					array("Subject", "230", "subject", "", "", "","","true","center"),
140
-					array("Body", "350", "body", "", "", "","","true","center"),
141
-					array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons","","true","center"),
142
-					array("Status", "100", "status", "status", "status", "email_status","","true","center"),
138
+					array("Date", "140", "date", "", "", "", "", "true", "center"),
139
+					array("Subject", "230", "subject", "", "", "", "", "true", "center"),
140
+					array("Body", "350", "body", "", "", "", "", "true", "center"),
141
+					array("Attachement", "120", "attachment", "attachment", "attachment", "attachment_icons", "", "true", "center"),
142
+					array("Status", "100", "status", "status", "status", "email_status", "", "true", "center"),
143 143
 					array("Action", "100", "", "", "", array("RESEND" => array("url" => "email/email_resend_edit_customer/", "mode" => "popup"),
144
-							"VIEW" => array("url" => "email/email_view_customer/", "mode" => "popup","layout"=>"medium"),
144
+							"VIEW" => array("url" => "email/email_view_customer/", "mode" => "popup", "layout"=>"medium"),
145 145
 							"DELETE" => array("url" => "email/email_delete_customer/".$accounttype."/".$accountid."/", "mode" => "single")))
146 146
 					));
147 147
 		return $grid_field_arr;
148 148
 	}
149 149
 
150
-	function build_list_for_email_client_area(){
150
+	function build_list_for_email_client_area() {
151 151
 		$logintype = $this->CI->session->userdata('logintype');
152 152
 	if ($logintype == 1 || $logintype == 5) {
153 153
 			$account_data = $this->CI->session->userdata("accountinfo");
154 154
 			$loginid = $account_data['id'];
155 155
 
156
-		}else{
156
+		} else {
157 157
 			$loginid = "0";
158 158
 		}
159
-		 $form['forms'] = array(base_url() . 'email/email_client_area/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
159
+		 $form['forms'] = array(base_url().'email/email_client_area/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
160 160
 		$form['Filter'] = array(
161
-		  array('Rate Group', 'pricelist_id', 'SELECT', '',array("name"=>"pricelist_id","rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => $loginid)),
162
-		  array('Account Type',array('name' => 'posttoexternal','class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'),
161
+		  array('Rate Group', 'pricelist_id', 'SELECT', '', array("name"=>"pricelist_id", "rules"=>"required"), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => $loginid)),
162
+		  array('Account Type', array('name' => 'posttoexternal', 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'),
163 163
 		  array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
164 164
 	  array('Entity Type', 'type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_entity_type_email_mass'),
165 165
 	);
@@ -174,26 +174,26 @@  discard block
 block discarded – undo
174 174
 		return $form;
175 175
 	} 
176 176
 	function get_form_fields_email_view_client($add_arr) {
177
-	if($add_arr['type'] == ''){
178
-	   $email_add = array('To','email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr',array('status'=>$add_arr['status'],'posttoexternal'=>$add_arr['posttoexternal'],'pricelist_id'=>$add_arr['pricelist_id']), 'multi');
179
-	} else{
180
-	 $email_add = array('To','email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr',array('status'=>$add_arr['status'],'posttoexternal'=>$add_arr['posttoexternal'],'pricelist_id'=>$add_arr['pricelist_id'],'type'=>$add_arr['type']), 'multi');
177
+	if ($add_arr['type'] == '') {
178
+	   $email_add = array('To', 'email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr', array('status'=>$add_arr['status'], 'posttoexternal'=>$add_arr['posttoexternal'], 'pricelist_id'=>$add_arr['pricelist_id']), 'multi');
179
+	} else {
180
+	 $email_add = array('To', 'email', 'SELECT', '', '', 'tOOL TIP', 'Please Enter receipent Email', 'email', 'email', 'accounts', 'build_dropdown', 'where_arr', array('status'=>$add_arr['status'], 'posttoexternal'=>$add_arr['posttoexternal'], 'pricelist_id'=>$add_arr['pricelist_id'], 'type'=>$add_arr['type']), 'multi');
181 181
 	}
182 182
 
183
-		 $form['forms'] = array(base_url() . 'email/email_send_multipal/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
183
+		 $form['forms'] = array(base_url().'email/email_send_multipal/', array('id' => 'commission_form', 'method' => 'POST', 'name' => 'commission_form'));
184 184
 		$form['Compose Email'] = array(
185 185
 			array('', 'HIDDEN', array('name' => 'accountid'), '', '', '', ''),
186 186
 			array('', 'HIDDEN', array('name' => 'temp'), '', '', '', ''),
187
-			array('From', 'INPUT', array('name' => 'from', 'size' => '20','readonly'=>true,'value'=>'',  'class' => "text field medium"),'trim|required|xss_clean', 'tOOL TIP', ''),
187
+			array('From', 'INPUT', array('name' => 'from', 'size' => '20', 'readonly'=>true, 'value'=>'', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
188 188
 			$email_add,
189 189
 			array('Subject', 'INPUT', array('name' => 'subject', 'size' => '20', 'class' => "text field medium"), 'trim|required', 'tOOL TIP', ''),
190 190
 			array('Body', 'TEXTAREA', array('name' => 'template', 'id' => 'template', 'size' => '20', 'class' => "textarea medium"), 'trim|required', 'tOOL TIP', ''),
191 191
 );
192
-	$form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10',  'onclick' => 'return redirect_page(\'/email/email_mass/\')');
192
+	$form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/email/email_mass/\')');
193 193
 		$form['button_save'] = array('name' => 'action', 'content' => 'Send', 'value' => 'save', 'id' => 'submit', 'type' => 'submit', 'class' => 'btn btn-line-parrot');
194 194
 		return $form;
195 195
 	}
196
-	function build_grid_buttons_email(){
196
+	function build_grid_buttons_email() {
197 197
 	$buttons_json = json_encode(array(
198 198
 					));
199 199
 	return $buttons_json;
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
  'class' => "text field "), '', 'tOOL TIP', '', 'date[date-date]'),
206 206
 			array('To Date', 'INPUT', array('name' => 'date[]', 'id' => 'customer_cdr_to_date', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '', 'date[date-date]'),
207 207
 			array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "deleted" => "0")),
208
-			array('From', 'INPUT', array('name' => 'from[from]', '','id'=>'from', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'from[from-string]', '', '', '', 'search_string_type', ''),
209
-			array('To', 'INPUT', array('name' => 'to[to]', '','id'=>'to', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'to[to-string]', '', '', '', 'search_string_type', ''),			
210
-			array('Subject', 'INPUT', array('name' => 'subject[subject]', '','id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''),  
211
-			array('Body', 'INPUT', array('name' => 'body[body]', '','id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'body[body-string]', '', '', '', 'search_string_type', ''),  
208
+			array('From', 'INPUT', array('name' => 'from[from]', '', 'id'=>'from', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'from[from-string]', '', '', '', 'search_string_type', ''),
209
+			array('To', 'INPUT', array('name' => 'to[to]', '', 'id'=>'to', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'to[to-string]', '', '', '', 'search_string_type', ''),			
210
+			array('Subject', 'INPUT', array('name' => 'subject[subject]', '', 'id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'subject[subject-string]', '', '', '', 'search_string_type', ''),  
211
+			array('Body', 'INPUT', array('name' => 'body[body]', '', 'id'=>'body', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'body[body-string]', '', '', '', 'search_string_type', ''),  
212 212
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),         
213 213
 			array('', 'HIDDEN', 'advance_search', '1', '', '', '')
214 214
 		);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/email/views/view_email_brod.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
               <div class="col-md-12">
17 17
             	<div class="w-box">
18 18
             	 <span  style="margin-left:10px; text-align: center;background-color: none;color:#1c8400;">
19
-                    <? if(isset($error) && !empty($error)) {
19
+                    <? if (isset($error) && ! empty($error)) {
20 20
                         echo $error;
21 21
                     }?>
22 22
                  </span>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/email/views/view_email_add_edit.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
             </div>
30 30
             <?php echo $form; ?>
31 31
         </div>    
32
-        <?php if(isset($maildata) && $maildata != ''){
32
+        <?php if (isset($maildata) && $maildata != '') {
33 33
 		  echo "<div class='col-md-12 no-padding'>Attachments :</div>";
34
-		  $imgArr = explode(",",$maildata);
35
-		  foreach($imgArr as $key => $imgname){
34
+		  $imgArr = explode(",", $maildata);
35
+		  foreach ($imgArr as $key => $imgname) {
36 36
 			$imgpath = base_url()."email/email_history_list_attachment/".$imgname;
37 37
 			echo "<div class='col-md-4 no-padding'>
38 38
                   <a href='".$imgpath."'>".$imgname."</a>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/models/trunk_model.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
 	function add_trunk($add_array) {
41 41
 		unset($add_array["action"]);
42
-		$add_array['creation_date']=gmdate('Y-m-d H:i:s');
42
+		$add_array['creation_date'] = gmdate('Y-m-d H:i:s');
43 43
 		$this->db->insert("trunks", $add_array);
44 44
 		return true;
45 45
 	}
46 46
 
47 47
 	function edit_trunk($data, $id) {
48 48
 		unset($data["action"]);
49
-		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
49
+		$data['last_modified_date'] = gmdate('Y-m-d H:i:s');
50 50
 		$this->db->where("id", $id);
51 51
 		$this->db->update("trunks", $data);
52 52
 	}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	function remove_trunk($id) {
55 55
 		$this->db->where("id", $id);
56 56
 		$this->db->update("trunks", array("status" => 2));
57
-		$this->db->where('trunk_id',$id);
57
+		$this->db->where('trunk_id', $id);
58 58
 		$this->db->delete('outbound_routes');
59 59
 		return true;
60 60
 	}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/controllers/trunk.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		$this->load->model('trunk_model');
34 34
 
35 35
 		if ($this->session->userdata('user_login') == FALSE)
36
-			redirect(base_url() . '/astpp/login');
36
+			redirect(base_url().'/astpp/login');
37 37
 	}
38 38
 
39 39
 	function trunk_list() {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function trunk_list_json() {
51 51
 		$json_data = array();
52 52
 		$count_all = $this->trunk_model->gettrunk_list(false);
53
-		$paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']);
53
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
54 54
 		$json_data = $paging_data["json_paging"];
55 55
 		$query = $this->trunk_model->gettrunk_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
56 56
 		$grid_fields = json_decode($this->trunk_form->build_trunk_list_for_admin());
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			$this->session->set_userdata('trunk_list_search', $action);
118 118
 		}
119 119
 		if (@$ajax_search != 1) {
120
-			redirect(base_url() . 'trunk/trunk_list/');
120
+			redirect(base_url().'trunk/trunk_list/');
121 121
 		}
122 122
 	}
123 123
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 	function trunk_remove($id) {
130 130
 		$this->trunk_model->remove_trunk($id);
131
-	$this->db->delete("routing",array("trunk_id"=>$id));
131
+	$this->db->delete("routing", array("trunk_id"=>$id));
132 132
 		$this->session->set_flashdata('astpp_notification', 'Trunk removed successfully!');
133
-		redirect(base_url() . 'trunk/trunk_list/');
133
+		redirect(base_url().'trunk/trunk_list/');
134 134
 	}
135 135
 
136 136
 	function trunk_delete_multiple() {
@@ -144,34 +144,34 @@  discard block
 block discarded – undo
144 144
 			$this->db->update('trunks', $update_data);
145 145
 			echo TRUE;
146 146
 		} else {
147
-			$trunk_arr=array();
147
+			$trunk_arr = array();
148 148
 			$this->db->select('id,name');
149 149
 			$this->db->where('id '.$where);
150
-			$trunk_res=$this->db->get('trunks');
151
-			$trunk_res=$trunk_res->result_array();
152
-			foreach($trunk_res as $value){
153
-				$trunk_arr[$value['id']]['name']=$value['name'];
150
+			$trunk_res = $this->db->get('trunks');
151
+			$trunk_res = $trunk_res->result_array();
152
+			foreach ($trunk_res as $value) {
153
+				$trunk_arr[$value['id']]['name'] = $value['name'];
154 154
 			}
155 155
 			$this->db->where('trunk_id '.$where);
156 156
 			$this->db->select('count(id) as cnt,trunk_id');
157 157
 			$this->db->group_by('trunk_id');
158
-			$outbound_routes_res=$this->db->get('outbound_routes');
159
-			if($outbound_routes_res->num_rows() > 0){
160
-			 $outbound_routes_res=$outbound_routes_res->result_array();
161
-			 foreach($outbound_routes_res as $key=>$value){
162
-				$trunk_arr[$value['trunk_id']]['outbound_routes']=$value['cnt'];
158
+			$outbound_routes_res = $this->db->get('outbound_routes');
159
+			if ($outbound_routes_res->num_rows() > 0) {
160
+			 $outbound_routes_res = $outbound_routes_res->result_array();
161
+			 foreach ($outbound_routes_res as $key=>$value) {
162
+				$trunk_arr[$value['trunk_id']]['outbound_routes'] = $value['cnt'];
163 163
 			 }
164 164
 			}
165
-			$str=null;
166
-			foreach($trunk_arr as $key=>$value){
167
-				 if(isset($value['outbound_routes'])){
168
-					 $str.= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
165
+			$str = null;
166
+			foreach ($trunk_arr as $key=>$value) {
167
+				 if (isset($value['outbound_routes'])) {
168
+					 $str .= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
169 169
 				 }
170 170
 			} 
171
-			if(!empty($str)){
172
-				$data['str']=$str;
171
+			if ( ! empty($str)) {
172
+				$data['str'] = $str;
173 173
 			}
174
-			$data['selected_ids']=$add_array['selected_ids'];
174
+			$data['selected_ids'] = $add_array['selected_ids'];
175 175
 			echo json_encode($data);
176 176
 		}
177 177
 	}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/libraries/trunk_form.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
20 20
 # You should have received a copy of the GNU Affero General Public License
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23
-if (!defined('BASEPATH'))
23
+if ( ! defined('BASEPATH'))
24 24
 	exit('No direct script access allowed');
25 25
 
26 26
 class trunk_form {
27 27
 
28 28
 	function get_trunk_form_fields() {
29
-		$form['forms'] = array(base_url() . 'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
29
+		$form['forms'] = array(base_url().'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
30 30
 		$form['Information'] = array(
31 31
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
32 32
 			array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
33
-			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr',array('type'=>3,"deleted"=>"0","status"=>"0")),
34
-			array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
33
+			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array('type'=>3, "deleted"=>"0", "status"=>"0")),
34
+			array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
35 35
 			array('Failover GW Name #1', 'failover_gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
36 36
 			array('Failover GW Name #2', 'failover_gateway_id1', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),            
37
-			array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0' , 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''));
37
+			array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''));
38 38
 		$form['Settings'] = array(  
39
-			array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
39
+			array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
40 40
 			array('Codecs', 'INPUT', array('name' => 'codec', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
41
-			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
41
+			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
42 42
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43 43
 		);
44 44
 		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 		$form['forms'] = array("", array('id' => "trunk_search"));
51 51
 		$form['Search'] = array(
52 52
 			array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
53
-			array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr',array('type'=>3, "status"=>0, "deleted" => 0)),
54
-			array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
53
+			array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array('type'=>3, "status"=>0, "deleted" => 0)),
54
+			array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
55 55
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
56 56
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
57 57
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
 
64 64
 	function build_trunk_list_for_admin() {
65 65
         
66
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
67
-			array("Name", "100", "name", "", "", "","EDITABLE","true","center"),
68
-			array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
69
-			array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name","","true","center"),
70
-			array("Failover <br>GW Name #1", "130", "failover_gateway_id","name", "gateways", "get_field_name","","true","center"),
71
-			array("Failover<br> GW Name #2", "130", "failover_gateway_id1","name", "gateways", "get_field_name","","true","center"),
72
-			array("CC", "90", "maxchannels", "", "", "","","true","center"),
73
-			array("Codecs", "90", "codec", "", "", "","","true","center"),
74
-			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count","","true","center"),
75
-			array("Status", "100", "status", "status", "trunks", "get_status","","true","center"),
66
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
67
+			array("Name", "100", "name", "", "", "", "EDITABLE", "true", "center"),
68
+			array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
69
+			array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name", "", "true", "center"),
70
+			array("Failover <br>GW Name #1", "130", "failover_gateway_id", "name", "gateways", "get_field_name", "", "true", "center"),
71
+			array("Failover<br> GW Name #2", "130", "failover_gateway_id1", "name", "gateways", "get_field_name", "", "true", "center"),
72
+			array("CC", "90", "maxchannels", "", "", "", "", "true", "center"),
73
+			array("Codecs", "90", "codec", "", "", "", "", "true", "center"),
74
+			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count", "", "true", "center"),
75
+			array("Status", "100", "status", "status", "trunks", "get_status", "", "true", "center"),
76 76
 			array("Created Date", "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
77
-			array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
78
-			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup","layout"=>"medium"),
77
+			array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
78
+			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup", "layout"=>"medium"),
79 79
 					"DELETE" => array("url" => "trunk/trunk_remove/", "mode" => "single")))
80 80
 				));
81 81
 			return $grid_field_arr;
82 82
 	}
83 83
 
84 84
 	function build_grid_buttons() {
85
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup","medium"),
85
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup", "medium"),
86 86
 			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/trunk/trunk_delete_multiple/")
87 87
 			));
88 88
 		return $buttons_json;
Please login to merge, or discard this patch.
astpp/application/modules/freeswitch/models/freeswitch_model.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 ASTPP  3.0 
33 33
 Voicemail data get
34 34
 ******/
35
-	function get_sipdevices_list($flag, $accountid = "",$entitytype='',$start = "", $limit = "") {
35
+	function get_sipdevices_list($flag, $accountid = "", $entitytype = '', $start = "", $limit = "") {
36 36
 	if ($accountid != "") {
37 37
 		$where = array("accountid" => $accountid);
38 38
 	}
39 39
 	$this->db_model->build_search('fssipdevices_list_search');
40
-		$instant_search=$this->session->userdata('left_panel_search_'.$entitytype.'_sipdevices');
41
-		if(!empty($instant_search)){
42
-			$like_str="(username like '%$instant_search%' OR creation_date like '%$instant_search%' OR last_modified_date like '%$instant_search%')";
40
+		$instant_search = $this->session->userdata('left_panel_search_'.$entitytype.'_sipdevices');
41
+		if ( ! empty($instant_search)) {
42
+			$like_str = "(username like '%$instant_search%' OR creation_date like '%$instant_search%' OR last_modified_date like '%$instant_search%')";
43 43
 			$this->db->where($like_str);   
44 44
 		}
45 45
 	$query = array();
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 		$where = array('id' => $add_array['accountcode']);
89 89
 		$query = $this->db_model->getSelect("*", "accounts", $where);
90 90
 		$query = $query->result_array();
91
-		$account_data=$query[0];
91
+		$account_data = $query[0];
92 92
        
93 93
 		$log_type = $this->session->userdata("logintype");
94 94
         	
95
-		$reseller_id = $log_type==1 ? $account_data['reseller_id']:0;
95
+		$reseller_id = $log_type == 1 ? $account_data['reseller_id'] : 0;
96 96
         
97
-		$sip_profile_id = isset($add_array['sip_profile_id'])?$add_array['sip_profile_id']:$this->common->get_field_name('id','sip_profiles',array('name'=>'default'));
97
+		$sip_profile_id = isset($add_array['sip_profile_id']) ? $add_array['sip_profile_id'] : $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default'));
98 98
 	
99 99
 	$parms_array = array('password' => $add_array['fs_password'],
100 100
 			'vm-enabled' => $add_array['voicemail_enabled'],
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 ASTPP  3.0 
129 129
 Email broadcast when Sip Device create
130 130
 ******/
131
-		$mail = (isset($add_array['voicemail_mail_to']) && $add_array['voicemail_mail_to'] != "")?$add_array['voicemail_mail_to']:$account_data['email'];
131
+		$mail = (isset($add_array['voicemail_mail_to']) && $add_array['voicemail_mail_to'] != "") ? $add_array['voicemail_mail_to'] : $account_data['email'];
132 132
     
133
-		$add_array['id']=$add_array['accountcode'];
134
-		$add_array['reseller_id']=$account_data['reseller_id'];
135
-		$add_array['email']=$mail;
136
-		$add_array['first_name']=$account_data['first_name'];
137
-		$add_array['last_name']=$account_data['last_name'];
138
-		$add_array['number']=$add_array['fs_username'];
133
+		$add_array['id'] = $add_array['accountcode'];
134
+		$add_array['reseller_id'] = $account_data['reseller_id'];
135
+		$add_array['email'] = $mail;
136
+		$add_array['first_name'] = $account_data['first_name'];
137
+		$add_array['last_name'] = $account_data['last_name'];
138
+		$add_array['number'] = $add_array['fs_username'];
139 139
 		//$add_array['password']=$this->common->decode($add_array['fs_password']);
140
-		$add_array['password']=$add_array['fs_password'];
140
+		$add_array['password'] = $add_array['fs_password'];
141 141
 		//echo "<pre>"; print_r($add_array); exit;		
142 142
 		$this->common->mail_to_users('add_sip_device', $add_array);
143 143
 /****************************/
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 		$add_array = $deviceinfo->result_array();
192 192
 		foreach ($add_array as $key => $value) {
193 193
 			$vars = json_decode($value['dir_vars']);
194
-			$vars_new = json_decode($value['dir_params'],true);
194
+			$vars_new = json_decode($value['dir_params'], true);
195 195
 			$passowrds = json_decode($value['dir_params']);
196
-			$query = array('id' => $value['id'],'fs_username' => $value['username'],
196
+			$query = array('id' => $value['id'], 'fs_username' => $value['username'],
197 197
 						'accountcode' => $value['accountid'],
198 198
 						'status' => $value['status'],
199 199
 						'sip_profile_id' => $value['sip_profile_id'],
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 		$deviceinfo = array();
224 224
 		$this->db_model->build_search('fssipdevices_list_search');
225 225
 		$accountinfo = $this->session->userdata("accountinfo");
226
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
226
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
227 227
 		$query = array();
228 228
 		$logintype = $this->session->userdata("logintype");
229 229
         
230
-		$where['reseller_id']=$reseller_id;
230
+		$where['reseller_id'] = $reseller_id;
231 231
       
232 232
 		if ($flag) {
233 233
 			$deviceinfo = $this->db_model->select("*", "sip_devices", $where, "id", "ASC", $limit, $start);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 				$add_array = $deviceinfo->result_array();
236 236
 				foreach ($add_array as $key => $value) {
237 237
 					$vars = json_decode($value['dir_vars']);
238
-					$vars_new = json_decode($value['dir_params'],true);
238
+					$vars_new = json_decode($value['dir_params'], true);
239 239
 					$passowrds = json_decode($value['dir_params']);
240 240
 					/*
241 241
                     ASTPP  3.0 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		/*
310 310
         ASTPP  3.0  ADD creation date 
311 311
         */
312
-		$data['creation_date']=gmdate('Y-m-d H:i:s');
312
+		$data['creation_date'] = gmdate('Y-m-d H:i:s');
313 313
 		/***********************************/
314 314
 		unset($data['action']);
315 315
 		$this->db->insert('freeswich_servers', $data);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		/*
322 322
         ASTPP  3.0  edit modified date add
323 323
         */
324
-		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
324
+		$data['last_modified_date'] = gmdate('Y-m-d H:i:s');
325 325
 		/***********************************************/
326 326
 		$this->db->where('id', $id);
327 327
 		$this->db->update('freeswich_servers', $data);
@@ -334,21 +334,21 @@  discard block
 block discarded – undo
334 334
 		return true;
335 335
 	}
336 336
 
337
-	function reload_freeswitch($command,$server_host="") {
338
-	$response='';
337
+	function reload_freeswitch($command, $server_host = "") {
338
+	$response = '';
339 339
 		$query = $this->db_model->getSelect("*", "freeswich_servers", "");
340 340
 		$fs_data = $query->result_array();
341 341
 	   foreach ($fs_data as $fs_key => $fs_value) {
342 342
 		$fp = $this->freeswitch_lib->event_socket_create($fs_value["freeswitch_host"], $fs_value["freeswitch_port"], $fs_value["freeswitch_password"]);
343 343
 		if ($fp) {
344
-		$response.= $this->freeswitch_lib->event_socket_request($fp, $command);
344
+		$response .= $this->freeswitch_lib->event_socket_request($fp, $command);
345 345
 		fclose($fp);
346 346
 		}
347 347
 	   }
348 348
 		return $response;
349 349
 	}
350 350
 	function reload_live_freeswitch($command) {
351
-	$response='';
351
+	$response = '';
352 352
 		$query = $this->db_model->getSelect("*", "freeswich_servers", "");
353 353
 		$fs_data = $query->result_array();
354 354
         
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		fclose($fp);
360 360
 		}
361 361
 		}
362
-	$response = str_replace("0 total.","",$response);
362
+	$response = str_replace("0 total.", "", $response);
363 363
 		return $response;
364 364
 	}
365 365
 
Please login to merge, or discard this patch.
astpp/application/modules/freeswitch/controllers/freeswitch.php 1 patch
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$this->load->model('freeswitch_model');
37 37
 
38 38
 		if ($this->session->userdata('user_login') == FALSE)
39
-			redirect(base_url() . '/astpp/login');
39
+			redirect(base_url().'/astpp/login');
40 40
 	}
41 41
 
42 42
 	function fssipdevices_add($type = "") {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 $account_data = $this->session->userdata("accountinfo");
45 45
 		$data['flag'] = 'create';
46 46
 		$data['page_title'] = 'Create SIP Device';
47
-	   if($account_data['type'] == '-1'  || $account_data['type'] == '1')
47
+	   if ($account_data['type'] == '-1' || $account_data['type'] == '1')
48 48
 	   {
49 49
 			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($type), '');
50 50
 			$this->load->view('view_freeswitch_add_edit', $data);
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	 $data['username'] = $this->session->userdata('user_name');
58 58
 	 $account_data = $this->session->userdata("accountinfo");
59 59
 		$data['page_title'] = 'Create SIP Device';
60
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid),"");
61
-		if($account_data['type'] == '-1'  || $account_data['type'] == '1')
60
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid), "");
61
+		if ($account_data['type'] == '-1' || $account_data['type'] == '1')
62 62
 		{
63 63
 			$this->load->view('view_freeswitch_add_edit', $data);
64
-		}else{
64
+		} else {
65 65
 			$this->load->view('view_freeswitch_customer_add_edit', $data);
66 66
 		}
67 67
 	}
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 		$account_data = $this->session->userdata("accountinfo");
72 72
 		$where = array('id' => $edit_id);
73 73
 		$account = $this->freeswitch_model->get_edited_data($edit_id);
74
-		if($account_data['type'] == '-1')
74
+		if ($account_data['type'] == '-1')
75 75
 		{
76 76
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account);
77 77
 			$this->load->view('view_freeswitch_add_edit', $data);
78
-		}else{
78
+		} else {
79 79
 		 $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account);
80 80
 		$this->load->view('view_freeswitch_customer_add_edit', $data);
81 81
 		}
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$data['page_title'] = 'Edit SIP device';
88 88
 		$where = array('id' => $edit_id);
89 89
 		$account = $this->freeswitch_model->get_edited_data($edit_id);
90
-		  if($account_data['type'] == '-1' || $account_data['type'] == '1')
90
+		  if ($account_data['type'] == '-1' || $account_data['type'] == '1')
91 91
 		{
92
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account);
92
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid, $edit_id), $account);
93 93
 		$this->load->view('view_freeswitch_add_edit', $data);
94
-		}else{
94
+		} else {
95 95
         
96
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account);
96
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid, $edit_id), $account);
97 97
 		$this->load->view('view_freeswitch_customer_add_edit', $data);
98 98
 		}
99 99
 	}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			$this->session->set_userdata('fsgateway_list_search', $action);
110 110
 		}
111 111
 		if (@$ajax_search != 1) {
112
-			redirect(base_url() . 'freeswitch/fsgateway/');
112
+			redirect(base_url().'freeswitch/fsgateway/');
113 113
 		}
114 114
 	}
115 115
 	function fssipprofile_search() {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			$this->session->set_userdata('fssipprofile_list_search', $action);
124 124
 		}
125 125
 		if (@$ajax_search != 1) {
126
-			redirect(base_url() . 'freeswitch/fssipprofile/');
126
+			redirect(base_url().'freeswitch/fssipprofile/');
127 127
 		}
128 128
 	}
129 129
 	function fssipdevices_clearsearchfilter() {
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 	function fssipdevices_save($user_flg = false) {
142 142
 		$add_array = $this->input->post();
143
-		if (!$user_flg) {
143
+		if ( ! $user_flg) {
144 144
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($add_array['id']), $add_array);
145 145
 		} else {
146
-			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']),  $add_array);
146
+			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"], $add_array['id']), $add_array);
147 147
 		}
148 148
 		if ($add_array['id'] != '') {
149 149
 			$data['page_title'] = 'Freeswitch SIP Devices';
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 	function customer_fssipdevices_save($user_flg = false) {
173 173
 		$add_array = $this->input->post();      
174
-		if (!$user_flg) {
174
+		if ( ! $user_flg) {
175 175
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields(), $add_array);
176 176
 		} else {
177
-			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array);
177
+			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"], $add_array['id']), $add_array);
178 178
 		}
179 179
 		if ($add_array['id'] != '') {
180 180
 			$data['page_title'] = 'Edit Freeswitch SIP Devices';
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	}
203 203
 	function user_fssipdevices_save($user_flg = false) {
204 204
 		$add_array = $this->input->post();
205
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array);
205
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"], $add_array['id']), $add_array);
206 206
 		if ($add_array['id'] != '') {
207 207
 			$data['page_title'] = 'Edit Freeswitch SIP Devices';
208 208
 			if ($this->form_validation->run() == FALSE) {
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 				echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!"));
215 215
 				exit;
216 216
 			}
217
-		}else{
217
+		} else {
218 218
 			$data['page_title'] = 'Create Freeswitch SIP Devices';
219 219
 			if ($this->form_validation->run() == FALSE) {
220 220
 				$data['validation_errors'] = validation_errors();
221 221
 				echo $data['validation_errors'];
222 222
 				exit;
223 223
 			} else {
224
-		$sip_profile_id=$this->common->get_field_name('id','sip_profiles',array('name'=>'default'));
224
+		$sip_profile_id = $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default'));
225 225
 				$this->freeswitch_model->add_freeswith($add_array);
226 226
 				echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!"));
227 227
 				exit;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 			$this->session->set_userdata('fssipdevices_list_search', $action);
240 240
 		}
241 241
 		if (@$ajax_search != 1) {
242
-			redirect(base_url() . 'freeswitch/fssipdevices/');
242
+			redirect(base_url().'freeswitch/fssipdevices/');
243 243
 		}
244 244
 	}
245 245
 
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 		foreach ($query as $key => $value) {
268 268
 	$path_true = base_url().'/assets/images/true.png';
269 269
 	$path_false = base_url().'/assets/images/false.png';
270
-	if($value['voicemail_enabled'] == 'true'){
271
-		$voicemail_enabled ='<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">';
272
-	} else{
273
-		$voicemail_enabled ='<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
270
+	if ($value['voicemail_enabled'] == 'true') {
271
+		$voicemail_enabled = '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">';
272
+	} else {
273
+		$voicemail_enabled = '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
274 274
 	}
275 275
 		$json_data['rows'][] = array('cell' => array(
276
-			'<input type="checkbox" name="chkAll" id=' . $value['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $value['id'] . ')" value=' . $value['id'] . '><lable class="lbl"></lable>',
276
+			'<input type="checkbox" name="chkAll" id='.$value['id'].' class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>',
277 277
 			"<a href='/freeswitch/fssipdevices_edit/".$value['id']."' style='cursor:pointer;color:#005298;' rel='facebox_medium' title='username'>".$value['username']."</a>",
278 278
 /**************************/
279 279
 					$value['password'],
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 					$this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', array('0' => $value['accountid'])),
282 282
 					$value['effective_caller_id_name'],
283 283
 					$value['effective_caller_id_number'],
284
-					 $voicemail_enabled ,
285
-					 $this->common->get_status('status', 'sip_devices',$value),
286
-					$this->common->convert_GMT_to('','',$value['creation_date']),
287
-					$this->common->convert_GMT_to('','',$value['last_modified_date']),                
284
+					 $voicemail_enabled,
285
+					 $this->common->get_status('status', 'sip_devices', $value),
286
+					$this->common->convert_GMT_to('', '', $value['creation_date']),
287
+					$this->common->convert_GMT_to('', '', $value['last_modified_date']),                
288 288
 					$this->get_action_buttons_fssipdevices($value['id'])
289 289
 					));
290 290
 		}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$this->db->delete("sip_devices");
305 305
 		echo TRUE;
306 306
 	}
307
-	function customer_fssipdevices_delete_multiple(){
307
+	function customer_fssipdevices_delete_multiple() {
308 308
 		$ids = $this->input->post("selected_ids", true);
309 309
 		$where = "id IN ($ids)";
310 310
 		$this->db->where($where);
@@ -316,42 +316,42 @@  discard block
 block discarded – undo
316 316
 ASTPP 3.0
317 317
 Customer side show voice mail detials
318 318
 ******/
319
-	function customer_fssipdevices_json($accountid,$entity_type='') {
319
+	function customer_fssipdevices_json($accountid, $entity_type = '') {
320 320
 		$json_data = array();
321
-		$count_all = $this->freeswitch_model->get_sipdevices_list(false, $accountid,$entity_type);
321
+		$count_all = $this->freeswitch_model->get_sipdevices_list(false, $accountid, $entity_type);
322 322
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
323 323
 		$json_data = $paging_data["json_paging"];
324 324
 		$devices_result = array();
325
-		$query = $this->freeswitch_model->get_sipdevices_list(true, $accountid,$entity_type, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
325
+		$query = $this->freeswitch_model->get_sipdevices_list(true, $accountid, $entity_type, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
326 326
 		foreach ($query as $key => $value) {
327 327
 	$path_true = base_url().'/assets/images/true.png';
328 328
 	$path_false = base_url().'/assets/images/false.png';
329
-	$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">';
329
+	$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">';
330 330
 		$json_data['rows'][] = array('cell' => array(
331
-			'<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>',
331
+			'<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>',
332 332
 					$value['username'],
333 333
 					$value['password'],
334 334
 					$this->common->get_field_name('name', '`sip_profiles', array('id' => $value['sip_profile_id'])),
335 335
 					$value['effective_caller_id_name'],
336 336
 					$value['effective_caller_id_number'],
337 337
 					$voicemail_enabled,
338
-					$this->common->get_status('status', 'sip_devices',$value),
339
-					$this->common->convert_GMT_to('','',$value['creation_date']),
340
-					$this->common->convert_GMT_to('','',$value['last_modified_date']),
341
-					$this->get_action_fssipdevices_buttons($value['id'], $value['accountid'],$entity_type)
338
+					$this->common->get_status('status', 'sip_devices', $value),
339
+					$this->common->convert_GMT_to('', '', $value['creation_date']),
340
+					$this->common->convert_GMT_to('', '', $value['last_modified_date']),
341
+					$this->get_action_fssipdevices_buttons($value['id'], $value['accountid'], $entity_type)
342 342
 					));
343 343
 		}//exit;
344 344
 		echo json_encode($json_data);
345 345
 	}
346 346
 /****************************/
347
-	function get_action_fssipdevices_buttons($id, $accountid,$entity_type='') {
347
+	function get_action_fssipdevices_buttons($id, $accountid, $entity_type = '') {
348 348
 		$ret_url = '';
349
-		if ($this->session->userdata("logintype") == '0'||$this->session->userdata("logintype") == '3') {
350
-			$ret_url = '<a href="'. base_url() .'user/user_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
351
-			$ret_url .= '<a href="'. base_url() .'user/user_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
349
+		if ($this->session->userdata("logintype") == '0' || $this->session->userdata("logintype") == '3') {
350
+			$ret_url = '<a href="'.base_url().'user/user_fssipdevices_action/edit/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
351
+			$ret_url .= '<a href="'.base_url().'user/user_fssipdevices_action/delete/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
352 352
 		} else {
353
-			$ret_url = '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
354
-			$ret_url .= '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
353
+			$ret_url = '<a href="'.base_url().'accounts/'.$entity_type.'_fssipdevices_action/edit/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
354
+			$ret_url .= '<a href="'.base_url().'accounts/'.$entity_type.'_fssipdevices_action/delete/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
355 355
 		}
356 356
 		return $ret_url;
357 357
 	}
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
 	function fssipdevices_delete($id) {
360 360
 		$this->freeswitch_model->delete_freeswith_devices($id);
361 361
 		$this->session->set_flashdata('astpp_notification', 'SIP Device Removed Successfully!');
362
-		redirect(base_url() . 'freeswitch/fssipdevices/');
362
+		redirect(base_url().'freeswitch/fssipdevices/');
363 363
 		exit;
364 364
 	}
365 365
 
366 366
 	function get_action_buttons_fssipdevices($id) {
367 367
 
368 368
 		$ret_url = '';
369
-		$ret_url = '<a href="'. base_url() .'freeswitch/fssipdevices_edit/' . $id . '/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
370
-		$ret_url .= '<a href="'. base_url() .'freeswitch/fssipdevices_delete/' . $id . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
369
+		$ret_url = '<a href="'.base_url().'freeswitch/fssipdevices_edit/'.$id.'/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
370
+		$ret_url .= '<a href="'.base_url().'freeswitch/fssipdevices_delete/'.$id.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
371 371
 		return $ret_url;
372 372
 	}
373 373
 
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 		$calls_final = array();
386 386
 		$data_header = array();
387 387
 		$k = 0;
388
-			$data = explode("\n",$response);
388
+			$data = explode("\n", $response);
389 389
 			for ($i = 0; $i < count($data) - 2; $i++) {
390 390
 				if (trim($data[$i]) != '') {
391
-					if (count($data_header) ==0 || substr($data[$i],0,4) == "uuid") {
391
+					if (count($data_header) == 0 || substr($data[$i], 0, 4) == "uuid") {
392 392
 						$data_header = explode(",", $data[$i]);
393 393
 					} else {
394 394
 						$data_call = explode(",", $data[$i]);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		$this->session->set_userdata('advance_search', 0);
436 436
 		$data['grid_fields'] = $this->freeswitch_form->build_fsgateway_list_for_admin();
437 437
 		$data["grid_buttons"] = $this->freeswitch_form->build_fdgateway_grid_buttons();
438
-	  	$data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_gateway_search_form());
438
+	  	$data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_gateway_search_form());
439 439
 		$this->load->view('view_fsgateway_list', $data);
440 440
 	}
441 441
 
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
 		if ($query->num_rows > 0) {
453 453
 			$query = $query->result_array();
454 454
 			foreach ($query as $key => $query_value) {
455
-$gateway_data=array();
456
-$tmp=null;
455
+$gateway_data = array();
456
+$tmp = null;
457 457
 				foreach ($query_value as $gateway_key => $gateway_val) {
458 458
 					if ($gateway_key != "gateway_data") {
459 459
 						$gateway_data[$gateway_key] = $gateway_val;
460 460
 					} else {
461
-						$tmp = (array) json_decode($gateway_val);
461
+						$tmp = (array)json_decode($gateway_val);
462 462
 					}
463 463
 				}
464 464
 						$gateway_result[$key] = array_merge($gateway_data, $tmp);
@@ -486,22 +486,22 @@  discard block
 block discarded – undo
486 486
 		$gateway_result = array();
487 487
 		foreach ($query as $key => $query_value) {
488 488
 			foreach ($query_value as $gateway_key => $gatewau_val) {
489
-  			$gateway_data["status"] = isset($query_value["status"])?$query_value["status"]:"";
489
+  			$gateway_data["status"] = isset($query_value["status"]) ? $query_value["status"] : "";
490 490
 				if ($gateway_key != "gateway_data") {
491 491
 					$gateway_data[$gateway_key] = $gatewau_val;
492
-				}else if($gateway_key == "status") {
492
+				} else if ($gateway_key == "status") {
493 493
 					$gateway_data[$gateway_key] = $gatewau_val;
494 494
 				} 
495 495
 				 /**
496 496
                  ASTPP 3.0 
497 497
                  put one variable with the name of dialplan variable 
498 498
 				  **/ 
499
-				else if($gateway_key == "dialplan_variable") {
499
+				else if ($gateway_key == "dialplan_variable") {
500 500
 					$gateway_data[$gateway_key] = $gatewau_val;
501 501
 				} 
502 502
 				/****************************************************/
503 503
 				else {
504
-					$tmp = (array) json_decode($gatewau_val);
504
+					$tmp = (array)json_decode($gatewau_val);
505 505
 					$gateway_result = array_merge($gateway_data, $tmp);
506 506
 				}
507 507
 			}
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
         ASTPP  3.0 
511 511
         put one variable with the name of dialplan variable 
512 512
 		 **/
513
-		if(!empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != ''){
514
-		 $gateway_result['dialplan_variable']  = $gateway_data['dialplan_variable'];
515
-		 }else{
513
+		if ( ! empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != '') {
514
+		 $gateway_result['dialplan_variable'] = $gateway_data['dialplan_variable'];
515
+		 } else {
516 516
 		 $gateway_result['dialplan_variable'] = '';
517 517
 		 }
518 518
 		 /**********************************************************************************************/
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		$data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), $gateway_data);
526 526
 		$insert_arr = array();
527 527
 		$gateway_arr = array();
528
-		$insert_arr['dialplan_variable'] ="";
528
+		$insert_arr['dialplan_variable'] = "";
529 529
 		foreach ($gateway_data as $key => $gateway_value) {
530 530
 			if ($gateway_value != "") {
531 531
 				if ($key == "sip_profile_id") {
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
 					$insert_arr['dialplan_variable'] = $gateway_data["dialplan_variable"];
544 544
 				}
545 545
 				/*********************************************************************/
546
-				else if($key == "status") {
546
+				else if ($key == "status") {
547 547
 					$insert_arr[$key] = $gateway_data["status"];
548
-				}  else {
548
+				} else {
549 549
 					if ($key != "id") {
550 550
 						$gateway_arr[$key] = $gateway_value;
551 551
 					}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 				echo $data['validation_errors'];
563 563
 				exit;
564 564
 			} else {
565
-		if ( preg_match('/\s/',$insert_arr['name']) )
565
+		if (preg_match('/\s/', $insert_arr['name']))
566 566
 		{
567 567
 		  echo json_encode(array("name_error"=> "Gateway name must not have any space."));
568 568
 		  exit;
@@ -571,17 +571,17 @@  discard block
 block discarded – undo
571 571
 		ASTPP  3.0 
572 572
 		gateway last modified date
573 573
 		*/
574
-		$insert_arr['last_modified_date']=gmdate('Y-m-d H:i:s');
574
+		$insert_arr['last_modified_date'] = gmdate('Y-m-d H:i:s');
575 575
 		/*************************************************/
576 576
 				$update = $this->db->update("gateways", $insert_arr, array('id' => $gateway_data['id']));
577 577
 				if ($update) {
578 578
 					$profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']);
579 579
 			$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']);
580 580
 					$cmd = "api sofia profile ".$profile_name." killgw '".$insert_arr['name']."' ";
581
-					$this->freeswitch_model->reload_freeswitch($cmd,$sip_ip);
581
+					$this->freeswitch_model->reload_freeswitch($cmd, $sip_ip);
582 582
 
583
-					$cmd2 = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml";
584
-					$this->freeswitch_model->reload_freeswitch($cmd2,$sip_ip);
583
+					$cmd2 = "api sofia profile ".$profile_name." rescan reloadacl reloadxml";
584
+					$this->freeswitch_model->reload_freeswitch($cmd2, $sip_ip);
585 585
 				}
586 586
 				echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Updated Successfully!"));
587 587
 				exit;
@@ -593,18 +593,18 @@  discard block
 block discarded – undo
593 593
 				echo $data['validation_errors'];
594 594
 				exit;
595 595
 			} else {
596
-		if ( preg_match('/\s/',$insert_arr['name']) )
596
+		if (preg_match('/\s/', $insert_arr['name']))
597 597
 		{
598 598
 		  echo json_encode(array("name_error"=> "Gateway name must not have any space."));
599 599
 		  exit;
600 600
 		}
601
-			$insert_arr['created_date']=gmdate('Y-m-d H:i:s'); 
601
+			$insert_arr['created_date'] = gmdate('Y-m-d H:i:s'); 
602 602
 				$insert = $this->db->insert("gateways", $insert_arr);
603 603
 				if ($insert) {
604 604
 					$profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']);
605 605
 			$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']);
606
-					$cmd = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml";
607
-					$this->freeswitch_model->reload_freeswitch($cmd,$sip_ip);
606
+					$cmd = "api sofia profile ".$profile_name." rescan reloadacl reloadxml";
607
+					$this->freeswitch_model->reload_freeswitch($cmd, $sip_ip);
608 608
 				}
609 609
 				echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Added Successfully!"));
610 610
 				exit;
@@ -619,12 +619,12 @@  discard block
 block discarded – undo
619 619
 			$profile_name = $this->common->get_field_name('name', 'sip_profiles', $profile_id);
620 620
 		$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id);
621 621
 			$gateway_name = $this->common->get_field_name('name', 'gateways', $gateway_id);
622
-			$cmd = "api sofia profile " . $profile_name . " killgw " . $gateway_name . " reloadxml";
623
-			$this->freeswitch_model->reload_freeswitch($cmd,$sip_ip);
622
+			$cmd = "api sofia profile ".$profile_name." killgw ".$gateway_name." reloadxml";
623
+			$this->freeswitch_model->reload_freeswitch($cmd, $sip_ip);
624 624
 		}
625 625
 
626 626
 		$this->session->set_flashdata('astpp_notification', 'Gateway Removed Successfully!');
627
-		redirect(base_url() . 'freeswitch/fsgateway/');
627
+		redirect(base_url().'freeswitch/fsgateway/');
628 628
 	}
629 629
 
630 630
 	function fsgateway_delete_multiple() {
@@ -641,8 +641,8 @@  discard block
 block discarded – undo
641 641
 		$this->session->set_userdata('advance_search', 0);
642 642
 		$data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_list_for_admin();
643 643
 		$data["grid_buttons"] = $this->freeswitch_form->build_fssipprofile_grid_buttons();
644
-	$data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_sipprofile_search_form());
645
-	$data['button_name']="Add Setting";
644
+	$data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_sipprofile_search_form());
645
+	$data['button_name'] = "Add Setting";
646 646
 	//$data['form_search'] = $this->form->build_serach_form($this->trunk_form->get_trunk_search_form());
647 647
 		$this->load->view('view_fssipprofile_list', $data);
648 648
 	}
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
675 675
 		$query = $query->result_array();
676 676
 		$gateway_result = array();
677
-		$i=0;
677
+		$i = 0;
678 678
 		foreach ($query as $key => $query_value) {
679 679
 			foreach ($query_value as $gateway_key => $gatewau_val) {
680
-		  if($gateway_key != 'id' && $gateway_key != 'name' && $gateway_key != 'sip_ip' && $gateway_key != 'sip_port'){
680
+		  if ($gateway_key != 'id' && $gateway_key != 'name' && $gateway_key != 'sip_ip' && $gateway_key != 'sip_port') {
681 681
 				if ($gateway_key != "profile_data") {
682 682
 					$gateway_data[$gateway_key] = $gatewau_val;
683 683
 				} else {
684
-					$tmp = (array) json_decode($gatewau_val);
684
+					$tmp = (array)json_decode($gatewau_val);
685 685
 					$gateway_result = array_merge($gateway_data, $tmp);
686 686
 				}
687 687
 	}
@@ -694,74 +694,74 @@  discard block
 block discarded – undo
694 694
 	  $json_data['rows'][] = array('cell' => array(
695 695
 		  $key,
696 696
 		  $value,
697
-		  array('<a href="/freeswitch/fssipprofile_edit/'.$edited_id.'/edit/' . $key .'/" class="btn btn-royelblue btn-sm"  title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="/freeswitch/fssipprofile_delete_params/'.$edited_id.'/' . $key .'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>')
697
+		  array('<a href="/freeswitch/fssipprofile_edit/'.$edited_id.'/edit/'.$key.'/" class="btn btn-royelblue btn-sm"  title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="/freeswitch/fssipprofile_delete_params/'.$edited_id.'/'.$key.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>')
698 698
 		  ));
699 699
   }
700 700
 		echo json_encode($json_data);
701 701
 	}
702
-	 function fssipprofile_action($button_name,$id) {
702
+	 function fssipprofile_action($button_name, $id) {
703 703
 		$where = array('id' => $id);
704 704
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
705 705
 		$query = $query->result_array();
706 706
 		$where = array('sip_profile_id' => $id);
707
-		if($button_name == "start")
707
+		if ($button_name == "start")
708 708
 		{ 
709
-		   $cmd = "api sofia profile " . trim($query[0]['name']) ." start"; 
709
+		   $cmd = "api sofia profile ".trim($query[0]['name'])." start"; 
710 710
 		}
711
-		elseif($button_name == "stop")
711
+		elseif ($button_name == "stop")
712 712
 		{
713
-			$cmd= "api sofia profile stop";
713
+			$cmd = "api sofia profile stop";
714 714
 		}
715
-		elseif($button_name == "reload")
715
+		elseif ($button_name == "reload")
716 716
 		{
717 717
 			$cmd = "api reloadxml";
718 718
 		}
719
-		elseif($button_name == "rescan")
719
+		elseif ($button_name == "rescan")
720 720
 		{
721
-			$cmd = "api sofia profile " . trim($query[0]['name']) . " rescan";
721
+			$cmd = "api sofia profile ".trim($query[0]['name'])." rescan";
722 722
 		}
723 723
         
724 724
 		$this->freeswitch_model->reload_freeswitch($cmd);
725
-	redirect(base_url() . 'freeswitch/fssipprofile/');   
725
+	redirect(base_url().'freeswitch/fssipprofile/');   
726 726
 	}
727
-	 function fssipprofile_add($add='') {
727
+	 function fssipprofile_add($add = '') {
728 728
      
729 729
 		$data['username'] = $this->session->userdata('user_name');
730 730
 		$data['flag'] = 'create';
731 731
 		$data['page_title'] = 'Create SIP Profile';
732 732
 		$sipprofile_data = $this->input->post();
733
-		 $sipprofile_data['status']=$sipprofile_data['sipstatus'];
734
-		$data['button_name']="Add Setting";
735
-		if($add == 'add')
733
+		 $sipprofile_data['status'] = $sipprofile_data['sipstatus'];
734
+		$data['button_name'] = "Add Setting";
735
+		if ($add == 'add')
736 736
 		{
737 737
           
738 738
 	  unset($sipprofile_data['action']);
739 739
 	   unset($sipprofile_data['sipstatus']);
740
-	  $insert_data=$sipprofile_data;
740
+	  $insert_data = $sipprofile_data;
741 741
 	  
742
-	  if($sipprofile_data['name'] == '' || $sipprofile_data['sip_ip'] =='' || $sipprofile_data['sip_port'] =='')
742
+	  if ($sipprofile_data['name'] == '' || $sipprofile_data['sip_ip'] == '' || $sipprofile_data['sip_port'] == '')
743 743
 	  {
744 744
 		  $this->session->set_flashdata('astpp_notification', 'Please enter All profile value!');
745
-		  redirect(base_url() . 'freeswitch/fssipprofile_add/');
745
+		  redirect(base_url().'freeswitch/fssipprofile_add/');
746 746
 		  exit;
747 747
 	  }
748
-	  if(preg_match('/\s/',$sipprofile_data['name']))
748
+	  if (preg_match('/\s/', $sipprofile_data['name']))
749 749
 	  {
750 750
 		$this->session->set_flashdata('astpp_notification', 'SIP Profile name must not have any space!');
751
- 		redirect(base_url() . 'freeswitch/fssipprofile_add/');
751
+ 		redirect(base_url().'freeswitch/fssipprofile_add/');
752 752
  		exit;
753 753
 	  }
754
-	  if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/', $sipprofile_data['sip_ip']))
754
+	  if ( ! preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/', $sipprofile_data['sip_ip']))
755 755
 	  {
756 756
 		$this->session->set_flashdata('astpp_notification', 'SIP IP must be proper!');
757
- 		redirect(base_url() . 'freeswitch/fssipprofile_add/');
757
+ 		redirect(base_url().'freeswitch/fssipprofile_add/');
758 758
  		exit;
759 759
 	  }
760
-	  $sipprofile_data['id']='';
760
+	  $sipprofile_data['id'] = '';
761 761
 	  $check_authentication = $this->freeswitch_model->profile_authentication($sipprofile_data);
762 762
 	  if ($check_authentication->num_rows == 0) {
763 763
 	      
764
-		  $sipprofile_data['created_date']=gmdate('Y-m-d H:i:s');
764
+		  $sipprofile_data['created_date'] = gmdate('Y-m-d H:i:s');
765 765
 		 /** Version 2.1
766 766
 		  * Purpose : Set default data for new created profile
767 767
 		  **/
@@ -772,40 +772,40 @@  discard block
 block discarded – undo
772 772
 		}
773 773
 		else {
774 774
 					$this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!');
775
-			redirect(base_url() . 'freeswitch/fssipprofile_add/');
775
+			redirect(base_url().'freeswitch/fssipprofile_add/');
776 776
 		}
777 777
 		$this->session->set_flashdata('astpp_errormsg', 'SIP Profile Added Successfully!');
778
-		redirect(base_url() . 'freeswitch/fssipprofile/');
778
+		redirect(base_url().'freeswitch/fssipprofile/');
779 779
 		}
780 780
 	
781
-		if($add == 'edit')
781
+		if ($add == 'edit')
782 782
 		{
783 783
 	  $check_authentication = $this->freeswitch_model->profile_authentication($sipprofile_data);
784 784
 		unset($sipprofile_data['action']);
785 785
 		unset($sipprofile_data['sipstatus']);
786 786
 		$insert_arr = $sipprofile_data;
787 787
 			if ($check_authentication->num_rows == 0) {
788
-			$insert_arr['last_modified_date']=gmdate("Y-m-d H:i:s");
788
+			$insert_arr['last_modified_date'] = gmdate("Y-m-d H:i:s");
789 789
 					$update = $this->db->update("sip_profiles", $insert_arr, array('id' => $sipprofile_data['id']));
790 790
 					$this->session->set_flashdata('astpp_errormsg', $sipprofile_data['name']." SIP Profile Updated Successfully!");
791
-					redirect(base_url() . 'freeswitch/fssipprofile/');   
791
+					redirect(base_url().'freeswitch/fssipprofile/');   
792 792
 					exit;
793 793
 				} else {
794 794
 					$this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!');
795
-			redirect(base_url() . 'freeswitch/fssipprofile/');
795
+			redirect(base_url().'freeswitch/fssipprofile/');
796 796
 				}
797
-	  redirect(base_url() . 'freeswitch/fssipprofile/');   
797
+	  redirect(base_url().'freeswitch/fssipprofile/');   
798 798
 		}
799 799
 		$this->load->view('view_fssipprofile_add', $data);
800 800
 	}
801 801
 
802 802
 
803
-	function fssipprofile_edit($edit_id = '',$type='',$name_prams='') {
803
+	function fssipprofile_edit($edit_id = '', $type = '', $name_prams = '') {
804 804
 		$data['page_title'] = 'Edit SIP Profile';
805 805
 		  $sipprofile_data = $this->input->post();
806
-		if(!$edit_id)
806
+		if ( ! $edit_id)
807 807
 		{
808
-	  $edit_id=$sipprofile_data['id'];
808
+	  $edit_id = $sipprofile_data['id'];
809 809
 		}
810 810
 		$where = array('id' => $edit_id);
811 811
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
@@ -816,45 +816,45 @@  discard block
 block discarded – undo
816 816
 				if ($gateway_key != "profile_data") {
817 817
 					$gateway_data[$gateway_key] = $gatewau_val;
818 818
 				} else {
819
-					$tmp = (array) json_decode($gatewau_val);
819
+					$tmp = (array)json_decode($gatewau_val);
820 820
 					$gateway_result = array_merge($gateway_data, $tmp);
821 821
 				}
822 822
 			}
823 823
 		}
824 824
 		$data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_params_list_for_admin();
825 825
 		$data['edited_id'] = $edit_id;
826
-		$data['sip_name']=$query[0]['name'];
827
-	$data['status']=$query[0]['status'];
828
-	$data['sip_ip']= $query[0]['sip_ip'];
829
-	$data['sip_port']=$query[0]['sip_port'];
830
-	$data['id']=$query[0]['id'];
831
-		$data['button_name']="Add Setting";
832
-		if($type == 'edit' || isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save')
826
+		$data['sip_name'] = $query[0]['name'];
827
+	$data['status'] = $query[0]['status'];
828
+	$data['sip_ip'] = $query[0]['sip_ip'];
829
+	$data['sip_port'] = $query[0]['sip_port'];
830
+	$data['id'] = $query[0]['id'];
831
+		$data['button_name'] = "Add Setting";
832
+		if ($type == 'edit' || isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save')
833 833
 		{
834
-		if($type == 'edit')
834
+		if ($type == 'edit')
835 835
 		{
836
-		$data['params_name']=$name_prams;
837
-		$data['params_status']=0;
838
-		if($gateway_result[$name_prams] == "true" || $gateway_result[$name_prams] == "false")
836
+		$data['params_name'] = $name_prams;
837
+		$data['params_status'] = 0;
838
+		if ($gateway_result[$name_prams] == "true" || $gateway_result[$name_prams] == "false")
839 839
 		{
840
-		  $data['params_status']=1;
840
+		  $data['params_status'] = 1;
841 841
 		}
842
-		$data['params_value']=$gateway_result[$name_prams];
843
-		$data['button_name']="Update Setting";
842
+		$data['params_value'] = $gateway_result[$name_prams];
843
+		$data['button_name'] = "Update Setting";
844 844
 		}
845
-		if(isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save'){
845
+		if (isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save') {
846 846
 		$sipprofile_data = $this->input->post();
847
-		$tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value'];
848
-		  $final_data= json_encode($tmp);
847
+		$tmp[$sipprofile_data['params_name']] = $sipprofile_data['params_value'];
848
+		  $final_data = json_encode($tmp);
849 849
 		  $insert_arr["profile_data"] = json_encode($tmp);
850 850
 		  $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $edit_id));
851
-		   if($sipprofile_data['type_settings']=="add_setting"){
852
-			$this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Added Successfully!");
853
-				  }else{
854
-			$this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Updated Successfully!");
851
+		   if ($sipprofile_data['type_settings'] == "add_setting") {
852
+			$this->session->set_flashdata('astpp_errormsg', $data['sip_name']." SIP Setting Added Successfully!");
853
+				  } else {
854
+			$this->session->set_flashdata('astpp_errormsg', $data['sip_name']." SIP Setting Updated Successfully!");
855 855
 		    
856 856
 				  }
857
-				  redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$sipprofile_data['id']);
857
+				  redirect(base_url().'freeswitch/fssipprofile_edit/'.$sipprofile_data['id']);
858 858
 		  exit;
859 859
 
860 860
 		}
@@ -875,19 +875,19 @@  discard block
 block discarded – undo
875 875
 				if ($gateway_key != "profile_data") {
876 876
 					$gateway_data[$gateway_key] = $gatewau_val;
877 877
 				} else {
878
-					$tmp = (array) json_decode($gatewau_val);
878
+					$tmp = (array)json_decode($gatewau_val);
879 879
 					$gateway_result = array_merge($gateway_data, $tmp);
880 880
 				}
881 881
 			}
882 882
 		}
883
-		$tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value'];
884
-	$final_data= json_encode($tmp);
883
+		$tmp[$sipprofile_data['params_name']] = $sipprofile_data['params_value'];
884
+	$final_data = json_encode($tmp);
885 885
 	$insert_arr["profile_data"] = json_encode($tmp);
886 886
 	$update = $this->db->update("sip_profiles", $insert_arr, array('id' => $id));
887 887
 	$this->load->view('view_fssipprofile_edit', $data);
888 888
 	}
889 889
     
890
-	function fssipprofile_delete_params($id,$name) {
890
+	function fssipprofile_delete_params($id, $name) {
891 891
 	$where = array('id' => $id);
892 892
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
893 893
 		$query = $query->result_array();
@@ -897,18 +897,18 @@  discard block
 block discarded – undo
897 897
 				if ($gateway_key != "profile_data") {
898 898
 					$gateway_data[$gateway_key] = $gatewau_val;
899 899
 				} else {
900
-					$tmp = (array) json_decode($gatewau_val);
900
+					$tmp = (array)json_decode($gatewau_val);
901 901
 					$gateway_result = array_merge($gateway_data, $tmp);
902 902
 				}
903 903
 			}
904 904
 		}
905
-	if(isset($tmp[$name])){
905
+	if (isset($tmp[$name])) {
906 906
 	  unset($tmp[$name]);
907 907
 	}
908 908
 	$insert_arr["profile_data"] = json_encode($tmp);
909 909
 	$update = $this->db->update("sip_profiles", $insert_arr, array('id' => $id));
910 910
 		$this->session->set_flashdata('astpp_notification', $name.' SIP Setting Removed Successfully!');
911
-		redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$id);
911
+		redirect(base_url().'freeswitch/fssipprofile_edit/'.$id);
912 912
 	}
913 913
     
914 914
 	function fssipprofile_delete($profile_id) {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 		$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id);
917 917
 	$delete = $this->db_model->delete("sip_profiles", array("id" => $profile_id));
918 918
 		$this->session->set_flashdata('astpp_notification', 'SIP Profile Removed Successfully!');
919
-		redirect(base_url() . 'freeswitch/fssipprofile/');
919
+		redirect(base_url().'freeswitch/fssipprofile/');
920 920
 	}
921 921
 
922 922
 	function fsserver_list() {
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 	function fsserver_delete($id) {
1004 1004
 		$this->freeswitch_model->fsserver_delete($id);
1005 1005
 		$this->session->set_flashdata('astpp_notification', 'Freeswitch Server Removed Successfully!');
1006
-		redirect(base_url() . 'freeswitch/fsserver_list/');
1006
+		redirect(base_url().'freeswitch/fsserver_list/');
1007 1007
 		exit;
1008 1008
 	}
1009 1009
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 			$this->session->set_userdata('fsserver_list_search', $action);
1019 1019
 		}
1020 1020
 		if (@$ajax_search != 1) {
1021
-			redirect(base_url() . 'freeswitch/fsserver_list/');
1021
+			redirect(base_url().'freeswitch/fsserver_list/');
1022 1022
 		}
1023 1023
 	}
1024 1024
 
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
 		$this->session->set_userdata('advance_search', 0);
1027 1027
 		$this->session->set_userdata('account_search', "");
1028 1028
 	}
1029
-	function fssipprofile_edit_validation($id,$name){
1030
-	$sip_profile_data=$this->common->get_field_name('profile_data','sip_profiles',$id);
1031
-	$final_data= json_decode($sip_profile_data,true);
1032
-	foreach($final_data as $key=>$value){
1033
-		if($key == $name){
1029
+	function fssipprofile_edit_validation($id, $name) {
1030
+	$sip_profile_data = $this->common->get_field_name('profile_data', 'sip_profiles', $id);
1031
+	$final_data = json_decode($sip_profile_data, true);
1032
+	foreach ($final_data as $key=>$value) {
1033
+		if ($key == $name) {
1034 1034
 			echo 1;
1035 1035
 			return true;
1036 1036
 		}
Please login to merge, or discard this patch.