Version19.174

This commit is contained in:
acanas 2020-04-11 15:21:30 +02:00
parent e2d5383755
commit d3082ecdc8
14 changed files with 451 additions and 343 deletions

View File

@ -1082,7 +1082,6 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
Ntf_RemoveUsrNtfs (UsrDat->UsrCod); Ntf_RemoveUsrNtfs (UsrDat->UsrCod);
/***** Delete user's messages sent and received *****/ /***** Delete user's messages sent and received *****/
Gbl.Msg.FilterContent[0] = '\0';
Msg_DelAllRecAndSntMsgsUsr (UsrDat->UsrCod); Msg_DelAllRecAndSntMsgsUsr (UsrDat->UsrCod);
if (QuietOrVerbose == Cns_VERBOSE) if (QuietOrVerbose == Cns_VERBOSE)
Ale_ShowAlert (Ale_SUCCESS,Txt_Messages_of_THE_USER_X_have_been_deleted, Ale_ShowAlert (Ale_SUCCESS,Txt_Messages_of_THE_USER_X_have_been_deleted,

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.173 (2020-04-11)" #define Log_PLATFORM_VERSION "SWAD 19.174 (2020-04-11)"
#define CSS_FILE "swad19.146.css" #define CSS_FILE "swad19.146.css"
#define JS_FILE "swad19.172.1.js" #define JS_FILE "swad19.172.1.js"
/* /*
@ -548,7 +548,8 @@ Funci
// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores // TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores
// TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub // TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub
Version 19.173: Apr 11, 2020 Code refactoring in timeline. (285165 lines) Version 19.174: Apr 11, 2020 Code refactoring in messages. (285250 lines)
Version 19.173: Apr 11, 2020 Code refactoring in timetables. (285165 lines)
Version 19.172.1: Apr 11, 2020 Fix bug in MathJax. (285144 lines) Version 19.172.1: Apr 11, 2020 Fix bug in MathJax. (285144 lines)
Version 19.172: Apr 11, 2020 Code refactoring in timeline. (285139 lines) Version 19.172: Apr 11, 2020 Code refactoring in timeline. (285139 lines)
Version 19.171: Apr 10, 2020 Code refactoring in surveys. (285010 lines) Version 19.171: Apr 10, 2020 Code refactoring in surveys. (285010 lines)

View File

@ -3956,6 +3956,7 @@ void For_ReceiveForumPost (void)
long PstCod = 0; long PstCod = 0;
unsigned NumUsrsToBeNotifiedByEMail; unsigned NumUsrsToBeNotifiedByEMail;
struct TL_Publication SocPub; struct TL_Publication SocPub;
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
char Content[Cns_MAX_BYTES_LONG_TEXT + 1]; char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
struct Media Media; struct Media Media;
@ -3975,7 +3976,7 @@ void For_ReceiveForumPost (void)
IsReply = true; IsReply = true;
/***** Get message subject *****/ /***** Get message subject *****/
Par_GetParToHTML ("Subject",Gbl.Msg.Subject,Cns_MAX_BYTES_SUBJECT); Par_GetParToHTML ("Subject",Subject,Cns_MAX_BYTES_SUBJECT);
/***** Get message body *****/ /***** Get message body *****/
Par_GetParAndChangeFormat ("Content",Content,Cns_MAX_BYTES_LONG_TEXT, Par_GetParAndChangeFormat ("Content",Content,Cns_MAX_BYTES_LONG_TEXT,
@ -3998,7 +3999,7 @@ void For_ReceiveForumPost (void)
/***** Create last message of the thread *****/ /***** Create last message of the thread *****/
PstCod = For_InsertForumPst (Forums.Thread.ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod, PstCod = For_InsertForumPst (Forums.Thread.ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Msg.Subject,Content,&Media); Subject,Content,&Media);
/***** Modify last message of the thread *****/ /***** Modify last message of the thread *****/
For_UpdateThrLastPst (Forums.Thread.ThrCod,PstCod); For_UpdateThrLastPst (Forums.Thread.ThrCod,PstCod);
@ -4010,7 +4011,7 @@ void For_ReceiveForumPost (void)
/***** Create first (and last) message of the thread *****/ /***** Create first (and last) message of the thread *****/
PstCod = For_InsertForumPst (Forums.Thread.ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod, PstCod = For_InsertForumPst (Forums.Thread.ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Msg.Subject,Content,&Media); Subject,Content,&Media);
/***** Update first and last posts of new thread *****/ /***** Update first and last posts of new thread *****/
For_UpdateThrFirstAndLastPst (Forums.Thread.ThrCod,PstCod,PstCod); For_UpdateThrFirstAndLastPst (Forums.Thread.ThrCod,PstCod,PstCod);

View File

@ -211,10 +211,6 @@ void Gbl_InitializeGlobals (void)
Gbl.ExamAnns.HighlightExaCod = -1L; Gbl.ExamAnns.HighlightExaCod = -1L;
Gbl.ExamAnns.HighlightDate[0] = '\0'; // No exam announcements highlighted Gbl.ExamAnns.HighlightDate[0] = '\0'; // No exam announcements highlighted
Gbl.Msg.Subject[0] = '\0';
Gbl.Msg.ShowOnlyUnreadMsgs = false;
Gbl.Msg.ExpandedMsgCod = -1L;
/***** Reset current hierarchy *****/ /***** Reset current hierarchy *****/
Hie_ResetHierarchy (); Hie_ResetHierarchy ();

View File

@ -506,7 +506,6 @@ struct Globals
char TmpDir[NAME_MAX + 1]; char TmpDir[NAME_MAX + 1];
} ZIP; } ZIP;
} FileBrowser; // Struct used for a file browser } FileBrowser; // Struct used for a file browser
struct Msg_Messages Msg;
struct struct
{ {
struct DateTime DateIni; // TODO: Remove in future versions struct DateTime DateIni; // TODO: Remove in future versions

View File

@ -1278,7 +1278,7 @@ void Lay_PutContextualLinkIconText (Act_Action_t NextAction,const char *Anchor,
/*****************************************************************************/ /*****************************************************************************/
void Lay_PutContextualLinkIconTextOnSubmit (Act_Action_t NextAction,const char *Anchor, void Lay_PutContextualLinkIconTextOnSubmit (Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (void), void (*FuncParams) (const void *Args),const void *Args,
const char *Icon, const char *Icon,
const char *Text, const char *Text,
const char *OnSubmit) const char *OnSubmit)
@ -1292,7 +1292,7 @@ void Lay_PutContextualLinkIconTextOnSubmit (Act_Action_t NextAction,const char *
/***** Begin form *****/ /***** Begin form *****/
Frm_StartFormAnchor (NextAction,Anchor); Frm_StartFormAnchor (NextAction,Anchor);
if (FuncParams) if (FuncParams)
FuncParams (); FuncParams (Args);
/***** Put icon with link *****/ /***** Put icon with link *****/
HTM_BUTTON_SUBMIT_Begin (Text,The_ClassFormLinkOutBoxBold[Gbl.Prefs.Theme],OnSubmit); HTM_BUTTON_SUBMIT_Begin (Text,The_ClassFormLinkOutBoxBold[Gbl.Prefs.Theme],OnSubmit);

View File

@ -59,7 +59,7 @@ void Lay_PutContextualLinkIconText (Act_Action_t NextAction,const char *Anchor,
const char *Icon, const char *Icon,
const char *Text); const char *Text);
void Lay_PutContextualLinkIconTextOnSubmit (Act_Action_t NextAction,const char *Anchor, void Lay_PutContextualLinkIconTextOnSubmit (Act_Action_t NextAction,const char *Anchor,
void (*FuncParams) (void), void (*FuncParams) (const void *Args),const void *Args,
const char *Icon, const char *Icon,
const char *Text, const char *Text,
const char *OnSubmit); const char *OnSubmit);

View File

@ -1643,6 +1643,8 @@ bool Mai_SendMailMsgToConfirmEmail (void)
extern const char *Txt_Confirmation_of_your_email_NO_HTML; extern const char *Txt_Confirmation_of_your_email_NO_HTML;
extern const char *Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address; extern const char *Txt_A_message_has_been_sent_to_email_address_X_to_confirm_that_address;
extern const char *Txt_There_was_a_problem_sending_an_email_automatically; extern const char *Txt_There_was_a_problem_sending_an_email_automatically;
char FileNameMail[PATH_MAX + 1];
FILE *FileMail;
char Command[2048 + char Command[2048 +
Cfg_MAX_BYTES_SMTP_PASSWORD + Cfg_MAX_BYTES_SMTP_PASSWORD +
Cns_MAX_BYTES_EMAIL_ADDRESS + Cns_MAX_BYTES_EMAIL_ADDRESS +
@ -1650,26 +1652,26 @@ bool Mai_SendMailMsgToConfirmEmail (void)
int ReturnCode; int ReturnCode;
/***** Create temporary file for mail content *****/ /***** Create temporary file for mail content *****/
Mai_CreateFileNameMail (); Mai_CreateFileNameMail (FileNameMail,&FileMail);
/***** Write mail content into file and close file *****/ /***** Write mail content into file and close file *****/
/* Welcome note */ /* Welcome note */
Mai_WriteWelcomeNoteEMail (&Gbl.Usrs.Me.UsrDat); Mai_WriteWelcomeNoteEMail (FileMail,&Gbl.Usrs.Me.UsrDat);
/* Store encrypted key in database */ /* Store encrypted key in database */
Mai_InsertMailKey (Gbl.Usrs.Me.UsrDat.Email,Gbl.UniqueNameEncrypted); Mai_InsertMailKey (Gbl.Usrs.Me.UsrDat.Email,Gbl.UniqueNameEncrypted);
/* Message body */ /* Message body */
fprintf (Gbl.Msg.FileMail, fprintf (FileMail,
Txt_If_you_just_request_from_X_the_confirmation_of_your_email_Y_NO_HTML, Txt_If_you_just_request_from_X_the_confirmation_of_your_email_Y_NO_HTML,
Cfg_URL_SWAD_CGI,Gbl.Usrs.Me.UsrDat.Email, Cfg_URL_SWAD_CGI,Gbl.Usrs.Me.UsrDat.Email,
Cfg_URL_SWAD_CGI,Act_GetActCod (ActCnfMai),Gbl.UniqueNameEncrypted, Cfg_URL_SWAD_CGI,Act_GetActCod (ActCnfMai),Gbl.UniqueNameEncrypted,
Cfg_URL_SWAD_CGI); Cfg_URL_SWAD_CGI);
/* Footer note */ /* Footer note */
Mai_WriteFootNoteEMail (Gbl.Prefs.Language); Mai_WriteFootNoteEMail (FileMail,Gbl.Prefs.Language);
fclose (Gbl.Msg.FileMail); fclose (FileMail);
/***** Call the script to send an email *****/ /***** Call the script to send an email *****/
snprintf (Command,sizeof (Command), snprintf (Command,sizeof (Command),
@ -1681,13 +1683,13 @@ bool Mai_SendMailMsgToConfirmEmail (void)
Gbl.Config.SMTPPassword, Gbl.Config.SMTPPassword,
Gbl.Usrs.Me.UsrDat.Email, Gbl.Usrs.Me.UsrDat.Email,
Cfg_PLATFORM_SHORT_NAME,Txt_Confirmation_of_your_email_NO_HTML, Cfg_PLATFORM_SHORT_NAME,Txt_Confirmation_of_your_email_NO_HTML,
Gbl.Msg.FileNameMail); FileNameMail);
ReturnCode = system (Command); ReturnCode = system (Command);
if (ReturnCode == -1) if (ReturnCode == -1)
Lay_ShowErrorAndExit ("Error when running script to send email."); Lay_ShowErrorAndExit ("Error when running script to send email.");
/***** Remove temporary file *****/ /***** Remove temporary file *****/
unlink (Gbl.Msg.FileNameMail); unlink (FileNameMail);
/***** Write message depending on return code *****/ /***** Write message depending on return code *****/
ReturnCode = WEXITSTATUS(ReturnCode); ReturnCode = WEXITSTATUS(ReturnCode);
@ -1836,12 +1838,12 @@ void Mai_ConfirmEmail (void)
/****************** Create temporary file for mail content *******************/ /****************** Create temporary file for mail content *******************/
/*****************************************************************************/ /*****************************************************************************/
void Mai_CreateFileNameMail (void) void Mai_CreateFileNameMail (char FileNameMail[PATH_MAX + 1],FILE **FileMail)
{ {
snprintf (Gbl.Msg.FileNameMail,sizeof (Gbl.Msg.FileNameMail), snprintf (FileNameMail,PATH_MAX + 1,
"%s/%s_mail.txt", "%s/%s_mail.txt",
Cfg_PATH_OUT_PRIVATE,Gbl.UniqueNameEncrypted); Cfg_PATH_OUT_PRIVATE,Gbl.UniqueNameEncrypted);
if ((Gbl.Msg.FileMail = fopen (Gbl.Msg.FileNameMail,"wb")) == NULL) if ((*FileMail = fopen (FileNameMail,"wb")) == NULL)
Lay_ShowErrorAndExit ("Can not open file to send email."); Lay_ShowErrorAndExit ("Can not open file to send email.");
} }
@ -1849,12 +1851,12 @@ void Mai_CreateFileNameMail (void)
/************ Write a welcome note heading the automatic email ***************/ /************ Write a welcome note heading the automatic email ***************/
/*****************************************************************************/ /*****************************************************************************/
void Mai_WriteWelcomeNoteEMail (struct UsrData *UsrDat) void Mai_WriteWelcomeNoteEMail (FILE *FileMail,struct UsrData *UsrDat)
{ {
extern const char *Txt_Dear_NO_HTML[Usr_NUM_SEXS][1 + Lan_NUM_LANGUAGES]; extern const char *Txt_Dear_NO_HTML[Usr_NUM_SEXS][1 + Lan_NUM_LANGUAGES];
extern const char *Txt_user_NO_HTML[Usr_NUM_SEXS][1 + Lan_NUM_LANGUAGES]; extern const char *Txt_user_NO_HTML[Usr_NUM_SEXS][1 + Lan_NUM_LANGUAGES];
fprintf (Gbl.Msg.FileMail,"%s %s:\n", fprintf (FileMail,"%s %s:\n",
Txt_Dear_NO_HTML[UsrDat->Sex][UsrDat->Prefs.Language], Txt_Dear_NO_HTML[UsrDat->Sex][UsrDat->Prefs.Language],
UsrDat->FirstName[0] ? UsrDat->FirstName : UsrDat->FirstName[0] ? UsrDat->FirstName :
Txt_user_NO_HTML[UsrDat->Sex][UsrDat->Prefs.Language]); Txt_user_NO_HTML[UsrDat->Sex][UsrDat->Prefs.Language]);
@ -1864,13 +1866,13 @@ void Mai_WriteWelcomeNoteEMail (struct UsrData *UsrDat)
/****************** Write a foot note in the automatic email *****************/ /****************** Write a foot note in the automatic email *****************/
/*****************************************************************************/ /*****************************************************************************/
void Mai_WriteFootNoteEMail (Lan_Language_t Language) void Mai_WriteFootNoteEMail (FILE *FileMail,Lan_Language_t Language)
{ {
extern const char *Txt_Please_do_not_reply_to_this_automatically_generated_email_NO_HTML[1 + Lan_NUM_LANGUAGES]; extern const char *Txt_Please_do_not_reply_to_this_automatically_generated_email_NO_HTML[1 + Lan_NUM_LANGUAGES];
fprintf (Gbl.Msg.FileMail,"%s\n" fprintf (FileMail,"%s\n"
"%s\n" "%s\n"
"%s\n", "%s\n",
Txt_Please_do_not_reply_to_this_automatically_generated_email_NO_HTML[Language], Txt_Please_do_not_reply_to_this_automatically_generated_email_NO_HTML[Language],
Cfg_PLATFORM_SHORT_NAME, Cfg_PLATFORM_SHORT_NAME,
Cfg_URL_SWAD_CGI); Cfg_URL_SWAD_CGI);

View File

@ -91,9 +91,9 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
bool Mai_SendMailMsgToConfirmEmail (void); bool Mai_SendMailMsgToConfirmEmail (void);
void Mai_ConfirmEmail (void); void Mai_ConfirmEmail (void);
void Mai_CreateFileNameMail (void); void Mai_CreateFileNameMail (char FileNameMail[PATH_MAX + 1],FILE **FileMail);
void Mai_WriteWelcomeNoteEMail (struct UsrData *UsrDat); void Mai_WriteWelcomeNoteEMail (FILE *FileMail,struct UsrData *UsrDat);
void Mai_WriteFootNoteEMail (Lan_Language_t Language); void Mai_WriteFootNoteEMail (FILE *FileMail,Lan_Language_t Language);
bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat); bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat);

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,6 @@ struct Msg_Messages
{ {
Msg_TypeOfMessages_t TypeOfMessages; Msg_TypeOfMessages_t TypeOfMessages;
unsigned NumMsgs; unsigned NumMsgs;
int MsgId;
char Subject[Cns_MAX_BYTES_SUBJECT + 1]; char Subject[Cns_MAX_BYTES_SUBJECT + 1];
unsigned NumCourses; unsigned NumCourses;
struct struct
@ -83,23 +82,18 @@ struct Msg_Messages
unsigned CurrentPage; unsigned CurrentPage;
long MsgCod; // Used as parameter with message to be removed long MsgCod; // Used as parameter with message to be removed
}; };
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Msg_FormMsgUsrs (void); void Msg_FormMsgUsrs (void);
void Msg_PutHiddenParamsSubjectAndContent (void);
void Msg_PutHiddenParamAnotherRecipient (const struct UsrData *UsrDat);
void Msg_PutHiddenParamOtherRecipients (void);
void Msg_RecMsgFromUsr (void); void Msg_RecMsgFromUsr (void);
void Msg_ReqDelAllRecMsgs (void); void Msg_ReqDelAllRecMsgs (void);
void Msg_ReqDelAllSntMsgs (void); void Msg_ReqDelAllSntMsgs (void);
void Msg_DelAllRecMsgs (void); void Msg_DelAllRecMsgs (void);
void Msg_DelAllSntMsgs (void); void Msg_DelAllSntMsgs (void);
void Msg_GetParamMsgsCrsCod (void);
void Msg_GetParamFilterFromTo (void);
void Msg_GetParamFilterContent (void);
void Msg_DelSntMsg (void); void Msg_DelSntMsg (void);
void Msg_DelRecMsg (void); void Msg_DelRecMsg (void);
void Msg_ExpSntMsg (void); void Msg_ExpSntMsg (void);
@ -120,17 +114,11 @@ unsigned Msg_GetNumMsgsSent (Hie_Level_t Scope,Msg_Status_t MsgStatus);
unsigned Msg_GetNumMsgsReceived (Hie_Level_t Scope,Msg_Status_t MsgStatus); unsigned Msg_GetNumMsgsReceived (Hie_Level_t Scope,Msg_Status_t MsgStatus);
void Msg_PutHiddenParamsMsgsFilters (void *Messages); void Msg_PutHiddenParamsMsgsFilters (void *Messages);
void Msg_GetDistinctCoursesInMyMessages (void);
void Msg_ShowFormSelectCourseSentOrRecMsgs (void);
void Msg_ShowFormToFilterMsgs (void);
void Msg_GetMsgSubject (long MsgCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1]);
void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr,long MsgCod,bool GetContent); char **ContentStr,long MsgCod,bool GetContent);
void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg); void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg);
void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor); void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor);
bool Msg_WriteCrsOrgMsg (long CrsCod);
void Msg_WriteListUsrsDstMsg (long MsgCod);
void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground); void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground);
void Msg_WriteMsgContent (char *Content,unsigned long MaxLength,bool InsertLinks,bool ChangeBRToRet); void Msg_WriteMsgContent (char *Content,unsigned long MaxLength,bool InsertLinks,bool ChangeBRToRet);

