<?php
	require_once '../../autoload.php';
		
	RightsCheck ('VIEW_WARNING');

	$conn = get_dbconnection();
	
	$answer = "<warnings>";
	
	if ( $conn )
	{
		$sql="select examwarning.id, examwarning.title from examwarning where examwarning.removed = false";
		
		if ( $query = pg_query($conn,$sql) )
		{
			while ( $row = pg_fetch_row($query) )
			{
				$row[1]=trim(preg_replace('/[[:cntrl:]]/', '', htmlspecialchars($row[1],ENT_QUOTES)));

				$answer .= "<warning id=\"".$row[0]."\" name=\"".$row[1]."\" ></warning>";
			}
		}
	}
	
	$answer .= "</warnings>";

	header ('Content-type: text/xml' );
	
	echo $answer;
?>