forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
97 lines (80 loc) · 3.24 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?PHP // $Id$
require_once("../config.php");
optional_variable($preview); // which theme to show
optional_variable($choose); // set this theme as default
if (! $site = get_site()) {
error("Site doesn't exist!");
}
require_login();
if (!isadmin()) {
error("You must be an administrator to change themes.");
}
if ($choose) {
if (!is_dir($choose)) {
error("This theme is not installed!");
}
$preview = $choose;
}
if ($preview) {
$CFG->theme = $preview;
$CFG->stylesheet = "$CFG->wwwroot/theme/$CFG->theme/styles.php?themename=$preview";
$CFG->header = "$CFG->dirroot/theme/$CFG->theme/header.html";
$CFG->footer = "$CFG->dirroot/theme/$CFG->theme/footer.html";
include ("$CFG->theme/config.php");
}
$stradministration = get_string("administration");
$strconfiguration = get_string("configuration");
$strthemes = get_string("themes");
$strpreview = get_string("preview");
$strsavechanges = get_string("savechanges");
$strtheme = get_string("theme");
$strthemesaved = get_string("themesaved");
print_header("$site->shortname: $strthemes", $site->fullname,
"<a href=\"$CFG->wwwroot/admin/index.php\">$stradministration</a> -> ".
"<a href=\"$CFG->wwwroot/admin/configure.php\">$strconfiguration</a> -> $strthemes");
if ($choose) {
if (set_config("theme", $choose)) {
print_heading(get_string("themesaved"));
print_continue("$CFG->wwwroot");
if (file_exists("$choose/README.html")) {
print_simple_box_start("center");
readfile("$choose/README.html");
print_simple_box_end();
} else if (file_exists("$choose/README.txt")) {
print_simple_box_start("center");
$file = file("$choose/README.txt");
echo format_text(implode('', $file), FORMAT_MOODLE);
print_simple_box_end();
}
print_footer();
exit;
} else {
error("Could not set the theme!");
}
}
print_heading(get_string("previeworchoose"));
$themes = get_list_of_plugins("theme");
echo "<TABLE ALIGN=CENTER cellpadding=7 cellspacing=5>";
echo "<TR><TH class=\"generaltableheader\">$strtheme<TH class=\"generaltableheader\"> </TR>";
foreach ($themes as $theme) {
include ("$theme/config.php");
echo "<TR>";
if ($CFG->theme == $theme) {
echo "<TD ALIGN=CENTER BGCOLOR=\"$THEME->body\">$theme</TD>";
echo "<TD ALIGN=CENTER><A HREF=\"index.php?choose=$theme\">$strsavechanges</A></TD>";
} else {
echo "<TD ALIGN=CENTER BGCOLOR=\"$THEME->body\">";
echo "<A TITLE=\"$strpreview\" HREF=\"index.php?preview=$theme\">$theme</A>";
echo "</TD>";
echo "<TD> </TD>";
}
echo "</tr>";
}
echo "</table>";
echo "<br><div align=center>";
$options["frame"] = "developer.html";
$options["sub"] = "themes";
print_single_button("$CFG->wwwroot/doc/index.php", $options, get_string("howtomakethemes"));
echo "</div>";
print_footer();
?>