View File

@ -1588,6 +1588,8 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
long Cod; long Cod;
struct For_Forum ForumSelected; struct For_Forum ForumSelected;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]; char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
char FileNameMail[PATH_MAX + 1];
FILE *FileMail;
char Command[2048 + char Command[2048 +
Cfg_MAX_BYTES_SMTP_PASSWORD + Cfg_MAX_BYTES_SMTP_PASSWORD +
Cns_MAX_BYTES_EMAIL_ADDRESS + Cns_MAX_BYTES_EMAIL_ADDRESS +
@ -1627,17 +1629,17 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
ToUsrLanguage = Gbl.Prefs.Language; ToUsrLanguage = Gbl.Prefs.Language;
/***** Create temporary file for mail content *****/ /***** Create temporary file for mail content *****/
Mai_CreateFileNameMail (); Mai_CreateFileNameMail (FileNameMail,&FileMail);
/***** Welcome note *****/ /***** Welcome note *****/
Mai_WriteWelcomeNoteEMail (ToUsrDat); Mai_WriteWelcomeNoteEMail (FileMail,ToUsrDat);
if (NumRows == 1) if (NumRows == 1)
fprintf (Gbl.Msg.FileMail,Txt_NOTIFY_EVENTS_There_is_a_new_event_NO_HTML[ToUsrLanguage], fprintf (FileMail,Txt_NOTIFY_EVENTS_There_is_a_new_event_NO_HTML[ToUsrLanguage],
Cfg_PLATFORM_SHORT_NAME); Cfg_PLATFORM_SHORT_NAME);
else else
fprintf (Gbl.Msg.FileMail,Txt_NOTIFY_EVENTS_There_are_X_new_events_NO_HTML[ToUsrLanguage], fprintf (FileMail,Txt_NOTIFY_EVENTS_There_are_X_new_events_NO_HTML[ToUsrLanguage],
(unsigned) NumRows,Cfg_PLATFORM_SHORT_NAME); (unsigned) NumRows,Cfg_PLATFORM_SHORT_NAME);
fprintf (Gbl.Msg.FileMail,": \n"); fprintf (FileMail,": \n");
/***** Initialize structure with origin user's data *****/ /***** Initialize structure with origin user's data *****/
Usr_UsrDataConstructor (&FromUsrDat); Usr_UsrDataConstructor (&FromUsrDat);
@ -1682,9 +1684,9 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
For_GetForumTypeAndLocationOfAPost (Cod,&ForumSelected); For_GetForumTypeAndLocationOfAPost (Cod,&ForumSelected);
/* Information about the type of this event */ /* Information about the type of this event */
fprintf (Gbl.Msg.FileMail,Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[NotifyEvent][ToUsrLanguage], fprintf (FileMail,Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[NotifyEvent][ToUsrLanguage],
Cfg_PLATFORM_SHORT_NAME); Cfg_PLATFORM_SHORT_NAME);
fprintf (Gbl.Msg.FileMail,"\n"); fprintf (FileMail,"\n");
/* Course/forum: */ /* Course/forum: */
switch (NotifyEvent) switch (NotifyEvent)
@ -1710,7 +1712,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
case Ntf_EVENT_MESSAGE: case Ntf_EVENT_MESSAGE:
case Ntf_EVENT_SURVEY: case Ntf_EVENT_SURVEY:
if (Crs.CrsCod > 0) if (Crs.CrsCod > 0)
fprintf (Gbl.Msg.FileMail,"%s: %s\n", fprintf (FileMail,"%s: %s\n",
Txt_Course_NO_HTML[ToUsrLanguage], Txt_Course_NO_HTML[ToUsrLanguage],
Crs.FullName); Crs.FullName);
break; break;
@ -1718,13 +1720,13 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
case Ntf_EVENT_FORUM_REPLY: case Ntf_EVENT_FORUM_REPLY:
For_SetForumName (&ForumSelected, For_SetForumName (&ForumSelected,
ForumName,ToUsrLanguage,false); // Set forum name in recipient's language ForumName,ToUsrLanguage,false); // Set forum name in recipient's language
fprintf (Gbl.Msg.FileMail,"%s: %s\n", fprintf (FileMail,"%s: %s\n",
Txt_Forum_NO_HTML[ToUsrLanguage], Txt_Forum_NO_HTML[ToUsrLanguage],
ForumName); ForumName);
break; break;
} }
/* From: */ /* From: */
fprintf (Gbl.Msg.FileMail,"%s: %s\n", fprintf (FileMail,"%s: %s\n",
Txt_MSG_From_NO_HTML[ToUsrLanguage], Txt_MSG_From_NO_HTML[ToUsrLanguage],
FromUsrDat.FullName); FromUsrDat.FullName);
} }
@ -1733,20 +1735,20 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
Usr_UsrDataDestructor (&FromUsrDat); Usr_UsrDataDestructor (&FromUsrDat);
/* Go to: */ /* Go to: */
fprintf (Gbl.Msg.FileMail,"%s: %s/ > %s > %s\n", fprintf (FileMail,"%s: %s/ > %s > %s\n",
Txt_Go_to_NO_HTML[ToUsrLanguage], Txt_Go_to_NO_HTML[ToUsrLanguage],
Cfg_URL_SWAD_CGI, Cfg_URL_SWAD_CGI,
Txt_TAB_Messages_NO_HTML[ToUsrLanguage], Txt_TAB_Messages_NO_HTML[ToUsrLanguage],
Txt_Notifications_NO_HTML[ToUsrLanguage]); Txt_Notifications_NO_HTML[ToUsrLanguage]);
/* Disclaimer */ /* Disclaimer */
fprintf (Gbl.Msg.FileMail,"\n%s\n", fprintf (FileMail,"\n%s\n",
Txt_If_you_no_longer_wish_to_receive_email_notifications_NO_HTML[ToUsrLanguage]); Txt_If_you_no_longer_wish_to_receive_email_notifications_NO_HTML[ToUsrLanguage]);
/* Footer note */ /* Footer note */
Mai_WriteFootNoteEMail (ToUsrLanguage); Mai_WriteFootNoteEMail (FileMail,ToUsrLanguage);
fclose (Gbl.Msg.FileMail); fclose (FileMail);
/***** Call the command to send an email *****/ /***** Call the command to send an email *****/
snprintf (Command,sizeof (Command), snprintf (Command,sizeof (Command),
@ -1759,13 +1761,13 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
ToUsrDat->Email, ToUsrDat->Email,
Cfg_PLATFORM_SHORT_NAME, Cfg_PLATFORM_SHORT_NAME,
Txt_Notifications_NO_HTML[ToUsrLanguage], Txt_Notifications_NO_HTML[ToUsrLanguage],
Gbl.Msg.FileNameMail); FileNameMail);
ReturnCode = system (Command); ReturnCode = system (Command);
if (ReturnCode == -1) if (ReturnCode == -1)
Lay_ShowErrorAndExit ("Error when running script to send email."); Lay_ShowErrorAndExit ("Error when running script to send email.");
/***** Remove temporary file *****/ /***** Remove temporary file *****/
unlink (Gbl.Msg.FileNameMail); unlink (FileNameMail);
/***** Update number of notifications, number of mails and statistics *****/ /***** Update number of notifications, number of mails and statistics *****/
ReturnCode = WEXITSTATUS(ReturnCode); ReturnCode = WEXITSTATUS(ReturnCode);

