function
update_xml() {
global $db, $dbid, $p_user_nick, $p_title, $p_description, $s_root_path, $r_root_path, $attach_path, $s_attach_path, $r_attach_path, $p_xml_cnt, $p_rss_public;
list($st, $header, $body, $lmdate, $xmlinfo) = xml_parser($s_root_path."index.xml","");
if ($xmlinfo) {
list($stitle, $slink, $sdesc) = str_dbi_check(get_siteinfo($xmlinfo));
}
if (trim($slink)) $s_root_path = str_replace("index.php", "", $slink);
$p_title = htmlspecialchars($p_title);
$p_description = htmlspecialchars(str_tag_truncate($p_description));
$rtime = get_rss_stamp(time());
$rss .= "\r\n";
$rss .= "
\r\n";
$rss .= "\r\n";
$rss .= "$p_title\r\n";
$rss .= "$s_root_path"."index.php\r\n";
$rss .= "$p_description\r\n";
$rss .= "ko\r\n";
$rss .= "$rtime\r\n";
$sql = "
select
no, category1, category2, title, body,
user_id, image_file_path1, image_file_path2, regdate
from
t3_".$dbid."
where
is_public = '1'
order by
regdate desc
limit 0, $p_xml_cnt
";
$result = @mysql_query($sql);
while(list(
$no, $category1, $category2, $title, $body,
$user_id, $image_file_path1, $image_file_path2, $regdate
) = @mysql_fetch_array($result)) {
$category = get_category1_label($category1);
if ($category2) $category .= " - ".get_category2_label($category2);
$title = htmlspecialchars($title);
$link = htmlspecialchars($s_root_path."index.php?pl=$no");
if ($p_rss_public) {
$description =
" nl2brc(
autolink(
set_body(
attach_image(0, $body, $s_root_path, $r_root_path, $attach_path.$image_file_path1.$image_file_path2)
)
)
)
, $no)."]]>";
} else {
if (strlen($body) > 240) $add_desc = " >> 글 전체보기";
else $add_desc = "";
$description = "";
}
$regdate = get_rss_stamp($regdate);
$creator = htmlspecialchars($user_id);
$rss .= "- \r\n";
$rss .= "$title\r\n";
$rss .= "$link\r\n";
$rss .= "$description\r\n";
$rss .= "".htmlspecialchars($category)."\r\n";
$rss .= "$creator\r\n";
$rss .= "$regdate\r\n";
$rss .= " \r\n";
}
$rss .= "\r\n";
$rss .= "";
$out = fopen($r_root_path."index.xml", "w");
@chmod($r_root_path."index.xml", 0777);
fwrite($out, $rss);
fclose($out);
}
Posted by 홍반장