2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if  ( ! file_exists ( " ../config.php " ))  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  header ( " Location: ../ " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								else {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  require_once ( " ../config.php " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  require_once ( " ../classes/constellation.php " ); 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 21:42:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  header ( 'Cache-Control: no-cache' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  header ( 'Content-type: application/json' ); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( ! isset ( $_GET [ 'id' ])) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									  $array  =  $constellation -> render_status ( true ,  false ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									  echo  json_encode ( $array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } else { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-15 08:57:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $queryId  =  $mysqli -> prepare ( " SELECT id as 'id' from services where id = ?; " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $queryId -> bind_param ( " i " ,  $_GET [ 'id' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $queryId -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $result  =  $queryId -> get_result () -> fetch_assoc (); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( ! count ( $result )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	die ( json_encode ([ " error "  =>  _ ( " Service does not exist! " )])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-15 08:57:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  	$query  =  $mysqli -> prepare ( " select services.id, name, description, status.type from services inner join status on status.id = services.id where services.id = ?; " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  	$query -> bind_param ( " i " ,  $_GET [ 'id' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  	$query -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $result  =  $query -> get_result () -> fetch_assoc (); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-15 08:57:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( is_numeric ( $result [ " type " ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $service  =  new  Service ( $_GET [ " id " ],  $result [ " name " ],  $result [ " description " ],  '' ,  $result [ " type " ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $service  =  new  Service ( $_GET [ " id " ],  $result [ " name " ],  $result [ " description " ]); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo  json_encode ( $service ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}