This commit is contained in:
gustav_delius
2004-06-30 12:09:29 +00:00
parent 1218d4702e
commit fe6571366c
5 changed files with 23 additions and 3 deletions
+15
View File
@@ -428,6 +428,21 @@
<?php print_string("configextendedusernamechars") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>autologinguests:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "autologinguests", $config->autologinguests, "", "", "");
?>
</td>
<td>
<?php print_string("configautologinguests") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>forcelogin:</td>
<td>
+1
View File
@@ -139,6 +139,7 @@ $string['closewindow'] = 'Close this window';
$string['comparelanguage'] = 'Compare and edit current language';
$string['complete'] = 'Complete';
$string['configallowunenroll'] = 'If this is set \'Yes\', then students are allowed to unenroll themselves from courses whenever they like. Otherwise they are not allowed, and this process will be solely controlled by the teachers and administrators.';
$string['configautologinguests'] = 'Should visitors be logged in as guests automatically when entering courses with guest access?';
$string['configcachetext'] = 'For larger sites or sites that use text filters, this setting can really speed things up. Copies of texts will be retained in their processed form for the time specified here. Setting this too small may actually slow things down slightly, but setting it too large may mean texts take too long to refresh (with new links, for example).';
$string['configcountry'] = 'If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset.';
$string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed. This is only useful for developers.';
+1
View File
@@ -5,6 +5,7 @@
$defaults = array (
"auth" => "email",
"autologinguests" => 0,
"allowunenroll" => true,
"cachetext" => 60,
"changepassword" => true,
+4 -2
View File
@@ -365,11 +365,13 @@ function require_login($courseid=0) {
$SESSION->fromurl = $_SERVER["HTTP_REFERER"];
}
$USER = NULL;
$loginguest = (isset($CFG->loginguests) and $CFG->autologinguests
and $courseid and get_field('course','guest','id',$courseid)) ? '?loginguest=true' : '';
if (empty($CFG->loginhttps)) {
redirect("$CFG->wwwroot/login/index.php");
redirect("$CFG->wwwroot/login/index.php$loginguest");
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
redirect("$wwwroot/login/index.php");
redirect("$wwwroot/login/index.php$loginguest");
}
die;
}
+2 -1
View File
@@ -1,6 +1,7 @@
<?PHP // $Id$
require_once("../config.php");
optional_variable($loginguest, false); // determines whether visitors are logged in as guest automatically
// Check if the guest user exists. If not, create one.
if (! record_exists("user", "username", "guest")) {
@@ -20,7 +21,7 @@
}
$frm = false;
if (!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,"username=guest")) {
if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,"username=guest")) or $loginguest) {
/// Log in as guest automatically (idea from Zbigniew Fiedorowicz)
$frm->username = "guest";
$frm->password = "guest";