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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 by sysadm, Mon Apr 7 06:34:07 2025 UTC Revision 1.14 by sysadm, Mon Apr 14 04:27:11 2025 UTC
# Line 5  if (!defined("_BBS_THEME_INIT_")) Line 5  if (!defined("_BBS_THEME_INIT_"))
5    
6          $BBS_theme_set = array(          $BBS_theme_set = array(
7                  "default" => array(                  "default" => array(
8                          "css" => "css/default.css",                          "css/default" => "css/default.css",
9                          "member_service_guide" => "member_service_guide.view.php",                          "js/lml_assistant" => "js/lml_assistant.js",
10                          "update_profile" => "update_profile.view.php",                          "view/list" => "list.view.php",
11                          "preference" => "preference.view.php",                          "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                            "view/suicide" => "suicide.view.php",
22                    ),
23                    "xml" => array(
24                            "xsl/1" => "xsl/1.xsl",
25                            "view/view_article" => "view_article_xml.view.php",
26                    ),
27                    "gen_ex" => array(
28                            "view/view_article" => "gen_ex_article.view.php",
29                    ),
30                    "portal" => array(
31                            "css/default" => "../www/css/default.css",
32                            "view/view_article" => "view_article.view.php",
33                  ),                  ),
34          );          );
35    
36          function get_theme_view_file(string $view_name, string $theme_name = "default") : string | null          $BBS_theme_current = "";
37    
38            function get_theme_file(string $view_name, string $theme_name = "") : string | null
39          {          {
40                  global $BBS_theme_set;                  global $BBS_theme_set;
41                    global $BBS_theme_current;
42    
43                    if ($theme_name == "")
44                    {
45                            $theme_name = $BBS_theme_current; // Use current selected theme
46                    }
47    
48                  if (!isset($BBS_theme_set[$theme_name]) || !isset($BBS_theme_set[$theme_name][$view_name]))                  if (!isset($BBS_theme_set[$theme_name]) || !isset($BBS_theme_set[$theme_name][$view_name]))
49                  {                  {
50                          $theme_name = "default"; // fallback                          $theme_name = "default"; // fallback
51                  }                  }
52    
53                    $BBS_theme_current = $theme_name; // Remember current theme for later use
54    
55                  if (!isset($BBS_theme_set[$theme_name][$view_name]))                  if (!isset($BBS_theme_set[$theme_name][$view_name]))
56                  {                  {
57                          return null; // View not exist                          return null; // View not exist
58                  }                  }
59    
60                  $file = "./themes/" . $theme_name . "/" . $BBS_theme_set[$theme_name][$view_name];                  $file = "../bbs/themes/" . $theme_name . "/" . $BBS_theme_set[$theme_name][$view_name];
61    
62                  if (!file_exists($file))                  if (!file_exists($file))
63                  {                  {
64                          return null; // View file not exist                          return $BBS_theme_set[$theme_name][$view_name]; // fallback file without theme
65                  }                  }
66    
67                  return $file;                  return $file;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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