<?PHP

class forum_Install{

	function install(){

		mysql_query("INSERT INTO `templates` (`parent_id`, `name`, `page`, `language`, `position`, `is_static`, `content`, `type`, `version`, `is_first_page`, `subject`, `from_name`, `from_email`, `page_position`, `template`, `is_active`, `title`, `meta_description`, `meta_keywords`, `queue`)
		VALUES
		(0, 'forum', 'forum', '"._defaultLanguage."', 'content', 0, NULL, 'MODEL', 0.00, 0, '', '', '', 'public,select', '', 1, '| Community', '', '', 1),
		(0, 'forum', 'forum_posts', '"._defaultLanguage."', 'content', 0, NULL, 'MODEL', 0.00, 0, '', '', '', 'public', '', 1, '| Community', '', '', 1);");

		$q = mysql_query("SELECT * FROM roles WHERE type IN('USER', 'SUPERADMIN', 'CLIENT', 'ADMIN') ");
		while($row = mysqli_fetch_Assoc($q)){

			$q2 = mysql_query("SELECT * FROM templates WHERE name = 'forum' ");
			while($row2 = mysqli_fetch_Assoc($q2)){

				mysql_query("INSERT INTO permissions
				(role_id, table_name, 	table_id, 	created_at, allow_access) VALUES
				(".$row['id'].", 'templates', ".$row2['id'].", NOW(), 1)");
			}
		}
	}
}

?>