Cosmetic changes, D***** replaced to Chamilo

skala
Julio Montoya 16 years ago
parent fdc4a36c37
commit a8502848fa
  1. 44
      main/inc/local.inc.php

@ -175,10 +175,10 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
unset($_user['user_id']); unset($_user['user_id']);
} }
//$_SESSION['info_current_user'][1] is user name //$_SESSION['info_current_user'][1] is user name
//$_SESSION['info_current_user'][2] is current password encrypted //$_SESSION['info_current_user'][2] is current password encrypted
//$_SESSION['update_term_and_condition'][1] is current user id, of user in session //$_SESSION['update_term_and_condition'][1] is current user id, of user in session
if (api_get_setting('allow_terms_conditions')=='true') { if (api_get_setting('allow_terms_conditions')=='true') {
if (isset($_POST['login']) && isset($_POST['password']) && isset($_SESSION['update_term_and_condition'][1])) { if (isset($_POST['login']) && isset($_POST['password']) && isset($_SESSION['update_term_and_condition'][1])) {
$user_id=$_SESSION['update_term_and_condition'][1]; // user id $user_id=$_SESSION['update_term_and_condition'][1]; // user id
@ -212,7 +212,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
} }
} }
} }
} }
if ((isset($_POST['login']) && isset($_POST['password']))) { if ((isset($_POST['login']) && isset($_POST['password']))) {
// $login && $password are given to log in // $login && $password are given to log in
@ -358,12 +358,10 @@ if (api_get_setting('allow_terms_conditions')=='true') {
// see configuration.php to define these // see configuration.php to define these
include_once($extAuthSource[$key]['login']); include_once($extAuthSource[$key]['login']);
/* >>>>>>>> External authentication modules <<<<<<<<< */ /* >>>>>>>> External authentication modules <<<<<<<<< */
} else // no standard Chamilo login - try external authentification } else { // no standard Chamilo login - try external authentification
{
//huh... nothing to do... we shouldn't get here //huh... nothing to do... we shouldn't get here
error_log('Chamilo Authentication file '. $extAuthSource[$uData['auth_source']]['login']. ' could not be found - this might prevent your system from doing the corresponding authentication process',0); error_log('Chamilo Authentication file '. $extAuthSource[$uData['auth_source']]['login']. ' could not be found - this might prevent your system from doing the corresponding authentication process',0);
} }
if (!empty($_SESSION['request_uri'])) { if (!empty($_SESSION['request_uri'])) {
$req = $_SESSION['request_uri']; $req = $_SESSION['request_uri'];
unset($_SESSION['request_uri']); unset($_SESSION['request_uri']);
@ -372,7 +370,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
if (isset($param)) { if (isset($param)) {
header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login').$param); header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login').$param);
} else { } else {
// here is the main redirect of a *normal* login page in Dokeos // here is the main redirect of a *normal* login page in Chamilo
header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login')); header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login'));
} }
} }
@ -383,7 +381,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
/* /*
* In this section: * In this section:
* there is no entry for the $login user in the Dokeos * there is no entry for the $login user in the Chamilo
* database. This also means there is no auth_source for the user. * database. This also means there is no auth_source for the user.
* We let all external procedures attempt to add him/her * We let all external procedures attempt to add him/her
* to the system. * to the system.
@ -392,7 +390,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
* of the authentication source list * of the authentication source list
* provided by the configuration settings. * provided by the configuration settings.
* If the login succeeds, for going further, * If the login succeeds, for going further,
* Dokeos needs the $_user['user_id'] variable to be * Chamilo needs the $_user['user_id'] variable to be
* set and registered in the session. It's the * set and registered in the session. It's the
* responsability of the external login script * responsability of the external login script
* to provide this $_user['user_id']. * to provide this $_user['user_id'].
@ -403,13 +401,12 @@ if (api_get_setting('allow_terms_conditions')=='true') {
if (!empty($thisAuthSource['newUser']) && file_exists($thisAuthSource['newUser'])) { if (!empty($thisAuthSource['newUser']) && file_exists($thisAuthSource['newUser'])) {
include_once($thisAuthSource['newUser']); include_once($thisAuthSource['newUser']);
} else { } else {
error_log('Dokeos Authentication file '. $thisAuthSource['newUser']. ' could not be found - this might prevent your system from using the authentication process in the user creation process',0); error_log('Chamilo Authentication file '. $thisAuthSource['newUser']. ' could not be found - this might prevent your system from using the authentication process in the user creation process',0);
} }
} }
} //end if is_array($extAuthSource) } //end if is_array($extAuthSource)
} //end else login failed } //end else login failed
} elseif(api_get_setting('sso_authentication')==='true' && !in_array('webservices', explode('/', $_SERVER['REQUEST_URI']))) { } elseif (api_get_setting('sso_authentication')==='true' && !in_array('webservices', explode('/', $_SERVER['REQUEST_URI']))) {
/** /**
* TODO: * TODO:
* - Implement user interface for api_get_setting('sso_authentication') * - Implement user interface for api_get_setting('sso_authentication')
@ -454,7 +451,6 @@ if (api_get_setting('allow_terms_conditions')=='true') {
$sql = "SELECT user_id, username, password, auth_source, active, expiration_date $sql = "SELECT user_id, username, password, auth_source, active, expiration_date
FROM $user_table FROM $user_table
WHERE username = '".trim(addslashes($sso['username']))."'"; WHERE username = '".trim(addslashes($sso['username']))."'";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
@ -465,7 +461,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
if (!$userPasswordCrypted) { if (!$userPasswordCrypted) {
$uData['password'] = md5($uData['password']); $uData['password'] = md5($uData['password']);
} }
//the authentification of this user is managed by Dokeos itself// check the user's password //the authentification of this user is managed by Chamilo itself// check the user's password
// password hash comes into a sha1 // password hash comes into a sha1
if ($sso['secret'] === sha1($uData['password']) && ($sso['username'] == $uData['username'])) { if ($sso['secret'] === sha1($uData['password']) && ($sso['username'] == $uData['username'])) {
//Check if the account is active (not locked) //Check if the account is active (not locked)
@ -519,10 +515,9 @@ if (api_get_setting('allow_terms_conditions')=='true') {
$_user['user_id'] = $uData['user_id']; $_user['user_id'] = $uData['user_id'];
api_session_register('_user'); api_session_register('_user');
event_login(); event_login();
} }
} else { } else {
//single URL access //Single URL access
$_user['user_id'] = $uData['user_id']; $_user['user_id'] = $uData['user_id'];
api_session_register('_user'); api_session_register('_user');
event_login(); event_login();
@ -573,7 +568,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
exit; exit;
} }
} }
} }//end logout
} elseif (api_get_setting('openid_authentication')=='true') { } elseif (api_get_setting('openid_authentication')=='true') {
if (!empty($_POST['openid_url'])) { if (!empty($_POST['openid_url'])) {
include('main/auth/openid/login.php'); include('main/auth/openid/login.php');
@ -601,7 +596,7 @@ if (api_get_setting('allow_terms_conditions')=='true') {
$uData = Database::fetch_array($result); $uData = Database::fetch_array($result);
if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) { if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
//the authentification of this user is managed by Dokeos itself //the authentification of this user is managed by Chamilo itself
// check if the account is active (not locked) // check if the account is active (not locked)
if ($uData['active']=='1') { if ($uData['active']=='1') {
@ -645,9 +640,9 @@ if (api_get_setting('allow_terms_conditions')=='true') {
// else {} => continue as anonymous user // else {} => continue as anonymous user
$uidReset = true; $uidReset = true;
// $cidReset = true; // $cidReset = true;
// $gidReset = true; // $gidReset = true;
} } // end else
//Now check for anonymous user mode //Now check for anonymous user mode
if (isset($use_anonymous) && $use_anonymous == true) { if (isset($use_anonymous) && $use_anonymous == true) {
@ -683,8 +678,7 @@ if ($gidReq && $gidReq != $gid) {
/* USER INIT */ /* USER INIT */
if (isset($uidReset) && $uidReset) // session data refresh requested if (isset($uidReset) && $uidReset) { // session data refresh requested
{
$is_platformAdmin = false; $is_allowedCreateCourse = false; $is_platformAdmin = false; $is_allowedCreateCourse = false;
if (isset($_user['user_id']) && $_user['user_id']) // a uid is given (log in succeeded) if (isset($_user['user_id']) && $_user['user_id']) // a uid is given (log in succeeded)

Loading…
Cancel
Save