View File

@ -229,12 +229,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
case Pag_MESSAGES_RECEIVED: case Pag_MESSAGES_RECEIVED:
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,1); Pag_PutHiddenParamPagNum (WhatPaginate,1);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MESSAGES_SENT: case Pag_MESSAGES_SENT:
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,1); Pag_PutHiddenParamPagNum (WhatPaginate,1);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MY_AGENDA: case Pag_MY_AGENDA:
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor); Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
@ -347,12 +347,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
case Pag_MESSAGES_RECEIVED: case Pag_MESSAGES_RECEIVED:
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,1); Pag_PutHiddenParamPagNum (WhatPaginate,1);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MESSAGES_SENT: case Pag_MESSAGES_SENT:
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,1); Pag_PutHiddenParamPagNum (WhatPaginate,1);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MY_AGENDA: case Pag_MY_AGENDA:
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor); Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
@ -451,12 +451,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
case Pag_MESSAGES_RECEIVED: case Pag_MESSAGES_RECEIVED:
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MESSAGES_SENT: case Pag_MESSAGES_SENT:
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->LeftPage);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MY_AGENDA: case Pag_MY_AGENDA:
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor); Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
@ -567,12 +567,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
case Pag_MESSAGES_RECEIVED: case Pag_MESSAGES_RECEIVED:
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage); Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MESSAGES_SENT: case Pag_MESSAGES_SENT:
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,NumPage); Pag_PutHiddenParamPagNum (WhatPaginate,NumPage);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MY_AGENDA: case Pag_MY_AGENDA:
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor); Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
@ -670,12 +670,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
case Pag_MESSAGES_RECEIVED: case Pag_MESSAGES_RECEIVED:
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MESSAGES_SENT: case Pag_MESSAGES_SENT:
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->RightPage);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MY_AGENDA: case Pag_MY_AGENDA:
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor); Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);
@ -774,12 +774,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
case Pag_MESSAGES_RECEIVED: case Pag_MESSAGES_RECEIVED:
Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeRcvMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MESSAGES_SENT: case Pag_MESSAGES_SENT:
Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor); Frm_StartFormAnchor (ActSeeSntMsg,Pagination->Anchor);
Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags); Pag_PutHiddenParamPagNum (WhatPaginate,Pagination->NumPags);
Msg_PutHiddenParamsMsgsFilters (&Gbl.Msg); Msg_PutHiddenParamsMsgsFilters ((struct Msg_Messages *) Context);
break; break;
case Pag_MY_AGENDA: case Pag_MY_AGENDA:
Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor); Frm_StartFormAnchor (ActSeeMyAgd,Pagination->Anchor);

