MDL-51000 editor_atto: No autosave for guests

This commit is contained in:
David Monllao 2015-09-09 13:42:57 +08:00 committed by Mr. Jenkins (CiBoT)
parent 541c5b8552
commit 3f08e9b98a
2 changed files with 12 additions and 0 deletions

View File

@ -44,6 +44,14 @@ $PAGE->set_context($context);
require_login($course, false, $cm);
require_sesskey();
if (isguestuser()) {
print_error('accessdenied', 'admin');
}
if (!in_array('atto', explode(',', get_config('core', 'texteditors')))) {
print_error('accessdenied', 'admin');
}
$action = required_param('action', PARAM_ALPHA);
$response = array();

View File

@ -166,6 +166,10 @@ class atto_texteditor extends texteditor {
}
$contentcss = $PAGE->theme->editor_css_url()->out(false);
// Autosave disabled for guests.
if (isguestuser()) {
$autosave = false;
}
// Note <> is a safe separator, because it will not appear in the output of s().
$pagehash = sha1($PAGE->url . '<>' . s($this->get_text()));
$params = array(