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> ";
}
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;
}
$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))) {
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;
}
}
/// 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);
}
}
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
/// 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;
}
/// 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)
}
}
/// 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) {
$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;
}
<?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&ss=1&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()) ?>&warning=1&profile=css2&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&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&ss=1&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()) ?>&warning=1&profile=css2&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&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>
<?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"); ?>
$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
}
?>
<?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>
<?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()\"";
<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>
</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>
<?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>
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 } ?>
<hr size="1" noshade="noshade" />
<?php } ?>
<!-- END OF HEADER -->
- <div id="content">
\ No newline at end of file
+ <div id="content">
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)) {
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 = '';
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";
<?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>
<?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>
<?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>
</div>
<?php } ?>
<!-- END OF HEADER -->
-<div id="content">
\ No newline at end of file
+<div id="content">
<?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>
$preview = optional_param('preview','standard',PARAM_FILE); // which theme to show
- if (!file_exists($preview)) {
+ if (!file_exists($CFG->themedir .'/'. $preview)) {
$preview = 'standard';
}
<?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>
<?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>
<?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>
<?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>
$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.
<?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>
<?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>
<?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>