mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-14 12:44:09 +02:00
Version 18.7.15
This commit is contained in:
parent
4bf8f0f936
commit
9650339c7d
|
@ -547,7 +547,7 @@ void Ann_HideActiveAnnouncement (void)
|
|||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_OBSOLETE_ANNOUNCEMENT,AnnCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryUPDATE (Query,"can not hide announcement");
|
||||
DB_QueryUPDATE_free (Query,"can not hide announcement");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -567,7 +567,7 @@ void Ann_RevealHiddenAnnouncement (void)
|
|||
" WHERE AnnCod=%ld",
|
||||
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,AnnCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryUPDATE (Query,"can not reveal announcement");
|
||||
DB_QueryUPDATE_free (Query,"can not reveal announcement");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -875,7 +875,7 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT
|
|||
" WHERE AsgCod=%ld AND CrsCod=%ld",
|
||||
AsgCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get assignment text");
|
||||
NumRows = DB_QuerySELECT_free (Query,&mysql_res,"can not get assignment text");
|
||||
|
||||
/***** The result of the query must have one row or none *****/
|
||||
if (NumRows == 1)
|
||||
|
|
|
@ -2526,10 +2526,7 @@ static unsigned Att_GetNumStdsFromAListWhoAreInAttEvent (long AttCod,long LstSel
|
|||
Str_Concat (Query,") AND Present='Y'",
|
||||
MaxLength);
|
||||
|
||||
NumStdsInAttEvent = (unsigned) DB_QueryCOUNT (Query,"can not get number of students from a list who are registered in an event");
|
||||
|
||||
/***** Free query *****/
|
||||
free ((void *) Query);
|
||||
NumStdsInAttEvent = (unsigned) DB_QueryCOUNT_free (Query,"can not get number of students from a list who are registered in an event");
|
||||
}
|
||||
return NumStdsInAttEvent;
|
||||
}
|
||||
|
|
|
@ -1012,7 +1012,7 @@ static void Ban_CreateBanner (struct Banner *Ban)
|
|||
" ('N','%s','%s','%s','%s')",
|
||||
Ban->ShrtName,Ban->FullName,Ban->Img,Ban->WWW) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
DB_QueryINSERT (Query,"can not create banner");
|
||||
DB_QueryINSERT_free (Query,"can not create banner");
|
||||
|
||||
/***** Write success message *****/
|
||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||
|
|
|
@ -1296,7 +1296,7 @@ void Ctr_GetShortNameOfCentreByCod (struct Centre *Ctr)
|
|||
" WHERE CtrCod=%ld",
|
||||
Ctr->CtrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of a centre") == 1)
|
||||
if (DB_QuerySELECT_free (Query,&mysql_res,"can not get the short name of a centre") == 1)
|
||||
{
|
||||
/***** Get the short name of this centre *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -3007,7 +3007,7 @@ unsigned Ctr_ListCtrsFound (const char *Query)
|
|||
struct Centre Ctr;
|
||||
|
||||
/***** Query database *****/
|
||||
if ((NumCtrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get centres")))
|
||||
if ((NumCtrs = (unsigned) DB_QuerySELECT_free (Query,&mysql_res,"can not get centres")))
|
||||
{
|
||||
/***** Start box and table *****/
|
||||
/* Number of centres found */
|
||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.7.14 (2018-10-20)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.7.15 (2018-10-20)"
|
||||
#define CSS_FILE "swad18.4.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
Version 18.7.15: Oct 20, 2018 Some sprintf for database queries changed by asprintf. (236996 lines)
|
||||
Version 18.7.14: Oct 20, 2018 Some sprintf for database queries changed by asprintf. (236993 lines)
|
||||
Version 18.7.13: Oct 20, 2018 Some sprintf for database queries changed by asprintf. (236953 lines)
|
||||
Version 18.7.12: Oct 19, 2018 Some sprintf for database queries changed by asprintf. (236924 lines)
|
||||
|
|
|
@ -2429,7 +2429,7 @@ unsigned Cty_ListCtysFound (const char *Query)
|
|||
struct Country Cty;
|
||||
|
||||
/***** Query database *****/
|
||||
if ((NumCtys = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get countries")))
|
||||
if ((NumCtys = (unsigned) DB_QuerySELECT_free (Query,&mysql_res,"can not get countries")))
|
||||
{
|
||||
/***** Start box and table *****/
|
||||
/* Number of countries found */
|
||||
|
|
|
@ -3200,7 +3200,7 @@ unsigned Crs_ListCrssFound (const char *Query)
|
|||
unsigned NumCrs;
|
||||
|
||||
/***** Query database *****/
|
||||
NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses");
|
||||
NumCrss = (unsigned) DB_QuerySELECT_free (Query,&mysql_res,"can not get courses");
|
||||
|
||||
/***** List the courses (one row per course) *****/
|
||||
if (NumCrss)
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <stdio.h> // For fprintf...
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <stdio.h> // For fprintf, asprintf...
|
||||
#include <string.h> // For string functions...
|
||||
|
||||
#include "swad_box.h"
|
||||
|
@ -615,7 +616,7 @@ static unsigned Sch_SearchCountriesInDB (const char *RangeQuery)
|
|||
{
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1];
|
||||
char Query[1024 + Sch_MAX_BYTES_SEARCH_QUERY * 2];
|
||||
char *Query;
|
||||
char FieldName[4+1+2+1]; // Example: Name_en
|
||||
|
||||
/***** Check scope *****/
|
||||
|
@ -633,12 +634,13 @@ static unsigned Sch_SearchCountriesInDB (const char *RangeQuery)
|
|||
if (Sch_BuildSearchQuery (SearchQuery,FieldName,NULL,NULL))
|
||||
{
|
||||
/***** Query database and list institutions found *****/
|
||||
sprintf (Query,"SELECT CtyCod"
|
||||
if (asprintf (&Query,"SELECT CtyCod"
|
||||
" FROM countries"
|
||||
" WHERE %s%s"
|
||||
" ORDER BY Name_%s",
|
||||
SearchQuery,RangeQuery,
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language]) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
return Cty_ListCtysFound (Query);
|
||||
}
|
||||
}
|
||||
|
@ -689,7 +691,7 @@ static unsigned Sch_SearchInstitutionsInDB (const char *RangeQuery)
|
|||
static unsigned Sch_SearchCentresInDB (const char *RangeQuery)
|
||||
{
|
||||
char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1];
|
||||
char Query[1024 + Sch_MAX_BYTES_SEARCH_QUERY * 2];
|
||||
char *Query;
|
||||
|
||||
/***** Check scope *****/
|
||||
if (Gbl.Scope.Current != Sco_SCOPE_DEG &&
|
||||
|
@ -700,14 +702,15 @@ static unsigned Sch_SearchCentresInDB (const char *RangeQuery)
|
|||
if (Sch_BuildSearchQuery (SearchQuery,"centres.FullName",NULL,NULL))
|
||||
{
|
||||
/***** Query database and list centres found *****/
|
||||
sprintf (Query,"SELECT centres.CtrCod"
|
||||
if (asprintf (&Query,"SELECT centres.CtrCod"
|
||||
" FROM centres,institutions,countries"
|
||||
" WHERE %s"
|
||||
" AND centres.InsCod=institutions.InsCod"
|
||||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY centres.FullName,institutions.FullName",
|
||||
SearchQuery,RangeQuery);
|
||||
SearchQuery,RangeQuery) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
return Ctr_ListCtrsFound (Query);
|
||||
}
|
||||
|
||||
|
@ -755,7 +758,7 @@ static unsigned Sch_SearchDegreesInDB (const char *RangeQuery)
|
|||
static unsigned Sch_SearchCoursesInDB (const char *RangeQuery)
|
||||
{
|
||||
char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1];
|
||||
char Query[1024 + Sch_MAX_BYTES_SEARCH_QUERY * 2];
|
||||
char *Query;
|
||||
|
||||
/***** Check user's permission *****/
|
||||
if (Sch_CheckIfIHavePermissionToSearch (Sch_SEARCH_COURSES))
|
||||
|
@ -763,7 +766,7 @@ static unsigned Sch_SearchCoursesInDB (const char *RangeQuery)
|
|||
if (Sch_BuildSearchQuery (SearchQuery,"courses.FullName",NULL,NULL))
|
||||
{
|
||||
/***** Query database and list courses found *****/
|
||||
sprintf (Query,"SELECT degrees.DegCod,courses.CrsCod,degrees.ShortName,degrees.FullName,"
|
||||
if (asprintf (&Query,"SELECT degrees.DegCod,courses.CrsCod,degrees.ShortName,degrees.FullName,"
|
||||
"courses.Year,courses.FullName,centres.ShortName"
|
||||
" FROM courses,degrees,centres,institutions,countries"
|
||||
" WHERE %s"
|
||||
|
@ -773,7 +776,8 @@ static unsigned Sch_SearchCoursesInDB (const char *RangeQuery)
|
|||
" AND institutions.CtyCod=countries.CtyCod"
|
||||
"%s"
|
||||
" ORDER BY courses.FullName,institutions.FullName,degrees.FullName,courses.Year",
|
||||
SearchQuery,RangeQuery);
|
||||
SearchQuery,RangeQuery) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
return Crs_ListCrssFound (Query);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user