<?php
if(!defined('IN_MYMPS')) exit('FORBIDDEN');
define('CURSCRIPT','announce');
$id 	= isset($id) 	? intval($id) 	: '';

$cache = get_cache_config();
require MYMPS_INC.'/cachepages.class.php';

$cachepages = new cachepages($cache['announce']['time'],'announce_'.$cityid,$areaid);
$cachetime = $cache['announce']['time'] > 0 ? true : false;
$cachepages->cacheCheck();

$city 		= get_city_caches($cityid,$areaid);
$city_limit = $city['cityid'] ? " AND cityid = '$city[cityid]'" : " ";
$loc 		= get_location('aboutus','','网站公告');
$query = $db -> query("SELECT * FROM `{$db_mymps}announce` WHERE begintime<='$timestamp' AND (endtime='0' OR endtime>'$timestamp') {$city_limit} ORDER BY id DESC");
while($row = $db -> fetchRow($query)){
	$arr['id'] 		= $row['id'];
	$arr['title'] 		= $row['title'];
	$arr['begintime']	= $row['begintime'] == 0 ? $row['pubdate'] : $row['begintime'];
	$arr['endtime'] 	= $row['endtime'];
	$arr['author'] 		= $row['author'];
	$arr['content'] 	= $row['redirecturl'] ? '<a href='.$row[redirecturl].' target=_blank>'.$row[redirecturl].'</a>' : $row['content'];
	$arr['uri'] 		= $row['redirecturl'] ? $row['redirecturl'] : Rewrite('about',array('part'=>'aboutus#'.$row['id']));
	$announce[]			= $arr;
}
$page_title = $loc['page_title'];
$location 	= $loc['location'];
globalassign();

include mayi_tpl('announce');
$cachetime && $cachepages->caching();
?>