Fixing Theme Config Variables MDL-6784

This commit is contained in:
skodak 2006-10-09 10:12:41 +00:00
parent 4dd5d7513d
commit a44091bffe
23 changed files with 76 additions and 59 deletions

View File

@ -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 "<a title=\"".get_string("settings")."\" href=\"$CFG->wwwroot/course/edit.php?id=$course->id\"><img".
" src=\"$pixpath/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\"></a> ";

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -14,9 +14,9 @@
<?php echo $homelink ?>
<!-- <p><div class="homelink"><a target="<?php echo $CFG->framename ?>" href="<?php $CFG->wwwroot ?>/course/view.php?id=<?php $course->id ?>"> <?php $course->shortname ?> </a></div></p> -->
<p>
<!-- <<a href="http://validator.w3.org/check?verbose=1&amp;ss=1&amp;uri=<?php echo urlencode(qualified_me()) ?>"><img src="<?php echo "$CFG->wwwroot/theme/$CFG->theme" ?>/xhtml_1_0.gif" alt="XHTML Validator" /></a>
<a href="http://jigsaw.w3.org/css-validator/validator?uri=<?php echo urlencode(qualified_me()) ?>&amp;warning=1&amp;profile=css2&amp;usermedium=all"><img src="<?php echo "$CFG->wwwroot/theme/$CFG->theme" ?>/css.gif" alt="CSS Validator" /></a>
<a href="http://www.contentquality.com/mynewtester/cynthia.exe?rptmode=-1&amp;url1=<?php echo urlencode(qualified_me()) ?>"><img src="<?php echo "$CFG->wwwroot/theme/$CFG->theme" ?>/section_508.gif" alt="Section 508 Validator" /></a> -->
<!-- <<a href="http://validator.w3.org/check?verbose=1&amp;ss=1&amp;uri=<?php echo urlencode(qualified_me()) ?>"><img src="<?php echo "$CFG->themewww/$CFG->theme" ?>/xhtml_1_0.gif" alt="XHTML Validator" /></a>
<a href="http://jigsaw.w3.org/css-validator/validator?uri=<?php echo urlencode(qualified_me()) ?>&amp;warning=1&amp;profile=css2&amp;usermedium=all"><img src="<?php echo "$CFG->themewww/$CFG->theme" ?>/css.gif" alt="CSS Validator" /></a>
<a href="http://www.contentquality.com/mynewtester/cynthia.exe?rptmode=-1&amp;url1=<?php echo urlencode(qualified_me()) ?>"><img src="<?php echo "$CFG->themewww/$CFG->theme" ?>/section_508.gif" alt="Section 508 Validator" /></a> -->
</p>
</div>
</div>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include('ui/chameleon.php'); ?>
<?php include("$CFG->javascript"); ?>

View File

@ -20,11 +20,11 @@ if (isset($THEME->chameleonenabled) && $THEME->chameleonenabled) {
$chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : current_theme();
?>
<style type="text/css"> @import '<?php echo "$CFG->wwwroot/theme/$chameleon_theme" ?>/ui/chameleon_ui.css'; </style>
<style type="text/css"> @import '<?php echo "$CFG->themewww/$chameleon_theme" ?>/ui/chameleon_ui.css'; </style>
<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/$chameleon_theme/ui/css_query.js" ?>"> </script>
<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/$chameleon_theme/ui/sarissa.js" ?>"> </script>
<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/$chameleon_theme/ui/chameleon_js.php$chameleon_courseparam" ?>"> </script>
<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/css_query.js" ?>"> </script>
<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/sarissa.js" ?>"> </script>
<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/chameleon_js.php$chameleon_courseparam" ?>"> </script>
<?php
}

View File

@ -10,7 +10,7 @@
?>
<?php echo $loggedinas ?>
<p align="center"><a href="http://moodle.org" target="_blank"><img src="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/images/moodlelogo.gif" border="0" /></a></p>
<p align="center"><a href="http://moodle.org" target="_blank"><img src="<?php echo $CFG->themewww .'/'. current_theme() ?>/images/moodlelogo.gif" border="0" /></a></p>
</div>
</div>

View File

