Merge branch 'MDL-57734-master' of https://github.com/xow/moodle

This commit is contained in:
David Monllao 2017-06-27 18:29:35 +02:00
commit aa736731ba
5 changed files with 20 additions and 12 deletions

View File

@ -18,6 +18,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('opentogoogle', new lang_string('opentogoogle', 'admin'), new lang_string('configopentogoogle', 'admin'), 0));
$temp->add(new admin_setting_configselect('allowindexing', new lang_string('allowindexing', 'admin'), new lang_string('allowindexing_desc', 'admin'),
0,
array(0 => new lang_string('allowindexingexceptlogin', 'admin'),
1 => new lang_string('allowindexingeverywhere', 'admin'),
2 => new lang_string('allowindexingnowhere', 'admin'))));
$temp->add(new admin_setting_pickroles('profileroles',
new lang_string('profileroles','admin'),
new lang_string('configprofileroles', 'admin'),

View File

@ -49,6 +49,11 @@ $string['allowcoursethemes'] = 'Allow course themes';
$string['allowediplist'] = 'Allowed IP list';
$string['allowedemaildomains'] = 'Allowed email domains';
$string['allowemailaddresses'] = 'Allowed email domains';
$string['allowindexing'] = 'Allow indexing by search engines';
$string['allowindexing_desc'] = 'This determines whether to allow search engines to index your site. "Everywhere" will allow the search engines to search everywhere including login and signup pages, which means sites with Force Login turned on are still indexed. To avoid the risk of spam involved with the signup page being searchable, use "Everywhere except login and signup pages". "Nowhere" will tell search engines not to index any page. Note this is only a tag in the header of the site. It is up to the search engine to respect the tag.';
$string['allowindexingeverywhere'] = 'Everywhere';
$string['allowindexingexceptlogin'] = 'Everywhere except login and signup pages';
$string['allowindexingnowhere'] = 'Nowhere';
$string['allowusermailcharset'] = 'Allow user to select character set';
$string['allowframembedding'] = 'Allow frame embedding';
$string['allowframembedding_help'] = 'If enabled, this site may be embedded in a frame in a remote system, as recommended when using the \'Publish as LTI tool\' enrolment plugin. Otherwise, it is recommended to leave frame embedding disabled for security reasons.';

View File

@ -650,6 +650,16 @@ class core_renderer extends renderer_base {
'type' => $type, 'title' => $alt->title, 'href' => $alt->url));
}
// Add noindex tag if relevant page and setting applied.
$allowindexing = isset($CFG->allowindexing) ? $CFG->allowindexing : 0;
$loginpages = array('login-index', 'login-signup');
if ($allowindexing == 2 || ($allowindexing == 0 && in_array($this->page->pagetype, $loginpages))) {
if (!isset($CFG->additionalhtmlhead)) {
$CFG->additionalhtmlhead = '';
}
$CFG->additionalhtmlhead .= '<meta name="robots" content="noindex" />';
}
if (!empty($CFG->additionalhtmlhead)) {
$output .= "\n".$CFG->additionalhtmlhead;
}

View File

@ -27,12 +27,6 @@
require('../config.php');
require_once('lib.php');
// Try to prevent searching for sites that allow sign-up.
if (!isset($CFG->additionalhtmlhead)) {
$CFG->additionalhtmlhead = '';
}
$CFG->additionalhtmlhead .= '<meta name="robots" content="noindex" />';
redirect_if_major_upgrade_required();
$testsession = optional_param('testsession', 0, PARAM_INT); // test session works properly

View File

@ -28,12 +28,6 @@ require('../config.php');
require_once($CFG->dirroot . '/user/editlib.php');
require_once($CFG->libdir . '/authlib.php');
// Try to prevent searching for sites that allow sign-up.
if (!isset($CFG->additionalhtmlhead)) {
$CFG->additionalhtmlhead = '';
}
$CFG->additionalhtmlhead .= '<meta name="robots" content="noindex" />';
if (!$authplugin = signup_is_enabled()) {
print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
}