| 1 |
<?php
|
| 2 |
if (!defined("_BBS_THEME_INIT_"))
|
| 3 |
{
|
| 4 |
define("_BBS_THEME_INIT_",1);
|
| 5 |
|
| 6 |
$BBS_theme_set = array(
|
| 7 |
"default" => array(
|
| 8 |
"css/default" => "css/default.css",
|
| 9 |
"js/lml_assistant" => "js/lml_assistant.js",
|
| 10 |
"view/list" => "list.view.php",
|
| 11 |
"view/post" => "post.view.php",
|
| 12 |
"view/view_article" => "view_article.view.php",
|
| 13 |
"view/search_article" => "search_article.view.php",
|
| 14 |
"view/search_user" => "search_user.view.php",
|
| 15 |
"view/user_center_header" => "user_center_header.view.php",
|
| 16 |
"view/update_profile" => "update_profile.view.php",
|
| 17 |
"view/update_pref" => "update_pref.view.php",
|
| 18 |
"view/user_section_favor" => "user_section_favor.view.php",
|
| 19 |
"view/section_setting" => "section_setting.view.php",
|
| 20 |
"view/view_user" => "view_user.view.php",
|
| 21 |
"view/score_detail" => "score_detail.view.php",
|
| 22 |
"view/user_suicide" => "user_suicide.view.php",
|
| 23 |
"view/msg_read" => "msg_read.view.php",
|
| 24 |
),
|
| 25 |
"xml" => array(
|
| 26 |
"xsl/1" => "xsl/1.xsl",
|
| 27 |
"view/view_article" => "view_article_xml.view.php",
|
| 28 |
),
|
| 29 |
"gen_ex" => array(
|
| 30 |
"view/view_article" => "gen_ex_article.view.php",
|
| 31 |
),
|
| 32 |
"portal" => array(
|
| 33 |
"css/default" => "../www/css/default.css",
|
| 34 |
"view/view_article" => "view_article.view.php",
|
| 35 |
),
|
| 36 |
"export_xml" => array(
|
| 37 |
"view/view_article" => "export_article_xml.view.php",
|
| 38 |
),
|
| 39 |
);
|
| 40 |
|
| 41 |
$BBS_theme_current = "";
|
| 42 |
|
| 43 |
function get_theme_file(string $view_name, string $theme_name = "") : string | null
|
| 44 |
{
|
| 45 |
global $BBS_theme_set;
|
| 46 |
global $BBS_theme_current;
|
| 47 |
|
| 48 |
if ($theme_name == "")
|
| 49 |
{
|
| 50 |
$theme_name = $BBS_theme_current; // Use current selected theme
|
| 51 |
}
|
| 52 |
|
| 53 |
if (!isset($BBS_theme_set[$theme_name]) || !isset($BBS_theme_set[$theme_name][$view_name]))
|
| 54 |
{
|
| 55 |
$theme_name = "default"; // fallback
|
| 56 |
}
|
| 57 |
|
| 58 |
$BBS_theme_current = $theme_name; // Remember current theme for later use
|
| 59 |
|
| 60 |
if (!isset($BBS_theme_set[$theme_name][$view_name]))
|
| 61 |
{
|
| 62 |
return null; // View not exist
|
| 63 |
}
|
| 64 |
|
| 65 |
$file = "../bbs/themes/" . $theme_name . "/" . $BBS_theme_set[$theme_name][$view_name];
|
| 66 |
|
| 67 |
if (!file_exists($file))
|
| 68 |
{
|
| 69 |
return $BBS_theme_set[$theme_name][$view_name]; // fallback file without theme
|
| 70 |
}
|
| 71 |
|
| 72 |
return $file;
|
| 73 |
}
|
| 74 |
}
|