<?php
/** dedeart list */
function get_dedearts($typeid = 0, $top_num = 10, $field = 'pubdate') {
	global $DB;
	
	
	if (!in_array($field, array('click', 'ctime'))) $field = 'ctime';
	
	
	switch ($field) {
		case 'click' :
			$sortby = "a.click";
			break;
		case 'pubdate' :
			$sortby = "a.pubdate";
			break;
		default :
			$sortby = "a.pubdate";
			break;
	}
	$order = strtoupper($order);
	
	$sql = "Select * from ".$DB->table('archives')." where typeid='$typeid' AND ismake=1 order by id desc limit $top_num";
	$query = $DB->query($sql);
	$results = array();
	while ($row = $DB->fetch_array($query)) {
		
		$row['pubdate'] = date('Y-m-d', $row['pubdate']);
		$row['litpic'] = get_litpic($row['litpic'],$row['id']);
		
		$results[] = $row;
	}
	unset($row);
	$DB->free_result($query);
	
	return $results;
}

function get_dedearts1( $top_num = 10, $field = 'pubdate') {
	global $DB;
	
	
	if (!in_array($field, array('click', 'ctime'))) $field = 'ctime';
	
	
	switch ($field) {
		case 'click' :
			$sortby = "a.click";
			break;
		case 'pubdate' :
			$sortby = "a.pubdate";
			break;
		default :
			$sortby = "a.pubdate";
			break;
	}
	$order = strtoupper($order);
	
	$sql = "Select * from ".$DB->table('archives')." where typeid=1  order by id desc limit $top_num";
	$query = $DB->query($sql);
	$results = array();
	while ($row = $DB->fetch_array($query)) {
		
		$row['pubdate'] = date('Y-m-d', $row['pubdate']);
		
		$results[] = $row;
	}
	unset($row);
	$DB->free_result($query);
	
	return $results;
}
?>