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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
<?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_gradient_top = get_pconfig($uid, 'redbasic', 'nav_gradient_top');
$nav_gradient_bottom = get_pconfig($uid, 'redbasic', 'nav_gradient_bottom');
$nav_active_gradient_top = get_pconfig($uid, 'redbasic', 'nav_active_gradient_top');
$nav_active_gradient_bottom = get_pconfig($uid, 'redbasic', 'nav_active_gradient_bottom');
$nav_bd = get_pconfig($uid, 'redbasic', 'nav_bd');
$nav_icon_colour = get_pconfig($uid, 'redbasic', 'nav_icon_colour');
$nav_active_icon_colour = get_pconfig($uid, 'redbasic', 'nav_active_icon_colour');
$narrow_navbar = get_pconfig($uid,'redbasic','narrow_navbar');
$banner_colour = get_pconfig($uid,'redbasic','banner_colour');
$link_colour = get_pconfig($uid, 'redbasic', 'link_colour');
$schema = get_pconfig($uid,'redbasic','schema');
$bgcolour = get_pconfig($uid, 'redbasic', 'background_colour');
$background_image = get_pconfig($uid, 'redbasic', 'background_image');
$toolicon_colour = get_pconfig($uid,'redbasic','toolicon_colour');
$toolicon_activecolour = get_pconfig($uid,'redbasic','toolicon_activecolour');
$item_colour = get_pconfig($uid, 'redbasic', 'item_colour');
$comment_item_colour = get_pconfig($uid, 'redbasic', 'comment_item_colour');
$comment_border_colour = get_pconfig($uid, 'redbasic', 'comment_border_colour');
$comment_indent = get_pconfig($uid, 'redbasic', 'comment_indent');
$body_font_size = get_pconfig($uid, 'redbasic', 'body_font_size');
$font_size = get_pconfig($uid, 'redbasic', 'font_size');
$font_colour = get_pconfig($uid, 'redbasic', 'font_colour');
$radius = get_pconfig($uid, 'redbasic', 'radius');
$shadow = get_pconfig($uid,'redbasic','photo_shadow');
$converse_width=get_pconfig($uid,'redbasic','converse_width');
$align_left=get_pconfig($uid,'redbasic','align_left');
$nav_min_opacity=get_pconfig($uid,'redbasic','nav_min_opacity');
$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($_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');
}
}
// If we haven't got a schema, load the default. We shouldn't touch this - we
// should leave it for admins to define for themselves.
// default.php and default.css MUST be symlinks to existing schema files.
if (! $schema) {
if(file_exists('view/theme/redbasic/schema/default.php')) {
$schemefile = 'view/theme/redbasic/schema/default.php';
require_once ($schemefile);
}
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 = '#222';
if (! $nav_gradient_top)
$nav_gradient_top = '#3c3c3c';
if (! $nav_gradient_bottom)
$nav_gradient_bottom = '#222';
if (! $nav_active_gradient_top)
$nav_active_gradient_top = '#222';
if (! $nav_active_gradient_bottom)
$nav_active_gradient_bottom = '#282828';
if (! $nav_bd)
$nav_bd = '#222';
if (! $nav_icon_colour)
$nav_icon_colour = '#999';
if (! $nav_active_icon_colour)
$nav_active_icon_colour = '#fff';
if (! $link_colour)
$link_colour = '#0275d8';
if (! $banner_colour)
$banner_colour = '#fff';
if (! $bgcolour)
$bgcolour = 'rgb(254,254,254)';
if (! $background_image)
$background_image ='';
if (! $item_colour)
$item_colour = 'rgb(238,238,238)';
if (! $comment_item_colour)
$comment_item_colour = 'rgb(255,255,255)';
if (! $comment_border_colour)
$comment_border_colour = 'rgb(255,255,255)';
if (! $toolicon_colour)
$toolicon_colour = '#777';
if (! $toolicon_activecolour)
$toolicon_activecolour = '#000';
if (! $item_opacity)
$item_opacity = '1';
if (! $font_size)
$font_size = '1rem';
if (! $body_font_size)
$body_font_size = '0.9rem';
if (! $font_colour)
$font_colour = '#4d4d4d';
if (! $radius)
$radius = '0.25rem';
if (! $shadow)
$shadow = '0';
if (! $converse_width)
$converse_width = '790';
if(! $top_photo)
$top_photo = '2.3rem';
if(! $comment_indent)
$comment_indent = '0px';
if(! $reply_photo)
$reply_photo = '2.3rem';
if($nav_min_opacity === false || $nav_min_opacity === '') {
$nav_float_min_opacity = 1.0;
$nav_percent_min_opacity = 100;
}
else {
$nav_float_min_opacity = (float) $nav_min_opacity;
$nav_percent_min_opacity = (int) 100 * $nav_min_opacity;
}
// Apply the settings
if(file_exists('view/theme/redbasic/css/style.css')) {
$x = file_get_contents('view/theme/redbasic/css/style.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($align_left && file_exists('view/theme/redbasic/css/align_left.css')) {
$x .= file_get_contents('view/theme/redbasic/css/align_left.css');
}
if($schemecss) {
$x .= $schemecss;
}
$aside_width = 288;
// left aside and right aside are 285px + converse width
if($align_left) {
$main_width = (($aside_width) + intval($converse_width));
}
else {
$main_width = (($aside_width * 2) + intval($converse_width));
}
// prevent main_width smaller than 768px
$main_width = (($main_width < 768) ? 768 : $main_width);
$options = array (
'$nav_bg' => $nav_bg,
'$nav_gradient_top' => $nav_gradient_top,
'$nav_gradient_bottom' => $nav_gradient_bottom,
'$nav_active_gradient_top' => $nav_active_gradient_top,
'$nav_active_gradient_bottom' => $nav_active_gradient_bottom,
'$nav_bd' => $nav_bd,
'$nav_icon_colour' => $nav_icon_colour,
'$nav_active_icon_colour' => $nav_active_icon_colour,
'$link_colour' => $link_colour,
'$banner_colour' => $banner_colour,
'$bgcolour' => $bgcolour,
'$background_image' => $background_image,
'$item_colour' => $item_colour,
'$comment_item_colour' => $comment_item_colour,
'$comment_border_colour' => $comment_border_colour,
'$toolicon_colour' => $toolicon_colour,
'$toolicon_activecolour' => $toolicon_activecolour,
'$font_size' => $font_size,
'$font_colour' => $font_colour,
'$body_font_size' => $body_font_size,
'$radius' => $radius,
'$shadow' => $shadow,
'$converse_width' => $converse_width,
'$nav_float_min_opacity' => $nav_float_min_opacity,
'$nav_percent_min_opacity' => $nav_percent_min_opacity,
'$top_photo' => $top_photo,
'$reply_photo' => $reply_photo,
'$pmenu_top' => $pmenu_top,
'$pmenu_reply' => $pmenu_reply,
'$comment_indent' => $comment_indent,
'$main_width' => $main_width,
'$aside_width' => $aside_width
);
echo str_replace(array_keys($options), array_values($options), $x);
}
// 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', '---');
|