Theme: Rework login settings, add settings to enable ability control login page background image(s) and color(s) separately from standard background image(s) and color(s).

This commit is contained in:
reliberate
2016-04-12 16:18:50 -06:00
parent 7961eb3b37
commit f0372faed1
2 changed files with 109 additions and 54 deletions

View File

@@ -42,6 +42,13 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_background_image';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $relative_path.'/'.$file;
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
$x++;
}
if ($x > 300) { break; };
}
@@ -167,7 +174,7 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'true';
$array[$x]['default_setting_enabled'] = 'false';
if($background_image_enabled) { $array[$x]['default_setting_enabled'] = 'true'; }
if ($background_image_enabled) { $array[$x]['default_setting_enabled'] = 'true'; }
$array[$x]['default_setting_description'] = 'Enable use of background images.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
@@ -907,48 +914,71 @@ if ($domains_processed == 1) {
/* login box */
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_background_color';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '#6c89b5';
$array[$x]['default_setting_order'] = '0';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the background color of the login page.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_background_color';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '#144794';
$array[$x]['default_setting_order'] = '1';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a secondary background color of the login page, for a gradient effect.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_background_image_enabled';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'true';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Enable use of background images on the login page.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_body_background_color';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'rgba(255,255,255,0.3)';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set the background color for the login box.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_shadow_color';
$array[$x]['default_setting_subcategory'] = 'login_body_shadow_color';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'rgba(140,140,140,0.3)';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set the shadow color of the login box.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_padding';
$array[$x]['default_setting_subcategory'] = 'login_body_padding';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '30px';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the padding of the login box.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_width';
$array[$x]['default_setting_subcategory'] = 'login_body_width';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '100%';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the width of the login box.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_border_radius';
$array[$x]['default_setting_subcategory'] = 'login_body_border_radius';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '4px';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the border radius of the login box.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_border_size';
$array[$x]['default_setting_subcategory'] = 'login_body_border_size';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '1px';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the border size of the login box.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_border_color';
$array[$x]['default_setting_subcategory'] = 'login_body_border_color';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '#ffffff';
$array[$x]['default_setting_enabled'] = 'false';

View File

@@ -53,16 +53,51 @@
}
echo "<link rel='icon' href='".$favicon."'>\n";
//determine which background image/color settings to use (login or standard)
$background_images_enabled = false;
if ($default_login) {
//try using login background images/colors
if ($_SESSION['theme']['login_background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['login_background_image'])) {
$background_images_enabled = true;
$background_images = $_SESSION['theme']['login_background_image'];
}
else if ($_SESSION['theme']['login_background_color'][0] != '' || $_SESSION['theme']['login_background_color'][1] != '') {
$background_colors[0] = $_SESSION['theme']['login_background_color'][0];
$background_colors[1] = $_SESSION['theme']['login_background_color'][1];
}
else {
//otherwise, use standard background images/colors
if ($_SESSION['theme']['background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['background_image'])) {
$background_images_enabled = true;
$background_images = $_SESSION['theme']['background_image'];
}
else {
$background_colors[0] = $_SESSION['theme']['background_color'][0];
$background_colors[1] = $_SESSION['theme']['background_color'][1];
}
}
}
else {
//use standard background images/colors
if ($_SESSION['theme']['background_image_enabled']['boolean'] == 'true' && is_array($_SESSION['theme']['background_image'])) {
$background_images_enabled = true;
$background_images = $_SESSION['theme']['background_image'];
}
else {
$background_colors[0] = $_SESSION['theme']['background_color'][0];
$background_colors[1] = $_SESSION['theme']['background_color'][1];
}
}
//check for background image
if ($_SESSION['theme']['background_image_enabled']['boolean'] == 'true' && isset($_SESSION['theme']['background_image'])) {
if ($background_images_enabled) {
// background image is enabled
$image_extensions = array('jpg','jpeg','png','gif');
if (count($_SESSION['theme']['background_image']) > 0) {
if (count($background_images) > 0) {
if (strlen($_SESSION['background_image']) == 0) {
$_SESSION['background_image'] = $_SESSION['theme']['background_image'][array_rand($_SESSION['theme']['background_image'])];
$_SESSION['background_image'] = $background_images[array_rand($background_images)];
$background_image = $_SESSION['background_image'];
}
@@ -127,28 +162,28 @@
// check for background color
else if (
$_SESSION['theme']['background_color'][0] != '' ||
$_SESSION['theme']['background_color'][1] != ''
$background_colors[0] != '' ||
$background_colors[1] != ''
) { // background color 1 or 2 is enabled
if ($_SESSION['theme']['background_color'][0] != '' && $_SESSION['theme']['background_color'][1] == '') { // use color 1
$background_color = "background: ".$_SESSION['theme']['background_color'][0].";";
if ($background_colors[0] != '' && $background_colors[1] == '') { // use color 1
$background_color = "background: ".$background_colors[0].";";
}
else if ($_SESSION['theme']['background_color'][0] == '' && $_SESSION['theme']['background_color'][1] != '') { // use color 2
$background_color = "background: ".$_SESSION['theme']['background_color'][1].";";
else if ($background_colors[0] == '' && $background_colors[1] != '') { // use color 2
$background_color = "background: ".$background_colors[1].";";
}
else if ($_SESSION['theme']['background_color'][0] != '' && $_SESSION['theme']['background_color'][1] != '') { // vertical gradient
$background_color = "background: ".$_SESSION['theme']['background_color'][0].";\n";
$background_color .= "background: -ms-linear-gradient(top, ".$_SESSION['theme']['background_color'][0]." 0%, ".$_SESSION['theme']['background_color'][1]." 100%);\n";
$background_color .= "background: -moz-linear-gradient(top, ".$_SESSION['theme']['background_color'][0]." 0%, ".$_SESSION['theme']['background_color'][1]." 100%);\n";
$background_color .= "background: -o-linear-gradient(top, ".$_SESSION['theme']['background_color'][0]." 0%, ".$_SESSION['theme']['background_color'][1]." 100%);\n";
$background_color .= "background: -webkit-gradient(linear, left top, left bottom, color-stop(0, ".$_SESSION['theme']['background_color'][0]."), color-stop(1, ".$_SESSION['theme']['background_color'][1]."));\n";
$background_color .= "background: -webkit-linear-gradient(top, ".$_SESSION['theme']['background_color'][0]." 0%, ".$_SESSION['theme']['background_color'][1]." 100%);\n";
$background_color .= "background: linear-gradient(to bottom, ".$_SESSION['theme']['background_color'][0]." 0%, ".$_SESSION['theme']['background_color'][1]." 100%);\n";
else if ($background_colors[0] != '' && $background_colors[1] != '') { // vertical gradient
$background_color = "background: ".$background_colors[0].";\n";
$background_color .= "background: -ms-linear-gradient(top, ".$background_colors[0]." 0%, ".$background_colors[1]." 100%);\n";
$background_color .= "background: -moz-linear-gradient(top, ".$background_colors[0]." 0%, ".$background_colors[1]." 100%);\n";
$background_color .= "background: -o-linear-gradient(top, ".$background_colors[0]." 0%, ".$background_colors[1]." 100%);\n";
$background_color .= "background: -webkit-gradient(linear, left top, left bottom, color-stop(0, ".$background_colors[0]."), color-stop(1, ".$background_colors[1]."));\n";
$background_color .= "background: -webkit-linear-gradient(top, ".$background_colors[0]." 0%, ".$background_colors[1]." 100%);\n";
$background_color .= "background: linear-gradient(to bottom, ".$background_colors[0]." 0%, ".$background_colors[1]." 100%);\n";
}
}
else { // default: white
$background_color = "background: #fff;\n";
$background_color = "background: #ffffff;\n";
}
?>
@@ -637,33 +672,22 @@
/* DOMAIN SELECTOR: END ********************************************************/
#default_login {
padding: <?php echo ($_SESSION['theme']['login_padding']['text'] != '') ? $_SESSION['theme']['login_padding']['text'] : '30px'; ?>;
<?php
echo ($_SESSION['theme']['login_width']['text'] != '') ? 'width: '.$_SESSION['theme']['login_width']['text'].";\n" : null;
if (
isset($_SESSION['theme']['background_image']) ||
$_SESSION['theme']['background_color'][0] != '' ||
$_SESSION['theme']['background_color'][1] != ''
) { ?>
background: <?php echo ($_SESSION['theme']['login_background_color']['text'] != '') ? $_SESSION['theme']['login_background_color']['text'] : "rgba(255,255,255,0.35)"; ?>;
<?php $br = format_border_radius($_SESSION['theme']['login_border_radius']['text'], '4px'); ?>
-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-khtml-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
<?php unset($br); ?>
<?php if ($_SESSION['theme']['login_border_size']['text'] != '' || $_SESSION['theme']['login_border_color']['text'] != '') { echo "border-style: solid;\n"; } ?>
<?php echo ($_SESSION['theme']['login_border_size']['text'] != '') ? 'border-width: '.$_SESSION['theme']['login_border_size']['text'].";\n" : null; ?>
<?php echo ($_SESSION['theme']['login_border_color']['text'] != '') ? 'border-color: '.$_SESSION['theme']['login_border_color']['text'].";\n" : null; ?>
-webkit-box-shadow: <?php echo ($_SESSION['theme']['login_shadow_color']['text'] != '') ? '0 1px 20px '.$_SESSION['theme']['login_shadow_color']['text'] : 'none'; ?>;
-moz-box-shadow: <?php echo ($_SESSION['theme']['login_shadow_color']['text'] != '') ? '0 1px 20px '.$_SESSION['theme']['login_shadow_color']['text'] : 'none'; ?>;
box-shadow: <?php echo ($_SESSION['theme']['login_shadow_color']['text'] != '') ? '0 1px 20px '.$_SESSION['theme']['login_shadow_color']['text'] : 'none'; ?>;
<?php
padding: <?php echo ($_SESSION['theme']['login_body_padding']['text'] != '') ? $_SESSION['theme']['login_body_padding']['text'] : '30px'; ?>;
<?php echo ($_SESSION['theme']['login_body_width']['text'] != '') ? 'width: '.$_SESSION['theme']['login_body_width']['text'].";\n" : null; ?>
background: <?php echo ($_SESSION['theme']['login_body_background_color']['text'] != '') ? $_SESSION['theme']['login_body_background_color']['text'] : "rgba(255,255,255,0.35)"; ?>;
<?php $br = format_border_radius($_SESSION['theme']['login_body_border_radius']['text'], '4px'); ?>
-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-khtml-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
<?php unset($br); ?>
<?php if ($_SESSION['theme']['login_body_border_size']['text'] != '' || $_SESSION['theme']['login_body_border_color']['text'] != '') { echo "border-style: solid;\n"; } ?>
<?php echo ($_SESSION['theme']['login_body_border_size']['text'] != '') ? 'border-width: '.$_SESSION['theme']['login_body_border_size']['text'].";\n" : null; ?>
<?php echo ($_SESSION['theme']['login_body_border_color']['text'] != '') ? 'border-color: '.$_SESSION['theme']['login_body_border_color']['text'].";\n" : null; ?>
-webkit-box-shadow: <?php echo ($_SESSION['theme']['login_body_shadow_color']['text'] != '') ? '0 1px 20px '.$_SESSION['theme']['login_body_shadow_color']['text'] : 'none'; ?>;
-moz-box-shadow: <?php echo ($_SESSION['theme']['login_body_shadow_color']['text'] != '') ? '0 1px 20px '.$_SESSION['theme']['login_body_shadow_color']['text'] : 'none'; ?>;
box-shadow: <?php echo ($_SESSION['theme']['login_body_shadow_color']['text'] != '') ? '0 1px 20px '.$_SESSION['theme']['login_body_shadow_color']['text'] : 'none'; ?>;
}
?>
}
a.login_link {
color: <?php echo ($_SESSION['theme']['login_link_text_color']['text'] != '') ? $_SESSION['theme']['login_link_text_color']['text'] : '#004083'; ?>;
@@ -683,9 +707,9 @@
if (
strlen($_SESSION["username"]) > 0 &&
(
isset($_SESSION['theme']['background_image']) ||
$_SESSION['theme']['background_color'][0] != '' ||
$_SESSION['theme']['background_color'][1] != ''
isset($background_images) ||
$background_colors[0] != '' ||
$background_colors[1] != ''
)) { ?>
background: <?php echo ($_SESSION['theme']['body_color']['text'] != '') ? $_SESSION['theme']['body_color']['text'] : "#ffffff"; ?>;
background-attachment: fixed;
@@ -2209,6 +2233,7 @@
</div>
<?php
unset($_SESSION['background_image']);
}
?>