/[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.3 - (hide annotations)
Mon Apr 7 14:16:29 2025 UTC (11 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.2: +1 -0 lines
Refact s_favor with AJAX and theme support

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

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