1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
<?php
if(! App::$install) {
// Get the UID of the channel owner
$uid = get_theme_uid();
if($uid) {
load_pconfig($uid,'redbasic');
}
// Load the owners pconfig
$nav_bg = get_pconfig($uid, 'redbasic', 'nav_bg');
$nav_bg_dark = get_pconfig($uid, 'redbasic', 'nav_bg_dark');
$narrow_navbar = get_pconfig($uid,'redbasic','narrow_navbar');
$link_color = get_pconfig($uid, 'redbasic', 'link_color');
$link_color_dark = get_pconfig($uid, 'redbasic', 'link_color_dark');
$link_hover_color = get_pconfig($uid, 'redbasic', 'link_hover_color');
$link_hover_color_dark = get_pconfig($uid, 'redbasic', 'link_hover_color_dark');
$bgcolor = get_pconfig($uid, 'redbasic', 'background_color');
$bgcolor_dark = get_pconfig($uid, 'redbasic', 'background_color_dark');
$schema = get_pconfig($uid,'redbasic','schema');
$background_image = get_pconfig($uid, 'redbasic', 'background_image');
$background_image_dark = get_pconfig($uid, 'redbasic', 'background_image_dark');
$font_size = get_pconfig($uid, 'redbasic', 'font_size');
$radius = get_pconfig($uid, 'redbasic', 'radius');
$converse_width=get_pconfig($uid,'redbasic','converse_width');
$top_photo=get_pconfig($uid,'redbasic','top_photo');
$reply_photo=get_pconfig($uid,'redbasic','reply_photo');
}
// Now load the scheme. If a value is changed above, we'll keep the settings
// If not, we'll keep those defined by the schema
// Setting $schema to '' wasn't working for some reason, so we'll check it's
// not --- like the mobile theme does instead.
// Allow layouts to over-ride the schema
if (isset($_REQUEST['schema']) && preg_match('/^[\w_-]+$/i', $_REQUEST['schema'])) {
$schema = $_REQUEST['schema'];
}
if (($schema) && ($schema != '---')) {
// Check it exists, because this setting gets distributed to clones
if(file_exists('view/theme/redbasic/schema/' . $schema . '.php')) {
$schemefile = 'view/theme/redbasic/schema/' . $schema . '.php';
require_once ($schemefile);
}
if(file_exists('view/theme/redbasic/schema/' . $schema . '.css')) {
$schemecss = file_get_contents('view/theme/redbasic/schema/' . $schema . '.css');
}
}
// Allow admins to set a default schema for the hub.
// default.php and default.css MUST be symlinks to existing schema files in view/theme/redbasic/schema
if ((!$schema) || ($schema == '---')) {
if(file_exists('view/theme/redbasic/schema/default.php')) {
$schemefile = 'view/theme/redbasic/schema/default.php';
require_once ($schemefile);
}
$schemecss = '';
if(file_exists('view/theme/redbasic/schema/default.css')) {
$schemecss = file_get_contents('view/theme/redbasic/schema/default.css');
}
}
//Set some defaults - we have to do this after pulling owner settings, and we have to check for each setting
//individually. If we don't, we'll have problems if a user has set one, but not all options.
if (! $nav_bg)
$nav_bg = 'rgba(33, 37, 41, 1)';
if (! $nav_bg_dark)
$nav_bg_dark = 'rgba(0, 0, 0, 1)';
if (! $link_color)
$link_color = '#0d6efd';
if (! $link_color_dark)
$link_color_dark = '#6ea8fe';
if (! $link_hover_color)
$link_hover_color = '#0a58ca';
if (! $link_hover_color_dark)
$link_hover_color_dark = '#9ec5fe';
if (! $bgcolor)
$bgcolor = '#fff';
if (! $bgcolor_dark)
$bgcolor_dark = '#212529';
if (! $background_image)
$background_image = '';
if (! $background_image_dark)
$background_image_dark = '';
if (! $item_color)
$item_color = '#fff';
if (! $item_color_dark)
$item_color_dark = '#212529';
if (! $header_item_color)
$header_item_color = '#f8f9fa';
if (! $header_item_color_dark)
$header_item_color_dark = '#212529';
if (! $font_size)
$font_size = '0.875rem';
if (! $radius)
$radius = '0.375rem';
if (! $converse_width)
$converse_width = '52'; //unit: rem
if(! $top_photo)
$top_photo = '2.3rem';
if(! $reply_photo)
$reply_photo = '2.3rem';
// Apply the settings
if(file_exists('view/theme/redbasic/css/style.css')) {
$x = file_get_contents('view/theme/redbasic/css/style.css');
if($schema === 'dark' && file_exists('view/theme/redbasic/schema/bootstrap-nightfall.css')) {
$x .= file_get_contents('view/theme/redbasic/schema/bootstrap-nightfall.css');
}
if($narrow_navbar && file_exists('view/theme/redbasic/css/narrow_navbar.css')) {
$x .= file_get_contents('view/theme/redbasic/css/narrow_navbar.css');
}
if($schemecss) {
$x .= $schemecss;
}
$left_aside_width = 21; //unit: rem
$right_aside_width = 21; //unit: rem
$main_width = $left_aside_width + $right_aside_width + intval($converse_width);
// prevent main_width smaller than 768px
$main_width = (($main_width < 30) ? 30 : $main_width);
$options = array (
'$nav_bg' => $nav_bg,
'$nav_bg_dark' => $nav_bg_dark,
'$link_color' => $link_color,
'$link_color_dark' => $link_color_dark,
'$link_hover_color' => $link_hover_color,
'$link_hover_color_dark' => $link_hover_color_dark,
'$bgcolor' => $bgcolor,
'$bgcolor_dark' => $bgcolor_dark,
'$background_image' => $background_image,
'$background_image_dark' => $background_image_dark,
'$item_color' => $item_color,
'$item_color_dark' => $item_color_dark,
'$header_item_color' => $header_item_color,
'$header_item_color_dark' => $header_item_color_dark,
'$font_size' => $font_size,
'$radius' => $radius,
'$converse_width' => $converse_width,
'$top_photo' => $top_photo,
'$reply_photo' => $reply_photo,
'$main_width' => $main_width,
'$left_aside_width' => $left_aside_width,
'$right_aside_width' => $right_aside_width
);
echo strtr($x, $options);
}
// Set the schema to the default schema in derived themes. See the documentation for creating derived themes how to override this.
if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'redbasic')
set_pconfig(local_channel(), 'redbasic', 'schema', '---');
|