Skip to content

Commit

Permalink
FIxed some notices and cleaned up a little
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Feb 25, 2005
1 parent e49617a commit e06f15a
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@

$frm = false;
$user = false;
if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,"username=guest")) or $loginguest) {
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";
} else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot . "/login/weblinkauth.php")) {
//Handles the case of another Moodle site linking into a page on this site
include $CFG->dirroot . "/login/weblinkauth.php";
$frm->username = 'guest';
$frm->password = 'guest';
} else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot.'/login/weblinkauth.php')) {
// Handles the case of another Moodle site linking into a page on this site
include($CFG->dirroot.'/login/weblinkauth.php');
if (function_exists(weblink_auth)) {
$user = weblink_auth($SESSION->wantsurl);
}
Expand Down Expand Up @@ -108,9 +108,6 @@

set_moodle_cookie($USER->username);

$wantsurl = $SESSION->wantsurl;

unset($SESSION->wantsurl);
unset($SESSION->lang);
$SESSION->justloggedin = true;

Expand Down Expand Up @@ -141,16 +138,18 @@


add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);

if (user_not_fully_set_up($USER)) {
$SESSION->wantsurl = $wantsurl; /// Postpone this redirect a while longer!
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID;
// We don't delete $SESSION->wantsurl yet, so we get there later

} else if (strpos($wantsurl, $CFG->wwwroot) === 0) { /// Matches site address
$urltogo = $wantsurl;
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
unset($SESSION->wantsurl);

} else {
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
unset($SESSION->wantsurl); /// Just in case
}

// check if user password has expired
Expand All @@ -176,7 +175,7 @@

redirect($urltogo);

die;
exit;

} else {
$errormsg = get_string("invalidlogin");
Expand Down

0 comments on commit e06f15a

Please sign in to comment.