View File

@ -414,6 +414,8 @@ int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_
{ {
extern const char *Txt_The_following_password_has_been_assigned_to_you_to_log_in_X_NO_HTML; extern const char *Txt_The_following_password_has_been_assigned_to_you_to_log_in_X_NO_HTML;
extern const char *Txt_New_password_NO_HTML[1 + Lan_NUM_LANGUAGES]; extern const char *Txt_New_password_NO_HTML[1 + Lan_NUM_LANGUAGES];
char FileNameMail[PATH_MAX + 1];
FILE *FileMail;
char Command[2048 + char Command[2048 +
Cfg_MAX_BYTES_SMTP_PASSWORD + Cfg_MAX_BYTES_SMTP_PASSWORD +
Cns_MAX_BYTES_EMAIL_ADDRESS + Cns_MAX_BYTES_EMAIL_ADDRESS +
@ -421,25 +423,25 @@ int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_
int ReturnCode; int ReturnCode;
/***** Create temporary file for mail content *****/ /***** Create temporary file for mail content *****/
Mai_CreateFileNameMail (); Mai_CreateFileNameMail (FileNameMail,&FileMail);
/***** Create a new random password *****/ /***** Create a new random password *****/
Pwd_CreateANewPassword (NewRandomPlainPassword); Pwd_CreateANewPassword (NewRandomPlainPassword);
/***** Write mail content into file and close file *****/ /***** Write mail content into file and close file *****/
/* Welcome note */ /* Welcome note */
Mai_WriteWelcomeNoteEMail (&Gbl.Usrs.Me.UsrDat); Mai_WriteWelcomeNoteEMail (FileMail,&Gbl.Usrs.Me.UsrDat);
/* Message body */ /* Message body */
fprintf (Gbl.Msg.FileMail,Txt_The_following_password_has_been_assigned_to_you_to_log_in_X_NO_HTML, fprintf (FileMail,Txt_The_following_password_has_been_assigned_to_you_to_log_in_X_NO_HTML,
Cfg_PLATFORM_SHORT_NAME,NewRandomPlainPassword,Cfg_URL_SWAD_CGI, Cfg_PLATFORM_SHORT_NAME,NewRandomPlainPassword,Cfg_URL_SWAD_CGI,
(unsigned) (Cfg_TIME_TO_DELETE_OLD_PENDING_PASSWORDS / (24L * 60L * 60L)), (unsigned) (Cfg_TIME_TO_DELETE_OLD_PENDING_PASSWORDS / (24L * 60L * 60L)),
Gbl.Usrs.Me.UsrDat.Email); Gbl.Usrs.Me.UsrDat.Email);
/* Footer note */ /* Footer note */
Mai_WriteFootNoteEMail (Gbl.Prefs.Language); Mai_WriteFootNoteEMail (FileMail,Gbl.Prefs.Language);
fclose (Gbl.Msg.FileMail); fclose (FileMail);
/***** Call the script to send an email *****/ /***** Call the script to send an email *****/
snprintf (Command,sizeof (Command), snprintf (Command,sizeof (Command),
@ -452,13 +454,13 @@ int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_
Gbl.Usrs.Me.UsrDat.Email, Gbl.Usrs.Me.UsrDat.Email,
Cfg_PLATFORM_SHORT_NAME, Cfg_PLATFORM_SHORT_NAME,
Txt_New_password_NO_HTML[Gbl.Usrs.Me.UsrDat.Prefs.Language], Txt_New_password_NO_HTML[Gbl.Usrs.Me.UsrDat.Prefs.Language],
Gbl.Msg.FileNameMail); FileNameMail);
ReturnCode = system (Command); ReturnCode = system (Command);
if (ReturnCode == -1) if (ReturnCode == -1)
Lay_ShowErrorAndExit ("Error when running script to send email."); Lay_ShowErrorAndExit ("Error when running script to send email.");
/***** Remove temporary file *****/ /***** Remove temporary file *****/
unlink (Gbl.Msg.FileNameMail); unlink (FileNameMail);
/***** Write message depending on return code *****/ /***** Write message depending on return code *****/
return WEXITSTATUS (ReturnCode); return WEXITSTATUS (ReturnCode);