Change the enhanced theme to use background image array instead of text.

This commit is contained in:
Mark Crane 2014-08-17 06:59:53 +00:00
parent 322fb0627d
commit 5fe7287c7b
1 changed files with 16 additions and 13 deletions

View File

@ -63,7 +63,7 @@ DIV#page {
<?php <?php
if ( if (
isset($_SESSION['theme']['background_image']['text']) || isset($_SESSION['theme']['background_image']) ||
$_SESSION['theme']['background_color'][0] != '' || $_SESSION['theme']['background_color'][0] != '' ||
$_SESSION['theme']['background_color'][1] != '' $_SESSION['theme']['background_color'][1] != ''
) { ?> ) { ?>
@ -114,7 +114,7 @@ DIV#default_login {
height: <?php echo ($_SESSION['login']['domain_name.visible']['boolean']) ? '300px' : '267px'; ?>; height: <?php echo ($_SESSION['login']['domain_name.visible']['boolean']) ? '300px' : '267px'; ?>;
<?php <?php
if ( if (
isset($_SESSION['theme']['background_image']['text']) || isset($_SESSION['theme']['background_image']) ||
$_SESSION['theme']['background_color'][0] != '' || $_SESSION['theme']['background_color'][0] != '' ||
$_SESSION['theme']['background_color'][1] != '' $_SESSION['theme']['background_color'][1] != ''
) { ?> ) { ?>
@ -580,7 +580,7 @@ legend {
if ( if (
strlen($_SESSION["username"]) > 0 && strlen($_SESSION["username"]) > 0 &&
( (
isset($_SESSION['theme']['background_image']['text']) || isset($_SESSION['theme']['background_image']) ||
$_SESSION['theme']['background_color'][0] != '' || $_SESSION['theme']['background_color'][0] != '' ||
$_SESSION['theme']['background_color'][1] != '' $_SESSION['theme']['background_color'][1] != ''
)) { ?> )) { ?>
@ -1124,14 +1124,19 @@ if (strlen($_SESSION['message']) > 0) {
<?php <?php
// check for background image // check for background image
if (isset($_SESSION['theme']['background_image']['text'])) { if (isset($_SESSION['theme']['background_image'])) {
// background image is enabled // background image is enabled
$image_extensions = array('jpg','jpeg','png','gif'); $image_extensions = array('jpg','jpeg','png','gif');
if ($_SESSION['theme']['background_image']['text'] != '') { if (count($_SESSION['theme']['background_image']) > 0) {
if (strlen($_SESSION['background_image']) == 0) {
$_SESSION['background_image'] = $_SESSION['theme']['background_image'][array_rand($_SESSION['theme']['background_image'])];
$background_image = $_SESSION['background_image'];
}
// background image(s) specified, check if source is file or folder // background image(s) specified, check if source is file or folder
if (in_array(strtolower(pathinfo($_SESSION['theme']['background_image']['text'], PATHINFO_EXTENSION)), $image_extensions)) { if (in_array(strtolower(pathinfo($background_image, PATHINFO_EXTENSION)), $image_extensions)) {
$image_source = 'file'; $image_source = 'file';
} }
else { else {
@ -1139,18 +1144,16 @@ if (strlen($_SESSION['message']) > 0) {
} }
// is source (file/folder) local or remote // is source (file/folder) local or remote
if ( if (substr($background_image, 0, 4) == 'http') {
substr($_SESSION['theme']['background_image']['text'], 0, 4) == 'http' $source_path = $background_image;
) {
$source_path = $_SESSION['theme']['background_image']['text'];
} }
else if (substr($_SESSION['theme']['background_image']['text'], 0, 1) == '/') { // else if (substr($background_image, 0, 1) == '/') { //
// use project path as root // use project path as root
$source_path = PROJECT_PATH.$_SESSION['theme']['background_image']['text']; $source_path = PROJECT_PATH.$background_image;
} }
else { else {
// use theme images/backgrounds folder as root // use theme images/backgrounds folder as root
$source_path = PROJECT_PATH.'/themes/enhanced/images/backgrounds/'.$_SESSION['theme']['background_image']['text']; $source_path = PROJECT_PATH.'/themes/enhanced/images/backgrounds/'.$background_image;
} }
} }