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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations)
Thu Apr 10 02:27:39 2025 UTC (11 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.5: +1 -0 lines
Add show_profile

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

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