$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php'));
/// Define variables used in page
-if (!$site = get_site()) {
- print_error("siteisnotdefined");
-}
+$site = get_site();
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
if (!in_array('ldap',$authsequence,true)) {
. ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
. $sesskey . '" />';
redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
-
-
-
-?>
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php'));
/// Define variables used in page
-if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
-}
+$site = get_site();
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
if (!in_array('ldap',$authsequence,true)) {
redirect($CFG->httpswwwroot . '/login/index.php?authldap_skipntlmsso=1',
get_string('ntlmsso_failed','auth_ldap'), 3);
}
-?>
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
if ($count == 0) {
notice("No backupable modules are installed!");
}
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
$preferences = new StdClass;
backup_fetch_prefs_from_request($preferences,$count,$course);
}
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
//Checks for the required files/functions to backup every mod
//And check if there is data about it
}
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
// Non-cached - get accessinfo
if (isset($USER->access)) {
}
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
$errorstr = '';
$status = restore_execute($restore,$info,$course_header,$errorstr);
}
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
//Checks for the required files/functions to restore every mod
$count = 0;
}
//Check site
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
+ $site = get_site();
$errorstr = '';
if (!empty($SESSION->restore->importing)) {
$moveto = optional_param('moveto', 0, PARAM_INT);
$resort = optional_param('resort', 0, PARAM_BOOL);
- if (!$site = get_site()) {
- print_error('siteisnotdefined', 'debug');
- }
-
+ $site = get_site();
+
if (empty($id)) {
print_error("unknowcategory");
}
print_error('cannotdeletecourse');
}
- if (!$site = get_site()) {
- print_error("siteisnotdefined", 'debug');
- }
-
+ $site = get_site();
+
$strdeletecourse = get_string("deletecourse");
$stradministration = get_string("administration");
$strcategories = get_string("categories");
print_error("invalidcourseid");
}
-if (!$site = get_site()){
- print_error("siteisnotdefined", 'debug');
-}
+$site = get_site();
require_login($course->id);
$tocontext = get_context_instance(CONTEXT_COURSE, $id);
$moveup = optional_param('moveup',0,PARAM_INT);
$movedown = optional_param('movedown',0,PARAM_INT);
-if (!$site = get_site()) {
- print_error('siteisnotdefined', 'debug');
-}
+$site = get_site();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$string['phpvaroff'] = 'The PHP server variable \'$a->name\' should be Off - $a->link';
$string['phpvaron'] = 'The PHP server variable \'$a->name\' is not turned On - $a->link';
$string['sessionmissing'] = '$a object missing from session';
-$string['siteisnotdefined'] = 'Site is not defined!';
$string['sqlrelyonobsoletetable'] = 'This SQL relies on obsolete table(s): $a! Your code must be fixed by a developer.';
$string['withoutversion'] = 'Main version.php file is missing, not readable or broken.';
$string['xmlizeunavailable'] = 'xmlize functions are not available';
/**
* Returns $course object of the top-level site.
*
- * @global object
- * @global object
- * @return bool|object A {@link $COURSE} object for the site
+ * @return object A {@link $COURSE} object for the site, exception if not found
*/
function get_site() {
global $SITE, $DB;
if ($course = $DB->get_record('course', array('category'=>0))) {
return $course;
} else {
- return false;
+ // course table exists, but the site is not there,
+ // unfortunately there is no automatic way to recover
+ throw new moodle_exception('nosite', 'error');
}
}
$PAGE->set_url("$CFG->httpswwwroot/login/index.php");
/// Define variables used in page
-if (!$site = get_site()) {
- print_error('siteisnotdefined', 'debug');
-}
+$site = get_site();
if (empty($CFG->langmenu)) {
$langmenu = "";