diff --git a/swad_ID.c b/swad_ID.c index fe456c0b2..2a13accfc 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -816,15 +816,16 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = ID_ID_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_can_not_delete_this_ID); + Str_Copy (Gbl.Alert.Txt,Txt_You_can_not_delete_this_ID, + Ale_MAX_BYTES_ALERT); } } else { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = ID_ID_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } @@ -994,8 +995,8 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = ID_ID_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } @@ -1094,16 +1095,16 @@ void ID_ConfirmOtherUsrID (void) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = ID_ID_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } else // I can not confirm { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = ID_ID_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } /***** Show one or multiple records *****/ diff --git a/swad_centre.c b/swad_centre.c index e228e81d4..1b04fa85a 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -1892,7 +1892,8 @@ void Ctr_ChangeCtrPlc (void) /***** Write message to show the change made and put button to go to centre changed *****/ Gbl.Alert.Type = Ale_SUCCESS; - sprintf (Gbl.Alert.Txt,"%s",Txt_The_place_of_the_centre_has_changed); + Str_Copy (Gbl.Alert.Txt,Txt_The_place_of_the_centre_has_changed, + Ale_MAX_BYTES_ALERT); Ctr_ShowAlertAndButtonToGoToCtr (); /***** Show the form again *****/ @@ -2769,16 +2770,10 @@ static void Ctr_RecFormRequestOrCreateCtr (unsigned Status) Ctr_CreateCentre (Status); } else // If there is not a web - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_web_address_of_the_new_centre); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_centre); } else // If there is not a centre name - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_centre); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_centre); /***** Show the form again *****/ Ctr_EditCentres (); diff --git a/swad_changelog.h b/swad_changelog.h index e68b966c7..45896c1b1 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -355,10 +355,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.5.2 (2018-10-16)" +#define Log_PLATFORM_VERSION "SWAD 18.5.3 (2018-10-16)" #define CSS_FILE "swad18.4.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.5.3: Oct 16, 2018 sprintf changed by safe string copy in some alerts. (235198 lines) Version 18.5.2: Oct 16, 2018 Code refactoring related to password change. (235170 lines) Version 18.5.1: Oct 16, 2018 Code refactoring related to edition of another user's account. (235212 lines) Version 18.5: Oct 16, 2018 Changes in management of other users. (235292 lines) diff --git a/swad_course.c b/swad_course.c index f920e296b..8ed884437 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1880,7 +1880,8 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status) else // If there is not a course name { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course); + Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course, + Ale_MAX_BYTES_ALERT); } } else // Year not valid @@ -2343,7 +2344,8 @@ void Crs_ChangeInsCrsCod (void) else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_dont_have_permission_to_edit_this_course); + Str_Copy (Gbl.Alert.Txt,Txt_You_dont_have_permission_to_edit_this_course, + Ale_MAX_BYTES_ALERT); } } @@ -2547,7 +2549,8 @@ void Crs_ChangeCrsYear (void) else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_dont_have_permission_to_edit_this_course); + Str_Copy (Gbl.Alert.Txt,Txt_You_dont_have_permission_to_edit_this_course, + Ale_MAX_BYTES_ALERT); } } @@ -2704,7 +2707,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_dont_have_permission_to_edit_this_course); + Str_Copy (Gbl.Alert.Txt,Txt_You_dont_have_permission_to_edit_this_course, + Ale_MAX_BYTES_ALERT); } } diff --git a/swad_degree.c b/swad_degree.c index 368229e80..d812cae3d 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -1574,16 +1574,10 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status) Deg_CreateDegree (Status); } else // If there is not a degree logo or web - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_web_address_of_the_new_degree); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_degree); } else // If there is not a degree name - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_degree); /***** Show the form again *****/ Deg_EditDegrees (); diff --git a/swad_degree_type.c b/swad_degree_type.c index 3e8772bbd..30d73fc4a 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -728,10 +728,7 @@ void DT_RecFormNewDegreeType (void) DT_CreateDegreeType (DegTyp); } else // If there is not a degree type name - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_name_of_the_new_type_of_degree); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_name_of_the_new_type_of_degree); /***** Show the form again *****/ DT_EditDegreeTypes (); diff --git a/swad_department.c b/swad_department.c index b6e81f9c0..f11e8471e 100644 --- a/swad_department.c +++ b/swad_department.c @@ -837,10 +837,7 @@ void Dpt_ChangeDptWWW (void) Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); } else - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_can_not_leave_the_web_address_empty); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_web_address_empty); /***** Show the form again *****/ Str_Copy (Dpt->WWW,NewWWW, @@ -1038,16 +1035,10 @@ void Dpt_RecFormNewDpt (void) Dpt_CreateDepartment (Dpt); } else // If there is not a web - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_web_address_of_the_new_department); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_web_address_of_the_new_department); } else // If there is not a department name - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_department); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_department); /***** Show the form again *****/ Dpt_EditDepartments (); diff --git a/swad_enrolment.c b/swad_enrolment.c index 6939a34ea..4e8c5d7bd 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -3486,13 +3486,15 @@ void Enr_RemUsrFromCrs1 (void) else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } } @@ -4222,7 +4224,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course * if (QuietOrVerbose == Cns_VERBOSE) { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } diff --git a/swad_file_browser.c b/swad_file_browser.c index 0dec4985b..c9cd2dad0 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -9291,8 +9291,10 @@ void Brw_RcvFileInFileBrwDropzone (void) void Brw_RcvFileInFileBrwClassic (void) { /***** Receive file and show feedback message *****/ - if (!Brw_RcvFileInFileBrw (Brw_CLASSIC_UPLOAD)) - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); + Brw_RcvFileInFileBrw (Brw_CLASSIC_UPLOAD); + + /***** Show possible alert *****/ + Ale_ShowPendingAlert (); /***** Show again file browser *****/ Brw_ShowAgainFileBrowserOrWorks (); @@ -9363,6 +9365,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType) /* Check if the destination file exists */ if (Fil_CheckIfPathExists (Path)) { + Gbl.Alert.Type = Ale_WARNING; sprintf (Gbl.Alert.Txt,Txt_UPLOAD_FILE_X_file_already_exists_NO_HTML, Gbl.FileBrowser.NewFilFolLnkName); } @@ -9384,6 +9387,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType) if (rename (PathTmp,Path)) // Fail { Fil_RemoveTree (PathTmp); + Gbl.Alert.Type = Ale_WARNING; sprintf (Gbl.Alert.Txt,Txt_UPLOAD_FILE_could_not_create_file_NO_HTML, Gbl.FileBrowser.NewFilFolLnkName); } @@ -9395,6 +9399,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType) if (Brw_CheckIfQuotaExceded ()) { Fil_RemoveTree (Path); + Gbl.Alert.Type = Ale_WARNING; sprintf (Gbl.Alert.Txt,Txt_UPLOAD_FILE_X_quota_exceeded_NO_HTML, Gbl.FileBrowser.NewFilFolLnkName); } @@ -9423,10 +9428,10 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType) Brw_IS_FOLDER, Gbl.FileBrowser.FilFolLnkName, FileNameToShow); + Gbl.Alert.Type = Ale_SUCCESS; sprintf (Gbl.Alert.Txt,Txt_The_file_X_has_been_placed_inside_the_folder_Y, Gbl.FileBrowser.NewFilFolLnkName, FileNameToShow); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); } UploadSucessful = true; @@ -9470,10 +9475,18 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType) } } else // Empty filename - sprintf (Gbl.Alert.Txt,"%s",Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML); + { + Gbl.Alert.Type = Ale_WARNING; + Str_Copy (Gbl.Alert.Txt,Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML, + Ale_MAX_BYTES_ALERT); + } } else // I do not have permission to create files here - sprintf (Gbl.Alert.Txt,"%s",Txt_UPLOAD_FILE_Forbidden_NO_HTML); + { + Gbl.Alert.Type = Ale_WARNING; + Str_Copy (Gbl.Alert.Txt,Txt_UPLOAD_FILE_Forbidden_NO_HTML, + Ale_MAX_BYTES_ALERT); + } return UploadSucessful; } diff --git a/swad_follow.c b/swad_follow.c index 535021927..c6d7c3241 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -1045,7 +1045,8 @@ void Fol_FollowUsr1 (void) else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } @@ -1058,7 +1059,8 @@ void Fol_FollowUsr2 (void) if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } if (Gbl.Alert.Type != Ale_SUCCESS) @@ -1093,7 +1095,8 @@ void Fol_UnfollowUsr1 (void) else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } diff --git a/swad_forum.c b/swad_forum.c index cdad051c0..2efeedba1 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -4165,8 +4165,8 @@ void For_RequestRemoveThread (void) sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_entire_thread_X, Subject); else - sprintf (Gbl.Alert.Txt,"%s", - Txt_Do_you_really_want_to_remove_the_entire_thread); + Str_Copy (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_entire_thread, + Ale_MAX_BYTES_ALERT); Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt, For_ActionsDelThrFor[Gbl.Forum.ForumSelected.Type], For_FORUM_THREADS_SECTION_ID,NULL, diff --git a/swad_game.c b/swad_game.c index 8e4930695..32e78fa9a 100644 --- a/swad_game.c +++ b/swad_game.c @@ -3327,8 +3327,7 @@ void Gam_RemoveQst (void) DB_QueryUPDATE (Query,"can not update indexes of questions"); /***** Write message *****/ - sprintf (Gbl.Alert.Txt,"%s",Txt_Question_removed); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); /***** Show current game *****/ Gam_ShowOneGame (Game.GamCod, diff --git a/swad_group.c b/swad_group.c index 366b6e300..cfc2e2707 100644 --- a/swad_group.c +++ b/swad_group.c @@ -671,19 +671,22 @@ void Grp_ChangeMyGrps (Cns_QuietOrVerbose_t QuietOrVerbose) if (ChangesMade) { Gbl.Alert.Type = Ale_SUCCESS; - sprintf (Gbl.Alert.Txt,"%s",Txt_The_requested_group_changes_were_successful); + Str_Copy (Gbl.Alert.Txt,Txt_The_requested_group_changes_were_successful, + Ale_MAX_BYTES_ALERT); } else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_There_has_been_no_change_in_groups); + Str_Copy (Gbl.Alert.Txt,Txt_There_has_been_no_change_in_groups, + Ale_MAX_BYTES_ALERT); } } } else if (QuietOrVerbose == Cns_VERBOSE) { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group); + Str_Copy (Gbl.Alert.Txt,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group, + Ale_MAX_BYTES_ALERT); } /***** Free memory with the list of groups which I want to belong to *****/ @@ -3690,7 +3693,8 @@ void Grp_RecFormNewGrpTyp (void) else // If there is not a group type name { AlertType = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_name_of_the_new_type_of_group); + Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_name_of_the_new_type_of_group, + Ale_MAX_BYTES_ALERT); } /***** Show the form again *****/ @@ -3759,13 +3763,15 @@ void Grp_RecFormNewGrp (void) else // If there is not a group name { AlertType = Ale_ERROR; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_name_of_the_new_group); + Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_name_of_the_new_group, + Ale_MAX_BYTES_ALERT); } } else // Invalid group type { AlertType = Ale_ERROR; - sprintf (Gbl.Alert.Txt,"%s","Wrong type of group."); + Str_Copy (Gbl.Alert.Txt,"Wrong type of group.", + Ale_MAX_BYTES_ALERT); } /***** Show the form again *****/ @@ -4430,7 +4436,7 @@ void Grp_ChangeOpenTimeGrpTyp (void) DB_QueryUPDATE (Query,"can not update enrolment type of a type of group"); /***** Write message to show the change made *****/ - sprintf (Gbl.Alert.Txt,"%s",Txt_The_date_time_of_opening_of_groups_has_changed); + Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed); /***** Show the form again *****/ Grp_ReqEditGroupsInternal (Ale_SUCCESS,Gbl.Alert.Txt, diff --git a/swad_holiday.c b/swad_holiday.c index 72d16edf9..34aa2e0a6 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -1158,7 +1158,8 @@ void Hld_RecFormNewHoliday1 (void) { /* Error message */ Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_must_specify_the_name_of_the_new_holiday); + Str_Copy (Gbl.Alert.Txt,Txt_You_must_specify_the_name_of_the_new_holiday, + Ale_MAX_BYTES_ALERT); } } diff --git a/swad_mail.c b/swad_mail.c index c1e2a6cb6..92cf467ce 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -1208,7 +1208,7 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, { extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_Please_fill_in_your_email_address; - extern const char *Txt_Please_check_and_confirm_your_email_address; + extern const char *Txt_Please_confirm_your_email_address; extern const char *Txt_Current_email; extern const char *Txt_Other_emails; extern const char *Txt_Email_X_confirmed; @@ -1234,7 +1234,7 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe, if (IMustFillEmail) Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_email_address); else if (IShouldConfirmEmail) - Ale_ShowAlert (Ale_WARNING,Txt_Please_check_and_confirm_your_email_address); + Ale_ShowAlert (Ale_WARNING,Txt_Please_confirm_your_email_address); /***** Get my emails *****/ sprintf (Query,"SELECT E_mail,Confirmed FROM usr_emails" @@ -1600,8 +1600,8 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Mai_EMAIL_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_User_not_found_or_you_do_not_have_permission_); + Str_Copy (Gbl.Alert.Txt,Txt_User_not_found_or_you_do_not_have_permission_, + Ale_MAX_BYTES_ALERT); } } @@ -1654,13 +1654,13 @@ void Mai_PutButtonToCheckEmailAddress (void) { extern const char *Hlp_PROFILE_Account_email; extern const char *Txt_Email_unconfirmed; - extern const char *Txt_Please_check_and_confirm_your_email_address; + extern const char *Txt_Please_confirm_your_email_address; extern const char *Txt_Check; /***** Box with button to check email address *****/ Box_StartBox (NULL,Txt_Email_unconfirmed,NULL, Hlp_PROFILE_Account_email,Box_CLOSABLE); - Ale_ShowAlertAndButton (Ale_WARNING,Txt_Please_check_and_confirm_your_email_address, + Ale_ShowAlertAndButton (Ale_WARNING,Txt_Please_confirm_your_email_address, ActFrmMyAcc,NULL,NULL,NULL, Btn_CONFIRM_BUTTON,Txt_Check); Box_EndBox (); @@ -1737,8 +1737,8 @@ bool Mai_SendMailMsgToConfirmEmail (void) case 1: Gbl.Alert.Type = Ale_ERROR; Gbl.Alert.Section = Mai_EMAIL_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_There_was_a_problem_sending_an_email_automatically); + Str_Copy (Gbl.Alert.Txt,Txt_There_was_a_problem_sending_an_email_automatically, + Ale_MAX_BYTES_ALERT); return false; default: Gbl.Alert.Type = Ale_ERROR; diff --git a/swad_mark.c b/swad_mark.c index 73cafd8ea..4d555cac7 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -325,7 +325,9 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks) // Only one table is allowed if (Str_FindStrInFile (FileAllMarks,"",Gbl.Alert.Txt); } @@ -872,7 +880,9 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], } else { - sprintf (Gbl.Alert.Txt,"%s","User's IDs not found!"); // TODO: Need translation! + Gbl.Alert.Type = Ale_WARNING; + Str_Copy (Gbl.Alert.Txt,"User's IDs not found!", // TODO: Need translation! + Ale_MAX_BYTES_ALERT); if ((*ContentStr = (char *) malloc (9 + strlen (Gbl.Alert.Txt) + 3 + 1))) sprintf (*ContentStr,"",Gbl.Alert.Txt); } diff --git a/swad_nickname.c b/swad_nickname.c index ddaac3af8..c4f859114 100644 --- a/swad_nickname.c +++ b/swad_nickname.c @@ -447,7 +447,8 @@ void Nck_RemoveMyNick (void) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Nck_NICKNAME_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s",Txt_You_can_not_delete_your_current_nickname); + Str_Copy (Gbl.Alert.Txt,Txt_You_can_not_delete_your_current_nickname, + Ale_MAX_BYTES_ALERT); } /***** Show my account again *****/ diff --git a/swad_password.c b/swad_password.c index 998da3289..c24c5043c 100644 --- a/swad_password.c +++ b/swad_password.c @@ -181,8 +181,8 @@ void Pwd_UpdateMyPwd (void) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_You_have_not_entered_your_password_correctly); + Str_Copy (Gbl.Alert.Txt,Txt_You_have_not_entered_your_password_correctly, + Ale_MAX_BYTES_ALERT); } } @@ -227,8 +227,8 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat) // Passwords don't match Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_You_have_not_written_twice_the_same_new_password); + Str_Copy (Gbl.Alert.Txt,Txt_You_have_not_written_twice_the_same_new_password, + Ale_MAX_BYTES_ALERT); } else { @@ -245,8 +245,8 @@ static void Pwd_CheckAndUpdateNewPwd (struct UsrData *UsrDat) Gbl.Alert.Type = Ale_SUCCESS; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s", - Txt_The_password_has_been_changed_successfully); + Str_Copy (Gbl.Alert.Txt,Txt_The_password_has_been_changed_successfully, + Ale_MAX_BYTES_ALERT); } } } @@ -546,7 +546,8 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword, { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s",Txt_The_password_is_too_trivial_); + Str_Copy (Gbl.Alert.Txt,Txt_The_password_is_too_trivial_, + Ale_MAX_BYTES_ALERT); return false; } @@ -556,7 +557,8 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword, { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s",Txt_The_password_is_too_trivial_); + Str_Copy (Gbl.Alert.Txt,Txt_The_password_is_too_trivial_, + Ale_MAX_BYTES_ALERT); return false; } @@ -637,7 +639,8 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s",Txt_The_password_can_not_contain_spaces); + Str_Copy (Gbl.Alert.Txt,Txt_The_password_can_not_contain_spaces, + Ale_MAX_BYTES_ALERT); return false; } @@ -651,7 +654,8 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword) { Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Section = Pwd_PASSWORD_SECTION_ID; - sprintf (Gbl.Alert.Txt,"%s",Txt_The_password_can_not_consist_only_of_digits); + Str_Copy (Gbl.Alert.Txt,Txt_The_password_can_not_consist_only_of_digits, + Ale_MAX_BYTES_ALERT); return false; } diff --git a/swad_photo.c b/swad_photo.c index 67f889353..adb0e3100 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -737,19 +737,22 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr if (NumFacesTotal == 0) { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_Could_not_detect_any_face_in_front_position_); + Str_Copy (Gbl.Alert.Txt,Txt_Could_not_detect_any_face_in_front_position_, + Ale_MAX_BYTES_ALERT); } else if (NumFacesTotal == 1) { if (NumFacesGreen == 1) { Gbl.Alert.Type = Ale_SUCCESS; - sprintf (Gbl.Alert.Txt,"%s",Txt_A_face_marked_in_green_has_been_detected_); + Str_Copy (Gbl.Alert.Txt,Txt_A_face_marked_in_green_has_been_detected_, + Ale_MAX_BYTES_ALERT); } else { Gbl.Alert.Type = Ale_WARNING; - sprintf (Gbl.Alert.Txt,"%s",Txt_A_face_marked_in_red_has_been_detected_); + Str_Copy (Gbl.Alert.Txt,Txt_A_face_marked_in_red_has_been_detected_, + Ale_MAX_BYTES_ALERT); } } else // NumFacesTotal > 1 @@ -899,12 +902,14 @@ static void Pho_UpdatePhoto1 (struct UsrData *UsrDat) Pho_RemoveUsrFromTableClicksWithoutPhoto (UsrDat->UsrCod); Gbl.Alert.Type = Ale_SUCCESS; - sprintf (Gbl.Alert.Txt,"%s",Txt_Photo_has_been_updated); + Str_Copy (Gbl.Alert.Txt,Txt_Photo_has_been_updated, + Ale_MAX_BYTES_ALERT); } else { Gbl.Alert.Type = Ale_ERROR; - sprintf (Gbl.Alert.Txt,"%s","Error updating photo."); + Str_Copy (Gbl.Alert.Txt,"Error updating photo.", + Ale_MAX_BYTES_ALERT); } } @@ -1131,13 +1136,15 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat) if (NumErrors) { Gbl.Alert.Type = Ale_ERROR; - sprintf (Gbl.Alert.Txt,"%s","Error removing photo."); + Str_Copy (Gbl.Alert.Txt,"Error removing photo.", + Ale_MAX_BYTES_ALERT); return false; } else { Gbl.Alert.Type = Ale_SUCCESS; - sprintf (Gbl.Alert.Txt,"%s",Txt_Photo_removed); + Str_Copy (Gbl.Alert.Txt,Txt_Photo_removed, + Ale_MAX_BYTES_ALERT); return true; } } diff --git a/swad_plugin.c b/swad_plugin.c index cb585a51e..ab4411e9a 100644 --- a/swad_plugin.c +++ b/swad_plugin.c @@ -633,10 +633,7 @@ void Plg_ChangePlgDescription (void) Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); } else - { - sprintf (Gbl.Alert.Txt,"%s",Txt_You_can_not_leave_the_description_empty); - Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); - } + Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_leave_the_description_empty); /***** Show the form again *****/ Str_Copy (Plg->Description,NewDescription, diff --git a/swad_record.c b/swad_record.c index 8282ac881..80804166b 100644 --- a/swad_record.c +++ b/swad_record.c @@ -1680,8 +1680,8 @@ void Rec_UpdateAndShowOtherCrsRecord (void) /***** Update the record *****/ Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod); Gbl.Alert.Type = Ale_SUCCESS; - sprintf (Gbl.Alert.Txt,"%s", - Txt_Student_record_card_in_this_course_has_been_updated); + Str_Copy (Gbl.Alert.Txt,Txt_Student_record_card_in_this_course_has_been_updated, + Ale_MAX_BYTES_ALERT); /***** Show one or multiple records *****/ switch (Gbl.Action.Original) diff --git a/swad_string.c b/swad_string.c index 6e735094f..c84bc467a 100644 --- a/swad_string.c +++ b/swad_string.c @@ -2793,9 +2793,10 @@ bool Str_ConvertFilFolLnkNameToValid (char *FileName) FileName); } else // FileName is empty - sprintf (Gbl.Alert.Txt,"%s", - Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML : - Txt_UPLOAD_FILE_Invalid_name); + Str_Copy (Gbl.Alert.Txt, + Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML : + Txt_UPLOAD_FILE_Invalid_name, + Ale_MAX_BYTES_ALERT); return FileNameIsOK; } diff --git a/swad_survey.c b/swad_survey.c index d1b47b6ad..625b28c50 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -3640,8 +3640,7 @@ void Svy_RemoveQst (void) DB_QueryUPDATE (Query,"can not update indexes of questions"); /***** Write message *****/ - sprintf (Gbl.Alert.Txt,"%s",Txt_Question_removed); - Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); + Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); /***** Show current survey *****/ Svy_ShowOneSurvey (SvyCod,&SvyQst,true); diff --git a/swad_test.c b/swad_test.c index 700c977b4..00a486d24 100644 --- a/swad_test.c +++ b/swad_test.c @@ -6221,7 +6221,6 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt) MYSQL_ROW row; unsigned long NumRows; long TagCod = -1L; // -1 means that the tag does not exist in database - bool Error = false; /***** Get tag code from database *****/ sprintf (Query,"SELECT TagCod FROM tst_tags" @@ -6229,26 +6228,29 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt) Gbl.CurrentCrs.Crs.CrsCod,TagTxt); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get tag"); + Gbl.Alert.Type = Ale_NONE; if (NumRows == 1) { /***** Get tag code *****/ row = mysql_fetch_row (mysql_res); if ((TagCod = Str_ConvertStrCodToLongCod (row[0])) < 0) { - sprintf (Gbl.Alert.Txt,"%s","Wrong code of tag."); - Error = true; + Gbl.Alert.Type = Ale_ERROR; + Str_Copy (Gbl.Alert.Txt,"Wrong code of tag.", + Ale_MAX_BYTES_ALERT); } } else if (NumRows > 1) { - sprintf (Gbl.Alert.Txt,"%s","Duplicated tag."); - Error = true; + Gbl.Alert.Type = Ale_ERROR; + Str_Copy (Gbl.Alert.Txt,"Duplicated tag.", + Ale_MAX_BYTES_ALERT); } /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - if (Error) + if (Gbl.Alert.Type == Ale_ERROR) Lay_ShowErrorAndExit (Gbl.Alert.Txt); return TagCod; diff --git a/swad_text.c b/swad_text.c index 854aba930..6173088b6 100644 --- a/swad_text.c +++ b/swad_text.c @@ -2847,21 +2847,21 @@ const char *Txt_Another_department = const char *Txt_Another_ID = #if L==1 - "Un altre ID (DNI/cèdula)"; + "Un altre ID"; #elif L==2 "Ein anderer Ausweis-Nr."; #elif L==3 "Another ID"; #elif L==4 - "Otro ID (DNI/cédula)"; + "Otro ID"; #elif L==5 "Un autre numéro d'identité"; #elif L==6 - "Otro ID (DNI/cédula)"; // Okoteve traducción + "Otro ID"; // Okoteve traducción #elif L==7 "Un'altra carta d'identità"; #elif L==8 - "Another ID"; // Potrzebujesz tlumaczenie + "Another ID"; // Potrzebujesz tlumaczenie #elif L==9 "Outro nº de identif."; #endif @@ -29780,25 +29780,25 @@ const char *Txt_Play = // To play a game "Jogar"; #endif -const char *Txt_Please_check_and_confirm_your_email_address = +const char *Txt_Please_confirm_your_email_address = #if L==1 - "Si us plau, comproveu i confirmeu la seva adreça de correu."; + "Si us plau, confirmeu la seva adreça de correu."; #elif L==2 - "Bitte überprüfen Sie und Ihre E-Mail-Adresse bestätigen."; + "Bitte Ihre E-Mail-Adresse bestätigen."; #elif L==3 - "Please check and confirm your email address."; + "Please confirm your email address."; #elif L==4 - "Por favor, compruebe y confirme su dirección de correo."; + "Por favor, confirme su dirección de correo."; #elif L==5 - "S'il vous plaít, vérifiez et confirmez votre adresse email."; + "S'il vous plaít, confirmez votre adresse email."; #elif L==6 - "Por favor, compruebe y confirme su dirección de correo."; // Okoteve traducción + "Por favor, confirme su dirección de correo."; // Okoteve traducción #elif L==7 - "Per favore, verifica e conferma il tuo indirizzo email."; + "Per favore, conferma il tuo indirizzo email."; #elif L==8 - "Proszę sprawdzić i potwierdzić swój adres email."; + "Proszę potwierdzić swój adres email."; #elif L==9 - "Por favor, verificar e confirmar o seu endereço de email."; + "Por favor, confirmar o seu endereço de email."; #endif const char *Txt_Please_enter_your_ID = @@ -45951,63 +45951,63 @@ const char *Txt_The_ID_is_used_in_order_to_facilitate_ = " la inscripció en les assignatures" " i la consulta de qualificacions." " Si hi ha diverses versions de la ID" - " (per ex. DNI amb o sense lletra al final)," + " (per ex. DNI amb o sense lletra)," " indiqueu totes les versions."; #elif L==2 "Die ID wird zu erleichtern," " um die Einschreibung in Kurse" " und Beratungskompetenz eingesetzt." " Wenn es mehrere Versionen der ID" - " (zB. mit oder ohne Buchstabe am Ende)," + " (zB. mit oder ohne Buchstabe)," " schreiben alle Versionen."; #elif L==3 "The ID is used in order to facilitate" " enrolment in courses" " and consulting marks." " If there are multiple versions of the ID" - " (eg. with or without letter at the end)," + " (eg. with or without letter)," " write out all versions."; #elif L==4 - "El ID se utiliza con el fin de facilitar" + "El ID se utiliza para facilitar" " la inscripción en las asignaturas" " y la consulta de calificaciones." " Si existen varias versiones del ID" - " (por ej. DNI con o sin letra al final)," + " (por ej. DNI con o sin letra)," " indique todas las versiones."; #elif L==5 "L'ID est utilisé afin de faciliter" " l'inscription à des matières" " et la consulte des notes." " S'il existe plusieurs versions du ID" - " (par example avec ou sans lettre à la fin)," + " (par example avec ou sans lettre)," " écrire toutes les versions."; #elif L==6 - "El ID se utiliza con el fin de facilitar" + "El ID se utiliza para facilitar" " la inscripción en las asignaturas" " y la consulta de calificaciones." " Si existen varias versiones del ID" - " (por ej. DNI con o sin letra al final)," + " (por ej. DNI con o sin letra)," " indique todas las versiones."; // Okoteve traducción #elif L==7 "L'ID è utilizzato per agevolare" " l'iscrizione ai corsi" " e consultare dei risultati." " Se ci sono più versioni del ID" - " (ad es. con o senza lettera alla fine)," + " (ad es. con o senza lettera)," " scrivere tutte le versioni."; #elif L==8 "Identyfikator jest używany w celu ułatwienia" " rejestracji w kursach" " i skonsultuje znaków." " Jeśli istnieje wiele wersji identyfikatora" - " (np. Z lub bez litery na końcu)," + " (np. Z lub bez litery)," " wypisać wszystkie wersje."; #elif L==9 "O nº de identificação é usado para facilitar" " a inscrição em disciplinas" " e consultas de notas." " Se houver várias versões do nº de identificação" - " (eg., com ou sem letra no final)," + " (eg., com ou sem letra)," " escreva todas as versões."; #endif