2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  if  (  !  defined ( 'BASEPATH' ))  exit ( 'No direct script access allowed' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  User  extends  CI_Controller  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-06 18:58:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  __construct () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										parent :: __construct (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Load language files
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> lang -> load ( array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											'account' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										)); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-09 02:42:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									public  function  index () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( 99 ))  {  $this -> session -> set_flashdata ( 'notice' ,  'You\'re not allowed to do that!' );  redirect ( 'dashboard' );  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'results' ]  =  $this -> user_model -> users (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-21 04:49:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$data [ 'page_title' ]  =  " User Accounts " ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'user/main' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  add ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( 99 ))  {  $this -> session -> set_flashdata ( 'notice' ,  'You\'re not allowed to do that!' );  redirect ( 'dashboard' );  } 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'form_validation' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_name' ,  'Username' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_email' ,  'E-mail' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_password' ,  'Password' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_type' ,  'Type' ,  'required' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-27 03:45:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_firstname' ,  'First name' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_lastname' ,  'Last name' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_callsign' ,  'Callsign' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_locator' ,  'Locator' ,  'required' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_timezone' ,  'Timezone' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:13:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Get themes list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'themes' ]  =  $this -> user_model -> getThemes (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Get timezones
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'timezones' ]  =  $this -> user_model -> timezones (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $this -> form_validation -> run ()  ==  FALSE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'page_title' ]  =  " Add User " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-15 17:16:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $data [ 'measurement_base' ]  =  $this -> config -> item ( 'measurement_base' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_name' )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_name' ]  =  $this -> input -> post ( 'user_name' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_email' ]  =  $this -> input -> post ( 'user_email' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_password' ]  =  $this -> input -> post ( 'user_password' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_type' ]  =  $this -> input -> post ( 'user_type' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-27 03:45:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_firstname' ]  =  $this -> input -> post ( 'user_firstname' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_lastname' ]  =  $this -> input -> post ( 'user_lastname' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_callsign' ]  =  $this -> input -> post ( 'user_callsign' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_locator' ]  =  $this -> input -> post ( 'user_locator' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_timezone' ]  =  $this -> input -> post ( 'user_timezone' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-14 18:29:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $data [ 'user_measurement_base' ]  =  $this -> input -> post ( 'user_measurement_base' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-23 16:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $data [ 'user_stylesheet' ]  =  $this -> input -> post ( 'user_stylesheet' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_sota_lookup' ]  =  $this -> input -> post ( 'user_sota_lookup' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-21 04:19:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_show_notes' ]  =  $this -> input -> post ( 'user_show_notes' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_column1' ]  =  $this -> input -> post ( 'user_column1' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column2' ]  =  $this -> input -> post ( 'user_column2' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column3' ]  =  $this -> input -> post ( 'user_column3' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column4' ]  =  $this -> input -> post ( 'user_column4' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-07 14:03:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_column5' ]  =  $this -> input -> post ( 'user_column5' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-29 05:40:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> load -> view ( 'user/add' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> load -> view ( 'user/add' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											switch ( $this -> user_model -> add ( $this -> input -> post ( 'user_name' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_password' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_email' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_type' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_firstname' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_lastname' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_callsign' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_locator' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_timezone' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_measurement_base' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_date_format' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_stylesheet' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_sota_lookup' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_show_notes' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_column1' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_column2' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_column3' ), 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-07 14:03:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_column4' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> input -> post ( 'user_column5' )))  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Check for errors
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  EUSERNAMEEXISTS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$data [ 'username_error' ]  =  'Username <b>' . $this -> input -> post ( 'user_name' ) . '</b> already in use!' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  EEMAILEXISTS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$data [ 'email_error' ]  =  'E-mail address <b>' . $this -> input -> post ( 'user_email' ) . '</b> already in use!' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  EPASSWORDINVALID : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$data [ 'password_error' ]  =  'Invalid password!' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// All okay, return to user screen
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OK : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> session -> set_flashdata ( 'notice' ,  'User ' . $this -> input -> post ( 'user_name' ) . ' added' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													redirect ( 'user' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 09:27:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'page_title' ]  =  " Users " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_name' ]  =  $this -> input -> post ( 'user_name' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_email' ]  =  $this -> input -> post ( 'user_email' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_password' ]  =  $this -> input -> post ( 'user_password' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_type' ]  =  $this -> input -> post ( 'user_type' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-27 03:45:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_firstname' ]  =  $this -> input -> post ( 'user_firstname' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_lastname' ]  =  $this -> input -> post ( 'user_lastname' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_callsign' ]  =  $this -> input -> post ( 'user_callsign' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_locator' ]  =  $this -> input -> post ( 'user_locator' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-14 18:29:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $data [ 'user_measurement_base' ]  =  $this -> input -> post ( 'user_measurement_base' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-23 16:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $data [ 'user_stylesheet' ]  =  $this -> input -> post ( 'user_stylesheet' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_sota_lookup' ]  =  $this -> input -> post ( 'user_sota_lookup' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-21 04:19:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_show_notes' ]  =  $this -> input -> post ( 'user_show_notes' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_column1' ]  =  $this -> input -> post ( 'user_column1' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column2' ]  =  $this -> input -> post ( 'user_column2' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column3' ]  =  $this -> input -> post ( 'user_column3' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column4' ]  =  $this -> input -> post ( 'user_column4' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-07 14:03:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_column5' ]  =  $this -> input -> post ( 'user_column5' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-29 05:40:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'user/add' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  edit ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if (( ! $this -> user_model -> authorize ( 99 ))  &&  ( $this -> session -> userdata ( 'user_id' )  !=  $this -> uri -> segment ( 3 )))  {  $this -> session -> set_flashdata ( 'notice' ,  'You\'re not allowed to do that!' );  redirect ( 'dashboard' );  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										$query  =  $this -> user_model -> get_by_id ( $this -> uri -> segment ( 3 )); 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'form_validation' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_name' ,  'Username' ,  'required|xss_clean' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_email' ,  'E-mail' ,  'required|xss_clean' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( $this -> session -> userdata ( 'user_type' )  ==  99 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> form_validation -> set_rules ( 'user_type' ,  'Type' ,  'required|xss_clean' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_firstname' ,  'First name' ,  'required|xss_clean' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_lastname' ,  'Last name' ,  'required|xss_clean' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_callsign' ,  'Callsign' ,  'trim|required|xss_clean' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_locator' ,  'Locator' ,  'required|xss_clean' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_timezone' ,  'Timezone' ,  'required' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:13:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Get themes list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'themes' ]  =  $this -> user_model -> getThemes (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Get timezones
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'timezones' ]  =  $this -> user_model -> timezones (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $this -> form_validation -> run ()  ==  FALSE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'page_title' ]  =  " Edit User " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$q  =  $query -> row (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'id' ]  =  $q -> user_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_name' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_name' ]  =  $this -> input -> post ( 'user_name' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_name' ]  =  $q -> user_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_email' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_email' ]  =  $this -> input -> post ( 'user_email' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_email' ]  =  $q -> user_email ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_password' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_password' ]  =  $this -> input -> post ( 'user_password' , true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_password' ]  =  $q -> user_password ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_type' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_type' ]  =  $this -> input -> post ( 'user_type' , true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_type' ]  =  $q -> user_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_callsign' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_callsign' ]  =  $this -> input -> post ( 'user_callsign' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_callsign' ]  =  $q -> user_callsign ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_locator' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_locator' ]  =  $this -> input -> post ( 'user_locator' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_locator' ]  =  $q -> user_locator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_firstname' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_firstname' ]  =  $this -> input -> post ( 'user_firstname' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_firstname' ]  =  $q -> user_firstname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_lastname' ,  true ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-16 00:04:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_lastname' ]  =  $this -> input -> post ( 'user_lastname' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_lastname' ]  =  $q -> user_lastname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_callsign' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_callsign' ]  =  $this -> input -> post ( 'user_callsign' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_callsign' ]  =  $q -> user_callsign ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_locator' ,  true ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_locator' ]  =  $this -> input -> post ( 'user_locator' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_locator' ]  =  $q -> user_locator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_timezone' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_timezone' ]  =  $this -> input -> post ( 'user_timezone' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 06:47:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_timezone' ]  =  $q -> user_timezone ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-22 08:31:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_lotw_name' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_lotw_name' ]  =  $this -> input -> post ( 'user_lotw_name' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-22 08:31:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_lotw_name' ]  =  $q -> user_lotw_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 21:14:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_clublog_name' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_clublog_name' ]  =  $this -> input -> post ( 'user_clublog_name' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 21:14:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_clublog_name' ]  =  $q -> user_clublog_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 21:14:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_clublog_password' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_clublog_password' ]  =  $this -> input -> post ( 'user_clublog_password' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 21:14:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_clublog_password' ]  =  $q -> user_clublog_password ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-22 08:31:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_lotw_password' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_lotw_password' ]  =  $this -> input -> post ( 'user_lotw_password' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-22 08:31:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_lotw_password' ]  =  $q -> user_lotw_password ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 22:08:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_eqsl_name' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_eqsl_name' ]  =  $this -> input -> post ( 'user_eqsl_name' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 22:08:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_eqsl_name' ]  =  $q -> user_eqsl_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 22:08:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_eqsl_password' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$data [ 'user_eqsl_password' ]  =  $this -> input -> post ( 'user_eqsl_password' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 22:08:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_eqsl_password' ]  =  $q -> user_eqsl_password ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-14 18:29:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if ( $this -> input -> post ( 'user_measurement_base' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'user_measurement_base' ]  =  $this -> input -> post ( 'user_measurement_base' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'user_measurement_base' ]  =  $q -> user_measurement_base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-16 05:04:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_date_format' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'user_date_format' ]  =  $this -> input -> post ( 'user_date_format' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'user_date_format' ]  =  $q -> user_date_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-23 16:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if ( $this -> input -> post ( 'user_stylesheet' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'user_stylesheet' ]  =  $this -> input -> post ( 'user_stylesheet' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'user_stylesheet' ]  =  $q -> user_stylesheet ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_sota_lookup' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_sota_lookup' ]  =  $this -> input -> post ( 'user_sota_lookup' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_sota_lookup' ]  =  $q -> user_sota_lookup ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-21 04:19:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_show_notes' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_show_notes' ]  =  $this -> input -> post ( 'user_show_notes' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_show_notes' ]  =  $q -> user_show_notes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_column1' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column1' ]  =  $this -> input -> post ( 'user_column1' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column1' ]  =  $q -> user_column1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_column2' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column2' ]  =  $this -> input -> post ( 'user_column2' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column2' ]  =  $q -> user_column2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_column3' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column3' ]  =  $this -> input -> post ( 'user_column3' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column3' ]  =  $q -> user_column3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_column4' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column4' ]  =  $this -> input -> post ( 'user_column4' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column4' ]  =  $q -> user_column4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-07 14:03:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> input -> post ( 'user_column5' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column5' ]  =  $this -> input -> post ( 'user_column5' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'user_column5' ]  =  $q -> user_column5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'user/edit' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											unset ( $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											switch ( $this -> user_model -> edit ( $this -> input -> post ()))  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Check for errors
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  EUSERNAMEEXISTS : 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 02:35:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$data [ 'username_error' ]  =  'Username <b>' . $this -> input -> post ( 'user_name' ,  true ) . '</b> already in use!' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  EEMAILEXISTS : 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 02:35:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$data [ 'email_error' ]  =  'E-mail address <b>' . $this -> input -> post ( 'user_email' ,  true ) . '</b> already in use!' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  EPASSWORDINVALID : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$data [ 'password_error' ]  =  'Invalid password!' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// All okay, return to user screen
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  OK : 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 02:35:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if ( $this -> session -> userdata ( 'user_id' )  ==  $this -> input -> post ( 'id' ,  true ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-07 21:53:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$this -> session -> set_flashdata ( 'success' ,  'User ' . $this -> input -> post ( 'user_name' ,  true ) . ' edited' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														redirect ( 'user/edit/' . $this -> uri -> segment ( 3 )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 04:14:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-07 21:53:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$this -> session -> set_flashdata ( 'success' ,  'User ' . $this -> input -> post ( 'user_name' ,  true ) . ' edited' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 04:14:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														redirect ( 'user' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'page_title' ]  =  " Edit User " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 04:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_name' ]  =  $this -> input -> post ( 'user_name' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_email' ]  =  $this -> input -> post ( 'user_email' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_password' ]  =  $this -> input -> post ( 'user_password' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_type' ]  =  $this -> input -> post ( 'user_type' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_firstname' ]  =  $this -> input -> post ( 'user_firstname' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_lastname' ]  =  $this -> input -> post ( 'user_lastname' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_callsign' ]  =  $this -> input -> post ( 'user_callsign' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_locator' ]  =  $this -> input -> post ( 'user_locator' ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_timezone' ]  =  $this -> input -> post ( 'user_timezone' ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-23 16:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $data [ 'user_stylesheet' ]  =  $this -> input -> post ( 'user_stylesheet' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_sota_lookup' ]  =  $this -> input -> post ( 'user_sota_lookup' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-21 04:19:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_show_notes' ]  =  $this -> input -> post ( 'user_show_notes' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_column1' ]  =  $this -> input -> post ( 'user_column1' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column2' ]  =  $this -> input -> post ( 'user_column2' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column3' ]  =  $this -> input -> post ( 'user_column3' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column4' ]  =  $this -> input -> post ( 'user_column4' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-07 14:03:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'user_column4' ]  =  $this -> input -> post ( 'user_column4' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'user_column5' ]  =  $this -> input -> post ( 'user_column5' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'user/edit' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  profile ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$query  =  $this -> user_model -> get_by_id ( $this -> session -> userdata ( 'user_id' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 06:10:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $q  =  $query -> row (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'page_title' ]  =  " Profile " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_name' ]  =  $q -> user_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_type' ]  =  $q -> user_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_email' ]  =  $q -> user_email ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_firstname' ]  =  $q -> user_firstname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_lastname' ]  =  $q -> user_lastname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_callsign' ]  =  $q -> user_callsign ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data [ 'user_locator' ]  =  $q -> user_locator ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'user/profile' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 03:33:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  delete ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( 99 ))  {  $this -> session -> set_flashdata ( 'notice' ,  'You\'re not allowed to do that!' );  redirect ( 'dashboard' );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$query  =  $this -> user_model -> get_by_id ( $this -> uri -> segment ( 3 )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'form_validation' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'id' ,  'user_id' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data  =  $query -> row (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $this -> form_validation -> run ()  ==  FALSE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'user/delete' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-09 23:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 00:12:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $this -> user_model -> delete ( $data -> user_id )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> session -> set_flashdata ( 'notice' ,  'User deleted' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												redirect ( 'user' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> session -> set_flashdata ( 'notice' ,  '<b>Database error:</b> Could not delete user!' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												redirect ( 'user' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  login ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-13 02:01:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Check our version and run any migrations
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'Migration' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-26 17:37:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> migration -> current (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-06 02:28:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$query  =  $this -> user_model -> get ( $this -> input -> post ( 'user_name' ,  true )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'form_validation' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_name' ,  'Username' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'user_password' ,  'Password' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-25 05:42:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$data [ 'user' ]  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( $this -> form_validation -> run ()  ==  FALSE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-25 05:31:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$data [ 'page_title' ]  =  " Login " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 23:22:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/mini_header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'user/login' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-09 02:42:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $this -> user_model -> login ()  ==  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> session -> set_flashdata ( 'notice' ,  'User logged in' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-25 05:42:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> user_model -> update_session ( $data [ 'user' ] -> user_id ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												redirect ( 'dashboard' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-25 05:31:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> session -> set_flashdata ( 'error' ,  'Incorrect username or password!' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 08:31:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  logout ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$user_name  =  $this -> session -> userdata ( 'user_name' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> user_model -> clear_session (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> session -> set_flashdata ( 'notice' ,  'User ' . $user_name . ' logged out.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										redirect ( 'dashboard' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 23:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Function :  forgot_password 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Allows  users  to  input  an  email  address  and  a  password  will  be  sent  to  that  address . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  forgot_password ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> helper ( array ( 'form' ,  'url' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'form_validation' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> form_validation -> set_rules ( 'email' ,  'Email' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $this -> form_validation -> run ()  ==  FALSE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'page_title' ]  =  " Forgot Password " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/mini_header' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> view ( 'user/forgot_password' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Check email address exists
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$check_email  =  $this -> user_model -> check_email_address ( $this -> input -> post ( 'email' ,  true )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $check_email  ==  TRUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Generate password reset code 50 characters long
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> helper ( 'string' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$reset_code  =  random_string ( 'alnum' ,  50 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> user_model -> set_password_reset_code ( $this -> input -> post ( 'email' ,  true ),  $reset_code ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Send email with reset code
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> data [ 'reset_code' ]  =  $reset_code ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> library ( 'email' ); 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 00:14:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 22:26:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( $this -> optionslib -> get_option ( 'emailProtocol' )  ==  " smtp " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$config  =  Array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'protocol'  =>  $this -> optionslib -> get_option ( 'emailProtocol' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'smtp_host'  =>  $this -> optionslib -> get_option ( 'smtpHost' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'smtp_port'  =>  $this -> optionslib -> get_option ( 'smtpPort' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'smtp_user'  =>  $this -> optionslib -> get_option ( 'smtpUsername' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'smtp_pass'  =>  $this -> optionslib -> get_option ( 'smtpPassword' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'crlf'  =>  " \r \n " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														'newline'  =>  " \r \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													  ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													  $this -> email -> initialize ( $config ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 23:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$message  =  $this -> load -> view ( 'email/forgot_password' ,  $this -> data ,   TRUE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> email -> from ( 'noreply@cloudlog.co.uk' ,  'Cloudlog' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> email -> to ( $this -> input -> post ( 'email' ,  true )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> email -> subject ( 'Cloudlog Account Password Reset' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> email -> message ( $message ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 22:26:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( !  $this -> email -> send ()) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Redirect to login page with message
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> session -> set_flashdata ( 'warning' ,  'Email settings are incorrect.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Redirect to login page with message
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> session -> set_flashdata ( 'notice' ,  'Password Reset Processed.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 23:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// No account found just return to login page
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> session -> set_flashdata ( 'notice' ,  'Password Reset Processed.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 00:14:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  reset_password ( $reset_code  =  NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'reset_code' ]  =  $reset_code ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $reset_code  !=  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> helper ( array ( 'form' ,  'url' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> library ( 'form_validation' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> form_validation -> set_rules ( 'password' ,  'Password' ,  'required' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> form_validation -> set_rules ( 'password_confirm' ,  'Password Confirmation' ,  'required|matches[password]' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( $this -> form_validation -> run ()  ==  FALSE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'page_title' ]  =  " Reset Password " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> view ( 'interface_assets/mini_header' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> view ( 'user/reset_password' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Lets reset the password!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> user_model -> reset_password ( $this -> input -> post ( 'password' ,  true ),  $reset_code ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> session -> set_flashdata ( 'notice' ,  'Password Reset.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}