//20100203:Tony:Implement get_news_content_v0.03_vb.php
//20090915:Tony:Use NBBC1.4.3 instead of own i_bbcode
require_once dirname(__FILE__).'/default_def.php';
require_once $GLOBALS['html']['libs']['incs']['coms']['xml_v1']['url'];
require_once $GLOBALS['html']['libs']['incs']['coms']['misc_v0']['url'];
$error_code = 0;
$threadid = get_param("threadid",""); if($threadid=="") $error_code=1; //echo $postid;
if($error_code==0)
{
$prm['threadid'] = $threadid;
$prm['db'] = 'forum';
$prm['mode'] = 'html';
$prm_st = arr2url($prm);
$xml_svr = $GLOBALS['html']['config']['news_events']['xml_svr'];
$xml_url = $xml_svr.$GLOBALS['html']['config']['news_events']['content.xml'].'?'.$prm_st; //echo $xml_url; die(0);
xml_v1_load($xml_svr,$GLOBALS['html']['config']['news_events']['counter.xml'],$prm,0);
echo '';
$xml_doc = new DOMDocument();
$xml_doc->load($xml_url); //echo "xx"; die(0);
$xml_doc->preserveWhiteSpace = false;
//ob_clean(); $xml_doc->saveXML(); die(0);
$head_text = $xml_doc->getElementsByTagname('head_text')->item(0)->nodeValue; //ob_clean(); echo $head_text; die(0);
$body_html = $xml_doc->getElementsByTagname('body_html')->item(0)->nodeValue; //ob_clean(); echo $body_html; die(0);
$body_html = post_process($body_html);
$body_html = fix_url($body_html);
}
else
{
echo "Missing news ID";
}
function arr2url($arr)
{
$st = "";
foreach($arr as $k=>$v) $st.=($k."=".urlencode($v)."&");
return substr($st,0,-1);
}
function post_process($st)
{
global $prm;
$s[] = '/forum/attachment.php?';
$r[] = '/2010/apps/vb_news/xmls/get_news_image_v0.03_vb.php?db='.$prm['db'].'&';
return str_replace($s,$r,$st);
}
function fix_url($st)
{
// ob_clean(); echo $GLOBALS['site']['server_name']; die(0);
if($GLOBALS['html']['config']['site']['name']=='2011p.star-board.com')
{
$s[] = 'http://www.star-board.com';
$r[] = 'http://2010p.star-board.com';
}
if($GLOBALS['html']['config']['site']['name']=='www.star-board.com')
{
$s[] = 'http://2010p.star-board.com';
$r[] = 'http://www.star-board.com';
}
return str_replace($s,$r,$st);
}
?>
=$head_text?>
=$body_html?>