mirror of https://github.com/acanas/swad-core.git
Version 16.114.1
This commit is contained in:
parent
11d3c9c235
commit
f274097fda
|
@ -189,13 +189,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.114 (2017-01-14)"
|
#define Log_PLATFORM_VERSION "SWAD 16.114.1 (2017-01-15)"
|
||||||
#define CSS_FILE "swad16.111.5.css"
|
#define CSS_FILE "swad16.111.5.css"
|
||||||
#define JS_FILE "swad16.114.js"
|
#define JS_FILE "swad16.114.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.114.1: Jan 15, 2017 Fixed bug in string concatenation. (211411 lines)
|
||||||
Version 16.114: Jan 14, 2017 Fixed bug in dates, reported by José Luis Bernier Villamor.
|
Version 16.114: Jan 14, 2017 Fixed bug in dates, reported by José Luis Bernier Villamor.
|
||||||
Javascript code refactoring related to dates. (211490 lines)
|
Javascript code refactoring related to dates. (211490 lines)
|
||||||
Version 16.113: Jan 13, 2017 Some strcpy changed to strncpy. (211497 lines)
|
Version 16.113: Jan 13, 2017 Some strcpy changed to strncpy. (211497 lines)
|
||||||
|
|
140
swad_chat.c
140
swad_chat.c
|
@ -420,11 +420,11 @@ void Cht_OpenChatWindow (void)
|
||||||
UsrName[Usr_MAX_BYTES_NAME] = '\0';
|
UsrName[Usr_MAX_BYTES_NAME] = '\0';
|
||||||
if (Gbl.Usrs.Me.UsrDat.Surname2[0])
|
if (Gbl.Usrs.Me.UsrDat.Surname2[0])
|
||||||
{
|
{
|
||||||
strncat (UsrName," ",1);
|
Str_Concat (UsrName," ",Usr_MAX_BYTES_NAME);
|
||||||
strncat (UsrName,Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_NAME);
|
Str_Concat (UsrName,Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_NAME);
|
||||||
}
|
}
|
||||||
strncat (UsrName,", ",2);
|
Str_Concat (UsrName,", ",Usr_MAX_BYTES_NAME);
|
||||||
strncat (UsrName,Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
Str_Concat (UsrName,Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||||
|
|
||||||
/***** Build the lists of available rooms *****/
|
/***** Build the lists of available rooms *****/
|
||||||
sprintf (ListRoomCodes,"#%s",RoomCode);
|
sprintf (ListRoomCodes,"#%s",RoomCode);
|
||||||
|
@ -437,76 +437,40 @@ void Cht_OpenChatWindow (void)
|
||||||
|
|
||||||
if (strcmp (RoomCode,"GBL_USR"))
|
if (strcmp (RoomCode,"GBL_USR"))
|
||||||
{
|
{
|
||||||
strncat (ListRoomCodes,"|#GBL_USR",
|
Str_Concat (ListRoomCodes,"|#GBL_USR",sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen ("|#GBL_USR")));
|
|
||||||
|
|
||||||
sprintf (RoomShortName,"|%s",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL]);
|
sprintf (RoomShortName,"|%s",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL]);
|
||||||
strncat (ListRoomShortNames,RoomShortName,
|
Str_Concat (ListRoomShortNames,RoomShortName,sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen (RoomShortName)));
|
|
||||||
|
|
||||||
sprintf (RoomFullName,"|%s (%s)",
|
sprintf (RoomFullName,"|%s (%s)",
|
||||||
Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
||||||
strncat (ListRoomFullNames,RoomFullName,
|
Str_Concat (ListRoomFullNames,RoomFullName,sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen (RoomFullName)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT)
|
||||||
if (strcmp (RoomCode,"GBL_STD"))
|
if (strcmp (RoomCode,"GBL_STD"))
|
||||||
{
|
{
|
||||||
strncat (ListRoomCodes,"|#GBL_STD",
|
Str_Concat (ListRoomCodes,"|#GBL_STD",sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen ("|#GBL_STD")));
|
|
||||||
|
|
||||||
sprintf (RoomShortName,"|%s",Txt_Students_ABBREVIATION);
|
sprintf (RoomShortName,"|%s",Txt_Students_ABBREVIATION);
|
||||||
strncat (ListRoomShortNames,RoomShortName,
|
Str_Concat (ListRoomShortNames,RoomShortName,sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen (RoomShortName)));
|
|
||||||
|
|
||||||
sprintf (RoomFullName,"|%s (%s)",Txt_General,
|
sprintf (RoomFullName,"|%s (%s)",Txt_General,
|
||||||
Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_ALL]);
|
Txt_ROLES_PLURAL_abc[Rol_STUDENT][Usr_SEX_ALL]);
|
||||||
strncat (ListRoomFullNames,RoomFullName,
|
Str_Concat (ListRoomFullNames,RoomFullName,sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen (RoomFullName)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
|
if (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
|
||||||
if (strcmp (RoomCode,"GBL_TCH"))
|
if (strcmp (RoomCode,"GBL_TCH"))
|
||||||
{
|
{
|
||||||
strncat (ListRoomCodes,"|#GBL_TCH",
|
Str_Concat (ListRoomCodes,"|#GBL_TCH",sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen ("|#GBL_TCH")));
|
|
||||||
|
|
||||||
sprintf (RoomShortName,"|%s",Txt_Teachers_ABBREVIATION);
|
sprintf (RoomShortName,"|%s",Txt_Teachers_ABBREVIATION);
|
||||||
strncat (ListRoomShortNames,RoomShortName,
|
Str_Concat (ListRoomShortNames,RoomShortName,sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen (RoomShortName)));
|
|
||||||
|
|
||||||
sprintf (RoomFullName,"|%s (%s)",
|
sprintf (RoomFullName,"|%s (%s)",
|
||||||
Txt_General,Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_ALL]);
|
Txt_General,Txt_ROLES_PLURAL_abc[Rol_TEACHER][Usr_SEX_ALL]);
|
||||||
strncat (ListRoomFullNames,RoomFullName,
|
Str_Concat (ListRoomFullNames,RoomFullName,sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen (RoomFullName)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NumMyDeg = 0;
|
for (NumMyDeg = 0;
|
||||||
|
@ -516,17 +480,9 @@ void Cht_OpenChatWindow (void)
|
||||||
sprintf (ThisRoomCode,"DEG_%ld",Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod);
|
sprintf (ThisRoomCode,"DEG_%ld",Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod);
|
||||||
if (strcmp (RoomCode,ThisRoomCode))
|
if (strcmp (RoomCode,ThisRoomCode))
|
||||||
{
|
{
|
||||||
strncat (ListRoomCodes,"|#",
|
Str_Concat (ListRoomCodes,"|#",sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen ("|#")));
|
|
||||||
|
|
||||||
strncat (ListRoomCodes,ThisRoomCode,
|
Str_Concat (ListRoomCodes,ThisRoomCode,sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen (ThisRoomCode)));
|
|
||||||
|
|
||||||
/* Get data of this degree */
|
/* Get data of this degree */
|
||||||
Deg.DegCod = Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod;
|
Deg.DegCod = Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod;
|
||||||
|
@ -534,31 +490,15 @@ void Cht_OpenChatWindow (void)
|
||||||
|
|
||||||
sprintf (ThisRoomShortName,"%s",Deg.ShrtName);
|
sprintf (ThisRoomShortName,"%s",Deg.ShrtName);
|
||||||
|
|
||||||
strncat (ListRoomShortNames,"|",
|
Str_Concat (ListRoomShortNames,"|",sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen ("|")));
|
|
||||||
|
|
||||||
strncat (ListRoomShortNames,ThisRoomShortName,
|
Str_Concat (ListRoomShortNames,ThisRoomShortName,sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen (ThisRoomShortName)));
|
|
||||||
|
|
||||||
sprintf (ThisRoomFullName,"%s %s",Txt_Degree,Deg.ShrtName);
|
sprintf (ThisRoomFullName,"%s %s",Txt_Degree,Deg.ShrtName);
|
||||||
|
|
||||||
strncat (ListRoomFullNames,"|",
|
Str_Concat (ListRoomFullNames,"|",sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen ("|")));
|
|
||||||
|
|
||||||
strncat (ListRoomFullNames,ThisRoomFullName,
|
Str_Concat (ListRoomFullNames,ThisRoomFullName,sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen (ThisRoomFullName)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,53 +509,25 @@ void Cht_OpenChatWindow (void)
|
||||||
sprintf (ThisRoomCode,"CRS_%ld",Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod);
|
sprintf (ThisRoomCode,"CRS_%ld",Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod);
|
||||||
if (strcmp (RoomCode,ThisRoomCode))
|
if (strcmp (RoomCode,ThisRoomCode))
|
||||||
{
|
{
|
||||||
strncat (ListRoomCodes,"|#",
|
Str_Concat (ListRoomCodes,"|#",sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen ("|#")));
|
|
||||||
|
|
||||||
strncat (ListRoomCodes,ThisRoomCode,
|
Str_Concat (ListRoomCodes,ThisRoomCode,sizeof (ListRoomCodes) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomCodes) - 1 -
|
|
||||||
strlen (ListRoomCodes) -
|
|
||||||
strlen (ThisRoomCode)));
|
|
||||||
|
|
||||||
/* Get data of this course */
|
/* Get data of this course */
|
||||||
Crs.CrsCod = Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod;
|
Crs.CrsCod = Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod;
|
||||||
Crs_GetDataOfCourseByCod (&Crs);
|
Crs_GetDataOfCourseByCod (&Crs);
|
||||||
|
|
||||||
sprintf (ThisRoomShortName,"%s",Crs.ShrtName);
|
sprintf (ThisRoomShortName,"%s",Crs.ShrtName);
|
||||||
strncat (ListRoomShortNames,"|",
|
Str_Concat (ListRoomShortNames,"|",sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen ("|")));
|
|
||||||
|
|
||||||
strncat (ListRoomShortNames,ThisRoomShortName,
|
Str_Concat (ListRoomShortNames,ThisRoomShortName,sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen (ThisRoomShortName)));
|
|
||||||
|
|
||||||
strncat (ListRoomShortNames,"|",
|
Str_Concat (ListRoomShortNames,"|",sizeof (ListRoomShortNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomShortNames) - 1 -
|
|
||||||
strlen (ListRoomShortNames) -
|
|
||||||
strlen (ThisRoomShortName)));
|
|
||||||
|
|
||||||
sprintf (ThisRoomFullName,"%s %s",Txt_Course,Crs.ShrtName);
|
sprintf (ThisRoomFullName,"%s %s",Txt_Course,Crs.ShrtName);
|
||||||
strncat (ListRoomFullNames,"|",
|
Str_Concat (ListRoomFullNames,"|",sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen ("|")));
|
|
||||||
|
|
||||||
strncat (ListRoomFullNames,"|",
|
Str_Concat (ListRoomFullNames,"|",sizeof (ListRoomFullNames) - 1);
|
||||||
MAX (0,
|
|
||||||
sizeof (ListRoomFullNames) - 1 -
|
|
||||||
strlen (ListRoomFullNames) -
|
|
||||||
strlen (ThisRoomFullName)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2812,3 +2812,12 @@ void Str_GetMailBox (const char *Email,char *MailBox,size_t MaxLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************** Safe string concatenation ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Str_Concat (char *Src,const char *Dst,size_t MaxLength)
|
||||||
|
{
|
||||||
|
strncat (Src,Dst,MaxLength - strlen (Src));
|
||||||
|
}
|
||||||
|
|
|
@ -119,4 +119,6 @@ void Str_ConvertToValidFileName (char *Str);
|
||||||
void Str_CreateRandomAlphanumStr (char *Str,size_t Length);
|
void Str_CreateRandomAlphanumStr (char *Str,size_t Length);
|
||||||
void Str_GetMailBox (const char *Email,char *MailBox,size_t MaxLength);
|
void Str_GetMailBox (const char *Email,char *MailBox,size_t MaxLength);
|
||||||
|
|
||||||
|
void Str_Concat (char *Src,const char *Dst,size_t MaxLength);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
10
swad_user.c
10
swad_user.c
|
@ -4968,8 +4968,8 @@ Lay_ShowErrorAndExit (Gbl.Message);
|
||||||
Gbl.Usrs.Select.All[Length ] = Par_SEPARATOR_PARAM_MULTIPLE;
|
Gbl.Usrs.Select.All[Length ] = Par_SEPARATOR_PARAM_MULTIPLE;
|
||||||
Gbl.Usrs.Select.All[Length+1] = '\0';
|
Gbl.Usrs.Select.All[Length+1] = '\0';
|
||||||
}
|
}
|
||||||
strncat (Gbl.Usrs.Select.All,Gbl.Usrs.Select.Tch,
|
Str_Concat (Gbl.Usrs.Select.All,Gbl.Usrs.Select.Tch,
|
||||||
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS - strlen (Gbl.Usrs.Select.All));
|
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Add students to the list with all selected users *****/
|
/***** Add students to the list with all selected users *****/
|
||||||
|
@ -4981,8 +4981,8 @@ Lay_ShowErrorAndExit (Gbl.Message);
|
||||||
Gbl.Usrs.Select.All[Length ] = Par_SEPARATOR_PARAM_MULTIPLE;
|
Gbl.Usrs.Select.All[Length ] = Par_SEPARATOR_PARAM_MULTIPLE;
|
||||||
Gbl.Usrs.Select.All[Length+1] = '\0';
|
Gbl.Usrs.Select.All[Length+1] = '\0';
|
||||||
}
|
}
|
||||||
strncat (Gbl.Usrs.Select.All,Gbl.Usrs.Select.Std,
|
Str_Concat (Gbl.Usrs.Select.All,Gbl.Usrs.Select.Std,
|
||||||
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS - strlen (Gbl.Usrs.Select.All));
|
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5217,7 +5217,7 @@ void Usr_AllocateListSelectedUsrCodAll (void)
|
||||||
{
|
{
|
||||||
if (!Gbl.Usrs.Select.All)
|
if (!Gbl.Usrs.Select.All)
|
||||||
{
|
{
|
||||||
if ((Gbl.Usrs.Select.All = (char *) malloc (Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS+1)) == NULL)
|
if ((Gbl.Usrs.Select.All = (char *) malloc (Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS + 1)) == NULL)
|
||||||
Lay_ShowErrorAndExit ("Not enough memory to store list of users.");
|
Lay_ShowErrorAndExit ("Not enough memory to store list of users.");
|
||||||
Gbl.Usrs.Select.All[0] = '\0';
|
Gbl.Usrs.Select.All[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue