| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if(! App::$install) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Get the UID of the channel owner
 | 
					
						
							|  |  |  | 	$uid = get_theme_uid(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if($uid) { | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 		load_pconfig($uid,'ussrbasicright'); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Load the owners pconfig
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	$nav_bg = get_pconfig($uid, 'ussrbasicright', 'nav_bg'); | 
					
						
							|  |  |  | 	$nav_icon_colour = get_pconfig($uid, 'ussrbasicright', 'nav_icon_colour'); | 
					
						
							|  |  |  | 	$nav_active_icon_colour = get_pconfig($uid, 'ussrbasicright', 'nav_active_icon_colour'); | 
					
						
							|  |  |  | 	$banner_colour = get_pconfig($uid,'ussrbasicright','banner_colour'); | 
					
						
							|  |  |  | 	$narrow_navbar = get_pconfig($uid,'ussrbasicright','narrow_navbar'); | 
					
						
							|  |  |  | 	$link_colour = get_pconfig($uid, 'ussrbasicright', 'link_colour'); | 
					
						
							|  |  |  | 	$schema = get_pconfig($uid,'ussrbasicright','schema'); | 
					
						
							|  |  |  | 	$bgcolour = get_pconfig($uid, 'ussrbasicright', 'background_colour'); | 
					
						
							|  |  |  | 	$background_image = get_pconfig($uid, 'ussrbasicright', 'background_image'); | 
					
						
							|  |  |  | 	$item_colour = get_pconfig($uid, 'ussrbasicright', 'item_colour'); | 
					
						
							|  |  |  | 	$comment_item_colour = get_pconfig($uid, 'ussrbasicright', 'comment_item_colour'); | 
					
						
							|  |  |  | 	$font_size = get_pconfig($uid, 'ussrbasicright', 'font_size'); | 
					
						
							|  |  |  | 	$font_colour = get_pconfig($uid, 'ussrbasicright', 'font_colour'); | 
					
						
							|  |  |  | 	$radius = get_pconfig($uid, 'ussrbasicright', 'radius'); | 
					
						
							|  |  |  | 	$shadow = get_pconfig($uid,'ussrbasicright','photo_shadow'); | 
					
						
							|  |  |  | 	$converse_width=get_pconfig($uid,'ussrbasicright','converse_width'); | 
					
						
							|  |  |  | 	$top_photo=get_pconfig($uid,'ussrbasicright','top_photo'); | 
					
						
							|  |  |  | 	$reply_photo=get_pconfig($uid,'ussrbasicright','reply_photo'); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 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
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	if(file_exists('view/theme/ussrbasicright/schema/' . $schema . '.php')) { | 
					
						
							|  |  |  | 		$schemefile = 'view/theme/ussrbasicright/schema/' . $schema . '.php'; | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 		require_once ($schemefile); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	if(file_exists('view/theme/ussrbasicright/schema/' . $schema . '.css')) { | 
					
						
							|  |  |  | 		$schemecss = file_get_contents('view/theme/ussrbasicright/schema/' . $schema . '.css'); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Allow admins to set a default schema for the hub.
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | // default.php and default.css MUST be symlinks to existing schema files in view/theme/ussrbasicright/schema
 | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | if ((!$schema) || ($schema == '---')) { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	if(file_exists('view/theme/ussrbasicright/schema/default.php')) { | 
					
						
							|  |  |  | 		$schemefile = 'view/theme/ussrbasicright/schema/default.php'; | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 		require_once ($schemefile); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	if(file_exists('view/theme/ussrbasicright/schema/default.css')) { | 
					
						
							|  |  |  | 		$schemecss = file_get_contents('view/theme/ussrbasicright/schema/default.css'); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | //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 = '#343a40'; | 
					
						
							|  |  |  | if (! $nav_icon_colour) | 
					
						
							|  |  |  | 	$nav_icon_colour = 'rgba(255, 255, 255, 0.5)'; | 
					
						
							|  |  |  | if (! $nav_active_icon_colour) | 
					
						
							|  |  |  | 	$nav_active_icon_colour = 'rgba(255, 255, 255, 0.75)'; | 
					
						
							|  |  |  | if (! $link_colour) | 
					
						
							|  |  |  | 	$link_colour = '#007bff'; | 
					
						
							|  |  |  | 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 (! $item_opacity) | 
					
						
							|  |  |  | 	$item_opacity = '1'; | 
					
						
							|  |  |  | if (! $font_size) | 
					
						
							|  |  |  | 	$font_size = '0.875rem'; | 
					
						
							|  |  |  | 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(! $reply_photo) | 
					
						
							|  |  |  | 	$reply_photo = '2.3rem'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Apply the settings
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | if(file_exists('view/theme/ussrbasicright/css/style.css')) { | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	$x = file_get_contents('view/theme/ussrbasicright/css/style.css'); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-25 23:10:43 +00:00
										 |  |  | 	if($narrow_navbar && file_exists('view/theme/ussrbasicright/css/narrow_navbar.css')) { | 
					
						
							|  |  |  | 		$x .= file_get_contents('view/theme/ussrbasicright/css/narrow_navbar.css'); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if($schemecss) { | 
					
						
							|  |  |  | 		$x .= $schemecss; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 20:13:31 +00:00
										 |  |  | 	$left_aside_width = 288; | 
					
						
							|  |  |  | 	$right_aside_width = 288; | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 20:13:31 +00:00
										 |  |  | 	$main_width = $left_aside_width + $right_aside_width + intval($converse_width); | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// prevent main_width smaller than 768px
 | 
					
						
							|  |  |  | 	$main_width = (($main_width < 768) ? 768 : $main_width); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	$options = array ( | 
					
						
							|  |  |  | 		'$nav_bg' => $nav_bg, | 
					
						
							|  |  |  | 		'$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, | 
					
						
							|  |  |  | 		'$font_size' => $font_size, | 
					
						
							|  |  |  | 		'$font_colour' => $font_colour, | 
					
						
							|  |  |  | 		'$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, | 
					
						
							|  |  |  | 		'$main_width' => $main_width, | 
					
						
							| 
									
										
										
										
											2021-07-13 20:13:31 +00:00
										 |  |  | 		'$left_aside_width' => $left_aside_width, | 
					
						
							|  |  |  | 		'$right_aside_width' => $right_aside_width | 
					
						
							| 
									
										
										
										
											2019-03-02 09:20:31 +00:00
										 |  |  | 	); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	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. 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-13 20:13:31 +00:00
										 |  |  | if(local_channel() && App::$channel && App::$channel['channel_theme'] != 'ussrbasicright') | 
					
						
							|  |  |  | 	set_pconfig(local_channel(), 'ussrbasicright', 'schema', '---'); |