<?php
function show_page($path = null)
{
global $prefix, $go, $title, $headline, $output, $module, $page, $html_header, $footnotes;
$styles = [];
if (file_exists("modules/{$module}/style.css")) {
$styles[] = "modules/{$module}/style.css";
}
foreach ($styles as $style) {
html_header('<link rel="stylesheet" href="' . $prefix . $style . '">' . "\n");
}
if ($path) {
$module = $path;
}
$theme = config('theme');
if (!$theme) {
$theme = 'default';
}
$theme_path = "themes/$theme/";
$candidates = [];
if ($page) {
$candidates[] = "{$theme_path}page-$module-$page.tpl.php";
}
$candidates[] = "{$theme_path}page-$module.tpl.php";
$candidates[] = "{$theme_path}page.tpl.php";
if ($page) {
$candidates[] = "modules/{$module}/theme/page-$page.tpl.php";
}
$candidates[] = "modules/{$module}/theme/page.tpl.php";
if ($page) {
$candidates[] = "themes/default/page-$module-$page.tpl.php";
}
$candidates[] = "themes/default/page-$module.tpl.php";
$candidates[] = "themes/default/page.tpl.php";
$theme_file = null;
foreach ($candidates as $c) {
if (file_exists($c)) {