diff --git a/course/search.php b/course/search.php
index e2d5d7a4483..652f2370b37 100644
--- a/course/search.php
+++ b/course/search.php
@@ -176,7 +176,7 @@
if (empty($THEME->custompix)) {
$pixpath = "$CFG->wwwroot/pix";
} else {
- $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
+ $pixpath = "$CFG->themedir/$CFG->theme/pix";
}
echo "wwwroot/course/edit.php?id=$course->id\">
";
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 29bb598ff81..8519da19ea4 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -4670,11 +4670,11 @@ function get_list_of_themes() {
}
foreach ($themelist as $key => $theme) {
- if (!file_exists("$CFG->dirroot/theme/$theme/config.php")) { // bad folder
+ if (!file_exists("$CFG->themedir/$theme/config.php")) { // bad folder
continue;
}
unset($THEME); // Note this is not the global one!! :-)
- include("$CFG->dirroot/theme/$theme/config.php");
+ include("$CFG->themedir/$theme/config.php");
if (!isset($THEME->sheets)) { // Not a valid 1.5 theme
continue;
}
@@ -5127,10 +5127,21 @@ function get_list_of_plugins($plugin='mod', $exclude='', $basedir='') {
$plugins = array();
if (empty($basedir)) {
- $basedir = $CFG->dirroot .'/'. $plugin;
+
+ # This switch allows us to use the appropiate theme directory - and potentialy alternatives for other plugins
+ switch ($plugin) {
+ case "theme":
+ $basedir = $CFG->themedir;
+ break;
+
+ default:
+ $basedir = $CFG->dirroot .'/'. $plugin;
+ }
+
} else {
$basedir = $basedir .'/'. $plugin;
}
+
if (file_exists($basedir) && filetype($basedir) == 'dir') {
$dirhandle = opendir($basedir);
while (false !== ($dir = readdir($dirhandle))) {
@@ -5978,8 +5989,10 @@ function httpsrequired() {
if (!empty($CFG->loginhttps)) {
$HTTPSPAGEREQUIRED = true;
$CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
+ $CFG->httpsthemewww = str_replace('http:', 'https:', $CFG->themewww);
} else {
$CFG->httpswwwroot = $CFG->wwwroot;
+ $CFG->httpsthemewww = $CFG->themewww;
}
}
diff --git a/lib/setup.php b/lib/setup.php
index c28c8236a30..c23a806f4b8 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -496,15 +496,18 @@ $CFG->os = PHP_OS;
/// Load up theme variables (colours etc)
if (!isset($CFG->themedir)) {
- $CFG->themedir = $CFG->dirroot.'/theme/';
- $CFG->themewww = $CFG->wwwroot.'/theme/';
+ $CFG->themedir = $CFG->dirroot.'/theme';
+ $CFG->themewww = $CFG->wwwroot.'/theme';
}
+ $CFG->httpsthemewww = $CFG->themewww;
if (isset($_GET['theme'])) {
if ($CFG->allowthemechangeonurl || confirm_sesskey()) {
- if (!detect_munged_arguments($_GET['theme'], 0) and file_exists($CFG->themedir. $_GET['theme'])) {
- $SESSION->theme = $_GET['theme'];
+ $themename = clean_param($_GET['theme'], PARAM_SAFEDIR);
+ if (($themename != '') and file_exists($CFG->themedir.'/'.$themename)) {
+ $SESSION->theme = $themename;
}
+ unset($themename);
}
}
diff --git a/lib/weblib.php b/lib/weblib.php
index be2e6842fdf..1aa70fa2f31 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -2414,7 +2414,7 @@ function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $force
if (!empty($forceconfig)) { // Page wants to use the config from this theme instead
unset($THEME);
- include($CFG->themedir.$forceconfig.'/'.'config.php');
+ include($CFG->themedir.'/'.$forceconfig.'/'.'config.php');
}
/// If this is the standard theme calling us, then find out what sheets we need
@@ -2445,8 +2445,8 @@ function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $force
/// Work out the last modified date for this theme
foreach ($THEME->sheets as $sheet) {
- if (file_exists($CFG->themedir.$themename.'/'.$sheet.'.css')) {
- $sheetmodified = filemtime($CFG->themedir.$themename.'/'.$sheet.'.css');
+ if (file_exists($CFG->themedir.'/'.$themename.'/'.$sheet.'.css')) {
+ $sheetmodified = filemtime($CFG->themedir.'/'.$themename.'/'.$sheet.'.css');
if ($sheetmodified > $lastmodified) {
$lastmodified = $sheetmodified;
}
@@ -2504,12 +2504,12 @@ function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $force
/// Actually output all the files in order.
foreach ($files as $file) {
echo '/***** '.$file[1].' start *****/'."\n\n";
- @include_once($file[0].$file[1]);
+ @include_once($file[0].'/'.$file[1]);
echo '/***** '.$file[1].' end *****/'."\n\n";
}
}
- return $CFG->themewww.$themename; // Only to help old themes (1.4 and earlier)
+ return $CFG->themewww.'/'.$themename; // Only to help old themes (1.4 and earlier)
}
@@ -2523,13 +2523,13 @@ function theme_setup($theme = '', $params=NULL) {
}
/// If the theme doesn't exist for some reason then revert to standardwhite
- if (!file_exists($CFG->themedir. $theme .'/config.php')) {
+ if (!file_exists($CFG->themedir .'/'. $theme .'/config.php')) {
$CFG->theme = $theme = 'standardwhite';
}
/// Load up the theme config
$THEME = NULL; // Just to be sure
- include($CFG->themedir. $theme .'/config.php'); // Main config for current theme
+ include($CFG->themedir .'/'. $theme .'/config.php'); // Main config for current theme
/// Put together the parameters
if (!$params) {
@@ -2556,23 +2556,23 @@ function theme_setup($theme = '', $params=NULL) {
$CFG->pixpath = $CFG->wwwroot .'/pix';
$CFG->modpixpath = $CFG->wwwroot .'/mod';
} else {
- $CFG->pixpath = $CFG->themewww . $theme .'/pix';
- $CFG->modpixpath = $CFG->themewww . $theme .'/pix/mod';
+ $CFG->pixpath = $CFG->themewww .'/'. $theme .'/pix';
+ $CFG->modpixpath = $CFG->themewww .'/'. $theme .'/pix/mod';
}
/// Header and footer paths
- $CFG->header = $CFG->themedir . $theme .'/header.html';
- $CFG->footer = $CFG->themedir . $theme .'/footer.html';
+ $CFG->header = $CFG->themedir .'/'. $theme .'/header.html';
+ $CFG->footer = $CFG->themedir .'/'. $theme .'/footer.html';
/// Define stylesheet loading order
$CFG->stylesheets = array();
if ($theme != 'standard') { /// The standard sheet is always loaded first
- $CFG->stylesheets[] = $CFG->themewww.'standard/styles.php'.$paramstring;
+ $CFG->stylesheets[] = $CFG->themewww.'/standard/styles.php'.$paramstring;
}
if (!empty($THEME->parent)) { /// Parent stylesheets are loaded next
- $CFG->stylesheets[] = $CFG->themewww.$THEME->parent.'/styles.php'.$paramstring;
+ $CFG->stylesheets[] = $CFG->themewww.'/'.$THEME->parent.'/styles.php'.$paramstring;
}
- $CFG->stylesheets[] = $CFG->themewww.$theme.'/styles.php'.$paramstring;
+ $CFG->stylesheets[] = $CFG->themewww.'/'.$theme.'/styles.php'.$paramstring;
}
diff --git a/theme/chameleon/footer.html b/theme/chameleon/footer.html
index dd44283c711..a54e3d9567b 100644
--- a/theme/chameleon/footer.html
+++ b/theme/chameleon/footer.html
@@ -14,9 +14,9 @@
- +
diff --git a/theme/chameleon/header.html b/theme/chameleon/header.html index 25f5d43c8e4..78c7601dc03 100644 --- a/theme/chameleon/header.html +++ b/theme/chameleon/header.html @@ -4,7 +4,7 @@
-
|