diff --git a/swad_changelog.h b/swad_changelog.h index a357088d4..a7ca09d34 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.129 (2020-02-20)" +#define Log_PLATFORM_VERSION "SWAD 19.130.2 (2020-02-24)" #define CSS_FILE "swad19.118.css" #define JS_FILE "swad19.91.1.js" /* @@ -522,9 +522,10 @@ Param // TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario // TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado) // TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo -// TODO: Análisis > Informe: "Informe de uso de SWAD" sale descentrado // TODO: Fig_GetAndShowCourseProgramStats + Version 19.130.2: Feb 24, 2020 Fixed bugs in usage report. (281259 lines) + Version 19.130.1: Feb 24, 2020 Fixed bugs related to database. (281259 lines) Version 19.130: Feb 20, 2020 New module swad_program. (281273 lines) 2 changes necessary in database: CREATE TABLE IF NOT EXISTS prg_grp (PrgIteCod INT NOT NULL,GrpCod INT NOT NULL,UNIQUE INDEX(PrgIteCod,GrpCod)); diff --git a/swad_connected.c b/swad_connected.c index 90f687a9c..ed9204f9e 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -711,7 +711,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t } /***** Free structure that stores the query result *****/ - mysql_free_result (mysql_res); + DB_FreeMySQLResult (&mysql_res); } /*****************************************************************************/ @@ -761,7 +761,7 @@ static void Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Rol_Role_t Role } /***** Free structure that stores the query result *****/ - mysql_free_result (mysql_res); + DB_FreeMySQLResult (&mysql_res); } /*****************************************************************************/ diff --git a/swad_enrolment.c b/swad_enrolment.c index 406b3abbe..b2b413777 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -488,7 +488,6 @@ void Enr_GetNotifEnrolment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], Rol_Role_t Role; SummaryStr[0] = '\0'; // Return nothing on error - // This function may be called inside a web service, so don't report error /***** Get user's role in course from database *****/ if (DB_QuerySELECT (&mysql_res,"can not get user's role" @@ -2033,7 +2032,6 @@ void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], Rol_Role_t DesiredRole; SummaryStr[0] = '\0'; // Return nothing on error - // This function may be called inside a web service, so don't report error /***** Get user and requested role from database *****/ if (DB_QuerySELECT (&mysql_res,"can not get enrolment request", diff --git a/swad_file_browser.c b/swad_file_browser.c index 0c6905d26..e7d799d32 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -11724,7 +11724,6 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat) /*****************************************************************************/ /******************** Get summary and content of a file **********************/ /*****************************************************************************/ -// This function may be called inside a web service, so don't report error void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], char **ContentStr, diff --git a/swad_follow.c b/swad_follow.c index f60e0b62b..c3f16994c 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -1447,7 +1447,6 @@ void Fol_GetAndShowRankingFollowers (void) /*****************************************************************************/ /********************* Get notification of a new follower ********************/ /*****************************************************************************/ -// This function may be called inside a web service, so don't report error void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], char **ContentStr) diff --git a/swad_forum.c b/swad_forum.c index 89df7abf6..aecdb11d2 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1366,53 +1366,49 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC, /*****************************************************************************/ /***************** Get summary and content for a forum post ******************/ /*****************************************************************************/ -// This function may be called inside a web service, so don't report error void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], char **ContentStr, long PstCod,bool GetContent) { - char *Query = NULL; MYSQL_RES *mysql_res; MYSQL_ROW row; size_t Length; SummaryStr[0] = '\0'; // Return nothing on error - /***** Get subject of message from database *****/ - if (asprintf (&Query,"SELECT Subject,Content FROM forum_post" - " WHERE PstCod=%ld",PstCod) < 0) - Lay_NotEnoughMemoryExit (); - if (!mysql_query (&Gbl.mysql,Query)) - if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL) - { - /***** Result should have a unique row *****/ - if (mysql_num_rows (mysql_res) == 1) - { - /***** Get subject and content of the message *****/ - row = mysql_fetch_row (mysql_res); + /***** Get post subject and content from database *****/ + if (DB_QuerySELECT (&mysql_res,"can not get subject and content", + "SELECT Subject," // row[0] + "Content" // row[1] + " FROM forum_post" + " WHERE PstCod=%ld",PstCod) == 1) + { + /***** Get subject and content of the post *****/ + row = mysql_fetch_row (mysql_res); - /***** Copy subject *****/ - Str_Copy (SummaryStr,row[0], - Ntf_MAX_BYTES_SUMMARY); + /***** Copy subject *****/ + Str_Copy (SummaryStr,row[0], + Ntf_MAX_BYTES_SUMMARY); - /***** Copy content *****/ - if (GetContent) - { - Length = strlen (row[1]); + /***** Copy content *****/ + if (GetContent) + { + Length = strlen (row[1]); - if ((*ContentStr = (char *) malloc (Length + 1)) == NULL) - Lay_ShowErrorAndExit ("Error allocating memory for notification content."); + if ((*ContentStr = (char *) malloc (Length + 1)) == NULL) + Lay_ShowErrorAndExit ("Error allocating memory for notification content."); - if (Length) - Str_Copy (*ContentStr,row[1], - Length); - else - **ContentStr = '\0'; - } - } - mysql_free_result (mysql_res); - } + if (Length) + Str_Copy (*ContentStr,row[1], + Length); + else + **ContentStr = '\0'; + } + } + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); } /*****************************************************************************/ diff --git a/swad_log.c b/swad_log.c index c1dab9124..8848f6357 100644 --- a/swad_log.c +++ b/swad_log.c @@ -348,5 +348,5 @@ void Log_GetAndShowLastClicks (void) HTM_TABLE_End (); /***** Free structure that stores the query result *****/ - mysql_free_result (mysql_res); + DB_FreeMySQLResult (&mysql_res); } diff --git a/swad_mark.c b/swad_mark.c index 4f8dd4d2b..73e42b146 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -716,7 +716,6 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], char *Ptr; SummaryStr[0] = '\0'; // Return nothing on error - // This function may be called inside a web service, so don't report error /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); diff --git a/swad_message.c b/swad_message.c index 642b91ca4..35ac22d71 100644 --- a/swad_message.c +++ b/swad_message.c @@ -3099,7 +3099,6 @@ void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], size_t Length; SummaryStr[0] = '\0'; // Return nothing on error - // This function may be called inside a web service, so don't report error /***** Get subject of message from database *****/ if (DB_QuerySELECT (&mysql_res,"can not get subject and content" diff --git a/swad_notice.c b/swad_notice.c index 79f3fae74..b84d89631 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -766,7 +766,6 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], size_t Length; SummaryStr[0] = '\0'; // Return nothing on error - // This function may be called inside a web service, so don't report error /***** Get subject of message from database *****/ if (DB_QuerySELECT (&mysql_res,"can not get content of notice", diff --git a/swad_report.c b/swad_report.c index f93e0b3b2..faa41b330 100644 --- a/swad_report.c +++ b/swad_report.c @@ -461,7 +461,7 @@ static void Rep_WriteHeader (const struct Rep_Report *Report) fprintf (Gbl.F.Rep,"

"); fprintf (Gbl.F.Rep,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME); fprintf (Gbl.F.Rep,"

"); - HTM_UL_Begin (NULL); + fprintf (Gbl.F.Rep,"