mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-27 02:45:56 +02:00
Version18.82
This commit is contained in:
parent
db0921ab18
commit
69e82bded5
|
@ -188,7 +188,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
|
|||
|
||||
/* Get author */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); // Get from the database the data of the autor
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get from the database the data of the autor
|
||||
|
||||
/***** Write item with notice *****/
|
||||
fprintf (FileRSS,"<item>\n");
|
||||
|
|
|
@ -230,7 +230,7 @@ void Acc_CheckIfEmptyAccountExists (void)
|
|||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/***** Write row with data of empty account *****/
|
||||
Acc_WriteRowEmptyAccount (NumUsr,ID,&UsrDat);
|
||||
|
|
|
@ -394,7 +394,7 @@ void Agd_ShowOtherAgendaAfterLogIn (void)
|
|||
{
|
||||
/***** Get user *****/
|
||||
/* If nickname is correct, user code is already got from nickname */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Existing user
|
||||
{
|
||||
/***** Start box *****/
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
|
|
|
@ -3317,7 +3317,7 @@ static void Att_ListStdsAttendanceTable (Att_TypeOfView_t TypeOfView,
|
|||
NumStd++)
|
||||
{
|
||||
UsrDat.UsrCod = LstSelectedUsrCods[NumStd];
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfICanViewAtt (&UsrDat))
|
||||
{
|
||||
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
||||
|
@ -3551,7 +3551,7 @@ static void Att_ListStdsWithAttEventsDetails (unsigned NumStdsInList,
|
|||
NumStd++)
|
||||
{
|
||||
UsrDat.UsrCod = LstSelectedUsrCods[NumStd];
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfICanViewAtt (&UsrDat))
|
||||
{
|
||||
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
||||
|
|
|
@ -1619,7 +1619,7 @@ static void Ctr_ListCentresForEdition (void)
|
|||
|
||||
/* Centre requester */
|
||||
UsrDat.UsrCod = Ctr->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT INPUT_REQUESTER LEFT_TOP\">");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
|
|
@ -436,8 +436,6 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
|
|||
|
||||
// TODO: Los usuarios que no tienes permiso para ver su perfil público, se debería mostrar algo, una mínima ficha sin tinmeline o algo así
|
||||
|
||||
// TODO: Para acelerar la carga, todas las preferencias de usuarios no deberían obtenerse siempre, sino en una llamada especial pues en general sólo interesan para el usuario identificado
|
||||
|
||||
// TODO: Allow timeline posting only for users belonging to courses or admins to avoid user who create accounts only to post
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -459,10 +457,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.81.5 (2019-03-19)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.82 (2019-03-19)"
|
||||
#define CSS_FILE "swad18.80.css"
|
||||
#define JS_FILE "swad18.80.js"
|
||||
/*
|
||||
Version 18.82: Mar 19, 2019 User preferences are retrieved from database only when they are needed. (240630 lines)
|
||||
Version 18.81.5: Mar 19, 2019 Code refactoring related to media. (240594 lines)
|
||||
Version 18.81.4: Mar 19, 2019 Code refactoring related to media. (240586 lines)
|
||||
Version 18.81.3: Mar 19, 2019 Remove unused fields MediaName,MediaType,MediaTitle,MediaURL,Media from tables. (240657 lines)
|
||||
|
|
|
@ -807,7 +807,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
|
|||
Usr_UsrDataConstructor (&OtherUsrDat);
|
||||
|
||||
/***** Get user's data *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (&OtherUsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&OtherUsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
UsrDat = &OtherUsrDat;
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
|
|||
|
||||
/* Get user's data */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Existing user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Existing user
|
||||
{
|
||||
/* Get course code (row[1]) */
|
||||
ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) == Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
|
|
@ -1560,7 +1560,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
|||
|
||||
/* Course requester */
|
||||
UsrDat.UsrCod = Crs->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT INPUT_REQUESTER LEFT_TOP\">");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
|
|
@ -837,7 +837,7 @@ static void Deg_ListDegreesForEdition (void)
|
|||
|
||||
/* Degree requester */
|
||||
UsrDat.UsrCod = Deg->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT INPUT_REQUESTER LEFT_TOP\">");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
|
|
@ -174,7 +174,7 @@ void Dup_ListDuplicateUsrs (void)
|
|||
|
||||
/* Get user code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/* Get if user has accepted all his/her courses */
|
||||
if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
|
||||
|
@ -307,7 +307,7 @@ static void Dup_ListSimilarUsrs (void)
|
|||
|
||||
/* Get user code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/* Get if user has accepted all his/her courses */
|
||||
if (Usr_GetNumCrssOfUsr (UsrDat.UsrCod) != 0)
|
||||
|
|
|
@ -350,9 +350,9 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
|||
Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_TCH,-1,UsrDat->UsrCod);
|
||||
|
||||
/***** Create new notification ******/
|
||||
CreateNotif = (UsrDat->Prefs.NotifNtfEvents & (1 << NotifyEvent));
|
||||
CreateNotif = (UsrDat->NtfEvents.CreateNotif & (1 << NotifyEvent));
|
||||
NotifyByEmail = CreateNotif && !ItsMe &&
|
||||
(UsrDat->Prefs.EmailNtfEvents & (1 << NotifyEvent));
|
||||
(UsrDat->NtfEvents.SendEmail & (1 << NotifyEvent));
|
||||
if (CreateNotif)
|
||||
Ntf_StoreNotifyEventToOneUser (NotifyEvent,UsrDat,-1L,
|
||||
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
|
||||
|
@ -504,7 +504,7 @@ void Enr_GetNotifEnrolment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
/* Get user's data */
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Role (row[0]) */
|
||||
Role = Rol_ConvertUnsignedStrToRole (row[0]);
|
||||
|
@ -892,7 +892,7 @@ void Enr_RemoveOldUsrs (void)
|
|||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
Acc_CompletelyEliminateAccount (&UsrDat,Cns_QUIET);
|
||||
NumUsrsEliminated++;
|
||||
|
@ -1281,7 +1281,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
|||
if (Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].Remove) // If this student must be removed
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
if (WhatToDo.EliminateUsrs) // Eliminate user completely from the platform
|
||||
{
|
||||
|
@ -1796,7 +1796,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
|
|||
|
||||
/***** Check if the record of the user exists and get the type of user *****/
|
||||
if (UsrDat->UsrCod > 0) // User exists in database
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat); // Get user's data
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS); // Get user's data
|
||||
else // User does not exist in database, create it using his/her ID!
|
||||
{
|
||||
// Reset user's data
|
||||
|
@ -2071,7 +2071,7 @@ void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
/* User's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Role (row[1]) */
|
||||
DesiredRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
||||
|
@ -2109,7 +2109,7 @@ void Enr_AskIfRejectSignUp (void)
|
|||
/***** Get user's code *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
|
@ -2163,7 +2163,7 @@ void Enr_RejectSignUp (void)
|
|||
/***** Get user's code *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
|
@ -2837,7 +2837,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
|||
|
||||
/* Get user code (row[2]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
UsrExists = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
UsrExists = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/***** Get requested role (row[3]) *****/
|
||||
DesiredRole = Rol_ConvertUnsignedStrToRole (row[3]);
|
||||
|
@ -3246,7 +3246,7 @@ static void Enr_AskIfRegRemUsr (struct ListUsrCods *ListUsrCods,Rol_Role_t Role)
|
|||
{
|
||||
/* Get user's data */
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = ListUsrCods->Lst[NumUsr];
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Show form to edit user */
|
||||
Enr_ShowFormToEditOtherUsr ();
|
||||
|
|
|
@ -3244,7 +3244,7 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get of the database the data of the user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfICanViewAsgWrk (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
/***** Show a row with the data of the owner of the works *****/
|
||||
|
@ -6676,7 +6676,7 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,unsigned long UsrCod)
|
|||
|
||||
/***** Get data of file/folder publisher *****/
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
ShowUsr = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); // Get user's data from database
|
||||
ShowUsr = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get user's data from database
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
|
||||
|
@ -7168,7 +7168,7 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_assignments_area,
|
||||
|
@ -7181,7 +7181,7 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_works_area,
|
||||
|
@ -8130,7 +8130,7 @@ static void Brw_PasteClipboard (void)
|
|||
{
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat); // Check that user exists
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Check that user exists
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%ld/%s/%02u/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,Cfg_FOLDER_USR,
|
||||
|
@ -9705,7 +9705,7 @@ void Brw_ShowFileMetadata (void)
|
|||
Usr_UsrDataConstructor (&PublisherUsrDat);
|
||||
|
||||
PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod;
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat);
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat,Usr_DONT_GET_PREFS);
|
||||
}
|
||||
else
|
||||
FileHasPublisher = false; // Get user's data from database
|
||||
|
@ -12014,7 +12014,7 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/* Initialize structure with publisher's data */
|
||||
Usr_UsrDataConstructor (&PublisherUsrDat);
|
||||
PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod;
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat);
|
||||
FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat,Usr_DONT_GET_PREFS);
|
||||
}
|
||||
else
|
||||
/* Unknown publisher */
|
||||
|
|
|
@ -163,7 +163,7 @@ void Fol_SuggestUsrsToFollowMainZone (void)
|
|||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
Fol_ShowFollowedOrFollower (&UsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
|
@ -231,7 +231,7 @@ void Fol_SuggestUsrsToFollowMainZoneOnRightColumn (void)
|
|||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/***** Show user *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
Fol_WriteRowUsrToFollowOnRightColumn (&UsrDat);
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ void Fol_ListFollowing (void)
|
|||
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||
{
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
@ -722,7 +722,7 @@ static void Fol_ListFollowingUsr (struct UsrData *UsrDat)
|
|||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowingUsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowingUsrDat,Usr_DONT_GET_PREFS))
|
||||
Fol_ShowFollowedOrFollower (&FollowingUsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
|
@ -754,7 +754,7 @@ void Fol_ListFollowers (void)
|
|||
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||
{
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat);
|
||||
else
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
@ -805,7 +805,7 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
|
|||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowerUsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowerUsrDat,Usr_DONT_GET_PREFS))
|
||||
Fol_ShowFollowedOrFollower (&FollowerUsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
|
@ -1203,7 +1203,7 @@ static void Fol_GetFollowedFromSelectedUsrs (unsigned *NumFollowed,
|
|||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
{
|
||||
/* Check if I follow this user */
|
||||
|
@ -1252,7 +1252,7 @@ void Fol_FollowUsrs ()
|
|||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
/* If I don't follow this user ==> follow him/her */
|
||||
if (!Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -1299,7 +1299,7 @@ void Fol_UnfollowUsrs (void)
|
|||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
/* If I follow this user ==> unfollow him/her */
|
||||
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -1380,9 +1380,9 @@ static void Fol_FollowUsr (struct UsrData *UsrDat)
|
|||
Fol_FlushCacheFollow ();
|
||||
|
||||
/***** This follow must be notified by email? *****/
|
||||
CreateNotif = (UsrDat->Prefs.NotifNtfEvents & (1 << Ntf_EVENT_FOLLOWER));
|
||||
CreateNotif = (UsrDat->NtfEvents.CreateNotif & (1 << Ntf_EVENT_FOLLOWER));
|
||||
NotifyByEmail = CreateNotif &&
|
||||
(UsrDat->Prefs.EmailNtfEvents & (1 << Ntf_EVENT_FOLLOWER));
|
||||
(UsrDat->NtfEvents.SendEmail & (1 << Ntf_EVENT_FOLLOWER));
|
||||
|
||||
/***** Create notification for this followed.
|
||||
If this followed wants to receive notifications by email,
|
||||
|
|
|
@ -1285,7 +1285,7 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod,
|
|||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** Write author *****/
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"AUTHOR_TXT LEFT_TOP\""
|
||||
" style=\"width:150px;\">");
|
||||
Msg_WriteMsgAuthor (&UsrDat,Enabled,NULL);
|
||||
|
@ -3502,7 +3502,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],
|
|||
{
|
||||
/* Write the author of first or last message */
|
||||
UsrDat.UsrCod = Thr.UsrCod[Order];
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP %s\">",Style,BgColor);
|
||||
Msg_WriteMsgAuthor (&UsrDat,Thr.Enabled[Order],BgColor);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
|
|
@ -1579,7 +1579,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
|
||||
/* Institution requester */
|
||||
UsrDat.UsrCod = Ins->RequesterUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT INPUT_REQUESTER LEFT_TOP\">");
|
||||
Msg_WriteMsgAuthor (&UsrDat,true,NULL);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
|
|
@ -657,7 +657,7 @@ void Mrk_ShowMyMarks (void)
|
|||
if (UsrIsOK)
|
||||
{
|
||||
/***** Get list of user's IDs *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/***** Create temporal file to store my marks (in HTML) *****/
|
||||
/* If the private directory does not exist, create it */
|
||||
|
|
|
@ -746,7 +746,7 @@ void Msg_RecMsgFromUsr (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDstData.EncryptedUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDstData);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData)) // Get recipient's data from the database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData,Usr_DONT_GET_PREFS)) // Get recipient's data from the database
|
||||
{
|
||||
/***** Check if recipient has banned me *****/
|
||||
RecipientHasBannedMe = Msg_CheckIfUsrIsBanned (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDstData.UsrCod);
|
||||
|
@ -770,10 +770,10 @@ void Msg_RecMsgFromUsr (void)
|
|||
UsrDstData.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/***** This received message must be notified by email? *****/
|
||||
CreateNotif = (UsrDstData.Prefs.NotifNtfEvents & (1 << Ntf_EVENT_MESSAGE));
|
||||
CreateNotif = (UsrDstData.NtfEvents.CreateNotif & (1 << Ntf_EVENT_MESSAGE));
|
||||
NotifyByEmail = CreateNotif &&
|
||||
(UsrDstData.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) &&
|
||||
(UsrDstData.Prefs.EmailNtfEvents & (1 << Ntf_EVENT_MESSAGE));
|
||||
(UsrDstData.NtfEvents.SendEmail & (1 << Ntf_EVENT_MESSAGE));
|
||||
|
||||
/***** Create the received message for this recipient
|
||||
and increment number of new messages received by this recipient *****/
|
||||
|
@ -2954,7 +2954,7 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
|
|||
Msg_WriteMsgNumber (MsgNum,!Open);
|
||||
|
||||
/***** Write message author *****/
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">",
|
||||
Open ? "MSG_AUT_BG" :
|
||||
|
@ -3480,7 +3480,7 @@ static void Msg_WriteMsgTo (long MsgCod)
|
|||
OpenByDst = (row[2][0] == 'Y');
|
||||
|
||||
/* Get user's data */
|
||||
UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Put an icon to show if user has read the message */
|
||||
Title = OpenByDst ? (Deleted ? Txt_MSG_Open_and_deleted :
|
||||
|
@ -3675,7 +3675,7 @@ void Msg_BanSenderWhenShowingMsgs (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
Lay_ShowErrorAndExit ("Sender does not exist.");
|
||||
|
||||
/***** Insert pair (sender's code - my code) in table of banned senders if not inserted *****/
|
||||
|
@ -3732,7 +3732,7 @@ static void Msg_UnbanSender (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
Lay_ShowErrorAndExit ("Sender does not exist.");
|
||||
|
||||
/***** Remove pair (sender's code - my code) from table of banned senders *****/
|
||||
|
@ -3822,7 +3822,7 @@ void Msg_ListBannedUsrs (void)
|
|||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data from database */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/* Put form to unban user */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
|
|
@ -736,7 +736,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
|
|||
AuthorClass[Status]);
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the autor
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the autor
|
||||
Usr_WriteFirstNameBRSurnames (&UsrDat);
|
||||
Usr_UsrDataDestructor (&UsrDat);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
|
|
@ -430,7 +430,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
|
||||
/* Get (from) user code (row[1]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); // Get user's data from the database
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get user's data from the database
|
||||
|
||||
/* Get institution code (row[2]) */
|
||||
Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
@ -1414,10 +1414,10 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
/* Get user code */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get user's data from the database
|
||||
if ((UsrDat.Prefs.NotifNtfEvents & NotifyEventMask)) // Create notification
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get user's data from the database
|
||||
if ((UsrDat.NtfEvents.CreateNotif & NotifyEventMask)) // Create notification
|
||||
{
|
||||
if ((UsrDat.Prefs.EmailNtfEvents & NotifyEventMask)) // Send notification by email
|
||||
if ((UsrDat.NtfEvents.SendEmail & NotifyEventMask)) // Send notification by email
|
||||
{
|
||||
Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,Cod,
|
||||
(Ntf_Status_t) Ntf_STATUS_BIT_EMAIL);
|
||||
|
@ -1557,7 +1557,7 @@ void Ntf_SendPendingNotifByEMailToAllUsrs (void)
|
|||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get user's data from the database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get user's data from the database
|
||||
{
|
||||
/* Send one email to this user */
|
||||
Ntf_SendPendingNotifByEMailToOneUsr (&UsrDat,&NumNotif,&NumMails);
|
||||
|
@ -1677,7 +1677,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
|
||||
/* Get origin user code (row[1]) */
|
||||
FromUsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FromUsrDat); // Get origin user's data from the database
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FromUsrDat,Usr_DONT_GET_PREFS); // Get origin user's data from the database
|
||||
|
||||
/* Get institution code (row[2]) */
|
||||
Ins.InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
@ -1967,14 +1967,14 @@ void Ntf_PutFormChangeNotifSentByEMail (void)
|
|||
The_ClassFormInBox[Gbl.Prefs.Theme],
|
||||
Txt_NOTIFY_EVENTS_PLURAL[NotifyEvent],
|
||||
Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent]);
|
||||
if ((Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents & (1 << NotifyEvent)))
|
||||
if ((Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif & (1 << NotifyEvent)))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />"
|
||||
"</td>"
|
||||
"<td class=\"CENTER_MIDDLE\">"
|
||||
"<input type=\"checkbox\" name=\"%s\" value=\"Y\"",
|
||||
Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]);
|
||||
if ((Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents & (1 << NotifyEvent)))
|
||||
if ((Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail & (1 << NotifyEvent)))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />"
|
||||
"</td>"
|
||||
|
@ -2005,20 +2005,20 @@ static void Ntf_GetParamsNotifyEvents (void)
|
|||
Ntf_NotifyEvent_t NotifyEvent;
|
||||
bool CreateNotifForThisEvent;
|
||||
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents = 0;
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents = 0;
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif = 0;
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail = 0;
|
||||
for (NotifyEvent = (Ntf_NotifyEvent_t) 1;
|
||||
NotifyEvent < Ntf_NUM_NOTIFY_EVENTS;
|
||||
NotifyEvent++) // 0 is reserved for Ntf_EVENT_UNKNOWN
|
||||
{
|
||||
if ((CreateNotifForThisEvent = Par_GetParToBool (Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent])))
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents |= (1 << NotifyEvent);
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif |= (1 << NotifyEvent);
|
||||
|
||||
if (CreateNotifForThisEvent)
|
||||
{
|
||||
Par_GetParToBool (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]);
|
||||
if (Par_GetParToBool (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]))
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents |= (1 << NotifyEvent);
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail |= (1 << NotifyEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2039,8 +2039,8 @@ void Ntf_ChangeNotifyEvents (void)
|
|||
"UPDATE usr_data"
|
||||
" SET NotifNtfEvents=%u,EmailNtfEvents=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents,
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents,
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif,
|
||||
Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Show message *****/
|
||||
|
|
|
@ -374,7 +374,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
|
|||
NumUsr++)
|
||||
{
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod = ListUsrCods.Lst[NumUsr];
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat); // Get my data
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_DONT_GET_PREFS); // Get my data
|
||||
|
||||
if (Gbl.Usrs.Me.UsrDat.Email[0])
|
||||
switch ((ReturnCode = Pwd_SendNewPasswordByEmail (NewRandomPlainPassword)))
|
||||
|
|
|
@ -403,7 +403,7 @@ void Pho_RecOtherUsrPhotoDetFaces (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/***** Receive photo *****/
|
||||
if (!Pho_ReceivePhotoAndDetectFaces (false,&Gbl.Usrs.Other.UsrDat))
|
||||
|
@ -487,7 +487,7 @@ void Pho_ReqRemoveUsrPhoto (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ void Pho_RemoveUsrPhoto (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/***** Remove photo *****/
|
||||
if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat))
|
||||
|
|
|
@ -235,7 +235,7 @@ void Prf_GetUsrDatAndShowUserProfile (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Show profile and timeline *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
/* Show profile */
|
||||
if (Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
|
@ -1523,7 +1523,7 @@ void Prf_ShowRankingFigure (MYSQL_RES **mysql_res,unsigned NumUsrs)
|
|||
|
||||
/* Get user's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Get figure (row[1]) */
|
||||
if (sscanf (row[1],"%ld",&Figure) != 1)
|
||||
|
@ -1692,7 +1692,7 @@ void Prf_GetAndShowRankingClicksPerDay (void)
|
|||
|
||||
/* Get user's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Get number of clicks per day (row[1]) */
|
||||
NumClicksPerDay = Str_GetFloatNumFromStr (row[1]);
|
||||
|
|
|
@ -1656,7 +1656,7 @@ static void Prj_ShowOneProjectMembersWithARole (const struct Project *Prj,
|
|||
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/* Start row for this user */
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
|
@ -1757,7 +1757,7 @@ static void Prj_ShowTableAllProjectsMembersWithARole (const struct Project *Prj,
|
|||
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/* Write user's name in "Surname1 Surname2, FirstName" format */
|
||||
fprintf (Gbl.F.Out,"<li>%s",Gbl.Usrs.Other.UsrDat.Surname1);
|
||||
|
@ -1950,7 +1950,7 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
|
|||
{
|
||||
/* Get user's data */
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = ListUsrCods.Lst[NumUsr];
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Add user to project */
|
||||
DB_QueryREPLACE ("can not add user to project",
|
||||
|
|
|
@ -1005,7 +1005,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
{
|
||||
/* Start container for this user */
|
||||
snprintf (RecordSectionId,sizeof (RecordSectionId),
|
||||
|
@ -1052,7 +1052,7 @@ void Rec_GetUsrAndShowRecOneStdCrs (void)
|
|||
/***** Get the selected student *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat))
|
||||
Rec_ShowRecordOneStdCrs ();
|
||||
}
|
||||
|
@ -1200,7 +1200,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
{
|
||||
/* Check if this user has accepted
|
||||
|
@ -1272,7 +1272,7 @@ void Rec_GetUsrAndShowRecOneTchCrs (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Show the record *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get from the database the data of the teacher
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the teacher
|
||||
if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat))
|
||||
Rec_ShowRecordOneTchCrs ();
|
||||
}
|
||||
|
@ -1419,7 +1419,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
{
|
||||
/* Check if this user has accepted
|
||||
|
@ -1611,7 +1611,7 @@ void Rec_UpdateAndShowOtherCrsRecord (void)
|
|||
|
||||
/***** Get the user whose record we want to modify *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/***** Get list of fields of records in current course *****/
|
||||
Rec_GetListRecordFieldsInCurrentCrs ();
|
||||
|
@ -2100,7 +2100,7 @@ void Rec_ShowMySharedRecordUpd (void)
|
|||
void Rec_ShowSharedRecordUnmodifiable (struct UsrData *UsrDat)
|
||||
{
|
||||
/***** Get password, user type and user's data from database *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS);
|
||||
UsrDat->Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (UsrDat);
|
||||
|
||||
/***** Show user's record *****/
|
||||
|
|
|
@ -1697,7 +1697,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
|
|||
|
||||
/* Get user's data of the database */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Get logged role */
|
||||
if (sscanf (row[2],"%u",&RoleFromLog) != 1)
|
||||
|
@ -1852,7 +1852,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res)
|
|||
|
||||
/* Get user's data from the database */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); // Get the data of the user from the database
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Get the data of the user from the database
|
||||
|
||||
/* Write the number of row */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
|
|
@ -7492,7 +7492,7 @@ void Tst_ShowUsrsTestResults (void)
|
|||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get of the database the data of the user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat))
|
||||
/***** Show test results *****/
|
||||
Tst_ShowTestResults (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -8073,7 +8073,7 @@ void Tst_ShowOneTestResult (void)
|
|||
|
||||
/***** Header row *****/
|
||||
/* Get data of the user who made the test */
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
Lay_ShowErrorAndExit ("User does not exists.");
|
||||
if (!Usr_CheckIfICanViewTst (&Gbl.Usrs.Other.UsrDat))
|
||||
Lay_ShowErrorAndExit ("You can not view this test result.");
|
||||
|
|
|
@ -1477,7 +1477,7 @@ static void TL_WriteNote (const struct TL_Note *SocNot,
|
|||
|
||||
/***** Get author data *****/
|
||||
UsrDat.UsrCod = SocNot->UsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
{
|
||||
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||
|
@ -1721,7 +1721,7 @@ static void TL_WriteTopMessage (TL_TopMessage_t TopMessage,long UsrCod)
|
|||
|
||||
/***** Get user's data *****/
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Really we only need EncryptedUsrCod and FullName
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Really we only need EncryptedUsrCod and FullName
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"TL_TOP_CONTAINER"
|
||||
" TL_TOP_PUBLISHER TL_WIDTH\">");
|
||||
|
@ -2781,7 +2781,7 @@ static void TL_WriteComment (struct TL_Comment *SocCom,
|
|||
/***** Get author's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = SocCom->UsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||
IAmTheAuthor = ItsMe;
|
||||
if (!IAmTheAuthor)
|
||||
|
@ -3457,12 +3457,12 @@ static void TL_CreateNotifToAuthor (long AuthorCod,long PubCod,
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
UsrDat.UsrCod = AuthorCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/***** This fav must be notified by email? *****/
|
||||
CreateNotif = (UsrDat.Prefs.NotifNtfEvents & (1 << NotifyEvent));
|
||||
CreateNotif = (UsrDat.NtfEvents.CreateNotif & (1 << NotifyEvent));
|
||||
NotifyByEmail = CreateNotif &&
|
||||
(UsrDat.Prefs.EmailNtfEvents & (1 << NotifyEvent));
|
||||
(UsrDat.NtfEvents.SendEmail & (1 << NotifyEvent));
|
||||
|
||||
/***** Create notification for the author of the post.
|
||||
If this author wants to receive notifications by email,
|
||||
|
@ -4555,7 +4555,7 @@ static void TL_ShowSharersOrFavers (MYSQL_RES **mysql_res,
|
|||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/***** Get user's data and show user's photo *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"TL_SHARER\">");
|
||||
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
|
||||
|
@ -5068,13 +5068,13 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
|
|||
if (!ItsMe) // Not me
|
||||
{
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
|
||||
|
||||
/* Create notification for the mentioned user *****/
|
||||
CreateNotif = (UsrDat.Prefs.NotifNtfEvents & (1 << Ntf_EVENT_TIMELINE_MENTION));
|
||||
CreateNotif = (UsrDat.NtfEvents.CreateNotif & (1 << Ntf_EVENT_TIMELINE_MENTION));
|
||||
if (CreateNotif)
|
||||
{
|
||||
NotifyByEmail = (UsrDat.Prefs.EmailNtfEvents & (1 << Ntf_EVENT_TIMELINE_MENTION));
|
||||
NotifyByEmail = (UsrDat.NtfEvents.SendEmail & (1 << Ntf_EVENT_TIMELINE_MENTION));
|
||||
Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_TIMELINE_MENTION,&UsrDat,PubCod,
|
||||
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
|
||||
0));
|
||||
|
|
417
swad_user.c
417
swad_user.c
|
@ -354,7 +354,7 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
|
|||
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;
|
||||
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
|
||||
UsrDat->Prefs.AcceptThirdPartyCookies = false; // By default, don't accept third party cookies
|
||||
UsrDat->Prefs.EmailNtfEvents = 0; // By default, don't notify anything
|
||||
UsrDat->NtfEvents.SendEmail = 0; // By default, don't notify anything
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -391,10 +391,10 @@ void Usr_UsrDataDestructor (struct UsrData *UsrDat)
|
|||
/*****************************************************************************/
|
||||
// Input: UsrDat->UsrCod must hold user's code
|
||||
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat)
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
||||
{
|
||||
ID_GetListIDsFromUsrCod (UsrDat);
|
||||
Usr_GetUsrDataFromUsrCod (UsrDat);
|
||||
Usr_GetUsrDataFromUsrCod (UsrDat,GetPrefs);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -463,45 +463,12 @@ void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat)
|
|||
UsrDat->UsrCod = -1L;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Get encrypted user's code from database using user's code *********/
|
||||
/*****************************************************************************/
|
||||
// Input: UsrDat->UsrCod must hold user's code
|
||||
|
||||
void Usr_GetEncryptedUsrCodFromUsrCod (struct UsrData *UsrDat) // TODO: Remove this funcion, it's not used
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
||||
if (UsrDat->UsrCod > 0)
|
||||
{
|
||||
/***** Get encrypted user's code from database *****/
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get encrypted user's code",
|
||||
"SELECT EncryptedUsrCod FROM usr_data"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
if (NumRows != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting encrypted user's code.");
|
||||
|
||||
/***** Get encrypted user's code *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (UsrDat->EncryptedUsrCod,row[0],
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
else
|
||||
UsrDat->EncryptedUsrCod[0] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Get user's data from database giving a user's code *************/
|
||||
/*****************************************************************************/
|
||||
// UsrDat->UsrCod must contain an existing user's code
|
||||
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
||||
{
|
||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||
|
@ -515,54 +482,97 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
Lan_Language_t Lan;
|
||||
|
||||
/***** Get user's data from database *****/
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get user's data",
|
||||
"SELECT EncryptedUsrCod," // row[ 0]
|
||||
"Password," // row[ 1]
|
||||
"Surname1," // row[ 2]
|
||||
"Surname2," // row[ 3]
|
||||
"FirstName," // row[ 4]
|
||||
"Sex," // row[ 5]
|
||||
"Theme," // row[ 6]
|
||||
"IconSet," // row[ 7]
|
||||
"Language," // row[ 8]
|
||||
"FirstDayOfWeek," // row[ 9]
|
||||
"DateFormat," // row[10]
|
||||
"Photo," // row[11]
|
||||
"PhotoVisibility," // row[12]
|
||||
"ProfileVisibility," // row[13]
|
||||
"CtyCod," // row[14]
|
||||
"InsCtyCod," // row[15]
|
||||
"InsCod," // row[16]
|
||||
"DptCod," // row[17]
|
||||
"CtrCod," // row[18]
|
||||
"Office," // row[19]
|
||||
"OfficePhone," // row[20]
|
||||
"LocalAddress," // row[21]
|
||||
"LocalPhone," // row[22]
|
||||
"FamilyAddress," // row[23]
|
||||
"FamilyPhone," // row[24]
|
||||
"OriginPlace," // row[25]
|
||||
"DATE_FORMAT(Birthday,"
|
||||
"'%%Y%%m%%d')," // row[26]
|
||||
"Comments," // row[27]
|
||||
"Menu," // row[28]
|
||||
"SideCols," // row[29]
|
||||
"ThirdPartyCookies," // row[30]
|
||||
"NotifNtfEvents," // row[31]
|
||||
"EmailNtfEvents" // row[32]
|
||||
" FROM usr_data WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
switch (GetPrefs)
|
||||
{
|
||||
case Usr_DONT_GET_PREFS:
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get user's data",
|
||||
"SELECT EncryptedUsrCod," // row[ 0]
|
||||
"Password," // row[ 1]
|
||||
"Surname1," // row[ 2]
|
||||
"Surname2," // row[ 3]
|
||||
"FirstName," // row[ 4]
|
||||
"Sex," // row[ 5]
|
||||
"Photo," // row[ 6]
|
||||
"PhotoVisibility," // row[ 7]
|
||||
"ProfileVisibility," // row[ 8]
|
||||
"CtyCod," // row[ 9]
|
||||
"InsCtyCod," // row[10]
|
||||
"InsCod," // row[11]
|
||||
"DptCod," // row[12]
|
||||
"CtrCod," // row[13]
|
||||
"Office," // row[14]
|
||||
"OfficePhone," // row[15]
|
||||
"LocalAddress," // row[16]
|
||||
"LocalPhone," // row[17]
|
||||
"FamilyAddress," // row[18]
|
||||
"FamilyPhone," // row[19]
|
||||
"OriginPlace," // row[20]
|
||||
"DATE_FORMAT(Birthday,"
|
||||
"'%%Y%%m%%d')," // row[21]
|
||||
"Comments," // row[22]
|
||||
"NotifNtfEvents," // row[23]
|
||||
"EmailNtfEvents" // row[24]
|
||||
" FROM usr_data"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
break;
|
||||
case Usr_GET_PREFS:
|
||||
default:
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get user's data",
|
||||
"SELECT EncryptedUsrCod," // row[ 0]
|
||||
"Password," // row[ 1]
|
||||
"Surname1," // row[ 2]
|
||||
"Surname2," // row[ 3]
|
||||
"FirstName," // row[ 4]
|
||||
"Sex," // row[ 5]
|
||||
"Photo," // row[ 6]
|
||||
"PhotoVisibility," // row[ 7]
|
||||
"ProfileVisibility," // row[ 8]
|
||||
"CtyCod," // row[ 9]
|
||||
"InsCtyCod," // row[10]
|
||||
"InsCod," // row[11]
|
||||
"DptCod," // row[12]
|
||||
"CtrCod," // row[13]
|
||||
"Office," // row[14]
|
||||
"OfficePhone," // row[15]
|
||||
"LocalAddress," // row[16]
|
||||
"LocalPhone," // row[17]
|
||||
"FamilyAddress," // row[18]
|
||||
"FamilyPhone," // row[19]
|
||||
"OriginPlace," // row[20]
|
||||
"DATE_FORMAT(Birthday,"
|
||||
"'%%Y%%m%%d')," // row[21]
|
||||
"Comments," // row[22]
|
||||
"NotifNtfEvents," // row[23]
|
||||
"EmailNtfEvents," // row[24]
|
||||
|
||||
// Preferences (usually not necessary
|
||||
// when getting another user's data)
|
||||
"Language," // row[25]
|
||||
"FirstDayOfWeek," // row[26]
|
||||
"DateFormat," // row[27]
|
||||
"Theme," // row[28]
|
||||
"IconSet," // row[29]
|
||||
"Menu," // row[30]
|
||||
"SideCols," // row[31]
|
||||
"ThirdPartyCookies" // row[32]
|
||||
" FROM usr_data"
|
||||
" WHERE UsrCod=%ld",
|
||||
UsrDat->UsrCod);
|
||||
break;
|
||||
}
|
||||
|
||||
if (NumRows != 1)
|
||||
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
|
||||
|
||||
/***** Read user's data *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get encrypted user's code */
|
||||
/* Get encrypted user's code (row[0]) */
|
||||
Str_Copy (UsrDat->EncryptedUsrCod,row[0],
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get encrypted password */
|
||||
/* Get encrypted password (row[1]) */
|
||||
Str_Copy (UsrDat->Password,row[1],
|
||||
Pwd_BYTES_ENCRYPTED_PASSWORD);
|
||||
|
||||
|
@ -573,122 +583,143 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
|
||||
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
|
||||
|
||||
/* Get name */
|
||||
/* Get name (row[2], row[3], row[4]) */
|
||||
Str_Copy (UsrDat->Surname1,row[2],
|
||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||
Str_Copy (UsrDat->Surname2,row[3],
|
||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||
Str_Copy (UsrDat->FirstName,row[4],
|
||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||
|
||||
/* Get sex */
|
||||
UsrDat->Sex = Usr_GetSexFromStr (row[5]);
|
||||
|
||||
/* Get theme */
|
||||
UsrDat->Prefs.Theme = The_THEME_DEFAULT;
|
||||
for (Theme = (The_Theme_t) 0;
|
||||
Theme < The_NUM_THEMES;
|
||||
Theme++)
|
||||
if (!strcasecmp (row[6],The_ThemeId[Theme]))
|
||||
{
|
||||
UsrDat->Prefs.Theme = Theme;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get icon set */
|
||||
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
|
||||
for (IconSet = (Ico_IconSet_t) 0;
|
||||
IconSet < Ico_NUM_ICON_SETS;
|
||||
IconSet++)
|
||||
if (!strcasecmp (row[7],Ico_IconSetId[IconSet]))
|
||||
{
|
||||
UsrDat->Prefs.IconSet = IconSet;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get language */
|
||||
UsrDat->Prefs.Language = Lan_LANGUAGE_UNKNOWN; // Language unknown
|
||||
for (Lan = (Lan_Language_t) 1;
|
||||
Lan <= Lan_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
if (!strcasecmp (row[8],Lan_STR_LANG_ID[Lan]))
|
||||
{
|
||||
UsrDat->Prefs.Language = Lan;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get first day of week */
|
||||
UsrDat->Prefs.FirstDayOfWeek = Cal_GetFirstDayOfWeekFromStr (row[9]);
|
||||
|
||||
/* Get date format */
|
||||
UsrDat->Prefs.DateFormat = Dat_GetDateFormatFromStr (row[10]);
|
||||
|
||||
/* Get rest of data */
|
||||
Str_Copy (UsrDat->Photo,row[11],
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[12]);
|
||||
UsrDat->ProfileVisibility = Pri_GetVisibilityFromStr (row[13]);
|
||||
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[14]);
|
||||
UsrDat->InsCtyCod = Str_ConvertStrCodToLongCod (row[15]);
|
||||
UsrDat->InsCod = Str_ConvertStrCodToLongCod (row[16]);
|
||||
|
||||
UsrDat->Tch.DptCod = Str_ConvertStrCodToLongCod (row[17]);
|
||||
UsrDat->Tch.CtrCod = Str_ConvertStrCodToLongCod (row[18]);
|
||||
Str_Copy (UsrDat->Tch.Office,row[19],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
Str_Copy (UsrDat->Tch.OfficePhone,row[20],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
|
||||
Str_Copy (UsrDat->LocalAddress,row[21],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
Str_Copy (UsrDat->LocalPhone,row[22],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->FamilyAddress,row[23],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
Str_Copy (UsrDat->FamilyPhone,row[24],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->OriginPlace,row[25],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
|
||||
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[26]);
|
||||
|
||||
Usr_GetUsrCommentsFromString (row[27] ? row[27] :
|
||||
"",
|
||||
UsrDat); // Get the comments comunes a todas the courses
|
||||
|
||||
/* Get menu */
|
||||
UsrDat->Prefs.Menu = Mnu_GetMenuFromStr (row[28]);
|
||||
|
||||
/* Get if user wants to show side columns */
|
||||
if (sscanf (row[29],"%u",&UsrDat->Prefs.SideCols) == 1)
|
||||
{
|
||||
if (UsrDat->Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS)
|
||||
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
|
||||
}
|
||||
else
|
||||
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
|
||||
|
||||
/* Get if user accepts third party cookies */
|
||||
UsrDat->Prefs.AcceptThirdPartyCookies = (row[30][0] == 'Y');
|
||||
|
||||
/* Get on which events the user wants to be notified inside the platform */
|
||||
if (sscanf (row[31],"%u",&UsrDat->Prefs.NotifNtfEvents) != 1)
|
||||
UsrDat->Prefs.NotifNtfEvents = (unsigned) -1; // 0xFF..FF
|
||||
|
||||
/* Get on which events the user wants to be notified by email */
|
||||
if (sscanf (row[32],"%u",&UsrDat->Prefs.EmailNtfEvents) != 1)
|
||||
UsrDat->Prefs.EmailNtfEvents = 0;
|
||||
if (UsrDat->Prefs.EmailNtfEvents >= (1 << Ntf_NUM_NOTIFY_EVENTS)) // Maximum binary value for NotifyEvents is 000...0011...11
|
||||
UsrDat->Prefs.EmailNtfEvents = 0;
|
||||
|
||||
Str_ConvertToTitleType (UsrDat->Surname1 );
|
||||
Str_ConvertToTitleType (UsrDat->Surname2 );
|
||||
Str_ConvertToTitleType (UsrDat->FirstName);
|
||||
/* Create full name using FirstName, Surname1 and Surname2 */
|
||||
Usr_BuildFullName (UsrDat);
|
||||
Usr_BuildFullName (UsrDat); // Create full name using FirstName, Surname1 and Surname2
|
||||
|
||||
/* Get sex (row[5]) */
|
||||
UsrDat->Sex = Usr_GetSexFromStr (row[5]);
|
||||
|
||||
/* Get photo (row[6]) */
|
||||
Str_Copy (UsrDat->Photo,row[6],
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get photo visibility (row[7]) */
|
||||
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[7]);
|
||||
|
||||
/* Get profile visibility (row[8]) */
|
||||
UsrDat->ProfileVisibility = Pri_GetVisibilityFromStr (row[8]);
|
||||
|
||||
/* Get country (row[9]) */
|
||||
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[9]);
|
||||
|
||||
/* Get institution country (row[10]) and institution (row[11]) */
|
||||
UsrDat->InsCtyCod = Str_ConvertStrCodToLongCod (row[10]);
|
||||
UsrDat->InsCod = Str_ConvertStrCodToLongCod (row[11]);
|
||||
|
||||
/* Get department (row[12]) */
|
||||
UsrDat->Tch.DptCod = Str_ConvertStrCodToLongCod (row[12]);
|
||||
|
||||
/* Get centre (row[13]) */
|
||||
UsrDat->Tch.CtrCod = Str_ConvertStrCodToLongCod (row[13]);
|
||||
|
||||
/* Get office (row[14]) and office phone (row[15]) */
|
||||
Str_Copy (UsrDat->Tch.Office,row[14],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
Str_Copy (UsrDat->Tch.OfficePhone,row[15],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
|
||||
/* Get local address (row[16]) and local phone (row[17]) */
|
||||
Str_Copy (UsrDat->LocalAddress,row[16],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
Str_Copy (UsrDat->LocalPhone,row[17],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
|
||||
/* Get local address (row[18]) and local phone (row[19]) */
|
||||
Str_Copy (UsrDat->FamilyAddress,row[18],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
Str_Copy (UsrDat->FamilyPhone,row[19],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
|
||||
/* Get origin place (row[20]) */
|
||||
Str_Copy (UsrDat->OriginPlace,row[20],
|
||||
Usr_MAX_BYTES_ADDRESS);
|
||||
|
||||
/* Get birthday (row[21]) */
|
||||
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[21]);
|
||||
Dat_ConvDateToDateStr (&(UsrDat->Birthday),UsrDat->StrBirthday);
|
||||
|
||||
/* Get comments (row[22]) */
|
||||
Usr_GetUsrCommentsFromString (row[22] ? row[22] :
|
||||
"",
|
||||
UsrDat);
|
||||
|
||||
/* Get on which events the user wants to be notified inside the platform (row[23]) */
|
||||
if (sscanf (row[23],"%u",&UsrDat->NtfEvents.CreateNotif) != 1)
|
||||
UsrDat->NtfEvents.CreateNotif = (unsigned) -1; // 0xFF..FF
|
||||
|
||||
/* Get on which events the user wants to be notified by email (row[24]) */
|
||||
if (sscanf (row[24],"%u",&UsrDat->NtfEvents.SendEmail) != 1)
|
||||
UsrDat->NtfEvents.SendEmail = 0;
|
||||
if (UsrDat->NtfEvents.SendEmail >= (1 << Ntf_NUM_NOTIFY_EVENTS)) // Maximum binary value for NotifyEvents is 000...0011...11
|
||||
UsrDat->NtfEvents.SendEmail = 0;
|
||||
|
||||
/***** Get user's preferences *****/
|
||||
if (GetPrefs == Usr_GET_PREFS)
|
||||
{
|
||||
/* Get language (row[25]) */
|
||||
UsrDat->Prefs.Language = Lan_LANGUAGE_UNKNOWN; // Language unknown
|
||||
for (Lan = (Lan_Language_t) 1;
|
||||
Lan <= Lan_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
if (!strcasecmp (row[25],Lan_STR_LANG_ID[Lan]))
|
||||
{
|
||||
UsrDat->Prefs.Language = Lan;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get first day of week (row[26]) */
|
||||
UsrDat->Prefs.FirstDayOfWeek = Cal_GetFirstDayOfWeekFromStr (row[26]);
|
||||
|
||||
/* Get date format (row[27]) */
|
||||
UsrDat->Prefs.DateFormat = Dat_GetDateFormatFromStr (row[27]);
|
||||
|
||||
/* Get theme (row[28]) */
|
||||
UsrDat->Prefs.Theme = The_THEME_DEFAULT;
|
||||
for (Theme = (The_Theme_t) 0;
|
||||
Theme < The_NUM_THEMES;
|
||||
Theme++)
|
||||
if (!strcasecmp (row[28],The_ThemeId[Theme]))
|
||||
{
|
||||
UsrDat->Prefs.Theme = Theme;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get icon set (row[29]) */
|
||||
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
|
||||
for (IconSet = (Ico_IconSet_t) 0;
|
||||
IconSet < Ico_NUM_ICON_SETS;
|
||||
IconSet++)
|
||||
if (!strcasecmp (row[29],Ico_IconSetId[IconSet]))
|
||||
{
|
||||
UsrDat->Prefs.IconSet = IconSet;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get menu (row[30]) */
|
||||
UsrDat->Prefs.Menu = Mnu_GetMenuFromStr (row[28]);
|
||||
|
||||
/* Get if user wants to show side columns (row[31]) */
|
||||
if (sscanf (row[29],"%u",&UsrDat->Prefs.SideCols) == 1)
|
||||
{
|
||||
if (UsrDat->Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS)
|
||||
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
|
||||
}
|
||||
else
|
||||
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
|
||||
|
||||
/* Get if user accepts third party cookies (row[32]) */
|
||||
UsrDat->Prefs.AcceptThirdPartyCookies = (row[32][0] == 'Y');
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
|
@ -2914,7 +2945,7 @@ bool Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (void)
|
|||
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
||||
|
||||
/***** Check if user exists and get her/his data *****/
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Existing user
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -3022,7 +3053,7 @@ void Usr_ChkUsrAndGetUsrData (void)
|
|||
/***** Get user's data *****/
|
||||
Usr_GetParamOtherUsrCodEncrypted (&Gbl.Usrs.Me.UsrDat);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Me.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat)) // User logged in
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_GET_PREFS)) // User logged in
|
||||
{
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Usr_SetMyPrefsAndRoles ();
|
||||
|
@ -3200,7 +3231,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void)
|
|||
}
|
||||
|
||||
/***** Get user's data *****/
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_GET_PREFS);
|
||||
|
||||
/***** Check password *****/
|
||||
/* Check user's password:
|
||||
|
@ -3233,7 +3264,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromSession (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod = Gbl.Session.UsrCod;
|
||||
|
||||
/* Check if user exists in database, and get his/her data */
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat))
|
||||
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_GET_PREFS))
|
||||
{
|
||||
Usr_ShowAlertUsrDoesNotExistsOrWrongPassword ();
|
||||
return false;
|
||||
|
@ -3416,13 +3447,13 @@ static void Usr_PutLinkToLogOut (void)
|
|||
// Output: When true ==> UsrDat will hold all user's data
|
||||
// When false ==> UsrDat is reset, except user's code
|
||||
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat)
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs)
|
||||
{
|
||||
/***** Check if a user exists having this user's code *****/
|
||||
if (Usr_ChkIfUsrCodExists (UsrDat->UsrCod))
|
||||
{
|
||||
/* Get user's data */
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat);
|
||||
Usr_GetAllUsrDataFromUsrCod (UsrDat,GetPrefs);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5745,7 +5776,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
|||
if (ListUsrCods.NumUsrs == 1) // Only if user is valid
|
||||
{
|
||||
/* Get user's data */
|
||||
Usr_GetUsrDataFromUsrCod (&UsrDat); // Really only EncryptedUsrCod is needed
|
||||
Usr_GetUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Really only EncryptedUsrCod is needed
|
||||
|
||||
/* Find if encrypted user's code is already in list */
|
||||
if (!Usr_FindUsrCodInListOfSelectedUsrs (UsrDat.EncryptedUsrCod)) // If not in list ==> add it
|
||||
|
@ -6520,7 +6551,7 @@ void Usr_ListAllDataGsts (void)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Rol_GST].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_GST].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
UsrDat.Accepted = false; // Guests have no courses,...
|
||||
// ...so they have not accepted...
|
||||
|
@ -6722,7 +6753,7 @@ void Usr_ListAllDataStds (void)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].Accepted;
|
||||
NumUsr++;
|
||||
|
@ -6784,7 +6815,7 @@ static void Usr_ListUsrsForSelection (Rol_Role_t Role)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted;
|
||||
Usr_WriteRowUsrMainData (++NumUsr,&UsrDat,true,Role);
|
||||
|
@ -6915,7 +6946,7 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role,
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Role].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].Accepted;
|
||||
NumUsr++;
|
||||
|
@ -7164,7 +7195,7 @@ void Usr_ListDataAdms (void)
|
|||
NumUsr < Gbl.Usrs.LstUsrs[Rol_DEG_ADM].NumUsrs; )
|
||||
{
|
||||
UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // If user's data exist...
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // If user's data exist...
|
||||
{
|
||||
UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].Accepted;
|
||||
Usr_WriteRowAdmData (++NumUsr,&UsrDat);
|
||||
|
@ -9476,7 +9507,7 @@ void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
|
|||
|
||||
/***** Get data of author *****/
|
||||
UsrDat.UsrCod = UsrCod;
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS))
|
||||
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
|
||||
|
||||
/***** Show photo *****/
|
||||
|
|
21
swad_user.h
21
swad_user.h
|
@ -86,6 +86,13 @@
|
|||
/******************************** Public types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// Get user's data with or without personal settings
|
||||
typedef enum
|
||||
{
|
||||
Usr_DONT_GET_PREFS = 0,
|
||||
Usr_GET_PREFS = 1,
|
||||
} Usr_GetPrefs_t;
|
||||
|
||||
// Related with user's sexs
|
||||
#define Usr_NUM_SEXS 4 // Unknown, female, male, all
|
||||
typedef enum
|
||||
|
@ -183,6 +190,11 @@ struct UsrData
|
|||
char Office [Usr_MAX_BYTES_ADDRESS + 1];
|
||||
char OfficePhone [Usr_MAX_BYTES_PHONE + 1];
|
||||
} Tch;
|
||||
struct
|
||||
{
|
||||
unsigned CreateNotif; // One bit activated for each type of event
|
||||
unsigned SendEmail; // One bit activated for each type of event
|
||||
} NtfEvents;
|
||||
struct
|
||||
{
|
||||
Lan_Language_t Language;
|
||||
|
@ -193,8 +205,6 @@ struct UsrData
|
|||
Mnu_Menu_t Menu;
|
||||
unsigned SideCols;
|
||||
bool AcceptThirdPartyCookies; // User has accepted third party cookies
|
||||
unsigned NotifNtfEvents; // One bit activated for each type of event
|
||||
unsigned EmailNtfEvents; // One bit activated for each type of event
|
||||
} Prefs;
|
||||
};
|
||||
|
||||
|
@ -246,13 +256,12 @@ void Usr_UsrDataConstructor (struct UsrData *UsrDat);
|
|||
void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat);
|
||||
void Usr_ResetMyLastData (void);
|
||||
void Usr_UsrDataDestructor (struct UsrData *UsrDat);
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat);
|
||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
|
||||
void Usr_AllocateListUsrCods (struct ListUsrCods *ListUsrCods);
|
||||
void Usr_FreeListUsrCods (struct ListUsrCods *ListUsrCods);
|
||||
bool Usr_ItsMe (long UsrCod);
|
||||
void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat);
|
||||
void Usr_GetEncryptedUsrCodFromUsrCod (struct UsrData *UsrDat); // TODO: Remove this funcion, it's not used
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat);
|
||||
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
|
||||
|
||||
void Usr_BuildFullName (struct UsrData *UsrDat);
|
||||
|
||||
|
@ -357,7 +366,7 @@ void Usr_ChkUsrAndGetUsrData (void);
|
|||
|
||||
void Usr_ShowFormsLogoutAndRole (void);
|
||||
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat);
|
||||
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
|
||||
void Usr_UpdateMyLastData (void);
|
||||
void Usr_InsertMyLastCrsTabAndTime (void);
|
||||
|
||||
|
|
|
@ -1175,7 +1175,7 @@ int swad__getNewPassword (struct soap *soap,
|
|||
/***** Get user code (row[0]) *****/
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat); // Get my data
|
||||
Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Usr_DONT_GET_PREFS); // Get my data
|
||||
|
||||
if (Gbl.Usrs.Me.UsrDat.Email[0])
|
||||
if (Pwd_SendNewPasswordByEmail (NewRandomPlainPassword) == 0) // Message sent successfully
|
||||
|
@ -3396,12 +3396,12 @@ int swad__sendMessage (struct soap *soap,
|
|||
/* Get user's code (row[0]) */
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = (long) Str_ConvertStrCodToLongCod (row[0])) > 0)
|
||||
/* Get recipient data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
{
|
||||
/* This received message must be notified by email? */
|
||||
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
NotifyByEmail = (!ItsMe &&
|
||||
(Gbl.Usrs.Other.UsrDat.Prefs.EmailNtfEvents & (1 << Ntf_EVENT_MESSAGE)));
|
||||
(Gbl.Usrs.Other.UsrDat.NtfEvents.SendEmail & (1 << Ntf_EVENT_MESSAGE)));
|
||||
|
||||
/* Send message to this user */
|
||||
if ((ReturnCode = Svc_SendMessageToUsr ((long) messageCode,Gbl.Usrs.Me.UsrDat.UsrCod,ReplyUsrCod,Gbl.Usrs.Other.UsrDat.UsrCod,NotifyByEmail,subject,body)) != SOAP_OK)
|
||||
|
@ -4569,7 +4569,7 @@ static bool Svc_WriteRowFileBrowser (unsigned Level,Brw_FileType_t FileType,cons
|
|||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
||||
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = FileMetadata.PublisherUsrCod;
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS);
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||
|
||||
fprintf (Gbl.F.XML,"<file name=\"%s\">"
|
||||
|
@ -4750,7 +4750,7 @@ int swad__getFile (struct soap *soap,
|
|||
|
||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = FileMetadata.PublisherUsrCod) > 0)
|
||||
/* Get publisher's data */
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||
/* Copy publisher's data into output structure */
|
||||
{
|
||||
Str_Copy (getFileOut->publisherName,Gbl.Usrs.Other.UsrDat.FullName,
|
||||
|
|
|
@ -188,7 +188,7 @@ void ZIP_CreateZIPAsgWrk (void)
|
|||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
|
||||
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get user's data from database
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS)) // Get user's data from database
|
||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
||||
ZIP_CreateDirCompressionUsr (&UsrDat);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user