2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-22 01:58:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$db_config_path  =  '../application/config/' ;  
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-21 01:19:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$db_file_path  =  $db_config_path . " database.php " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 07:10:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  delDir ( $dir )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									$files  =  glob (  $dir  .  '*' ,  GLOB_MARK  ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-16 04:01:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    foreach  (  $files  as  $file  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  (  substr (  $file ,  - 1  )  ==  '/'  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( file_exists ( $file ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            	delDir (  $file  ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( file_exists ( $file ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												unlink (  $file  ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 07:10:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-16 04:01:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// This step may be not needed
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-29 01:41:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // if (file_exists($dir)) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// 	rmdir( $dir );
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// }
 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 07:10:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-21 01:19:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( file_exists ( $db_file_path ))  {  
						 
					
						
							
								
									
										
										
										
											2022-01-20 07:10:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									delDir ( getcwd ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									header ( " ../ " ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-21 01:19:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									exit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Only load the classes in case the user submitted the form
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if ( $_POST )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Load the classes and create the new objects
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									require_once ( 'includes/core_class.php' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									require_once ( 'includes/database_class.php' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									$core  =  new  Core (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									$database  =  new  Database (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Validate the post data
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( $core -> validate_post ( $_POST )  ==  true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// First create the database, then create tables, then write config file
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $database -> create_database ( $_POST )  ==  false )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$message  =  $core -> show_message ( 'error' , " The database could not be created, please verify your settings. " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( $database -> create_tables ( $_POST )  ==  false )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$message  =  $core -> show_message ( 'error' , " The database tables could not be created, please verify your settings. " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( $core -> write_config ( $_POST )  ==  false )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$message  =  $core -> show_message ( 'error' , " The database configuration file could not be written, please chmod /application/config/database.php file to 777 " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $core -> write_configfile ( $_POST )  ==  false )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$message  =  $core -> show_message ( 'error' , " The config configuration file could not be written, please chmod /application/config/config.php file to 777 " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// If no errors, redirect to registration page
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! isset ( $message ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 07:10:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											sleep ( 1 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ch  =  curl_init (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$protocol = (( ! empty ( $_SERVER [ 'HTTPS' ])  &&  $_SERVER [ 'HTTPS' ]  !==  'off' )  ||  $_SERVER [ 'SERVER_PORT' ]  ==  443 )  ?  " https "  :  " http " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											list ( $realHost ,) = explode ( ':' , $_SERVER [ 'HTTP_HOST' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$cloudlog_url = $protocol . " :// " . $realHost . " : " . $_SERVER [ 'SERVER_PORT' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curl_setopt ( $ch ,  CURLOPT_URL , $cloudlog_url ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curl_setopt ( $ch ,  CURLOPT_VERBOSE ,  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curl_setopt ( $ch ,  CURLOPT_RETURNTRANSFER ,  true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$result  =  curl_exec ( $ch ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curl_setopt ( $ch ,  CURLOPT_URL , $cloudlog_url . " /index.php/update/dxcc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$result  =  curl_exec ( $ch ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											delDir ( getcwd ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											header ( 'Location: ' . $protocol . " :// " . $_SERVER [ 'HTTP_HOST' ] . $_POST [ 'directory' ]); 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											echo  " <h1>Install successful</h1> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											echo  " <p>Please delete the install folder " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											exit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$message  =  $core -> show_message ( 'error' , 'Not all fields have been filled in correctly. The host, username, password, and database name are required.' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								<! DOCTYPE  html  PUBLIC  " -//W3C//DTD XHTML 1.0 Transitional//EN "  " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< html  xmlns = " http://www.w3.org/1999/xhtml " >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< head > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< meta  http - equiv = " Content-Type "  content = " text/html; charset=utf-8 "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< title > Install  |  Cloudlog </ title > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< style  type = " text/css " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  body  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    font - size :  75 % ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    font - family :  Helvetica , Arial , sans - serif ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    width :  300 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    margin :  0  auto ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  input ,  label  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    display :  block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    font - size :  18 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    margin :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    padding :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  label  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    margin - top :  20 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  input . input_text  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    width :  270 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  input #submit {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    margin :  25 px  auto  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    font - size :  25 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  fieldset  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    padding :  15 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  legend  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    font - size :  18 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    font - weight :  bold ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  . error  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    background :  #ffd1d1;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    border :  1 px  solid  #ff5858;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        padding :  4 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</ style > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</ head > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< body > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < h1 > Install  Cloudlog </ h1 > 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-22 01:58:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   < ? php  if ( is_writable ( $db_config_path )) : ?> 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  < ? php  if ( isset ( $message ))  { echo  '<p class="error">'  .  $message  .  '</p>' ;} ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  < form  id = " install_form "  method = " post "  action = " <?php echo  $_SERVER['PHP_SELF'] ; ?> " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  < fieldset > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  	< legend > Configuration  Settings </ legend > 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-05 15:50:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										  	< label  for = " directory " > Directory </ label >< input  type = " text "  id = " directory "  value = " <?php echo str_replace( " index . php " ,  " " , str_replace( " / install / " ,  " " ,  $_SERVER['REQUEST_URI'] )); ?> "  class = " input_text "  name = " directory "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  	< label  for = " websiteurl " > Website  URL </ label >< input  type = " text "  id = " websiteurl "  value = " <?php echo  $_SERVER['REQUEST_SCHEME'] ; ?>://<?php echo str_replace( " index . php " ,  " " ,  $_SERVER['HTTP_HOST'] .str_replace( " / install / " ,  " " ,  $_SERVER['REQUEST_URI'] )); ?> "  class = " input_text "  name = " websiteurl "  /> 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										  	< label  for = " locator " > Default  Gridsquare </ label >< input  type = " text "  id = " locator "  value = " IO91JS "  class = " input_text "  name = " locator "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  </ fieldset > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  	< br > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < fieldset > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          < legend > Database  settings </ legend > 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-06 04:36:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										  < label  for = " hostname " > Hostname </ label >< input  type = " text "  id = " hostname "  value = " <?php echo getenv('MYSQL_HOST') ?: 'localhost'; ?> "  class = " input_text "  name = " hostname "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  < label  for = " username " > Username </ label >< input  type = " text "  id = " username "  value = " <?php echo getenv('MYSQL_USER'); ?> "  class = " input_text "  name = " username "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  < label  for = " password " > Password </ label >< input  type = " password "  id = " password "  value = " <?php echo getenv('MYSQL_PASSWORD'); ?> "  class = " input_text "  name = " password "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  < label  for = " database " > Database  Name </ label >< input  type = " text "  id = " database "  value = " <?php echo getenv('MYSQL_DATABASE'); ?> "  class = " input_text "  name = " database "  /> 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								          < input  type = " submit "  value = " Install "  id = " submit "  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        </ fieldset > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  </ form > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 < h2 > Demo  User  Account </ h2 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  	< ul > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  		< li > Username :  m0abc </ li > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  		< li > Password :  demo </ li > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  	</ ul > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  	< p > When  you  login  create  a  new  admin  account  and  delete  the  m0abc  user  account .</ p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-22 01:58:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 < ? php  else :  ?> 
 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-24 00:44:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     < p  class = " error " > Please  make  the  / application / config /  folder  writable .  < strong > Example </ strong >:< br  />< br  />< code > chmod  - R  777  / application / config /</ code >< br  />< br  />< i > Don ' t  forget  to  restore  the  permissions  afterwards .</ i ></ p > 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-22 01:58:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 < ? php  endif ;  ?> 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 23:38:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</ body > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								</ html >