Permalink
Browse files

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

  • Loading branch information...
dmonllao committed Jun 27, 2017
2 parents d4bd3db + 409ad1d commit aa736731ba0cc85f8bb16e3ef9e343f86f08f0ec
Showing with 20 additions and 12 deletions.
  1. +5 −0 admin/settings/security.php
  2. +5 −0 lang/en/admin.php
  3. +10 −0 lib/outputrenderers.php
  4. +0 −6 login/index.php
  5. +0 −6 login/signup.php
@@ -18,6 +18,11 @@
$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'),
@@ -49,6 +49,11 @@
$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.';
@@ -650,6 +650,16 @@ public function standard_head_html() {
'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;
}
@@ -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
@@ -28,12 +28,6 @@
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.');
}

0 comments on commit aa73673

Please sign in to comment.