[1071]XOOPS模組開發
<?php
include_once "header.php";
include_once $GLOBALS['xoops']->path('/modules/system/include/functions.php');
$op = system_CleanVars($_REQUEST, 'op', '', 'string');
$sn = system_CleanVars($_REQUEST, 'sn', 0, 'int');
if (!file_exists(XOOPS_ROOT_PATH . "/uploads/snews/{$sn}.html")) {
$html = mk_html($sn);
} else {
$html = file_get_contents(XOOPS_ROOT_PATH . "/uploads/snews/{$sn}.html");
}
if ($op == "online") {
header("location: " . XOOPS_URL . "/uploads/snews/{$sn}.html");
} else {
header("Content-type: text/html");
header("Content-Disposition: attachment; filename={$sn}.html");
echo $html;
}
exit;