Fix queries.

1.10.x
Julio Montoya 10 years ago
parent 6723fefdf5
commit 4b06b652b2
  1. 23
      main/inc/lib/online.inc.php
  2. 4
      main/inc/lib/usermanager.lib.php

@ -17,7 +17,7 @@
* @return void
*/
use \ChamiloSession as Session;
use ChamiloSession as Session;
function LoginCheck($uid) {
global $_course, $_configuration;
@ -38,9 +38,11 @@ function LoginCheck($uid) {
// if the $_course array exists this means we are in a course and we have to store this in the who's online table also
// to have the x users in this course feature working
if (is_array($_course) && count($_course)>0 && !empty($_course['id'])) {
$query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id) VALUES ($uid,$uid,'$login_date','$user_ip', '".$_course['real_id']."' , '$session_id' , '$access_url_id' )";
$query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
VALUES ($uid,$uid,'$login_date','$user_ip', '".$_course['real_id']."' , '$session_id' , '$access_url_id' )";
} else {
$query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, session_id, access_url_id) VALUES ($uid,$uid,'$login_date','$user_ip', '$session_id', '$access_url_id')";
$query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, session_id, access_url_id)
VALUES ($uid,$uid,'$login_date','$user_ip', '$session_id', '$access_url_id')";
}
@Database::query($query);
}
@ -100,7 +102,7 @@ function online_logout($user_id = null, $logout_redirect = false) {
$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
if (empty($user_id)) {
$user_id = intval($_GET['uid']);
$user_id = isset($_GET['uid']) ? intval($_GET['uid']) : 0;
}
//Changing global chat status to offline
@ -110,16 +112,21 @@ function online_logout($user_id = null, $logout_redirect = false) {
}
// selecting the last login of the user
$sql_last_connection="SELECT login_id, login_date FROM $tbl_track_login WHERE login_user_id=$user_id ORDER BY login_date DESC LIMIT 0,1";
$q_last_connection=Database::query($sql_last_connection);
$sql = "SELECT login_id, login_date
FROM $tbl_track_login
WHERE login_user_id = $user_id
ORDER BY login_date DESC
LIMIT 0,1";
$q_last_connection = Database::query($sql);
if (Database::num_rows($q_last_connection)>0) {
$i_id_last_connection=Database::result($q_last_connection,0,"login_id");
}
if (!isset($_SESSION['login_as'])) {
$current_date = api_get_utc_datetime();
$s_sql_update_logout_date="UPDATE $tbl_track_login SET logout_date='".$current_date."' WHERE login_id='$i_id_last_connection'";
Database::query($s_sql_update_logout_date);
$sql = "UPDATE $tbl_track_login SET logout_date='".$current_date."'
WHERE login_id='$i_id_last_connection'";
Database::query($sql);
}
LoginDelete($user_id); //from inc/lib/online.inc.php - removes the "online" status

@ -5349,8 +5349,8 @@ EOF;
*/
public static function getUserProfileLinkWithPicture($userInfo)
{
$imagePath = UserManager::get_user_picture_path_by_id($userInfo['id'], 'web', false, true);
$userProfile = UserManager::get_picture_user($userInfo['id'], $imagePath['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
$imagePath = UserManager::get_user_picture_path_by_id($userInfo['user_id'], 'web', false, true);
$userProfile = UserManager::get_picture_user($userInfo['user_id'], $imagePath['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
return Display::url(Display::img($userProfile['file']), $userInfo['profile_url']);
}

Loading…
Cancel
Save