/[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.8 - (show annotations)
Sat Apr 12 06:32:09 2025 UTC (11 months ago) by sysadm
Branch: MAIN
Changes since 1.7: +1 -0 lines
Add search_article

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/search_article" => "search_article.view.php",
13 "view/member_service_guide" => "member_service_guide.view.php",
14 "view/update_profile" => "update_profile.view.php",
15 "view/preference" => "preference.view.php",
16 "view/s_favor" => "s_favor.view.php",
17 "view/section_setting" => "section_setting.view.php",
18 "view/show_profile" => "show_profile.view.php",
19 ),
20 );
21
22 $BBS_theme_current = "";
23
24 function get_theme_file(string $view_name, string $theme_name = "") : string | null
25 {
26 global $BBS_theme_set;
27 global $BBS_theme_current;
28
29 if ($theme_name == "")
30 {
31 $theme_name = $BBS_theme_current; // Use current selected theme
32 }
33
34 if (!isset($BBS_theme_set[$theme_name]) || !isset($BBS_theme_set[$theme_name][$view_name]))
35 {
36 $theme_name = "default"; // fallback
37 }
38
39 $BBS_theme_current = $theme_name; // Remember current theme for later use
40
41 if (!isset($BBS_theme_set[$theme_name][$view_name]))
42 {
43 return null; // View not exist
44 }
45
46 $file = "./themes/" . $theme_name . "/" . $BBS_theme_set[$theme_name][$view_name];
47
48 if (!file_exists($file))
49 {
50 return $BBS_theme_set[$theme_name][$view_name]; // fallback file without theme
51 }
52
53 return $file;
54 }
55 }
56 ?>

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