Moodle

$CFG->themedir Mostly Broken

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.1, 1.6.2
  • Fix Version/s: 1.7
  • Component/s: Libraries
  • Labels:
    None
  • Environment:
    Apache/Linux etc
  • Database:
    Any
  • Affected Branches:
    MOODLE_16_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE

Description

The themedir configuration option seems to be quite broken from a few perspectives.

In: lib/moodlelib.php, functio get_list_of_themes():

if (!file_exists("$CFG->dirroot/theme/$theme/config.php")) { // bad folder

Should be:
if (!file_exists("$CFG->themedir/theme/$theme/config.php")) { // bad folder

same goes for:

include("$CFG->dirroot/theme/$theme/config.php");
to:
include("$CFG->themedir/$theme/config.php");

In order to use theme/index.php to select a theme from this directory, one would have to change the get_list_of_plugins_line.

As a trivial example in theme/index.php, i'd need to change:

$themes = get_list_of_plugins("theme");

to:
$themes = get_list_of_plugins("local_theme_dir");

Where local_theme_dir would be under my dirroot. This is what i've found skimming the surface. (Configurable theme directory would be quite powerful for me)

Issue Links

Activity

Hide
Dan Poltawski added a comment -

in course/search.php (around 185):

$pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";

should be:

$pixpath = "$CFG->themedir/$CFG->theme/pix";

In theme/index.php (around 90)L

link_to_popup_window('/theme/'.$theme.'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';

Prsumably should be:

link_to_popup_window($CFG->themewww .$theme.'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>';

(and same goes for the one under).

Quite a few of themes also don't use this variable. Will look at that later.

Show
Dan Poltawski added a comment - in course/search.php (around 185): $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix"; should be: $pixpath = "$CFG->themedir/$CFG->theme/pix"; In theme/index.php (around 90)L link_to_popup_window('/theme/'.$theme.'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>'; Prsumably should be: link_to_popup_window($CFG->themewww .$theme.'/README.html', $theme, $strinfo, 400, 500, '', 'none', true).'</li>'; (and same goes for the one under). Quite a few of themes also don't use this variable. Will look at that later.
Hide
Petr Škoda (skodak) added a comment -

I think this was fixed by MDL-6784 Fixing Theme Config Variables; closing now.

Show
Petr Škoda (skodak) added a comment - I think this was fixed by MDL-6784 Fixing Theme Config Variables; closing now.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: