<?php /* ------------------------- */

class wmadmin {
	function htmlparse($string){
		return htmlentities(trim($string), ENT_QUOTES);
	}

	function bericht($string, $html=1) {
		if($html == 0) {
			$string = htmlparse($string);
		}
		echo $string."\n";
	}

	function error($error=1, $actie) {
		if($error == 1) {
			echo "Er is iets niet ingevuld, <a href=\"admin-poll.php?a=".$actie."\">ga terug.</a>\n";
		}
	}

	function polllist() {
		echo "<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";
			$sql = @mysql_query("SELECT id, vraag FROM poll ORDER BY id DESC");
			while($list = @mysql_fetch_assoc($sql)) {
				echo "<tr><td width=\"60%\"> - ".$this->htmlparse($list['vraag'])."</td><td width=\"5%\"\><a href=\"admin-poll.php?a=bewerk&id=".$list['id']."\"><img src=\"images\b_edit.png\" border=0 alt=\"Bewerk\"></a></td><td width=\"5%\"\><a href=\"admin-poll.php?a=verwijder&id=".$list['id']."\"><img src=\"images\b_drop.png\" border=0 alt=\"Verwijder\"></a></td></tr>\n";
			}
		echo "</table>\n";
	}

	function openform($action) {
		echo "<form action=\"admin-poll.php?a=".$action."\" method=\"POST\">\n<table width=\"50%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";
	}

	function formtext($bericht, $naam, $value="", $lengte=50) {
		echo "<tr><td><b>".$this->htmlparse($bericht)."</b></td><td><input type=\"text\" name=\"".$naam."\" value=\"".$this->htmlparse($value)."\" maxlength=\"".$lengte."\"></td></tr>\n";
	}

	function formcheckbox($bericht, $naam, $checked=1) {
		echo "<tr><td><b>".$this->htmlparse($bericht)."</b></td><td><input type=\"checkbox\" name=\"".$naam."\" value=\"1\"";
		if($checked == 1) {
			echo " checked";
		}
		echo "></td></tr>\n";
	}

	function sluitform($submit) {
		echo "<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"".$submit."\"></td></tr>\n</table>\n</form>\n";
	}

	function formdata($value){
		$quotes = get_magic_quotes_gpc();

		$value = trim($value);
		if($quotes == FALSE){
			$value = addslashes($value);
		}

		return $value;
	}
}
/* ------------------------- */ ?>
