2 // Allows the admin to configure services for remote hosts
4 require_once(dirname(dirname(dirname(__FILE__
))) . '/config.php');
5 require_once($CFG->libdir
.'/adminlib.php');
6 include_once($CFG->dirroot
.'/mnet/lib.php');
7 error_reporting(E_ALL
);
8 ini_set('display_errors', true);
10 admin_externalpage_setup('mnetpeers');
12 $context = get_context_instance(CONTEXT_SYSTEM
);
14 require_capability('moodle/site:config', $context, $USER->id
, true, "nopermissions");
16 if (!$site = get_site()) {
17 print_error('nosite', '', '', NULL, true);
20 /// Initialize variables.
22 $hostid = required_param('hostid', PARAM_INT
);
24 $stradministration = get_string('administration');
25 $strconfiguration = get_string('configuration');
27 $strmnetedithost = get_string('reviewhostdetails', 'mnet');
28 $strmnetsettings = get_string('mnetsettings', 'mnet');
29 $strmnetservices = get_string('mnetservices', 'mnet');
30 $strmnetthemes = get_string('mnetthemes', 'mnet');
31 $strmnetlog = get_string('mnetlog', 'mnet');
34 $mnet_peer = new mnet_peer();
35 if (is_int($hostid)) {
36 $mnet_peer->set_id($hostid);
39 $choose = optional_param("choose",'',PARAM_FILE
); // set this theme as default
40 $stradministration = get_string("administration");
41 $strconfiguration = get_string("configuration");
42 $strthemes = get_string("themes");
43 $strpreview = get_string("preview");
44 $strchoose = get_string("choose");
45 $strinfo = get_string("info");
46 $strtheme = get_string("theme");
47 $strthemesaved = get_string("themesaved");
48 $strscreenshot = get_string("screenshot");
49 $stroldtheme = get_string("oldtheme");
51 $unlikely_name = 'ZoqZoqZ'; // Something unlikely to ever be a theme name
54 if (confirm_sesskey()) {
55 if ($choose == $unlikely_name) {
56 $mnet_peer->force_theme
= 1;
57 $mnet_peer->theme
= '';
58 if ($mnet_peer->commit()) {
59 $report = array(get_string('themesaved'), 'informationbox');
61 $report = array(get_string('themesavederror', 'mnet'), 'errorbox');
63 } elseif (!is_dir($CFG->themedir
.'/'. $choose) ||
!file_exists($CFG->themedir
.'/'. $choose .'/config.php')) {
64 echo 'CHOOSE -'.$choose.' '. $CFG->themedir
.'/'. $choose .'/config.php' ;
65 $report = array('This theme is not installed!'.'3', 'errorbox');
67 $mnet_peer->force_theme
= 1;
68 $mnet_peer->theme
= addslashes($choose);
69 if ($mnet_peer->commit()) {
70 $report = array(get_string('themesaved').'1', 'informationbox');
72 $report = array(get_string('themesavederror', 'mnet').'2', 'errorbox');
78 include('./mnet_themes.html');