<?php
/** page list */
function get_page_list($where = 1, $orderby = 'page_id', $start = 0, $pagesize = 0) {
	global $DB;
	
	$sql = "SELECT page_id, page_name, page_intro FROM ".$DB->table('pages')." WHERE $where ORDER BY $orderby DESC LIMIT $start, $pagesize";
	$result = $DB->fetch_all($sql);
	
	return $result;
}
	
/** one page */
function get_one_page($page_id) {
	global $DB;
	
	$sql = "SELECT * FROM ".$DB->table('pages')." WHERE page_id=$page_id LIMIT 1";
	$result = $DB->fetch_one($sql);
	
	return $result;
}

/** links */
function get_links() {
	global $DB;
	
	$links = load_cache('links') ? load_cache('links') : $DB->fetch_all("SELECT link_id, link_name, link_url, link_logo FROM ".$DB->table('links')." WHERE link_display=1 ORDER BY link_id ASC");
	
	return $links;
}
?>