/[LeafOK_CVS]/fenglin/bbs/theme.inc.php
ViewVC logotype

Contents of /fenglin/bbs/theme.inc.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations)
Mon Apr 14 02:14:40 2025 UTC (11 months ago) by sysadm
Branch: MAIN
Changes since 1.12: +1 -0 lines
Refact score_detail with theme support

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/member_service_guide" => "member_service_guide.view.php",
15 "view/update_profile" => "update_profile.view.php",
16 "view/preference" => "preference.view.php",
17 "view/s_favor" => "s_favor.view.php",
18 "view/section_setting" => "section_setting.view.php",
19 "view/show_profile" => "show_profile.view.php",
20 "view/score_detail" => "score_detail.view.php",
21 ),
22 "xml" => array(
23 "xsl/1" => "xsl/1.xsl",
24 "view/view_article" => "view_article_xml.view.php",
25 ),
26 "gen_ex" => array(
27 "view/view_article" => "gen_ex_article.view.php",
28 ),
29 "portal" => array(
30 "css/default" => "../www/css/default.css",
31 "view/view_article" => "view_article.view.php",
32 ),
33 );
34
35 $BBS_theme_current = "";
36
37 function get_theme_file(string $view_name, string $theme_name = "") : string | null
38 {
39 global $BBS_theme_set;
40 global $BBS_theme_current;
41
42 if ($theme_name == "")
43 {
44 $theme_name = $BBS_theme_current; // Use current selected theme
45 }
46
47 if (!isset($BBS_theme_set[$theme_name]) || !isset($BBS_theme_set[$theme_name][$view_name]))
48 {
49 $theme_name = "default"; // fallback
50 }
51
52 $BBS_theme_current = $theme_name; // Remember current theme for later use
53
54 if (!isset($BBS_theme_set[$theme_name][$view_name]))
55 {
56 return null; // View not exist
57 }
58
59 $file = "../bbs/themes/" . $theme_name . "/" . $BBS_theme_set[$theme_name][$view_name];
60
61 if (!file_exists($file))
62 {
63 return $BBS_theme_set[$theme_name][$view_name]; // fallback file without theme
64 }
65
66 return $file;
67 }
68 }
69 ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1