<?php 

Abstract Class baseModel {
	public $db;
	
	function __construct() {
		global $registry;
		$this->db = $registry->db;
	}
	
	function filterFields($data, $fields) {
    	foreach ($data as $index => $value) {
			if (!in_array($index, $fields)) {
				unset($data[$index]);
			} else {
				$data[$index] = trim(htmlentities($value));
			}
		}
		return $data;
	}
}
