mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-13 04:04:35 +02:00
Version 18.3.9
This commit is contained in:
parent
43f6a24a45
commit
8f0f23c30c
16
swad_ID.c
16
swad_ID.c
|
@ -401,7 +401,7 @@ void ID_WriteUsrIDs (struct UsrData *UsrDat,const char *Anchor)
|
||||||
|
|
||||||
bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
|
bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
@ -505,7 +505,7 @@ void ID_PutLinkToChangeUsrIDs (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Change_IDs;
|
extern const char *Txt_Change_IDs;
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Link for changing the password *****/
|
/***** Link for changing the password *****/
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
|
@ -561,7 +561,7 @@ void ID_ShowFormOthIDs (void)
|
||||||
|
|
||||||
/***** Form with the user's ID *****/
|
/***** Form with the user's ID *****/
|
||||||
Tbl_StartTableWide (2);
|
Tbl_StartTableWide (2);
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||||
Tbl_EndTable ();
|
Tbl_EndTable ();
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ void ID_RemoveOtherUsrID (void)
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/***** Remove user's ID *****/
|
/***** Remove user's ID *****/
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
ID_RemoveUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
ID_RemoveUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||||
|
|
||||||
/***** Update list of IDs *****/
|
/***** Update list of IDs *****/
|
||||||
|
@ -868,7 +868,7 @@ void ID_NewOtherUsrID (void)
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/***** New user's ID *****/
|
/***** New user's ID *****/
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
ID_NewUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
ID_NewUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||||
|
|
||||||
/***** Update list of IDs *****/
|
/***** Update list of IDs *****/
|
||||||
|
@ -999,6 +999,7 @@ void ID_ConfirmOtherUsrID (void)
|
||||||
long OriginalActCod;
|
long OriginalActCod;
|
||||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||||
bool ICanConfirm;
|
bool ICanConfirm;
|
||||||
|
bool ItsMe;
|
||||||
bool Found;
|
bool Found;
|
||||||
unsigned NumID;
|
unsigned NumID;
|
||||||
unsigned NumIDFound = 0; // Initialized to avoid warning
|
unsigned NumIDFound = 0; // Initialized to avoid warning
|
||||||
|
@ -1013,9 +1014,12 @@ void ID_ConfirmOtherUsrID (void)
|
||||||
/***** Get other user's code from form and get user's data *****/
|
/***** Get other user's code from form and get user's data *****/
|
||||||
ICanConfirm = false;
|
ICanConfirm = false;
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // Not me
|
{
|
||||||
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
if (!ItsMe) // Not me
|
||||||
if (ID_ICanSeeOtherUsrIDs (&Gbl.Usrs.Other.UsrDat))
|
if (ID_ICanSeeOtherUsrIDs (&Gbl.Usrs.Other.UsrDat))
|
||||||
ICanConfirm = true;
|
ICanConfirm = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ICanConfirm)
|
if (ICanConfirm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -900,7 +900,7 @@ void Acc_GetUsrCodAndRemUsrGbl (void)
|
||||||
|
|
||||||
void Acc_ReqRemAccountOrRemAccount (Acc_ReqOrRemUsr_t RequestOrRemove)
|
void Acc_ReqRemAccountOrRemAccount (Acc_ReqOrRemUsr_t RequestOrRemove)
|
||||||
{
|
{
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
switch (RequestOrRemove)
|
switch (RequestOrRemove)
|
||||||
{
|
{
|
||||||
|
@ -927,8 +927,7 @@ void Acc_ReqRemAccountOrRemAccount (Acc_ReqOrRemUsr_t RequestOrRemove)
|
||||||
|
|
||||||
bool Acc_CheckIfICanEliminateAccount (long UsrCod)
|
bool Acc_CheckIfICanEliminateAccount (long UsrCod)
|
||||||
{
|
{
|
||||||
bool ItsMe = (Gbl.Usrs.Me.Logged &&
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
// A user logged as superuser can eliminate any user except her/him
|
// A user logged as superuser can eliminate any user except her/him
|
||||||
// Other users only can eliminate themselves
|
// Other users only can eliminate themselves
|
||||||
|
@ -936,7 +935,7 @@ bool Acc_CheckIfICanEliminateAccount (long UsrCod)
|
||||||
(Gbl.Usrs.Me.Role.Available & (1 << Rol_SYS_ADM)) == 0) // I can not be system admin
|
(Gbl.Usrs.Me.Role.Available & (1 << Rol_SYS_ADM)) == 0) // I can not be system admin
|
||||||
||
|
||
|
||||||
(!ItsMe && // It's not me
|
(!ItsMe && // It's not me
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); // I am logged as system admin
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); // I am logged as system admin
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -365,7 +365,7 @@ void Agd_ShowUsrAgenda (void)
|
||||||
|
|
||||||
/***** Start box *****/
|
/***** Start box *****/
|
||||||
sprintf (Gbl.Title,Txt_Public_agenda_USER,Gbl.Usrs.Other.UsrDat.FullName);
|
sprintf (Gbl.Title,Txt_Public_agenda_USER,Gbl.Usrs.Other.UsrDat.FullName);
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
Box_StartBox ("100%",Gbl.Title,
|
Box_StartBox ("100%",Gbl.Title,
|
||||||
ItsMe ? Agd_PutIconsMyPublicAgenda :
|
ItsMe ? Agd_PutIconsMyPublicAgenda :
|
||||||
Agd_PutIconsOtherPublicAgenda,
|
Agd_PutIconsOtherPublicAgenda,
|
||||||
|
@ -408,7 +408,7 @@ void Agd_ShowOtherAgendaAfterLogIn (void)
|
||||||
{
|
{
|
||||||
/***** Start box *****/
|
/***** Start box *****/
|
||||||
sprintf (Gbl.Title,Txt_Public_agenda_USER,Gbl.Usrs.Other.UsrDat.FullName);
|
sprintf (Gbl.Title,Txt_Public_agenda_USER,Gbl.Usrs.Other.UsrDat.FullName);
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
Box_StartBox ("100%",Gbl.Title,
|
Box_StartBox ("100%",Gbl.Title,
|
||||||
ItsMe ? Agd_PutIconToViewEditMyFullAgenda :
|
ItsMe ? Agd_PutIconToViewEditMyFullAgenda :
|
||||||
Agd_PutIconsOtherPublicAgenda,
|
Agd_PutIconsOtherPublicAgenda,
|
||||||
|
|
|
@ -2037,6 +2037,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
char CommentStd[Cns_MAX_BYTES_TEXT + 1];
|
char CommentStd[Cns_MAX_BYTES_TEXT + 1];
|
||||||
char CommentTch[Cns_MAX_BYTES_TEXT + 1];
|
char CommentTch[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
bool ItsMe;
|
||||||
bool ICanChangeStdAttendance;
|
bool ICanChangeStdAttendance;
|
||||||
bool ICanEditStdComment;
|
bool ICanEditStdComment;
|
||||||
bool ICanEditTchComment;
|
bool ICanEditTchComment;
|
||||||
|
@ -2046,7 +2047,8 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
// A student can see only her/his attendance
|
// A student can see only her/his attendance
|
||||||
if (UsrDat->UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod)
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
if (!ItsMe)
|
||||||
Lay_ShowErrorAndExit ("Wrong call.");
|
Lay_ShowErrorAndExit ("Wrong call.");
|
||||||
ICanChangeStdAttendance = false;
|
ICanChangeStdAttendance = false;
|
||||||
ICanEditStdComment = Att->Open; // Attendance event is open
|
ICanEditStdComment = Att->Open; // Attendance event is open
|
||||||
|
@ -2253,7 +2255,8 @@ void Att_RegisterMeAsStdInAttEvent (void)
|
||||||
if (Att.Open)
|
if (Att.Open)
|
||||||
{
|
{
|
||||||
/***** Get comments for this student *****/
|
/***** Get comments for this student *****/
|
||||||
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod,CommentStd,CommentTch);
|
Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Att.AttCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
CommentStd,CommentTch);
|
||||||
sprintf (CommentParamName,"CommentStd%ld",Gbl.Usrs.Me.UsrDat.UsrCod);
|
sprintf (CommentParamName,"CommentStd%ld",Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Par_GetParToHTML (CommentParamName,CommentStd,Cns_MAX_BYTES_TEXT);
|
Par_GetParToHTML (CommentParamName,CommentStd,Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.3.8 (2018-10-10)"
|
#define Log_PLATFORM_VERSION "SWAD 18.3.9 (2018-10-11)"
|
||||||
#define CSS_FILE "swad18.3.css"
|
#define CSS_FILE "swad18.3.css"
|
||||||
#define JS_FILE "swad17.17.1.js"
|
#define JS_FILE "swad17.17.1.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.3.9: Oct 11, 2018 Code refactoring related with checking if I am the logged user. (235046 lines)
|
||||||
Version 18.3.8: Oct 10, 2018 Code refactoring related with checking if I am the logged user. (234984 lines)
|
Version 18.3.8: Oct 10, 2018 Code refactoring related with checking if I am the logged user. (234984 lines)
|
||||||
Version 18.3.7: Oct 10, 2018 Fixed bug in icon in breadcrumb to go to user's courses. (234947 lines)
|
Version 18.3.7: Oct 10, 2018 Fixed bug in icon in breadcrumb to go to user's courses. (234947 lines)
|
||||||
Version 18.3.6: Oct 09, 2018 Change in layout of user's record card. (234937 lines)
|
Version 18.3.6: Oct 09, 2018 Change in layout of user's record card. (234937 lines)
|
||||||
|
|
|
@ -961,14 +961,13 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
|
||||||
const char *Font = (Gbl.Usrs.Connected.Lst[Gbl.Usrs.Connected.NumUsr].ThisCrs ? "CON_CRS" :
|
const char *Font = (Gbl.Usrs.Connected.Lst[Gbl.Usrs.Connected.NumUsr].ThisCrs ? "CON_CRS" :
|
||||||
"CON_NO_CRS");
|
"CON_NO_CRS");
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
struct UsrData OtherUsrDat;
|
|
||||||
struct UsrData *UsrDat;
|
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
|
struct UsrData *UsrDat;
|
||||||
|
struct UsrData OtherUsrDat;
|
||||||
|
|
||||||
/***** Get user's code from list *****/
|
/***** Get user's code from list *****/
|
||||||
UsrCod = Gbl.Usrs.Connected.Lst[Gbl.Usrs.Connected.NumUsr].UsrCod;
|
UsrCod = Gbl.Usrs.Connected.Lst[Gbl.Usrs.Connected.NumUsr].UsrCod;
|
||||||
ItsMe = (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (UsrCod);
|
||||||
UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); // It's me
|
|
||||||
|
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
UsrDat = &Gbl.Usrs.Me.UsrDat;
|
UsrDat = &Gbl.Usrs.Me.UsrDat;
|
||||||
|
|
|
@ -86,7 +86,7 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/* Check if it's allowed to me to report users as possible duplicatedr */
|
/* Check if it's allowed to me to report users as possible duplicatedr */
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
if (!ItsMe && Gbl.Usrs.Me.Role.Logged >= Rol_TCH)
|
if (!ItsMe && Gbl.Usrs.Me.Role.Logged >= Rol_TCH)
|
||||||
{
|
{
|
||||||
/***** Insert possible duplicate into database *****/
|
/***** Insert possible duplicate into database *****/
|
||||||
|
|
|
@ -151,7 +151,8 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat);
|
||||||
static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *Crs,
|
static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *Crs,
|
||||||
Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose);
|
Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose);
|
||||||
|
|
||||||
static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,const char *InsCtrDegName);
|
static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,
|
||||||
|
const char *InsCtrDegName);
|
||||||
static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope,
|
static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope,
|
||||||
long Cod,const char *InsCtrDegName);
|
long Cod,const char *InsCtrDegName);
|
||||||
|
|
||||||
|
@ -308,6 +309,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
||||||
bool CreateNotif;
|
bool CreateNotif;
|
||||||
bool NotifyByEmail;
|
bool NotifyByEmail;
|
||||||
Ntf_NotifyEvent_t NotifyEvent;
|
Ntf_NotifyEvent_t NotifyEvent;
|
||||||
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
/***** Check if user's role is allowed *****/
|
/***** Check if user's role is allowed *****/
|
||||||
switch (NewRole)
|
switch (NewRole)
|
||||||
|
@ -336,8 +338,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
|
||||||
|
|
||||||
/***** Create new notification ******/
|
/***** Create new notification ******/
|
||||||
CreateNotif = (UsrDat->Prefs.NotifNtfEvents & (1 << NotifyEvent));
|
CreateNotif = (UsrDat->Prefs.NotifNtfEvents & (1 << NotifyEvent));
|
||||||
NotifyByEmail = CreateNotif &&
|
NotifyByEmail = CreateNotif && !ItsMe &&
|
||||||
(UsrDat->UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) &&
|
|
||||||
(UsrDat->Prefs.EmailNtfEvents & (1 << NotifyEvent));
|
(UsrDat->Prefs.EmailNtfEvents & (1 << NotifyEvent));
|
||||||
if (CreateNotif)
|
if (CreateNotif)
|
||||||
Ntf_StoreNotifyEventToOneUser (NotifyEvent,UsrDat,-1L,
|
Ntf_StoreNotifyEventToOneUser (NotifyEvent,UsrDat,-1L,
|
||||||
|
@ -3527,7 +3528,7 @@ static bool Enr_CheckIfICanRemUsrFromCrs (void)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
return ItsMe; // A student or non-editing teacher can remove herself/himself
|
return ItsMe; // A student or non-editing teacher can remove herself/himself
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_DEG_ADM:
|
case Rol_DEG_ADM:
|
||||||
|
@ -3619,7 +3620,7 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/* Check if it's forbidden to remove an administrator */
|
/* Check if it's forbidden to remove an administrator */
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
ICanRemove = (ItsMe ||
|
ICanRemove = (ItsMe ||
|
||||||
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
|
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
|
||||||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
|
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
|
||||||
|
@ -3878,7 +3879,7 @@ void Enr_ModifyUsr1 (void)
|
||||||
/***** Get user from form *****/
|
/***** Get user from form *****/
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Get the action to do *****/
|
/***** Get the action to do *****/
|
||||||
Gbl.Usrs.RegRemAction = (Enr_RegRemOneUsrAction_t)
|
Gbl.Usrs.RegRemAction = (Enr_RegRemOneUsrAction_t)
|
||||||
|
@ -4103,7 +4104,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
|
||||||
|
|
||||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
|
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
|
||||||
{
|
{
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Show question and button to remove user as administrator *****/
|
/***** Show question and button to remove user as administrator *****/
|
||||||
/* Start alert */
|
/* Start alert */
|
||||||
|
@ -4157,7 +4158,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
||||||
extern const char *Txt_THE_USER_X_has_been_removed_from_the_course_Y;
|
extern const char *Txt_THE_USER_X_has_been_removed_from_the_course_Y;
|
||||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
|
if (Usr_CheckIfUsrBelongsToCurrentCrs (UsrDat))
|
||||||
{
|
{
|
||||||
|
@ -4242,7 +4243,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
||||||
/** Ask if really wanted to remove an administrator from current institution */
|
/** Ask if really wanted to remove an administrator from current institution */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,const char *InsCtrDegName)
|
static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,
|
||||||
|
const char *InsCtrDegName)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X;
|
extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X;
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_X;
|
extern const char *Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_X;
|
||||||
|
|
|
@ -7223,7 +7223,8 @@ void Brw_RemSubtreeInFileBrowser (void)
|
||||||
Brw_RemoveChildrenOfFolderFromDB (Gbl.FileBrowser.Priv.FullPathInTree);
|
Brw_RemoveChildrenOfFolderFromDB (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
|
||||||
/* Remove affected clipboards */
|
/* Remove affected clipboards */
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/* Remove affected expanded folders */
|
/* Remove affected expanded folders */
|
||||||
Brw_RemoveAffectedExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
Brw_RemoveAffectedExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
@ -8266,7 +8267,8 @@ void Brw_PasteIntoFileBrowser (void)
|
||||||
Brw_PasteClipboard ();
|
Brw_PasteClipboard ();
|
||||||
|
|
||||||
/***** Remove the affected clipboards *****/
|
/***** Remove the affected clipboards *****/
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/***** Write message ******/
|
/***** Write message ******/
|
||||||
|
@ -9085,7 +9087,9 @@ void Brw_RecFolderFileBrowser (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Remove affected clipboards */
|
/* Remove affected clipboards */
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/* Add path where new file is created to table of expanded folders */
|
/* Add path where new file is created to table of expanded folders */
|
||||||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
@ -9397,7 +9401,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Remove affected clipboards */
|
/* Remove affected clipboards */
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/* Add path where new file is created to table of expanded folders */
|
/* Add path where new file is created to table of expanded folders */
|
||||||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
@ -9581,7 +9587,9 @@ void Brw_RecLinkFileBrowser (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Remove affected clipboards */
|
/* Remove affected clipboards */
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/* Add path where new file is created to table of expanded folders */
|
/* Add path where new file is created to table of expanded folders */
|
||||||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
@ -9744,7 +9752,9 @@ void Brw_SetDocumentAsVisible (void)
|
||||||
Brw_ChangeFileOrFolderHiddenInDB (Gbl.FileBrowser.Priv.FullPathInTree,false);
|
Brw_ChangeFileOrFolderHiddenInDB (Gbl.FileBrowser.Priv.FullPathInTree,false);
|
||||||
|
|
||||||
/***** Remove the affected clipboards *****/
|
/***** Remove the affected clipboards *****/
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Write message of confirmation *****/
|
/***** Write message of confirmation *****/
|
||||||
Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.Type,
|
Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.Type,
|
||||||
|
@ -9779,7 +9789,9 @@ void Brw_SetDocumentAsHidden (void)
|
||||||
Brw_ChangeFileOrFolderHiddenInDB (Gbl.FileBrowser.Priv.FullPathInTree,true);
|
Brw_ChangeFileOrFolderHiddenInDB (Gbl.FileBrowser.Priv.FullPathInTree,true);
|
||||||
|
|
||||||
/***** Remove the affected clipboards *****/
|
/***** Remove the affected clipboards *****/
|
||||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Write confirmation message *****/
|
/***** Write confirmation message *****/
|
||||||
Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.Type,
|
Brw_GetFileNameToShowDependingOnLevel (Gbl.FileBrowser.Type,
|
||||||
|
|
|
@ -496,7 +496,7 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat,
|
||||||
extern const char *Txt_Following_unfollow;
|
extern const char *Txt_Following_unfollow;
|
||||||
extern const char *Txt_Unfollow;
|
extern const char *Txt_Unfollow;
|
||||||
extern const char *Txt_Follow;
|
extern const char *Txt_Follow;
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
/***** Start section *****/
|
/***** Start section *****/
|
||||||
Lay_StartSection (Fol_FOLLOW_SECTION_ID);
|
Lay_StartSection (Fol_FOLLOW_SECTION_ID);
|
||||||
|
@ -531,7 +531,7 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat,
|
||||||
|
|
||||||
/* I follow user? */
|
/* I follow user? */
|
||||||
fprintf (Gbl.F.Out,"<div id=\"follow_usr\">");
|
fprintf (Gbl.F.Out,"<div id=\"follow_usr\">");
|
||||||
if (Gbl.Usrs.Me.Logged && !ItsMe) // It's another logged user
|
if (!ItsMe) // Not me
|
||||||
{
|
{
|
||||||
if (IFollowUsr) // I follow this user
|
if (IFollowUsr) // I follow this user
|
||||||
{
|
{
|
||||||
|
@ -755,6 +755,7 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
unsigned NumUsr;
|
unsigned NumUsr;
|
||||||
struct UsrData FollowerUsrDat;
|
struct UsrData FollowerUsrDat;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Show user's profile *****/
|
/***** Show user's profile *****/
|
||||||
if (Prf_ShowUserProfile (UsrDat))
|
if (Prf_ShowUserProfile (UsrDat))
|
||||||
|
@ -804,7 +805,8 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
/***** If it's me, mark possible notification as seen *****/
|
/***** If it's me, mark possible notification as seen *****/
|
||||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
if (ItsMe)
|
||||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_FOLLOWER,
|
Ntf_MarkNotifAsSeen (Ntf_EVENT_FOLLOWER,
|
||||||
-1L,-1L,
|
-1L,-1L,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -823,7 +825,7 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
char PhotoURL[PATH_MAX + 1];
|
char PhotoURL[PATH_MAX + 1];
|
||||||
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
|
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
/***** Show user's photo *****/
|
/***** Show user's photo *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"FOLLOW_PHOTO\">");
|
fprintf (Gbl.F.Out,"<td class=\"FOLLOW_PHOTO\">");
|
||||||
|
@ -851,7 +853,7 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (!Gbl.Usrs.Me.Logged || // Not logged
|
if (!Gbl.Usrs.Me.Logged || // Not logged
|
||||||
ItsMe) // It's me
|
ItsMe) // It's me
|
||||||
/* Inactive icon to follow/unfollow */
|
/* Inactive icon to follow/unfollow */
|
||||||
|
@ -879,7 +881,7 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
char PhotoURL[PATH_MAX + 1];
|
char PhotoURL[PATH_MAX + 1];
|
||||||
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
|
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
/***** Show user's photo *****/
|
/***** Show user's photo *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
|
43
swad_forum.c
43
swad_forum.c
|
@ -1191,6 +1191,7 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod,
|
||||||
char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
|
char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
|
||||||
struct Image Image;
|
struct Image Image;
|
||||||
bool Enabled;
|
bool Enabled;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Initialize structure with user's data *****/
|
/***** Initialize structure with user's data *****/
|
||||||
Usr_UsrDataConstructor (&UsrDat);
|
Usr_UsrDataConstructor (&UsrDat);
|
||||||
|
@ -1298,24 +1299,28 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Form to remove post *****/
|
/***** Form to remove post *****/
|
||||||
if (LastPst && Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat.UsrCod)
|
if (LastPst)
|
||||||
// Post can be removed if post is the last (without answers) and it's mine
|
|
||||||
{
|
{
|
||||||
if (PstNum == 1) // First and unique post in thread
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||||
Act_FormStartAnchor (For_ActionsDelPstFor[Gbl.Forum.ForumSelected.Type],
|
if (ItsMe)
|
||||||
For_FORUM_THREADS_SECTION_ID);
|
{
|
||||||
else // Last of several posts in thread
|
// Post can be removed if post is the last (without answers) and it's mine
|
||||||
Act_FormStartAnchor (For_ActionsDelPstFor[Gbl.Forum.ForumSelected.Type],
|
if (PstNum == 1) // First and unique post in thread
|
||||||
For_FORUM_POSTS_SECTION_ID);
|
Act_FormStartAnchor (For_ActionsDelPstFor[Gbl.Forum.ForumSelected.Type],
|
||||||
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
For_FORUM_THREADS_SECTION_ID);
|
||||||
Gbl.Forum.CurrentPagePsts, // Page of posts = current
|
else // Last of several posts in thread
|
||||||
Gbl.Forum.ForumSet,
|
Act_FormStartAnchor (For_ActionsDelPstFor[Gbl.Forum.ForumSelected.Type],
|
||||||
Gbl.Forum.ThreadsOrder,
|
For_FORUM_POSTS_SECTION_ID);
|
||||||
Gbl.Forum.ForumSelected.Location,
|
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current
|
||||||
Gbl.Forum.ForumSelected.ThrCod,
|
Gbl.Forum.CurrentPagePsts, // Page of posts = current
|
||||||
PstCod);
|
Gbl.Forum.ForumSet,
|
||||||
Ico_PutIconRemove ();
|
Gbl.Forum.ThreadsOrder,
|
||||||
Act_FormEnd ();
|
Gbl.Forum.ForumSelected.Location,
|
||||||
|
Gbl.Forum.ForumSelected.ThrCod,
|
||||||
|
PstCod);
|
||||||
|
Ico_PutIconRemove ();
|
||||||
|
Act_FormEnd ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
|
@ -4069,6 +4074,7 @@ void For_RemovePost (void)
|
||||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||||
char OriginalContent[Cns_MAX_BYTES_LONG_TEXT + 1];
|
char OriginalContent[Cns_MAX_BYTES_LONG_TEXT + 1];
|
||||||
struct Image Image;
|
struct Image Image;
|
||||||
|
bool ItsMe;
|
||||||
bool ThreadDeleted = false;
|
bool ThreadDeleted = false;
|
||||||
|
|
||||||
/***** Get parameters related to forum *****/
|
/***** Get parameters related to forum *****/
|
||||||
|
@ -4087,7 +4093,8 @@ void For_RemovePost (void)
|
||||||
Lay_ShowErrorAndExit ("The post to remove no longer exists.");
|
Lay_ShowErrorAndExit ("The post to remove no longer exists.");
|
||||||
|
|
||||||
/* Check if I am the author of the message */
|
/* Check if I am the author of the message */
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod)
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||||
|
if (!ItsMe)
|
||||||
Lay_ShowErrorAndExit ("You can not remove post because you aren't the author.");
|
Lay_ShowErrorAndExit ("You can not remove post because you aren't the author.");
|
||||||
|
|
||||||
/* Check if the message is the last message in the thread */
|
/* Check if the message is the last message in the thread */
|
||||||
|
|
|
@ -1182,7 +1182,7 @@ unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *Lst
|
||||||
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
bool ItsMe = (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from all the groups of the course *****/
|
/***** Remove user from all the groups of the course *****/
|
||||||
sprintf (Query,"DELETE FROM crs_grp_usr"
|
sprintf (Query,"DELETE FROM crs_grp_usr"
|
||||||
|
@ -1206,7 +1206,7 @@ void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
||||||
void Grp_RemUsrFromAllGrps (long UsrCod)
|
void Grp_RemUsrFromAllGrps (long UsrCod)
|
||||||
{
|
{
|
||||||
char Query[128];
|
char Query[128];
|
||||||
bool ItsMe = (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from all groups *****/
|
/***** Remove user from all groups *****/
|
||||||
sprintf (Query,"DELETE FROM crs_grp_usr WHERE UsrCod=%ld",
|
sprintf (Query,"DELETE FROM crs_grp_usr WHERE UsrCod=%ld",
|
||||||
|
@ -1226,7 +1226,7 @@ void Grp_RemUsrFromAllGrps (long UsrCod)
|
||||||
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
||||||
{
|
{
|
||||||
char Query[256];
|
char Query[256];
|
||||||
bool ItsMe = (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from group *****/
|
/***** Remove user from group *****/
|
||||||
sprintf (Query,"DELETE FROM crs_grp_usr"
|
sprintf (Query,"DELETE FROM crs_grp_usr"
|
||||||
|
@ -3325,7 +3325,7 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 5. Fast check: It's me? *****/
|
/***** 5. Fast check: It's me? *****/
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -1137,7 +1137,7 @@ void Mai_PutLinkToChangeOtherUsrEmails (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Change_email;
|
extern const char *Txt_Change_email;
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Link for changing the password *****/
|
/***** Link for changing the password *****/
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
|
@ -1193,7 +1193,7 @@ void Mai_ShowFormOthEmail (void)
|
||||||
|
|
||||||
/***** Form with the user's email *****/
|
/***** Form with the user's email *****/
|
||||||
Tbl_StartTableCenter (2);
|
Tbl_StartTableCenter (2);
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||||
Tbl_EndTable ();
|
Tbl_EndTable ();
|
||||||
|
|
||||||
|
@ -1498,7 +1498,7 @@ void Mai_NewOtherUsrEmail (void)
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
/***** New user's ID *****/
|
/***** New user's ID *****/
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||||
|
|
||||||
/***** Show user's record *****/
|
/***** Show user's record *****/
|
||||||
|
@ -1889,7 +1889,7 @@ void Mai_WriteFootNoteEMail (Txt_Language_t Language)
|
||||||
|
|
||||||
bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
|
bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1453,7 +1453,8 @@ static void Msg_SetReceivedMsgAsReplied (long MsgCod)
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Update received message by setting Replied field to true *****/
|
/***** Update received message by setting Replied field to true *****/
|
||||||
sprintf (Query,"UPDATE msg_rcv SET Replied='Y' WHERE MsgCod=%ld AND UsrCod=%ld",
|
sprintf (Query,"UPDATE msg_rcv SET Replied='Y'"
|
||||||
|
" WHERE MsgCod=%ld AND UsrCod=%ld",
|
||||||
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
MsgCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryUPDATE (Query,"can not update a received message");
|
DB_QueryUPDATE (Query,"can not update a received message");
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,7 @@ void Nck_UpdateNick (void)
|
||||||
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
|
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
|
||||||
NewNicknameWithoutArroba);
|
NewNicknameWithoutArroba);
|
||||||
}
|
}
|
||||||
else if (strcasecmp (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba)) // My nickname does not match, not even case insensitive, the new nickname
|
else if (strcasecmp (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba)) // My nickname does not match, not even case insensitive, the new nickname
|
||||||
{
|
{
|
||||||
/***** Check if the new nickname matches any of my old nicknames *****/
|
/***** Check if the new nickname matches any of my old nicknames *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||||
|
@ -385,7 +385,7 @@ void Nck_UpdateNick (void)
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
sprintf (Query,"SELECT COUNT(*) FROM usr_nicknames"
|
||||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||||
NewNicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.UsrCod);
|
NewNicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that my nickname
|
if (DB_QueryCOUNT (Query,"can not check if nickname already existed")) // A nickname of another user is the same that my nickname
|
||||||
{
|
{
|
||||||
Error = true;
|
Error = true;
|
||||||
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_had_been_registered_by_another_user,
|
sprintf (Gbl.Alert.Txt,Txt_The_nickname_X_had_been_registered_by_another_user,
|
||||||
|
|
|
@ -2079,7 +2079,8 @@ static unsigned Ntf_GetNumberOfAllMyUnseenNtfs (void)
|
||||||
/***** Get number of places with a name from database *****/
|
/***** Get number of places with a name from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM notif"
|
sprintf (Query,"SELECT COUNT(*) FROM notif"
|
||||||
" WHERE ToUsrCod=%ld AND (Status & %u)=0",
|
" WHERE ToUsrCod=%ld AND (Status & %u)=0",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED));
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
(unsigned) (Ntf_STATUS_BIT_READ | Ntf_STATUS_BIT_REMOVED));
|
||||||
return DB_QueryCOUNT (Query,"can not get number of unseen notifications");
|
return DB_QueryCOUNT (Query,"can not get number of unseen notifications");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -918,7 +918,7 @@ void Pwd_PutLinkToChangeOtherUsrPassword (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Change_password;
|
extern const char *Txt_Change_password;
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Link for changing the password *****/
|
/***** Link for changing the password *****/
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
|
|
11
swad_photo.c
11
swad_photo.c
|
@ -135,7 +135,7 @@ static void Pho_ComputePhotoSize (int NumStds,int NumStdsWithPhoto,unsigned *Pho
|
||||||
|
|
||||||
bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
|
bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
@ -172,7 +172,7 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
|
||||||
char PhotoURL[PATH_MAX + 1];
|
char PhotoURL[PATH_MAX + 1];
|
||||||
const char *TitleText;
|
const char *TitleText;
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
bool ItsMe = (Gbl.Record.UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Record.UsrDat->UsrCod);
|
||||||
|
|
||||||
/***** Link for changing / uploading the photo *****/
|
/***** Link for changing / uploading the photo *****/
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
|
@ -300,7 +300,7 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat)
|
||||||
extern const char *Txt_You_can_send_a_file_with_an_image_in_JPEG_format_;
|
extern const char *Txt_You_can_send_a_file_with_an_image_in_JPEG_format_;
|
||||||
extern const char *Txt_File_with_the_photo;
|
extern const char *Txt_File_with_the_photo;
|
||||||
extern const char *Txt_Upload_photo;
|
extern const char *Txt_Upload_photo;
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
|
|
||||||
/***** Start box *****/
|
/***** Start box *****/
|
||||||
|
@ -366,7 +366,7 @@ void Pho_SendPhotoUsr (void)
|
||||||
if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) // If I have permission to change user's photo...
|
if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) // If I have permission to change user's photo...
|
||||||
{
|
{
|
||||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
/***** Form to send my photo *****/
|
/***** Form to send my photo *****/
|
||||||
Pho_ReqMyPhoto ();
|
Pho_ReqMyPhoto ();
|
||||||
|
@ -969,7 +969,8 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
||||||
/* Update number of clicks */
|
/* Update number of clicks */
|
||||||
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
if (NumClicks <= Pho_MAX_CLICKS_WITHOUT_PHOTO)
|
||||||
{
|
{
|
||||||
sprintf (Query,"UPDATE clicks_without_photo SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
|
sprintf (Query,"UPDATE clicks_without_photo"
|
||||||
|
" SET NumClicks=NumClicks+1 WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryUPDATE (Query,"can not update number of clicks without photo");
|
DB_QueryUPDATE (Query,"can not update number of clicks without photo");
|
||||||
NumClicks++;
|
NumClicks++;
|
||||||
|
|
|
@ -233,7 +233,7 @@ Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName)
|
||||||
|
|
||||||
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
|
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
/***** I always can see my things *****/
|
/***** I always can see my things *****/
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
|
|
|
@ -207,6 +207,7 @@ void Prf_RequestUserProfile (void)
|
||||||
void Prf_GetUsrDatAndShowUserProfile (void)
|
void Prf_GetUsrDatAndShowUserProfile (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||||
|
bool ItsMe;
|
||||||
bool ProfileShown = false;
|
bool ProfileShown = false;
|
||||||
|
|
||||||
/***** Get user's data *****/
|
/***** Get user's data *****/
|
||||||
|
@ -240,7 +241,8 @@ void Prf_GetUsrDatAndShowUserProfile (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** If it's not me, mark possible notification as seen *****/
|
/***** If it's not me, mark possible notification as seen *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // Not me
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
if (!ItsMe) // Not me
|
||||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_FOLLOWER,
|
Ntf_MarkNotifAsSeen (Ntf_EVENT_FOLLOWER,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod,-1L,
|
Gbl.Usrs.Other.UsrDat.UsrCod,-1L,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -257,8 +259,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
|
||||||
unsigned NumFollowers;
|
unsigned NumFollowers;
|
||||||
bool UsrFollowsMe;
|
bool UsrFollowsMe;
|
||||||
bool IFollowUsr;
|
bool IFollowUsr;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.Logged &&
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
/***** Check if I can see the public profile *****/
|
/***** Check if I can see the public profile *****/
|
||||||
if (Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat))
|
if (Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat))
|
||||||
|
@ -268,10 +269,10 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||||
|
|
||||||
if (ItsMe) // It's me
|
if (ItsMe)
|
||||||
/* Put link to show another user's profile */
|
/* Put link to show another user's profile */
|
||||||
Prf_PutLinkRequestAnotherUserProfile ();
|
Prf_PutLinkRequestAnotherUserProfile ();
|
||||||
else // Not me
|
else // Not me
|
||||||
/* Put link to show my public profile */
|
/* Put link to show my public profile */
|
||||||
Prf_PutLinkMyPublicProfile ();
|
Prf_PutLinkMyPublicProfile ();
|
||||||
|
|
||||||
|
@ -282,7 +283,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Shared record card *****/
|
/***** Shared record card *****/
|
||||||
if (!ItsMe && // If not it's me...
|
if (!ItsMe && // If not me...
|
||||||
Gbl.CurrentCrs.Crs.CrsCod > 0) // ...and a course is selected
|
Gbl.CurrentCrs.Crs.CrsCod > 0) // ...and a course is selected
|
||||||
{
|
{
|
||||||
/* Get user's role in current course */
|
/* Get user's role in current course */
|
||||||
|
|
|
@ -1976,7 +1976,7 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
|
||||||
DB_QueryREPLACE (Query,"can not add user to project");
|
DB_QueryREPLACE (Query,"can not add user to project");
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
Prj_FlushCacheMyRoleInProject ();
|
Prj_FlushCacheMyRoleInProject ();
|
||||||
|
|
||||||
|
@ -2050,7 +2050,7 @@ static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
||||||
{
|
{
|
||||||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||||
{
|
{
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Show question and button to remove user as administrator *****/
|
/***** Show question and button to remove user as administrator *****/
|
||||||
/* Start alert */
|
/* Start alert */
|
||||||
|
@ -2141,7 +2141,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
||||||
DB_QueryDELETE (Query,"can not remove a user from a project");
|
DB_QueryDELETE (Query,"can not remove a user from a project");
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
Prj_FlushCacheMyRoleInProject ();
|
Prj_FlushCacheMyRoleInProject ();
|
||||||
|
|
||||||
|
@ -3460,7 +3460,7 @@ void Prj_RemoveUsrFromProjects (long UsrCod)
|
||||||
DB_QueryDELETE (Query,"can not remove user from projects");
|
DB_QueryDELETE (Query,"can not remove user from projects");
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
ItsMe = (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
Prj_FlushCacheMyRoleInProject ();
|
Prj_FlushCacheMyRoleInProject ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ static void Rec_ShowRecordOneStdCrs (void)
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||||
|
@ -1204,6 +1204,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
||||||
unsigned NumUsr = 0;
|
unsigned NumUsr = 0;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
|
bool ItsMe;
|
||||||
char RecordSectionId[32];
|
char RecordSectionId[32];
|
||||||
|
|
||||||
/***** Assign users listing type depending on current action *****/
|
/***** Assign users listing type depending on current action *****/
|
||||||
|
@ -1281,16 +1282,19 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
||||||
|
|
||||||
/* Record of the student in the course */
|
/* Record of the student in the course */
|
||||||
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
|
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
|
||||||
|
{
|
||||||
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||||
if ( Gbl.Usrs.Me.Role.Logged == Rol_NET ||
|
if ( Gbl.Usrs.Me.Role.Logged == Rol_NET ||
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
|
||||||
(Gbl.Usrs.Me.Role.Logged == Rol_STD && // I am student in this course...
|
(Gbl.Usrs.Me.Role.Logged == Rol_STD && // I am student in this course...
|
||||||
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me
|
ItsMe)) // ...and it's me
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||||
Rec_ShowCrsRecord (CrsTypeOfView,&UsrDat,RecordSectionId);
|
Rec_ShowCrsRecord (CrsTypeOfView,&UsrDat,RecordSectionId);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* End container for this user */
|
/* End container for this user */
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
@ -1732,7 +1736,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD: // I am a student
|
case Rol_STD: // I am a student
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
{
|
{
|
||||||
switch (TypeOfView)
|
switch (TypeOfView)
|
||||||
|
@ -1764,7 +1768,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // It's not me ==> I am a student trying to do something forbidden
|
else // Not me ==> I am a student trying to do something forbidden
|
||||||
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
||||||
break;
|
break;
|
||||||
case Rol_NET:
|
case Rol_NET:
|
||||||
|
@ -2227,7 +2231,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
|
|
||||||
/***** Initializations *****/
|
/***** Initializations *****/
|
||||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.Role.Logged == Rol_NET || // My current role is non-editing teacher
|
IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.Role.Logged == Rol_NET || // My current role is non-editing teacher
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_TCH || // My current role is teacher
|
Gbl.Usrs.Me.Role.Logged == Rol_TCH || // My current role is teacher
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // My current role is system admin
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // My current role is system admin
|
||||||
|
@ -2470,7 +2474,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
||||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||||
Grp_ShowLstGrpsToChgMyGrps ();
|
Grp_ShowLstGrpsToChgMyGrps ();
|
||||||
}
|
}
|
||||||
else
|
else // Not me
|
||||||
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
|
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2512,7 +2516,7 @@ static void Rec_PutIconsCommands (void)
|
||||||
extern const char *Txt_View_attendance;
|
extern const char *Txt_View_attendance;
|
||||||
extern const char *Txt_Following_unfollow;
|
extern const char *Txt_Following_unfollow;
|
||||||
extern const char *Txt_Follow;
|
extern const char *Txt_Follow;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Record.UsrDat->UsrCod);
|
||||||
bool ICanViewUsrProfile;
|
bool ICanViewUsrProfile;
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
|
|
||||||
|
@ -2610,7 +2614,7 @@ static void Rec_PutIconsCommands (void)
|
||||||
"exam64x64.png",
|
"exam64x64.png",
|
||||||
Txt_View_test_results,NULL,
|
Txt_View_test_results,NULL,
|
||||||
NULL);
|
NULL);
|
||||||
else
|
else // Not me
|
||||||
Lay_PutContextualLink (ActSeeUsrTstRes,NULL,Rec_PutParamsStudent,
|
Lay_PutContextualLink (ActSeeUsrTstRes,NULL,Rec_PutParamsStudent,
|
||||||
"exam64x64.png",
|
"exam64x64.png",
|
||||||
Txt_View_test_results,NULL,
|
Txt_View_test_results,NULL,
|
||||||
|
@ -2625,7 +2629,7 @@ static void Rec_PutIconsCommands (void)
|
||||||
"folder64x64.gif",
|
"folder64x64.gif",
|
||||||
Txt_View_homework,NULL,
|
Txt_View_homework,NULL,
|
||||||
NULL);
|
NULL);
|
||||||
else // I am not a student in current course
|
else // Not me // I am not a student in current course
|
||||||
Lay_PutContextualLink (ActAdmAsgWrkCrs,NULL,Rec_PutParamsWorks,
|
Lay_PutContextualLink (ActAdmAsgWrkCrs,NULL,Rec_PutParamsWorks,
|
||||||
"folder64x64.gif",
|
"folder64x64.gif",
|
||||||
Txt_View_homework,NULL,
|
Txt_View_homework,NULL,
|
||||||
|
@ -2640,7 +2644,7 @@ static void Rec_PutIconsCommands (void)
|
||||||
"rollcall64x64.png",
|
"rollcall64x64.png",
|
||||||
Txt_View_attendance,NULL,
|
Txt_View_attendance,NULL,
|
||||||
NULL);
|
NULL);
|
||||||
else
|
else // Not me
|
||||||
Lay_PutContextualLink (ActSeeLstStdAtt,NULL,Rec_PutParamsStudent,
|
Lay_PutContextualLink (ActSeeLstStdAtt,NULL,Rec_PutParamsStudent,
|
||||||
"rollcall64x64.png",
|
"rollcall64x64.png",
|
||||||
Txt_View_attendance,NULL,
|
Txt_View_attendance,NULL,
|
||||||
|
@ -2662,7 +2666,7 @@ static void Rec_PutIconsCommands (void)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/***** Button to follow / unfollow *****/
|
/***** Button to follow / unfollow *****/
|
||||||
if (!ItsMe)
|
if (!ItsMe) // Not me
|
||||||
{
|
{
|
||||||
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Record.UsrDat->UsrCod))
|
Gbl.Record.UsrDat->UsrCod))
|
||||||
|
@ -2814,8 +2818,7 @@ static void Rec_ShowNickname (struct UsrData *UsrDat,bool PutFormLinks)
|
||||||
if (PutFormLinks)
|
if (PutFormLinks)
|
||||||
{
|
{
|
||||||
/* Put form to go to public profile */
|
/* Put form to go to public profile */
|
||||||
ItsMe = (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
Act_FormStart (ActSeeOthPubPrf);
|
Act_FormStart (ActSeeOthPubPrf);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
|
||||||
Act_LinkFormSubmit (ItsMe ? Txt_My_public_profile :
|
Act_LinkFormSubmit (ItsMe ? Txt_My_public_profile :
|
||||||
|
|
|
@ -781,7 +781,8 @@ static void Rep_WriteSectionHitsPerAction (struct Rep_Report *Report)
|
||||||
sprintf (Query,"SELECT SQL_NO_CACHE ActCod,COUNT(*) AS N FROM log_full"
|
sprintf (Query,"SELECT SQL_NO_CACHE ActCod,COUNT(*) AS N FROM log_full"
|
||||||
" WHERE ClickTime>=FROM_UNIXTIME(%ld) AND UsrCod=%ld"
|
" WHERE ClickTime>=FROM_UNIXTIME(%ld) AND UsrCod=%ld"
|
||||||
" GROUP BY ActCod ORDER BY N DESC LIMIT %u",
|
" GROUP BY ActCod ORDER BY N DESC LIMIT %u",
|
||||||
(long) Report->UsrFigures.FirstClickTimeUTC,Gbl.Usrs.Me.UsrDat.UsrCod,
|
(long) Report->UsrFigures.FirstClickTimeUTC,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Rep_MAX_ACTIONS);
|
Rep_MAX_ACTIONS);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get clicks");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get clicks");
|
||||||
|
|
||||||
|
|
|
@ -917,7 +917,7 @@ static void Soc_ShowTimeline (const char *Query,const char *Title,
|
||||||
struct SocialPublishing SocPub;
|
struct SocialPublishing SocPub;
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0);
|
bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0);
|
||||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Get publishings from database *****/
|
/***** Get publishings from database *****/
|
||||||
NumPubsGot = DB_QuerySELECT (Query,&mysql_res,"can not get timeline");
|
NumPubsGot = DB_QuerySELECT (Query,&mysql_res,"can not get timeline");
|
||||||
|
@ -1258,6 +1258,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
||||||
extern const char *Txt_Centre;
|
extern const char *Txt_Centre;
|
||||||
extern const char *Txt_Institution;
|
extern const char *Txt_Institution;
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
|
bool ItsMe;
|
||||||
bool IAmTheAuthor = false;
|
bool IAmTheAuthor = false;
|
||||||
bool IAmASharerOfThisSocNot = false;
|
bool IAmASharerOfThisSocNot = false;
|
||||||
bool IAmAFaverOfThisSocNot = false;
|
bool IAmAFaverOfThisSocNot = false;
|
||||||
|
@ -1316,7 +1317,8 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
||||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
IAmTheAuthor = (UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||||
|
IAmTheAuthor = ItsMe;
|
||||||
if (!IAmTheAuthor)
|
if (!IAmTheAuthor)
|
||||||
{
|
{
|
||||||
IAmASharerOfThisSocNot = Soc_CheckIfNoteIsSharedByUsr (SocNot->NotCod,
|
IAmASharerOfThisSocNot = Soc_CheckIfNoteIsSharedByUsr (SocNot->NotCod,
|
||||||
|
@ -1539,8 +1541,7 @@ static void Soc_WriteTopMessage (Soc_TopMessage_t TopMessage,long UsrCod)
|
||||||
extern const char *Txt_Another_user_s_profile;
|
extern const char *Txt_Another_user_s_profile;
|
||||||
extern const char *Txt_SOCIAL_NOTE_TOP_MESSAGES[Soc_NUM_TOP_MESSAGES];
|
extern const char *Txt_SOCIAL_NOTE_TOP_MESSAGES[Soc_NUM_TOP_MESSAGES];
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.Logged &&
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
if (TopMessage != Soc_TOP_MESSAGE_NONE)
|
if (TopMessage != Soc_TOP_MESSAGE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1581,8 +1582,7 @@ static void Soc_WriteAuthorNote (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
extern const char *Txt_My_public_profile;
|
extern const char *Txt_My_public_profile;
|
||||||
extern const char *Txt_Another_user_s_profile;
|
extern const char *Txt_Another_user_s_profile;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.Logged &&
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_RIGHT_AUTHOR\">");
|
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_RIGHT_AUTHOR\">");
|
||||||
|
|
||||||
|
@ -2523,6 +2523,7 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
|
||||||
extern const char *Txt_Centre;
|
extern const char *Txt_Centre;
|
||||||
extern const char *Txt_Institution;
|
extern const char *Txt_Institution;
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
|
bool ItsMe;
|
||||||
bool IAmTheAuthor;
|
bool IAmTheAuthor;
|
||||||
bool IAmAFaverOfThisSocCom = false;
|
bool IAmAFaverOfThisSocCom = false;
|
||||||
bool ShowPhoto = false;
|
bool ShowPhoto = false;
|
||||||
|
@ -2558,8 +2559,8 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
|
||||||
Usr_UsrDataConstructor (&UsrDat);
|
Usr_UsrDataConstructor (&UsrDat);
|
||||||
UsrDat.UsrCod = SocCom->UsrCod;
|
UsrDat.UsrCod = SocCom->UsrCod;
|
||||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
|
||||||
IAmTheAuthor = (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||||
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
IAmTheAuthor = ItsMe;
|
||||||
if (!IAmTheAuthor)
|
if (!IAmTheAuthor)
|
||||||
IAmAFaverOfThisSocCom = Soc_CheckIfCommIsFavedByUsr (SocCom->PubCod,
|
IAmAFaverOfThisSocCom = Soc_CheckIfCommIsFavedByUsr (SocCom->PubCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -2630,8 +2631,7 @@ static void Soc_WriteAuthorComment (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
extern const char *Txt_My_public_profile;
|
extern const char *Txt_My_public_profile;
|
||||||
extern const char *Txt_Another_user_s_profile;
|
extern const char *Txt_Another_user_s_profile;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.Logged &&
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_RIGHT_AUTHOR\">");
|
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_RIGHT_AUTHOR\">");
|
||||||
|
|
||||||
|
@ -3101,6 +3101,7 @@ static long Soc_ShareSocialNote (void)
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_original_post_no_longer_exists;
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
struct SocialPublishing SocPub;
|
struct SocialPublishing SocPub;
|
||||||
|
bool ItsMe;
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
|
@ -3109,8 +3110,8 @@ static long Soc_ShareSocialNote (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
||||||
SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // I am not the author
|
if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
if (!Soc_CheckIfNoteIsSharedByUsr (SocNot.NotCod,
|
if (!Soc_CheckIfNoteIsSharedByUsr (SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // Not yet shared by me
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // Not yet shared by me
|
||||||
{
|
{
|
||||||
|
@ -3179,6 +3180,7 @@ static long Soc_FavSocialNote (void)
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_original_post_no_longer_exists;
|
||||||
char Query[256];
|
char Query[256];
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
|
bool ItsMe;
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
|
@ -3187,8 +3189,8 @@ static long Soc_FavSocialNote (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
||||||
SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // I am not the author
|
if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
if (!Soc_CheckIfNoteIsFavedByUsr (SocNot.NotCod,
|
if (!Soc_CheckIfNoteIsFavedByUsr (SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note
|
||||||
{
|
{
|
||||||
|
@ -3264,6 +3266,7 @@ static long Soc_FavSocialComment (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_comment_no_longer_exists;
|
extern const char *Txt_The_comment_no_longer_exists;
|
||||||
struct SocialComment SocCom;
|
struct SocialComment SocCom;
|
||||||
|
bool ItsMe;
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
|
@ -3275,8 +3278,8 @@ static long Soc_FavSocialComment (void)
|
||||||
|
|
||||||
if (SocCom.PubCod > 0)
|
if (SocCom.PubCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocCom.UsrCod);
|
||||||
SocCom.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // I am not the author
|
if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
if (!Soc_CheckIfCommIsFavedByUsr (SocCom.PubCod,
|
if (!Soc_CheckIfCommIsFavedByUsr (SocCom.PubCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the comment
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the comment
|
||||||
{
|
{
|
||||||
|
@ -3390,6 +3393,7 @@ static long Soc_UnshareSocialNote (void)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||||
|
@ -3397,9 +3401,9 @@ static long Soc_UnshareSocialNote (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
|
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
||||||
if (SocNot.NumShared &&
|
if (SocNot.NumShared &&
|
||||||
Gbl.Usrs.Me.Logged &&
|
Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // I am not the author
|
|
||||||
if (Soc_CheckIfNoteIsSharedByUsr (SocNot.NotCod,
|
if (Soc_CheckIfNoteIsSharedByUsr (SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I am a sharer
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I am a sharer
|
||||||
{
|
{
|
||||||
|
@ -3478,6 +3482,7 @@ static long Soc_UnfavSocialNote (void)
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
char Query[256];
|
char Query[256];
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||||
|
@ -3485,9 +3490,9 @@ static long Soc_UnfavSocialNote (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
|
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
||||||
if (SocNot.NumFavs &&
|
if (SocNot.NumFavs &&
|
||||||
Gbl.Usrs.Me.Logged &&
|
Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // I am not the author
|
|
||||||
if (Soc_CheckIfNoteIsFavedByUsr (SocNot.NotCod,
|
if (Soc_CheckIfNoteIsFavedByUsr (SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note
|
||||||
{
|
{
|
||||||
|
@ -3560,6 +3565,7 @@ static long Soc_UnfavSocialComment (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_comment_no_longer_exists;
|
extern const char *Txt_The_comment_no_longer_exists;
|
||||||
struct SocialComment SocCom;
|
struct SocialComment SocCom;
|
||||||
|
bool ItsMe;
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
|
@ -3571,9 +3577,9 @@ static long Soc_UnfavSocialComment (void)
|
||||||
|
|
||||||
if (SocCom.PubCod > 0)
|
if (SocCom.PubCod > 0)
|
||||||
{
|
{
|
||||||
|
ItsMe = Usr_ItsMe (SocCom.UsrCod);
|
||||||
if (SocCom.NumFavs &&
|
if (SocCom.NumFavs &&
|
||||||
Gbl.Usrs.Me.Logged &&
|
Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
SocCom.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // I am not the author
|
|
||||||
if (Soc_CheckIfCommIsFavedByUsr (SocCom.PubCod,
|
if (Soc_CheckIfCommIsFavedByUsr (SocCom.PubCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the comment
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the comment
|
||||||
{
|
{
|
||||||
|
@ -3645,6 +3651,7 @@ static void Soc_RequestRemovalSocialNote (void)
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_post;
|
extern const char *Txt_Do_you_really_want_to_remove_the_following_post;
|
||||||
extern const char *Txt_Remove;
|
extern const char *Txt_Remove;
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||||
|
@ -3652,8 +3659,8 @@ static void Soc_RequestRemovalSocialNote (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
||||||
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author of this note
|
if (ItsMe) // I am the author of this note
|
||||||
{
|
{
|
||||||
/***** Show question and button to remove social note *****/
|
/***** Show question and button to remove social note *****/
|
||||||
/* Start alert */
|
/* Start alert */
|
||||||
|
@ -3732,6 +3739,7 @@ static void Soc_RemoveSocialNote (void)
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_original_post_no_longer_exists;
|
||||||
extern const char *Txt_Post_removed;
|
extern const char *Txt_Post_removed;
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||||
|
@ -3739,8 +3747,8 @@ static void Soc_RemoveSocialNote (void)
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot.NotCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
||||||
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author of this note
|
if (ItsMe) // I am the author of this note
|
||||||
{
|
{
|
||||||
if (SocNot.NoteType == Soc_NOTE_SOCIAL_POST)
|
if (SocNot.NoteType == Soc_NOTE_SOCIAL_POST)
|
||||||
/***** Remove image file associated to social post *****/
|
/***** Remove image file associated to social post *****/
|
||||||
|
@ -3980,6 +3988,7 @@ static void Soc_RequestRemovalSocialComment (void)
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_comment;
|
extern const char *Txt_Do_you_really_want_to_remove_the_following_comment;
|
||||||
extern const char *Txt_Remove;
|
extern const char *Txt_Remove;
|
||||||
struct SocialComment SocCom;
|
struct SocialComment SocCom;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
Img_ImageConstructor (&SocCom.Image);
|
Img_ImageConstructor (&SocCom.Image);
|
||||||
|
@ -3990,8 +3999,8 @@ static void Soc_RequestRemovalSocialComment (void)
|
||||||
|
|
||||||
if (SocCom.PubCod > 0)
|
if (SocCom.PubCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocCom.UsrCod);
|
||||||
SocCom.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author of this comment
|
if (ItsMe) // I am the author of this comment
|
||||||
{
|
{
|
||||||
/***** Show question and button to remove social comment *****/
|
/***** Show question and button to remove social comment *****/
|
||||||
/* Start alert */
|
/* Start alert */
|
||||||
|
@ -4073,6 +4082,7 @@ static void Soc_RemoveSocialComment (void)
|
||||||
extern const char *Txt_The_comment_no_longer_exists;
|
extern const char *Txt_The_comment_no_longer_exists;
|
||||||
extern const char *Txt_Comment_removed;
|
extern const char *Txt_Comment_removed;
|
||||||
struct SocialComment SocCom;
|
struct SocialComment SocCom;
|
||||||
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
Img_ImageConstructor (&SocCom.Image);
|
Img_ImageConstructor (&SocCom.Image);
|
||||||
|
@ -4083,8 +4093,8 @@ static void Soc_RemoveSocialComment (void)
|
||||||
|
|
||||||
if (SocCom.PubCod > 0)
|
if (SocCom.PubCod > 0)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged &&
|
ItsMe = Usr_ItsMe (SocCom.UsrCod);
|
||||||
SocCom.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author of this comment
|
if (ItsMe) // I am the author of this comment
|
||||||
{
|
{
|
||||||
/***** Remove image file associated to social post *****/
|
/***** Remove image file associated to social post *****/
|
||||||
Soc_RemoveImgFileFromSocialComment (SocCom.PubCod);
|
Soc_RemoveImgFileFromSocialComment (SocCom.PubCod);
|
||||||
|
@ -4931,6 +4941,7 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
|
||||||
size_t Length; // Length of the nickname
|
size_t Length; // Length of the nickname
|
||||||
} Nickname;
|
} Nickname;
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
|
bool ItsMe;
|
||||||
bool CreateNotif;
|
bool CreateNotif;
|
||||||
bool NotifyByEmail;
|
bool NotifyByEmail;
|
||||||
|
|
||||||
|
@ -4972,7 +4983,9 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
|
||||||
strncpy (UsrDat.Nickname,Nickname.PtrStart,Nickname.Length);
|
strncpy (UsrDat.Nickname,Nickname.PtrStart,Nickname.Length);
|
||||||
|
|
||||||
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.Nickname)) > 0)
|
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.Nickname)) > 0)
|
||||||
if (UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // It's not me
|
{
|
||||||
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||||
|
if (!ItsMe) // Not me
|
||||||
{
|
{
|
||||||
/* Get user's data */
|
/* Get user's data */
|
||||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||||
|
@ -4987,6 +5000,7 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
|
||||||
0));
|
0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* The next char is not the start of a nickname */
|
/* The next char is not the start of a nickname */
|
||||||
|
|
|
@ -412,7 +412,7 @@ void Sta_LogAccess (const char *Comments)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Increment my number of clicks *****/
|
/***** Increment my number of clicks *****/
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod > 0)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
Prf_IncrementNumClicksUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
|
Prf_IncrementNumClicksUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7714,7 +7714,7 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
|
||||||
double ScoreInThisTest;
|
double ScoreInThisTest;
|
||||||
double TotalScoreOfAllTests = 0.0;
|
double TotalScoreOfAllTests = 0.0;
|
||||||
unsigned NumExamsVisibleByTchs = 0;
|
unsigned NumExamsVisibleByTchs = 0;
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
bool ICanViewTest;
|
bool ICanViewTest;
|
||||||
bool ICanViewScore;
|
bool ICanViewScore;
|
||||||
time_t TimeUTC;
|
time_t TimeUTC;
|
||||||
|
@ -8117,7 +8117,7 @@ void Tst_ShowOneTestResult (void)
|
||||||
Gbl.Test.Config.Feedback = Tst_FEEDBACK_FULL_FEEDBACK; // Initialize feedback to maximum
|
Gbl.Test.Config.Feedback = Tst_FEEDBACK_FULL_FEEDBACK; // Initialize feedback to maximum
|
||||||
|
|
||||||
/***** Check if I can view this test result *****/
|
/***** Check if I can view this test result *****/
|
||||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
switch (Gbl.Usrs.Me.Role.Logged)
|
||||||
{
|
{
|
||||||
case Rol_STD:
|
case Rol_STD:
|
||||||
|
|
34
swad_user.c
34
swad_user.c
|
@ -408,6 +408,16 @@ void Usr_FreeListUsrCods (struct ListUsrCods *ListUsrCods)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************ Check if I am a given user *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool Usr_ItsMe (long UsrCod)
|
||||||
|
{
|
||||||
|
return Gbl.Usrs.Me.Logged &&
|
||||||
|
(UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** Get user's code from database using encrypted user's code **********/
|
/******** Get user's code from database using encrypted user's code **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -854,7 +864,7 @@ bool Usr_CheckIfUsrIsSuperuser (long UsrCod)
|
||||||
|
|
||||||
bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
|
bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
@ -888,7 +898,7 @@ bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
|
||||||
|
|
||||||
bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat)
|
bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
|
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1095,7 +1105,7 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 7. Fast check: It's me? *****/
|
/***** 7. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1156,7 +1166,7 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** 4. Fast check: It's me? *****/
|
/***** 4. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1197,7 +1207,7 @@ bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 6. Fast check: It's me? *****/
|
/***** 6. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1251,7 +1261,7 @@ bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 7. Fast check: It's me? *****/
|
/***** 7. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1300,7 +1310,7 @@ bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 7. Fast check: It's me? *****/
|
/***** 7. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1329,7 +1339,7 @@ bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 2. Fast check: It's me? *****/
|
/***** 2. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1365,7 +1375,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** 3. Fast check: It's me? *****/
|
/***** 3. Fast check: It's me? *****/
|
||||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
if (ItsMe)
|
if (ItsMe)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -3701,7 +3711,7 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
|
||||||
char PhotoURL[PATH_MAX + 1];
|
char PhotoURL[PATH_MAX + 1];
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
struct Instit Ins;
|
struct Instit Ins;
|
||||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
bool ShowData = (ItsMe || UsrDat->Accepted ||
|
bool ShowData = (ItsMe || UsrDat->Accepted ||
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM ||
|
Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM ||
|
||||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
|
||||||
|
@ -7244,7 +7254,7 @@ static void Usr_UpdateMyColsClassPhotoInDB (void)
|
||||||
{
|
{
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod > 0 && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
{
|
{
|
||||||
/***** Update number of colums in class photo for current course *****/
|
/***** Update number of colums in class photo for current course *****/
|
||||||
sprintf (Query,"UPDATE crs_usr SET ColsClassPhoto=%u"
|
sprintf (Query,"UPDATE crs_usr SET ColsClassPhoto=%u"
|
||||||
|
@ -7346,7 +7356,7 @@ static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void)
|
||||||
{
|
{
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod > 0 && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
if (Gbl.Usrs.Me.Logged && Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||||
{
|
{
|
||||||
/***** Update number of colums in class photo for current course *****/
|
/***** Update number of colums in class photo for current course *****/
|
||||||
sprintf (Query,"UPDATE crs_usr SET ListWithPhotos='%c'"
|
sprintf (Query,"UPDATE crs_usr SET ListWithPhotos='%c'"
|
||||||
|
|
|
@ -235,6 +235,7 @@ void Usr_UsrDataDestructor (struct UsrData *UsrDat);
|
||||||
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat);
|
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat);
|
||||||
void Usr_AllocateListUsrCods (struct ListUsrCods *ListUsrCods);
|
void Usr_AllocateListUsrCods (struct ListUsrCods *ListUsrCods);
|
||||||
void Usr_FreeListUsrCods (struct ListUsrCods *ListUsrCods);
|
void Usr_FreeListUsrCods (struct ListUsrCods *ListUsrCods);
|
||||||
|
bool Usr_ItsMe (long UsrCod);
|
||||||
void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat);
|
void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat);
|
||||||
void Usr_GetEncryptedUsrCodFromUsrCod (struct UsrData *UsrDat); // TODO: Remove this funcion, it's not used
|
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);
|
||||||
|
|
|
@ -3180,6 +3180,7 @@ int swad__sendMessage (struct soap *soap,
|
||||||
bool FirstNickname = true;
|
bool FirstNickname = true;
|
||||||
bool ThereAreNicknames = false;
|
bool ThereAreNicknames = false;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
bool ItsMe;
|
||||||
bool NotifyByEmail;
|
bool NotifyByEmail;
|
||||||
|
|
||||||
/***** Initializations *****/
|
/***** Initializations *****/
|
||||||
|
@ -3339,7 +3340,8 @@ int swad__sendMessage (struct soap *soap,
|
||||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat))
|
||||||
{
|
{
|
||||||
/* This received message must be notified by email? */
|
/* This received message must be notified by email? */
|
||||||
NotifyByEmail = ((Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) &&
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
NotifyByEmail = (!ItsMe &&
|
||||||
(Gbl.Usrs.Other.UsrDat.Prefs.EmailNtfEvents & (1 << Ntf_EVENT_MESSAGE)));
|
(Gbl.Usrs.Other.UsrDat.Prefs.EmailNtfEvents & (1 << Ntf_EVENT_MESSAGE)));
|
||||||
|
|
||||||
/* Send message to this user */
|
/* Send message to this user */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user