增加时间XML输出时的特殊字符处理,以及默认GMT+8

This commit is contained in:
wlx 2010-06-25 04:02:40 +00:00
parent 1e1513a817
commit e69fb93f37
1 changed files with 3 additions and 3 deletions

View File

@ -151,13 +151,13 @@ class WaterController extends DataController
$rows=$this->db->fetchAll("select id,uuid,description,title,timebegin,timeend from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and timebegin is not null order by timebegin"); $rows=$this->db->fetchAll("select id,uuid,description,title,timebegin,timeend from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and timebegin is not null order by timebegin");
$timexml='<data>'; $timexml='<data>';
foreach($rows as $row) { foreach($rows as $row) {
$timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).'" '; $timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).' GMT+0800" ';
if ($row['timeend']!='' && $row['timeend']!=$row['timebegin']) $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"'; if ($row['timeend']!='' && $row['timeend']!=$row['timebegin']) $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"';
$timexml.= ' title="'.mb_substr($row['title'],31).'" image="/images/westdc_40w.gif" link="/water/'.$row['uuid'].'">'; $timexml.= ' title="'.htmlspecialchars(mb_substr($row['title'],31)).'" image="/images/westdc_40w.gif" link="/water/'.$row['uuid'].'">';
$desc_length=mb_strlen($row['description'],"UTF-8"); $desc_length=mb_strlen($row['description'],"UTF-8");
$desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8"); $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
if ($desc_length>300) $desc.=" ..."; if ($desc_length>300) $desc.=" ...";
//$timexml.=htmlspecialchars($desc); $timexml.=htmlspecialchars($desc);
$timexml.="</event>\n"; $timexml.="</event>\n";
} }
$timexml.='</data>'; $timexml.='</data>';