includes/output.php
changeset 1371 d9814c4c2948
parent 1227 bdac73ed481e
equal deleted inserted replaced
1370:24f5610ea589 1371:d9814c4c2948
   271 	{
   271 	{
   272 	}
   272 	}
   273 }
   273 }
   274 
   274 
   275 /**
   275 /**
       
   276  * Output engine that sends data using Comet. This allows incremental pushing of data.
       
   277  * Note that this tends to not work with every server.
       
   278  */
       
   279 
       
   280 class Output_Comet extends Output_Naked
       
   281 {
       
   282 	/**
       
   283 	 * Be warned: this header function will flush ALL output buffers!
       
   284 	 */
       
   285 	
       
   286 	public function header()
       
   287 	{
       
   288 		while ( ob_get_level() )
       
   289 			ob_end_flush();
       
   290 	}
       
   291 	
       
   292 	/**
       
   293 	 * Write data and immediately send it to the client.
       
   294 	 * @param string Data to write
       
   295 	 */
       
   296 	
       
   297 	public function write($data)
       
   298 	{
       
   299 		echo $data;
       
   300 		flush();
       
   301 		if ( $data === 'STOP' || !stristr(@$_SERVER['HTTP_USER_AGENT'], 'gecko') || stristr(@$_SERVER['HTTP_USER_AGENT'], 'like gecko') )
       
   302 		{
       
   303 			global $db;
       
   304 			$db->close();
       
   305 			exit;
       
   306 		}
       
   307 	}
       
   308 }
       
   309 
       
   310 /**
   276  * Safe template outputter
   311  * Safe template outputter
   277  */
   312  */
   278 
   313 
   279 class Output_Safe
   314 class Output_Safe
   280 {
   315 {