<?php

require_once "../../../mainfile.php";
require_once XOOPS_ROOT_PATH . "/header.php";


$theme = isset($_GET['theme']) ? trim($_GET['theme']) : null;
$file = trim($_GET['file']);

if (strpos($file, "..") !== false) {
	exit();
}

$smarty = new Legacy_AdminSmarty();

if ($theme !=null && !file_exists(XOOPS_THEME_PATH . "/" . $theme . "/" . $file)) {
	exit();
}

if($theme!=null) {
	$path = XOOPS_THEME_PATH . "/" . $theme;
}
else {
	$path = LEGACY_ADMIN_RENDER_FALLBACK_PATH;
}

$smarty->template_dir = $path;
$smarty->setModulePrefix('_css_'.$theme);
$result=$smarty->fetch("file:" . $file);

header('Content-Type:text/css;');
print $result;

?>