View file news/app/Controllers/Controller.php

File size: 637B
<?php

class Controller 
{
	function __construct($f3)
	{
		$db = new \DB\SQL('mysql:host='.$f3->get('DBHOST').';port=3306;dbname='.$f3->get('DBNAME'), $f3->get('DBUSER'), $f3->get('DBPASSWORD'));
		
		$this->db = $db;
		$this->prefix = $f3->get('DBPREFIX');
	}
	
	function display($f3)
	{
		echo View::instance()->render($f3->get('TEMPLATE').'/index.htm', 'text/html');
	}

	function isAdmin($f3)
	{
		if($f3->exists('COOKIE.password') and $f3->get('COOKIE.password') == md5($f3->get('PASSWORD')))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function protect($text)
	{
		return htmlspecialchars($text, ENT_QUOTES);
	}
}