From 5fe7287c7b400df3b3ee0a1f0f77a80aee81599d Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 17 Aug 2014 06:59:53 +0000 Subject: [PATCH] Change the enhanced theme to use background image array instead of text. --- themes/enhanced/template.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index 74494b28e4..6ac77e516e 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -63,7 +63,7 @@ DIV#page { @@ -114,7 +114,7 @@ DIV#default_login { height: ; @@ -580,7 +580,7 @@ legend { if ( strlen($_SESSION["username"]) > 0 && ( - isset($_SESSION['theme']['background_image']['text']) || + isset($_SESSION['theme']['background_image']) || $_SESSION['theme']['background_color'][0] != '' || $_SESSION['theme']['background_color'][1] != '' )) { ?> @@ -1124,14 +1124,19 @@ if (strlen($_SESSION['message']) > 0) { 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 - 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'; } else { @@ -1139,18 +1144,16 @@ if (strlen($_SESSION['message']) > 0) { } // is source (file/folder) local or remote - if ( - substr($_SESSION['theme']['background_image']['text'], 0, 4) == 'http' - ) { - $source_path = $_SESSION['theme']['background_image']['text']; + if (substr($background_image, 0, 4) == 'http') { + $source_path = $background_image; } - else if (substr($_SESSION['theme']['background_image']['text'], 0, 1) == '/') { // + else if (substr($background_image, 0, 1) == '/') { // // use project path as root - $source_path = PROJECT_PATH.$_SESSION['theme']['background_image']['text']; + $source_path = PROJECT_PATH.$background_image; } else { // 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; } }