@ -4,11 +4,11 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>
<body background="<?php echo $CFG->httpswwwroot.'/theme/'.current_theme() ?>/images/bg.gif" <?php
<body background="<?php echo $CFG->httpsthemewww .'/'. current_theme() ?>/images/bg.gif" <?php
echo " $bodytags";
if ($focus) {
echo " onload=\"setfocus()\"";
@ -25,7 +25,7 @@
<tr>
<td>
<table background="<?php echo $CFG->httpswwwroot.'/theme/'.current_theme() ?>/images/headerbg.jpg" width="100%" height="112" cellpadding="0" cellspacing="0" border="0">
<table background="<?php echo $CFG->httpsthemewww .'/'. current_theme() ?>/images/headerbg.jpg" width="100%" height="112" cellpadding="0" cellspacing="0" border="0">
<tr>
@ -38,13 +38,14 @@
</tr>
</table></tr></td>
</table>
<?php } else if ($heading) { // This is what gets printed on any other page with a heading ?>
<?php } else if ($heading) { // This is what gets printed on any other page with a heading
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table background="<?php echo $CFG->httpswwwroot.'/theme/'.current_theme() ?>/images/headerbg.jpg" width="100%" height="112" cellpadding="0" cellspacing="0" border="0">
<table background="<?php echo $CFG->httpsthemewww .'/'. current_theme() ?>/images/headerbg.jpg" width="100%" height="112" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top"><?php echo $heading ?></td>
<td align="right" sty class="headermain"le="padding-right:5px" valign="top" class="headerhomemenu"><?php echo $menu ?></td>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>
@ -21,13 +21,13 @@
if ($home) { // This is what gets printed on the home page only
?>
<div id="header-home" class="clearfix">
<h1 class="headermain"><img alt='Moodle' src='<?php echo $CFG->httpswwwroot.'/theme/'.current_theme() ?>/logo.jpg' /></h1>
<h1 class="headermain"><img alt='Moodle' src='<?php echo $CFG->httpsthemewww .'/'. current_theme() ?>/logo.jpg' /></h1>
<div class="headermenu"><?php echo $menu ?></div>
</div>
<?php } else if ($heading) { // This is what gets printed on any other page with a heading
?>
<div id="header" class="clearfix">
<h1 class="headermain"><img alt='Moodle' src='<?php echo $CFG->httpswwwroot.'/theme/'.current_theme() ?>/logo_small.jpg' /></h1>
<h1 class="headermain"><img alt='Moodle' src='<?php echo $CFG->httpsthemewww .'/'. current_theme() ?>/logo_small.jpg' /></h1>
<div class="headermenu"><?php echo $menu ?></div>
</div>
<?php } ?>
@ -42,4 +42,4 @@
<hr size="1" noshade="noshade" />
<?php } ?>
<!-- END OF HEADER -->
<div id="content">
<div id="content">

View File

@ -23,7 +23,7 @@
if ($choose and confirm_sesskey()) {
if (!is_dir($choose)) {
if (!is_dir($CFG->themedir .'/'. $choose)) {
error("This theme is not installed!");
}
if (set_config("theme", $choose)) {
@ -64,11 +64,11 @@
unset($THEME);
if (!file_exists($CFG->themedir.$theme.'/config.php')) { // bad folder
if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) { // bad folder
continue;
}
include($CFG->themedir.$theme.'/config.php');
include($CFG->themedir.'/'.$theme.'/config.php');
$readme = '';
$screenshot = '';
@ -76,10 +76,10 @@
if (file_exists("$theme/README.html")) {
$readme = '<li>'.
link_to_popup_window('/theme/'.$theme.'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
} else if (file_exists("$theme/README.txt")) {
$readme = '<li>'.
link_to_popup_window('/theme/'.$theme.'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
link_to_popup_window($CFG->themewww .'/'. $theme .'/README.txt', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';
}
if (file_exists("$theme/screenshot.png")) {
$screenshotpath = "$theme/screenshot.png";

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>
@ -41,4 +41,4 @@
</div>
<?php } ?>
<!-- END OF HEADER -->
<div id="content">
<div id="content">

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
$preview = optional_param('preview','standard',PARAM_FILE); // which theme to show
if (!file_exists($preview)) {
if (!file_exists($CFG->themedir .'/'. $preview)) {
$preview = 'standard';
}

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>
@ -35,7 +35,7 @@
$standardlogo = $CFG->httpswwwroot.'/file.php/1/logo.gif';
}
} else {
$standardlogo = $CFG->httpswwwroot.'/theme/'.current_theme().'/logo.gif';
$standardlogo = $CFG->httpsthemewww .'/'. current_theme().'/logo.gif';
}
//Accessibility: warning: ALT text will need editing if logo changes. 'headermain' is now H1.

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>

View File

@ -4,7 +4,7 @@
<?php echo $meta ?>
<meta name="keywords" content="moodle, <?php echo $title ?> " />
<title><?php echo $title ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->themewww .'/'. current_theme() ?>/favicon.ico" />
<?php include("$CFG->javascript"); ?>
</head>