<?php
require dirname(__FILE__) . '/../jxcms/common.php';
$name = trim(R('name', 'get'));
if ($name) {
	$ads = Cache :: read('ad');
	if (is_array($ads[$name])) {
		$str = M('ad') -> makeAdCode($ads[$name], true);
		$str = str_replace('"', '\"', $str);
		$str = str_replace("\r", "\\r", $str);
		$str = str_replace("\n", "\\n", $str);
		$str = "document.write(\"{$str}\");";
		$str = "<!--\r\n{$str}\r\n//-->";
		exit($str);
	}
	unset($ads);
}
exit("<!--none-->");

?>
