more install time fixes for new admin code
This commit is contained in:
+10
-8
@@ -428,6 +428,9 @@ class admin_externalpage extends part_of_admin_tree {
|
||||
* @return bool True if user has access, false otherwise.
|
||||
*/
|
||||
function check_access() {
|
||||
if (!get_site()) {
|
||||
return true; // no access check before site is fully set up
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
return has_capability($this->role, $context);
|
||||
}
|
||||
@@ -500,6 +503,9 @@ class admin_settingpage extends part_of_admin_tree {
|
||||
|
||||
// see admin_externalpage
|
||||
function check_access() {
|
||||
if (!get_site()) {
|
||||
return true; // no access check before site is fully set up
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
return has_capability($this->role, $context);
|
||||
}
|
||||
@@ -766,8 +772,7 @@ class admin_setting_sitesetselect extends admin_setting_configselect {
|
||||
|
||||
function admin_setting_sitesetselect($name, $visiblename, $description, $defaultsetting, $choices) {
|
||||
|
||||
$site = get_site();
|
||||
$this->id = $site->id;
|
||||
$this->id = SITEID;
|
||||
parent::admin_setting_configselect($name, $visiblename, $description, $defaultsetting, $choices);
|
||||
|
||||
}
|
||||
@@ -863,8 +868,7 @@ class admin_setting_sitesetcheckbox extends admin_setting_configcheckbox {
|
||||
|
||||
function admin_setting_sitesetcheckbox($name, $visiblename, $description, $defaultsetting) {
|
||||
|
||||
$site = get_site();
|
||||
$this->id = $site->id;
|
||||
$this->id = SITEID;
|
||||
parent::admin_setting_configcheckbox($name, $visiblename, $description, $defaultsetting);
|
||||
|
||||
}
|
||||
@@ -891,8 +895,7 @@ class admin_setting_sitesettext extends admin_setting_configtext {
|
||||
|
||||
function admin_setting_sitesettext($name, $visiblename, $description, $defaultsetting, $paramtype) {
|
||||
|
||||
$site = get_site();
|
||||
$this->id = $site->id;
|
||||
$this->id = SITEID;
|
||||
parent::admin_setting_configtext($name, $visiblename, $description, $defaultsetting, $paramtype);
|
||||
|
||||
}
|
||||
@@ -918,8 +921,7 @@ class admin_setting_special_frontpagedesc extends admin_setting {
|
||||
var $id;
|
||||
|
||||
function admin_setting_special_frontpagedesc() {
|
||||
$site = get_site();
|
||||
$this->id = $site->id;
|
||||
$this->id = SITEID;
|
||||
$name = 'summary';
|
||||
$visiblename = get_string('frontpagedescription');
|
||||
$description = get_string('frontpagedescriptionhelp');
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
global $USER;
|
||||
|
||||
// this depends on what file is including us
|
||||
if (!isset($site)) {
|
||||
$site = get_site();
|
||||
}
|
||||
|
||||
// stuff under the "usermanagement" subcategory
|
||||
$ADMIN->add('authenticationandsecurity', new admin_category('usermanagement', get_string('users')), 0);
|
||||
@@ -19,7 +15,7 @@ $ADMIN->add('usermanagement', new admin_externalpage('uploadusers', get_string('
|
||||
// stuff under the "roles" subcategory
|
||||
$ADMIN->add('authenticationandsecurity', new admin_category('roles', get_string('roles')));
|
||||
$ADMIN->add('roles', new admin_externalpage('manageroles', get_string('manageroles'), $CFG->wwwroot . '/admin/roles/manage.php'));
|
||||
$ADMIN->add('roles', new admin_externalpage('assignsitewideroles', get_string('assignsiteroles'), $CFG->wwwroot . '/admin/roles/assign.php?contextid=' . $site->id));
|
||||
$ADMIN->add('roles', new admin_externalpage('assignsitewideroles', get_string('assignsiteroles'), $CFG->wwwroot . '/admin/roles/assign.php?contextid=' . SITEID));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,7 @@ if (file_exists($CFG->dirroot . '/' . $CFG->admin . '/mysql/frame.php')) {
|
||||
|
||||
$ADMIN->add('root', new admin_category('unsorted', 'Unsorted', 999));
|
||||
|
||||
if (!isset($site)) {
|
||||
$site = get_site();
|
||||
}
|
||||
|
||||
$ADMIN->add('unsorted', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . $site->id));
|
||||
$ADMIN->add('unsorted', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID));
|
||||
$ADMIN->add('unsorted', new admin_externalpage('stickyblocks', get_string('stickyblocks'), $CFG->wwwroot . '/admin/stickyblocks.php'));
|
||||
|
||||
?>
|
||||
@@ -85,7 +85,7 @@ $temp->add(new admin_setting_configtext('editorfontfamily', get_string('editorfo
|
||||
$temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_special_editorfontlist());
|
||||
$temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
|
||||
if ($CFG->aspellpath !== '') { // make aspell settings disappear if path isn't set
|
||||
if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
|
||||
$temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
|
||||
$temp->add(new admin_setting_special_editordictionary());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user