mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-03 23:35:23 +02:00
Version 18.6.6
This commit is contained in:
parent
2f2c0b731c
commit
86ed4799a8
20
swad_ID.c
20
swad_ID.c
|
@ -516,7 +516,9 @@ void ID_ShowFormChangeMyID (bool IShouldFillID)
|
|||
Lay_StartSection (ID_ID_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_ID,Acc_PutLinkToRemoveMyAccount,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -546,7 +548,9 @@ void ID_ShowFormChangeOtherUsrID (void)
|
|||
Lay_StartSection (ID_ID_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_ID,NULL,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -646,10 +650,10 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/* User's ID */
|
||||
sprintf (Gbl.Title,
|
||||
UsrDat->IDs.List[NumID].Confirmed ? Txt_ID_X_confirmed :
|
||||
Txt_ID_X_not_confirmed,
|
||||
UsrDat->IDs.List[NumID].ID);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
UsrDat->IDs.List[NumID].Confirmed ? Txt_ID_X_confirmed :
|
||||
Txt_ID_X_not_confirmed,
|
||||
UsrDat->IDs.List[NumID].ID);
|
||||
fprintf (Gbl.F.Out,"<span class=\"%s\" title=\"%s\">%s</span>",
|
||||
UsrDat->IDs.List[NumID].Confirmed ? "USR_ID_C" :
|
||||
"USR_ID_NC",
|
||||
|
@ -659,7 +663,9 @@ static void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,
|
|||
/* ID confirmed? */
|
||||
if (UsrDat->IDs.List[NumID].Confirmed)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_ID_X_confirmed,UsrDat->IDs.List[NumID].ID);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_ID_X_confirmed,
|
||||
UsrDat->IDs.List[NumID].ID);
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s/ok_green16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
|
|
@ -235,7 +235,9 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
|||
MFU_MAX_BYTES_TAB);
|
||||
Str_Copy (MenuStr,Title,
|
||||
MFU_MAX_BYTES_MENU);
|
||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
||||
snprintf (TabMenuStr,sizeof (TabMenuStr),
|
||||
"%s > %s",
|
||||
TabStr,MenuStr);
|
||||
|
||||
/* Icon and text */
|
||||
fprintf (Gbl.F.Out,"<li>");
|
||||
|
@ -296,7 +298,9 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
|||
MFU_MAX_BYTES_TAB);
|
||||
Str_Copy (MenuStr,Title,
|
||||
MFU_MAX_BYTES_MENU);
|
||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
||||
snprintf (TabMenuStr,sizeof (TabMenuStr),
|
||||
"%s > %s",
|
||||
TabStr,MenuStr);
|
||||
|
||||
/* Icon and text */
|
||||
fprintf (Gbl.F.Out,"<li>");
|
||||
|
|
|
@ -65,11 +65,15 @@ void RSS_UpdateRSSFileForACrs (struct Course *Crs)
|
|||
struct tm *tm;
|
||||
|
||||
/***** Create RSS directory if not exists *****/
|
||||
sprintf (PathRelPublRSSDir,"%s/%s/%ld/%s",Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CRS,Crs->CrsCod,Cfg_RSS_FOLDER);
|
||||
snprintf (PathRelPublRSSDir,sizeof (PathRelPublRSSDir),
|
||||
"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CRS,Crs->CrsCod,Cfg_RSS_FOLDER);
|
||||
Fil_CreateDirIfNotExists (PathRelPublRSSDir);
|
||||
|
||||
/***** Create RSS file *****/
|
||||
sprintf (PathRelPublRSSFile,"%s/%s",PathRelPublRSSDir,Cfg_RSS_FILE);
|
||||
snprintf (PathRelPublRSSFile,sizeof (PathRelPublRSSFile),
|
||||
"%s/%s",
|
||||
PathRelPublRSSDir,Cfg_RSS_FILE);
|
||||
if ((FileRSS = fopen (PathRelPublRSSFile,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not create RSS file.");
|
||||
|
||||
|
|
|
@ -5241,12 +5241,12 @@ static void Act_StartFormInternal (Act_Action_t NextAction,bool PutParameterLoca
|
|||
}
|
||||
}
|
||||
|
||||
void Act_SetParamsForm (char ParamsStr[Act_MAX_BYTES_PARAMS_STR],Act_Action_t NextAction,
|
||||
void Act_SetParamsForm (char ParamsStr[Act_MAX_BYTES_PARAMS_STR + 1],Act_Action_t NextAction,
|
||||
bool PutParameterLocationIfNoSesion)
|
||||
{
|
||||
char ParamAction[Act_MAX_BYTES_PARAM_ACTION];
|
||||
char ParamSession[Act_MAX_BYTES_PARAM_SESSION];
|
||||
char ParamLocation[Act_MAX_BYTES_PARAM_LOCATION];
|
||||
char ParamAction[Act_MAX_BYTES_PARAM_ACTION + 1];
|
||||
char ParamSession[Act_MAX_BYTES_PARAM_SESSION + 1];
|
||||
char ParamLocation[Act_MAX_BYTES_PARAM_LOCATION + 1];
|
||||
|
||||
ParamAction[0] = '\0';
|
||||
ParamSession[0] = '\0';
|
||||
|
@ -5294,7 +5294,7 @@ void Act_SetParamsForm (char ParamsStr[Act_MAX_BYTES_PARAMS_STR],Act_Action_t Ne
|
|||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
}
|
||||
|
||||
snprintf (ParamsStr,Act_MAX_BYTES_PARAMS_STR,
|
||||
snprintf (ParamsStr,Act_MAX_BYTES_PARAMS_STR + 1,
|
||||
"%s%s%s",
|
||||
ParamAction,ParamSession,ParamLocation);
|
||||
}
|
||||
|
@ -5375,7 +5375,7 @@ void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle,
|
|||
/***************************** Get unique Id *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID])
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID + 1])
|
||||
{
|
||||
static unsigned CountForThisExecution = 0;
|
||||
|
||||
|
@ -5384,7 +5384,7 @@ void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID])
|
|||
So, Id uses:
|
||||
- a name for this execution (Gbl.UniqueNameEncrypted)
|
||||
- a number for each element in this execution (CountForThisExecution) *****/
|
||||
snprintf (UniqueId,Act_MAX_BYTES_ID,
|
||||
snprintf (UniqueId,Act_MAX_BYTES_ID + 1,
|
||||
"id_%s_%u",
|
||||
Gbl.UniqueNameEncrypted,
|
||||
++CountForThisExecution);
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||
|
||||
#define Act_MAX_BYTES_ID (32 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1)
|
||||
#define Act_MAX_BYTES_ID (32 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 10)
|
||||
|
||||
#define Act_MAX_BYTES_PARAM_ACTION 256
|
||||
#define Act_MAX_BYTES_PARAM_SESSION (256 + Cns_BYTES_SESSION_ID)
|
||||
|
@ -1689,7 +1689,7 @@ void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,
|
|||
void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle,
|
||||
const char *OnSubmit);
|
||||
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID]);
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID + 1]);
|
||||
|
||||
void Act_AdjustActionWhenNoUsrLogged (void);
|
||||
void Act_AdjustCurrentAction (void);
|
||||
|
|
|
@ -116,7 +116,7 @@ void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt,
|
|||
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
|
||||
{
|
||||
extern const char *Txt_Close;
|
||||
char IdAlert[Act_MAX_BYTES_ID];
|
||||
char IdAlert[Act_MAX_BYTES_ID + 1];
|
||||
static const bool AlertClosable[Ale_NUM_ALERT_TYPES] =
|
||||
{
|
||||
false, // Ale_NONE
|
||||
|
|
|
@ -114,7 +114,7 @@ static void Box_StartBoxInternal (const char *Width,const char *Title,
|
|||
{
|
||||
extern const char *Txt_Help;
|
||||
extern const char *Txt_Close;
|
||||
char IdFrame[Act_MAX_BYTES_ID];
|
||||
char IdFrame[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Start box container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"FRAME_CONTAINER\"");
|
||||
|
|
|
@ -355,14 +355,15 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.6.4 (2018-10-17)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.6.6 (2018-10-17)"
|
||||
#define CSS_FILE "swad18.4.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
*
|
||||
* Código QR no sale en la ficha cuando no estoy en una asignatura!!!!!
|
||||
Version 18.6.5: Oct 17, 2018 Some sprintf changed by snprintf. (236125 lines)
|
||||
Version 18.6.4: Oct 17, 2018 Some sprintf changed by snprintf. (236034 lines)
|
||||
Version 18.6.6: Oct 17, 2018 Some sprintf changed by snprintf. (236560 lines)
|
||||
Version 18.6.5: Oct 17, 2018 Some sprintf changed by snprintf or asprintf. (236125 lines)
|
||||
Version 18.6.4: Oct 17, 2018 Some sprintf changed by snprintf or asprintf. (236034 lines)
|
||||
Version 18.6.3: Oct 17, 2018 Some sprintf changed by snprintf or asprintf. (235954 lines)
|
||||
Version 18.6.2: Oct 17, 2018 Some sprintf changed by snprintf. (235808 lines)
|
||||
Version 18.6.1: Oct 16, 2018 Some sprintf changed by snprintf. (235755 lines)
|
||||
|
|
10
swad_date.c
10
swad_date.c
|
@ -395,21 +395,21 @@ void Dat_ConvDateToDateStr (struct Date *Date,char StrDate[Cns_MAX_BYTES_DATE +
|
|||
switch (Gbl.Prefs.DateFormat)
|
||||
{
|
||||
case Dat_FORMAT_YYYY_MM_DD:
|
||||
snprintf (StrDate,Cns_MAX_BYTES_DATE,
|
||||
snprintf (StrDate,Cns_MAX_BYTES_DATE + 1,
|
||||
"%04u-%02u-%02u",
|
||||
Date->Year,
|
||||
Date->Month,
|
||||
Date->Day);
|
||||
break;
|
||||
case Dat_FORMAT_DD_MONTH_YYYY:
|
||||
snprintf (StrDate,Cns_MAX_BYTES_DATE,
|
||||
snprintf (StrDate,Cns_MAX_BYTES_DATE + 1,
|
||||
"%u %s %04u",
|
||||
Date->Day,
|
||||
Txt_MONTHS_SMALL_SHORT[Date->Month - 1],
|
||||
Date->Year);
|
||||
break;
|
||||
case Dat_FORMAT_MONTH_DD_YYYY:
|
||||
snprintf (StrDate,Cns_MAX_BYTES_DATE,
|
||||
snprintf (StrDate,Cns_MAX_BYTES_DATE + 1,
|
||||
"%s %u, %04u",
|
||||
Txt_MONTHS_SMALL_SHORT[Date->Month - 1],
|
||||
Date->Day,
|
||||
|
@ -781,12 +781,12 @@ void Dat_GetBrowserTimeZone (char BrowserTimeZone[Dat_MAX_BYTES_TIME_ZONE + 1])
|
|||
/* Convert from minutes to +-hh:mm */
|
||||
// BrowserTimeZone must have space for strings in +hh:mm format (6 chars + \0)
|
||||
if (ClientUTCMinusLocal > 0)
|
||||
snprintf (BrowserTimeZone,Dat_MAX_BYTES_TIME_ZONE,
|
||||
snprintf (BrowserTimeZone,Dat_MAX_BYTES_TIME_ZONE + 1,
|
||||
"-%02u:%02u",
|
||||
(unsigned) ClientUTCMinusLocal / 60,
|
||||
(unsigned) ClientUTCMinusLocal % 60);
|
||||
else // ClientUTCMinusLocal <= 0
|
||||
snprintf (BrowserTimeZone,Dat_MAX_BYTES_TIME_ZONE,
|
||||
snprintf (BrowserTimeZone,Dat_MAX_BYTES_TIME_ZONE + 1,
|
||||
"+%02u:%02u",
|
||||
(unsigned) (-ClientUTCMinusLocal) / 60,
|
||||
(unsigned) (-ClientUTCMinusLocal) % 60);
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#define Dat_MAX_BYTES_TIME_ZONE 256
|
||||
|
||||
#define Dat_MAX_BYTES_TIME (128 - 1)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
|
61
swad_file.c
61
swad_file.c
|
@ -75,15 +75,18 @@ void Fil_CreateFileForHTMLOutput (void)
|
|||
char PathHTMLOutputPriv[PATH_MAX + 1];
|
||||
|
||||
/***** Check if exists the directory for HTML output. If not exists, create it *****/
|
||||
sprintf (PathHTMLOutputPriv,"%s/%s",Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT);
|
||||
snprintf (PathHTMLOutputPriv,sizeof (PathHTMLOutputPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT);
|
||||
Fil_CreateDirIfNotExists (PathHTMLOutputPriv);
|
||||
|
||||
/***** Remove old files *****/
|
||||
Fil_RemoveOldTmpFiles (PathHTMLOutputPriv,Cfg_TIME_TO_DELETE_HTML_OUTPUT,false);
|
||||
|
||||
/***** Create a unique name for the file *****/
|
||||
sprintf (Gbl.HTMLOutput.FileName,"%s/%s.html",
|
||||
PathHTMLOutputPriv,Gbl.UniqueNameEncrypted);
|
||||
snprintf (Gbl.HTMLOutput.FileName,sizeof (Gbl.HTMLOutput.FileName),
|
||||
"%s/%s.html",
|
||||
PathHTMLOutputPriv,Gbl.UniqueNameEncrypted);
|
||||
|
||||
/***** Open file for writing and reading *****/
|
||||
if ((Gbl.F.Out = fopen (Gbl.HTMLOutput.FileName,"w+t")) == NULL)
|
||||
|
@ -331,7 +334,9 @@ void Fil_CreateUpdateFile (const char CurrentName[PATH_MAX + 1],
|
|||
Str_Copy (NewName,CurrentName,
|
||||
PATH_MAX);
|
||||
NewName[LengthFileRoot] = '\0';
|
||||
sprintf (OldName,"%s%s",NewName,ExtensionOldName);
|
||||
snprintf (OldName,PATH_MAX + 1,
|
||||
"%s%s",
|
||||
NewName,ExtensionOldName);
|
||||
Str_Concat (NewName,".new",
|
||||
PATH_MAX);
|
||||
|
||||
|
@ -477,7 +482,9 @@ void Fil_RemoveTree (const char *Path)
|
|||
if (strcmp (FileList[NumFile]->d_name,".") &&
|
||||
strcmp (FileList[NumFile]->d_name,"..")) // Skip directories "." and ".."
|
||||
{
|
||||
sprintf (PathFileRel,"%s/%s",Path,FileList[NumFile]->d_name);
|
||||
snprintf (PathFileRel,sizeof (PathFileRel),
|
||||
"%s/%s",
|
||||
Path,FileList[NumFile]->d_name);
|
||||
Fil_RemoveTree (PathFileRel);
|
||||
}
|
||||
free ((void *) FileList[NumFile]);
|
||||
|
@ -535,7 +542,9 @@ void Fil_RemoveOldTmpFiles (const char *Path,time_t TimeToRemove,bool RemoveDire
|
|||
if (strcmp (FileList[NumFile]->d_name,".") &&
|
||||
strcmp (FileList[NumFile]->d_name,"..")) // Skip directories "." and ".."
|
||||
{
|
||||
sprintf (Path2,"%s/%s",Path,FileList[NumFile]->d_name);
|
||||
snprintf (Path2,sizeof (Path2),
|
||||
"%s/%s",
|
||||
Path,FileList[NumFile]->d_name);
|
||||
Fil_RemoveOldTmpFiles (Path2,TimeToRemove,true); // Recursive call
|
||||
}
|
||||
free ((void *) FileList[NumFile]);
|
||||
|
@ -632,28 +641,48 @@ void Fil_WriteFileSizeBrief (double SizeInBytes,
|
|||
char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1])
|
||||
{
|
||||
if (SizeInBytes < Ki)
|
||||
sprintf (FileSizeStr,"%.0f B" ,SizeInBytes);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.0f B",
|
||||
SizeInBytes);
|
||||
else if (SizeInBytes < Mi)
|
||||
sprintf (FileSizeStr,"%.0f KiB",SizeInBytes / Ki);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.0f KiB",
|
||||
SizeInBytes / Ki);
|
||||
else if (SizeInBytes < Gi)
|
||||
sprintf (FileSizeStr,"%.0f MiB",SizeInBytes / Mi);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.0f MiB",
|
||||
SizeInBytes / Mi);
|
||||
else if (SizeInBytes < Ti)
|
||||
sprintf (FileSizeStr,"%.0f GiB",SizeInBytes / Gi);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.0f GiB",
|
||||
SizeInBytes / Gi);
|
||||
else
|
||||
sprintf (FileSizeStr,"%.0f TiB",SizeInBytes / Ti);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.0f TiB",
|
||||
SizeInBytes / Ti);
|
||||
}
|
||||
|
||||
void Fil_WriteFileSizeFull (double SizeInBytes,
|
||||
char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1])
|
||||
{
|
||||
if (SizeInBytes < Ki)
|
||||
sprintf (FileSizeStr,"%.0f B" ,SizeInBytes);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.0f B",
|
||||
SizeInBytes);
|
||||
else if (SizeInBytes < Mi)
|
||||
sprintf (FileSizeStr,"%.1f KiB",SizeInBytes / Ki);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.1f KiB",
|
||||
SizeInBytes / Ki);
|
||||
else if (SizeInBytes < Gi)
|
||||
sprintf (FileSizeStr,"%.1f MiB",SizeInBytes / Mi);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.1f MiB",
|
||||
SizeInBytes / Mi);
|
||||
else if (SizeInBytes < Ti)
|
||||
sprintf (FileSizeStr,"%.1f GiB",SizeInBytes / Gi);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.1f GiB",
|
||||
SizeInBytes / Gi);
|
||||
else
|
||||
sprintf (FileSizeStr,"%.1f TiB",SizeInBytes / Ti);
|
||||
snprintf (FileSizeStr,Fil_MAX_BYTES_FILE_SIZE_STRING + 1,
|
||||
"%.1f TiB",
|
||||
SizeInBytes / Ti);
|
||||
}
|
||||
|
|
72
swad_forum.c
72
swad_forum.c
|
@ -1009,7 +1009,9 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag
|
|||
Ale_ShowAlert (AlertType,Message);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (FrameTitle,"%s: %s",Txt_Thread,Thr.Subject);
|
||||
snprintf (FrameTitle,sizeof (FrameTitle),
|
||||
"%s: %s",
|
||||
Txt_Thread,Thr.Subject);
|
||||
Box_StartBox (NULL,FrameTitle,For_PutIconNewPost,
|
||||
Hlp_SOCIAL_Forums_posts,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -1267,9 +1269,10 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod,
|
|||
Gbl.Forum.ForumSelected.ThrCod,
|
||||
PstCod);
|
||||
|
||||
sprintf (Gbl.Title,Enabled ? Txt_Post_X_allowed_Click_to_ban_it :
|
||||
Txt_Post_X_banned_Click_to_unban_it,
|
||||
PstNum);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Enabled ? Txt_Post_X_allowed_Click_to_ban_it :
|
||||
Txt_Post_X_banned_Click_to_unban_it,
|
||||
PstNum);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s-on64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -1282,9 +1285,10 @@ static void For_ShowAForumPost (unsigned PstNum,long PstCod,
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf (Gbl.Title,Enabled ? Txt_Post_X_allowed :
|
||||
Txt_Post_X_banned,
|
||||
PstNum);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Enabled ? Txt_Post_X_allowed :
|
||||
Txt_Post_X_banned,
|
||||
PstNum);
|
||||
fprintf (Gbl.F.Out,"<span title=\"%s\">"
|
||||
"<img src=\"%s/%s-off64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
|
@ -2221,20 +2225,22 @@ void For_SetForumName (struct Forum *Forum,
|
|||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM_GLOBAL_TCHS:
|
||||
sprintf (ForumName,"%s%s",
|
||||
UseHTMLEntities ? Txt_General :
|
||||
Txt_General_NO_HTML[Language],
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
|
||||
"%s%s",
|
||||
UseHTMLEntities ? Txt_General :
|
||||
Txt_General_NO_HTML[Language],
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM__SWAD__USRS:
|
||||
Str_Copy (ForumName,Cfg_PLATFORM_SHORT_NAME,
|
||||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM__SWAD__TCHS:
|
||||
sprintf (ForumName,"%s%s",Cfg_PLATFORM_SHORT_NAME,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
|
||||
"%s%s",Cfg_PLATFORM_SHORT_NAME,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_INSTIT_USRS:
|
||||
Ins.InsCod = Forum->Location;
|
||||
|
@ -2247,9 +2253,10 @@ void For_SetForumName (struct Forum *Forum,
|
|||
Ins.InsCod = Forum->Location;
|
||||
if (!Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA))
|
||||
Lay_ShowErrorAndExit ("Institution not found.");
|
||||
sprintf (ForumName,"%s%s",Ins.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
|
||||
"%s%s",Ins.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_CENTRE_USRS:
|
||||
Ctr.CtrCod = Forum->Location;
|
||||
|
@ -2262,9 +2269,10 @@ void For_SetForumName (struct Forum *Forum,
|
|||
Ctr.CtrCod = Forum->Location;
|
||||
if (!Ctr_GetDataOfCentreByCod (&Ctr))
|
||||
Lay_ShowErrorAndExit ("Centre not found.");
|
||||
sprintf (ForumName,"%s%s",Ctr.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
|
||||
"%s%s",Ctr.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_DEGREE_USRS:
|
||||
Deg.DegCod = Forum->Location;
|
||||
|
@ -2277,9 +2285,10 @@ void For_SetForumName (struct Forum *Forum,
|
|||
Deg.DegCod = Forum->Location;
|
||||
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
||||
Lay_ShowErrorAndExit ("Degree not found.");
|
||||
sprintf (ForumName,"%s%s",Deg.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
|
||||
"%s%s",Deg.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_COURSE_USRS:
|
||||
Crs.CrsCod = Forum->Location;
|
||||
|
@ -2292,9 +2301,10 @@ void For_SetForumName (struct Forum *Forum,
|
|||
Crs.CrsCod = Forum->Location;
|
||||
if (!Crs_GetDataOfCourseByCod (&Crs))
|
||||
Lay_ShowErrorAndExit ("Course not found.");
|
||||
sprintf (ForumName,"%s%s",Crs.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,
|
||||
"%s%s",Crs.ShrtName,
|
||||
UseHTMLEntities ? Txt_only_teachers :
|
||||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
default:
|
||||
Str_Copy (ForumName,Txt_Unknown_FORUM,
|
||||
|
@ -2575,7 +2585,9 @@ static void For_ShowForumThreadsHighlightingOneThread (long ThrCodHighlighted,
|
|||
Ale_ShowAlert (AlertType,Message);
|
||||
|
||||
/***** Start box for threads of this forum *****/
|
||||
sprintf (FrameTitle,"%s: %s",Txt_Forum,ForumName);
|
||||
snprintf (FrameTitle,sizeof (FrameTitle),
|
||||
"%s: %s",
|
||||
Txt_Forum,ForumName);
|
||||
Box_StartBox (NULL,FrameTitle,For_PutIconNewThread,
|
||||
Hlp_SOCIAL_Forums_threads,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -3548,7 +3560,9 @@ static void For_GetThrData (struct ForumThread *Thr)
|
|||
Str_Copy (Thr->Subject,row[6],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
if (!Thr->Subject[0])
|
||||
sprintf (Thr->Subject,"[%s]",Txt_no_subject);
|
||||
snprintf (Thr->Subject,sizeof (Thr->Subject),
|
||||
"[%s]",
|
||||
Txt_no_subject);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
|
30
swad_game.c
30
swad_game.c
|
@ -2889,7 +2889,9 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game,
|
|||
{
|
||||
Gbl.RowEvenOdd = NumQst % 2;
|
||||
|
||||
sprintf (StrNumQst,"%u",NumQst + 1);
|
||||
snprintf (StrNumQst,sizeof (StrNumQst),
|
||||
"%u",
|
||||
NumQst + 1);
|
||||
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
/*
|
||||
|
@ -2924,7 +2926,9 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game,
|
|||
/* Put icon to move up the question */
|
||||
if (NumQst)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Move_up_X,StrNumQst);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Move_up_X,
|
||||
StrNumQst);
|
||||
Lay_PutContextualLink (ActUp_GamQst,NULL,Gam_PutParamsOneQst,
|
||||
"up_on16x16.gif",
|
||||
Gbl.Title,NULL,
|
||||
|
@ -2936,7 +2940,9 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game,
|
|||
/* Put icon to move down the question */
|
||||
if (NumQst + 1 < NumQsts)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Move_down_X,StrNumQst);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Move_down_X,
|
||||
StrNumQst);
|
||||
Lay_PutContextualLink (ActDwnGamQst,NULL,Gam_PutParamsOneQst,
|
||||
"down_on16x16.gif",
|
||||
Gbl.Title,NULL,
|
||||
|
@ -3204,13 +3210,15 @@ static void Gam_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
|
|||
|
||||
/***** String with the number of users *****/
|
||||
if (MaxUsrs)
|
||||
sprintf (Gbl.Title,"%u (%u%% %s %u)",
|
||||
NumUsrs,
|
||||
(unsigned) ((((float) NumUsrs * 100.0) / (float) MaxUsrs) + 0.5),
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u (%u%% %s %u)",
|
||||
NumUsrs,
|
||||
(unsigned) ((((float) NumUsrs * 100.0) / (float) MaxUsrs) + 0.5),
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
else
|
||||
sprintf (Gbl.Title,"0 (0%% %s %u)",
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"0 (0%% %s %u)",
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
|
||||
/***** Draw bar with a with proportional to the number of clicks *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\" style=\"width:%upx;\">",
|
||||
|
@ -3770,7 +3778,9 @@ static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod)
|
|||
Lay_ShowErrorAndExit ("Error: wrong question code.");
|
||||
|
||||
/* Get possible parameter with the user's answer */
|
||||
sprintf (ParamName,"Ans%010u",(unsigned) QstCod);
|
||||
snprintf (ParamName,sizeof (ParamName),
|
||||
"Ans%010u",
|
||||
(unsigned) QstCod);
|
||||
// Lay_ShowAlert (Lay_INFO,ParamName);
|
||||
Par_GetParMultiToText (ParamName,StrAnswersIndexes,
|
||||
Gam_MAX_ANSWERS_PER_QUESTION * (10 + 1));
|
||||
|
|
|
@ -135,16 +135,19 @@ void Gbl_InitializeGlobals (void)
|
|||
Gbl.Prefs.Menu = Mnu_MENU_DEFAULT; // Default menu
|
||||
Gbl.Prefs.Theme = The_THEME_DEFAULT; // Default theme
|
||||
Gbl.Prefs.IconSet = Ico_ICON_SET_DEFAULT; // Default icon set
|
||||
sprintf (Gbl.Prefs.IconsURL,"%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON);
|
||||
sprintf (Gbl.Prefs.PathTheme,"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON,
|
||||
Cfg_ICON_FOLDER_THEMES,
|
||||
The_ThemeId[Gbl.Prefs.Theme]);
|
||||
sprintf (Gbl.Prefs.PathIconSet,"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON,
|
||||
Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
snprintf (Gbl.Prefs.IconsURL,sizeof (Gbl.Prefs.IconsURL),
|
||||
"%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON);
|
||||
snprintf (Gbl.Prefs.PathTheme,sizeof (Gbl.Prefs.PathTheme),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON,
|
||||
Cfg_ICON_FOLDER_THEMES,
|
||||
The_ThemeId[Gbl.Prefs.Theme]);
|
||||
snprintf (Gbl.Prefs.PathIconSet,sizeof (Gbl.Prefs.PathIconSet),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON,
|
||||
Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
|
||||
Gbl.Session.NumSessions = 0;
|
||||
Gbl.Session.IsOpen = false;
|
||||
|
|
32
swad_group.c
32
swad_group.c
|
@ -1378,7 +1378,9 @@ static void Grp_ListGroupTypesForEdition (void)
|
|||
Txt_The_groups_will_not_automatically_open,
|
||||
Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? Txt_The_groups_will_automatically_open :
|
||||
Txt_The_groups_will_not_automatically_open);
|
||||
sprintf (Id,"open_time_%u",UniqueId);
|
||||
snprintf (Id,sizeof (Id),
|
||||
"open_time_%u",
|
||||
UniqueId);
|
||||
Dat_WriteFormClientLocalDateTimeFromTimeUTC (Id,
|
||||
"Open",
|
||||
Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC,
|
||||
|
@ -1521,10 +1523,10 @@ static void Grp_ListGroupsForEdition (void)
|
|||
ActOpeGrp,
|
||||
Grp_GROUPS_SECTION_ID);
|
||||
Grp_PutParamGrpCod (Grp->GrpCod);
|
||||
sprintf (Gbl.Title,
|
||||
Grp->Open ? Txt_Group_X_open_click_to_close_it :
|
||||
Txt_Group_X_closed_click_to_open_it,
|
||||
Grp->GrpName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Grp->Open ? Txt_Group_X_open_click_to_close_it :
|
||||
Txt_Group_X_closed_click_to_open_it,
|
||||
Grp->GrpName);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s-on64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -1542,10 +1544,10 @@ static void Grp_ListGroupsForEdition (void)
|
|||
ActEnaFilZonGrp,
|
||||
Grp_GROUPS_SECTION_ID);
|
||||
Grp_PutParamGrpCod (Grp->GrpCod);
|
||||
sprintf (Gbl.Title,
|
||||
Grp->FileZones ? Txt_File_zones_of_the_group_X_enabled_click_to_disable_them :
|
||||
Txt_File_zones_of_the_group_X_disabled_click_to_enable_them,
|
||||
Grp->GrpName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Grp->FileZones ? Txt_File_zones_of_the_group_X_enabled_click_to_disable_them :
|
||||
Txt_File_zones_of_the_group_X_disabled_click_to_enable_them,
|
||||
Grp->GrpName);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -2380,9 +2382,10 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
|
|||
Rol_Role_t Role;
|
||||
|
||||
/***** Write icon to show if group is open or closed *****/
|
||||
sprintf (Gbl.Title,Grp->Open ? Txt_Group_X_open :
|
||||
Txt_Group_X_closed,
|
||||
Grp->GrpName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Grp->Open ? Txt_Group_X_open :
|
||||
Txt_Group_X_closed,
|
||||
Grp->GrpName);
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE");
|
||||
if (Highlight)
|
||||
fprintf (Gbl.F.Out," LIGHT_BLUE");
|
||||
|
@ -4786,8 +4789,9 @@ void Grp_GetLstCodsGrpWanted (struct ListCodGrps *LstGrpsWanted)
|
|||
Lay_ShowErrorAndExit ("Not enough memory to store codes of groups in which a user wants to be enroled.");
|
||||
|
||||
/***** Get the multiple parameter code of group of this type *****/
|
||||
sprintf (Param,"GrpCod%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod);
|
||||
snprintf (Param,sizeof (Param),
|
||||
"GrpCod%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod);
|
||||
Par_GetParMultiToText (Param,LstStrCodGrps[NumGrpTyp],
|
||||
((1 + 10 + 1) * Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - 1);
|
||||
if (LstStrCodGrps[NumGrpTyp][0])
|
||||
|
|
48
swad_help.c
48
swad_help.c
|
@ -145,8 +145,9 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role] != ActUnk)
|
||||
{
|
||||
/* Request my removing from this course */
|
||||
sprintf (Gbl.Title,Txt_Remove_me_from_THE_COURSE_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Remove_me_from_THE_COURSE_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role],
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_me);
|
||||
|
@ -155,8 +156,9 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
else // I do not belong to this course
|
||||
{
|
||||
/* Request my registration in this course */
|
||||
sprintf (Gbl.Title,Txt_Register_me_in_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Register_me_in_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActReqSignUp,
|
||||
Btn_CREATE_BUTTON,Txt_Sign_up);
|
||||
|
@ -170,8 +172,9 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course
|
||||
{
|
||||
/* Request students enrolment */
|
||||
sprintf (Gbl.Title,Txt_Register_students_in_COURSE_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Register_students_in_COURSE_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActReqEnrSevStd,
|
||||
Btn_CREATE_BUTTON,Txt_Register_students);
|
||||
|
@ -187,9 +190,10 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
if (Gbl.CurrentDeg.Deg.DegCod > 0) // Degree selected
|
||||
{
|
||||
/* Select a course */
|
||||
sprintf (Gbl.Title,Gbl.CurrentCrs.Crs.CrsCod > 0 ? Txt_Select_create_course_in_X :
|
||||
Txt_Select_or_create_one_course_in_X,
|
||||
Gbl.CurrentDeg.Deg.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Gbl.CurrentCrs.Crs.CrsCod > 0 ? Txt_Select_create_course_in_X :
|
||||
Txt_Select_or_create_one_course_in_X,
|
||||
Gbl.CurrentDeg.Deg.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActSeeCrs,
|
||||
Btn_CONFIRM_BUTTON,Txt_Courses);
|
||||
|
@ -197,9 +201,10 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // Centre selected
|
||||
{
|
||||
/* Select a degree */
|
||||
sprintf (Gbl.Title,Gbl.CurrentDeg.Deg.DegCod > 0 ? Txt_Select_or_create_another_degree_in_X :
|
||||
Txt_Select_or_create_one_degree_in_X,
|
||||
Gbl.CurrentCtr.Ctr.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Gbl.CurrentDeg.Deg.DegCod > 0 ? Txt_Select_or_create_another_degree_in_X :
|
||||
Txt_Select_or_create_one_degree_in_X,
|
||||
Gbl.CurrentCtr.Ctr.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActSeeDeg,
|
||||
Btn_CONFIRM_BUTTON,Txt_Degrees);
|
||||
|
@ -207,9 +212,10 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
else if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected
|
||||
{
|
||||
/* Select a centre */
|
||||
sprintf (Gbl.Title,Gbl.CurrentCtr.Ctr.CtrCod > 0 ? Txt_Select_or_create_another_centre_in_X :
|
||||
Txt_Select_or_create_one_centre_in_X,
|
||||
Gbl.CurrentIns.Ins.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Gbl.CurrentCtr.Ctr.CtrCod > 0 ? Txt_Select_or_create_another_centre_in_X :
|
||||
Txt_Select_or_create_one_centre_in_X,
|
||||
Gbl.CurrentIns.Ins.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActSeeCtr,
|
||||
Btn_CONFIRM_BUTTON,Txt_Centres);
|
||||
|
@ -217,9 +223,10 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected
|
||||
{
|
||||
/* Select an institution */
|
||||
sprintf (Gbl.Title,Gbl.CurrentIns.Ins.InsCod > 0 ? Txt_Select_or_create_another_institution_in_X :
|
||||
Txt_Select_or_create_one_institution_in_X,
|
||||
Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Gbl.CurrentIns.Ins.InsCod > 0 ? Txt_Select_or_create_another_institution_in_X :
|
||||
Txt_Select_or_create_one_institution_in_X,
|
||||
Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActSeeIns,
|
||||
Btn_CONFIRM_BUTTON,Txt_Institutions);
|
||||
|
@ -244,8 +251,9 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
Btn_CONFIRM_BUTTON,Txt_Log_in);
|
||||
|
||||
/* Sign up */
|
||||
sprintf (Gbl.Title,Txt_New_on_PLATFORM_Sign_up,
|
||||
Cfg_PLATFORM_SHORT_NAME);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_New_on_PLATFORM_Sign_up,
|
||||
Cfg_PLATFORM_SHORT_NAME);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActFrmMyAcc,
|
||||
Btn_CREATE_BUTTON,Txt_Create_account);
|
||||
|
|
|
@ -543,12 +543,15 @@ void Hie_InitHierarchy (void)
|
|||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
{
|
||||
/***** Paths of course directories *****/
|
||||
sprintf (Gbl.CurrentCrs.PathPriv,"%s/%s/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
sprintf (Gbl.CurrentCrs.PathRelPubl,"%s/%s/%ld",
|
||||
Cfg_PATH_SWAD_PUBLIC ,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
sprintf (Gbl.CurrentCrs.PathURLPubl,"%s/%s/%ld",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
snprintf (Gbl.CurrentCrs.PathPriv,sizeof (Gbl.CurrentCrs.PathPriv),
|
||||
"%s/%s/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
snprintf (Gbl.CurrentCrs.PathRelPubl,sizeof (Gbl.CurrentCrs.PathRelPubl),
|
||||
"%s/%s/%ld",
|
||||
Cfg_PATH_SWAD_PUBLIC ,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
snprintf (Gbl.CurrentCrs.PathURLPubl,sizeof (Gbl.CurrentCrs.PathURLPubl),
|
||||
"%s/%s/%ld",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** If any of the course directories does not exist, create it *****/
|
||||
if (!Fil_CheckIfPathExists (Gbl.CurrentCrs.PathPriv))
|
||||
|
|
|
@ -125,10 +125,11 @@ void Ico_ChangeIconSet (void)
|
|||
|
||||
/***** Get param with icon set *****/
|
||||
Gbl.Prefs.IconSet = Ico_GetParamIconSet ();
|
||||
sprintf (Gbl.Prefs.PathIconSet,"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON,
|
||||
Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
snprintf (Gbl.Prefs.PathIconSet,sizeof (Gbl.Prefs.PathIconSet),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PUBLIC_ICON,
|
||||
Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
|
||||
/***** Store icon set in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
|
|
117
swad_image.c
117
swad_image.c
|
@ -197,7 +197,7 @@ void Img_PutImageUploader (int NumImgInForm,const char *ClassImgTitURL)
|
|||
extern const char *Txt_Image_title_attribution;
|
||||
extern const char *Txt_Link;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
char Id[Act_MAX_BYTES_ID];
|
||||
char Id[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Set names of parameters depending on number of image in form *****/
|
||||
Img_SetParamNames (&ParamUploadImg,NumImgInForm);
|
||||
|
@ -361,10 +361,18 @@ void Img_SetParamNames (struct ParamUploadImg *ParamUploadImg,int NumImgInForm)
|
|||
}
|
||||
else // Several images in form ==> add suffix
|
||||
{
|
||||
sprintf (ParamUploadImg->Action,"ImgAct%u",NumImgInForm);
|
||||
sprintf (ParamUploadImg->File ,"ImgFil%u",NumImgInForm);
|
||||
sprintf (ParamUploadImg->Title ,"ImgTit%u",NumImgInForm);
|
||||
sprintf (ParamUploadImg->URL ,"ImgURL%u",NumImgInForm);
|
||||
snprintf (ParamUploadImg->Action,sizeof (ParamUploadImg->Action),
|
||||
"ImgAct%u",
|
||||
NumImgInForm);
|
||||
snprintf (ParamUploadImg->File ,sizeof (ParamUploadImg->File),
|
||||
"ImgFil%u",
|
||||
NumImgInForm);
|
||||
snprintf (ParamUploadImg->Title ,sizeof (ParamUploadImg->Title),
|
||||
"ImgTit%u",
|
||||
NumImgInForm);
|
||||
snprintf (ParamUploadImg->URL ,sizeof (ParamUploadImg->URL),
|
||||
"ImgURL%u",
|
||||
NumImgInForm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,13 +437,15 @@ void Img_GetAndProcessImageFileFromForm (struct Image *Image,const char *ParamFi
|
|||
|
||||
/***** Create private directories if not exist *****/
|
||||
/* Create private directory for images if it does not exist */
|
||||
sprintf (PathImgPriv,"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG);
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
|
||||
/* Create temporary private directory for images if it does not exist */
|
||||
sprintf (PathImgPriv,"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP);
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
|
||||
/***** Remove old temporary private files *****/
|
||||
|
@ -444,18 +454,20 @@ void Img_GetAndProcessImageFileFromForm (struct Image *Image,const char *ParamFi
|
|||
/***** End the reception of original not processed image
|
||||
(it can be very big) into a temporary file *****/
|
||||
Image->Status = Img_FILE_NONE;
|
||||
sprintf (FileNameImgOrig,"%s/%s/%s/%s_original.%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP,
|
||||
Image->Name,PtrExtension);
|
||||
snprintf (FileNameImgOrig,sizeof (FileNameImgOrig),
|
||||
"%s/%s/%s/%s_original.%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP,
|
||||
Image->Name,PtrExtension);
|
||||
if (Fil_EndReceptionOfFile (FileNameImgOrig,Param)) // Success
|
||||
{
|
||||
Image->Status = Img_FILE_RECEIVED;
|
||||
|
||||
/***** Convert original image to temporary JPEG processed file
|
||||
by calling to program that makes the conversion *****/
|
||||
sprintf (FileNameImgTmp,"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP,
|
||||
Image->Name);
|
||||
snprintf (FileNameImgTmp,sizeof (FileNameImgTmp),
|
||||
"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP,
|
||||
Image->Name);
|
||||
Img_ProcessImage (Image,FileNameImgOrig,FileNameImgTmp);
|
||||
Image->Status = Img_FILE_PROCESSED;
|
||||
|
||||
|
@ -475,12 +487,13 @@ static void Img_ProcessImage (struct Image *Image,
|
|||
char Command[1024 + PATH_MAX * 2];
|
||||
int ReturnCode;
|
||||
|
||||
sprintf (Command,"convert %s -resize '%ux%u>' -quality %u %s",
|
||||
FileNameImgOriginal,
|
||||
Image->Width,
|
||||
Image->Height,
|
||||
Image->Quality,
|
||||
FileNameImgProcessed);
|
||||
snprintf (Command,sizeof (Command),
|
||||
"convert %s -resize '%ux%u>' -quality %u %s",
|
||||
FileNameImgOriginal,
|
||||
Image->Width,
|
||||
Image->Height,
|
||||
Image->Quality,
|
||||
FileNameImgProcessed);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running command to process image.");
|
||||
|
@ -508,23 +521,26 @@ void Img_MoveImageToDefinitiveDirectory (struct Image *Image)
|
|||
char FileNameImg[PATH_MAX + 1]; // Full name of definitive processed file
|
||||
|
||||
/***** Create subdirectory if it does not exist *****/
|
||||
sprintf (PathImgPriv,"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
Image->Name[0],
|
||||
Image->Name[1]);
|
||||
snprintf (PathImgPriv,sizeof (PathImgPriv),
|
||||
"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
Image->Name[0],
|
||||
Image->Name[1]);
|
||||
Fil_CreateDirIfNotExists (PathImgPriv);
|
||||
|
||||
/***** Temporary processed file *****/
|
||||
sprintf (FileNameImgTmp,"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP,
|
||||
Image->Name);
|
||||
snprintf (FileNameImgTmp,sizeof (FileNameImgTmp),
|
||||
"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,Cfg_FOLDER_IMG_TMP,
|
||||
Image->Name);
|
||||
|
||||
/***** Definitive processed file *****/
|
||||
sprintf (FileNameImg,"%s/%s/%c%c/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
Image->Name[0],
|
||||
Image->Name[1],
|
||||
Image->Name);
|
||||
snprintf (FileNameImg,sizeof (FileNameImg),
|
||||
"%s/%s/%c%c/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
Image->Name[0],
|
||||
Image->Name[1],
|
||||
Image->Name);
|
||||
|
||||
/***** Move file *****/
|
||||
if (rename (FileNameImgTmp,FileNameImg)) // Fail
|
||||
|
@ -558,12 +574,15 @@ void Img_ShowImage (struct Image *Image,
|
|||
Brw_CreateDirDownloadTmp ();
|
||||
|
||||
/***** Build private path to image *****/
|
||||
sprintf (FileNameImgPriv,"%s.jpg",Image->Name);
|
||||
sprintf (FullPathImgPriv,"%s/%s/%c%c/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
Image->Name[0],
|
||||
Image->Name[1],
|
||||
FileNameImgPriv);
|
||||
snprintf (FileNameImgPriv,sizeof (FileNameImgPriv),
|
||||
"%s.jpg",
|
||||
Image->Name);
|
||||
snprintf (FullPathImgPriv,sizeof (FullPathImgPriv),
|
||||
"%s/%s/%c%c/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
Image->Name[0],
|
||||
Image->Name[1],
|
||||
FileNameImgPriv);
|
||||
|
||||
/***** Check if private image file exists *****/
|
||||
if (Fil_CheckIfPathExists (FullPathImgPriv))
|
||||
|
@ -573,10 +592,11 @@ void Img_ShowImage (struct Image *Image,
|
|||
Brw_CreateTmpPublicLinkToPrivateFile (FullPathImgPriv,FileNameImgPriv);
|
||||
|
||||
/***** Create URL pointing to symbolic link *****/
|
||||
sprintf (URL,"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,
|
||||
FileNameImgPriv);
|
||||
snprintf (URL,sizeof (URL),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,
|
||||
FileNameImgPriv);
|
||||
|
||||
/***** Show image *****/
|
||||
/* Check if optional link is present */
|
||||
|
@ -621,11 +641,12 @@ void Img_RemoveImageFile (const char *ImageName)
|
|||
if (ImageName[0])
|
||||
{
|
||||
/***** Build path to private file *****/
|
||||
sprintf (FullPathImgPriv,"%s/%s/%c%c/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
ImageName[0],
|
||||
ImageName[1],
|
||||
ImageName);
|
||||
snprintf (FullPathImgPriv,sizeof (FullPathImgPriv),
|
||||
"%s/%s/%c%c/%s.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||
ImageName[0],
|
||||
ImageName[1],
|
||||
ImageName);
|
||||
|
||||
/***** Remove private file *****/
|
||||
unlink (FullPathImgPriv);
|
||||
|
|
125
swad_info.c
125
swad_info.c
|
@ -310,11 +310,12 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead);
|
|||
|
||||
static bool Inf_CheckPage (long CrsCod,Inf_InfoType_t InfoType);
|
||||
static bool Inf_CheckAndShowPage (void);
|
||||
static void Inf_BuildPathPage (long CrsCod,Inf_InfoType_t InfoType,char *PathDir);
|
||||
static void Inf_BuildPathPage (long CrsCod,Inf_InfoType_t InfoType,char PathDir[PATH_MAX + 1]);
|
||||
|
||||
static bool Inf_CheckURL (long CrsCod,Inf_InfoType_t InfoType);
|
||||
static bool Inf_CheckAndShowURL (void);
|
||||
static void Inf_BuildPathURL (long CrsCod,Inf_InfoType_t InfoType,char *PathFile);
|
||||
static void Inf_BuildPathURL (long CrsCod,Inf_InfoType_t InfoType,
|
||||
char PathFile[PATH_MAX + 1]);
|
||||
|
||||
static void Inf_ShowPage (const char *URL);
|
||||
|
||||
|
@ -771,12 +772,16 @@ static bool Inf_CheckPage (long CrsCod,Inf_InfoType_t InfoType)
|
|||
|
||||
/***** Open file with web page *****/
|
||||
/* 1. Check if index.html exists */
|
||||
sprintf (PathRelFileHTML,"%s/index.html",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.html",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML)) // TODO: Check if not empty?
|
||||
return true;
|
||||
|
||||
/* 2. If index.html does not exist, try index.htm */
|
||||
sprintf (PathRelFileHTML,"%s/index.htm",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.htm",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML)) // TODO: Check if not empty?
|
||||
return true;
|
||||
|
||||
|
@ -802,24 +807,30 @@ static bool Inf_CheckAndShowPage (void)
|
|||
|
||||
/***** Open file with web page *****/
|
||||
/* 1. Check if index.html exists */
|
||||
sprintf (PathRelFileHTML,"%s/index.html",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.html",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML)) // TODO: Check if not empty?
|
||||
{
|
||||
sprintf (URL,"%s/%s/%ld/%s/index.html",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_FileNamesForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
snprintf (URL,sizeof (URL),
|
||||
"%s/%s/%ld/%s/index.html",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_FileNamesForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
Inf_ShowPage (URL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 2. If index.html does not exist, try index.htm */
|
||||
sprintf (PathRelFileHTML,"%s/index.htm",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.htm",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML)) // TODO: Check if not empty?
|
||||
{
|
||||
sprintf (URL,"%s/%s/%ld/%s/index.htm",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_FileNamesForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
snprintf (URL,sizeof (URL),
|
||||
"%s/%s/%ld/%s/index.htm",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Inf_FileNamesForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
Inf_ShowPage (URL);
|
||||
|
||||
return true;
|
||||
|
@ -832,11 +843,12 @@ static bool Inf_CheckAndShowPage (void)
|
|||
/* Build path inside a course for a given a info type to store web page file */
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Inf_BuildPathPage (long CrsCod,Inf_InfoType_t InfoType,char *PathDir)
|
||||
static void Inf_BuildPathPage (long CrsCod,Inf_InfoType_t InfoType,char PathDir[PATH_MAX + 1])
|
||||
{
|
||||
sprintf (PathDir,"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CRS,CrsCod,
|
||||
Inf_FileNamesForInfoType[InfoType]);
|
||||
snprintf (PathDir,PATH_MAX + 1,
|
||||
"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CRS,CrsCod,
|
||||
Inf_FileNamesForInfoType[InfoType]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -860,13 +872,17 @@ int Inf_WritePageIntoHTMLBuffer (char **HTMLBuffer)
|
|||
|
||||
/***** Open file with web page *****/
|
||||
/* 1. Check if index.html exists */
|
||||
sprintf (PathRelFileHTML,"%s/index.html",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.html",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML)) // TODO: Check if not empty?
|
||||
FileExists = true;
|
||||
else
|
||||
{
|
||||
/* 2. If index.html not exists, try index.htm */
|
||||
sprintf (PathRelFileHTML,"%s/index.htm",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.htm",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML)) // TODO: Check if not empty?
|
||||
FileExists = true;
|
||||
}
|
||||
|
@ -973,11 +989,13 @@ static bool Inf_CheckAndShowURL (void)
|
|||
/*** Build path inside a course for a given a info type to store URL file ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Inf_BuildPathURL (long CrsCod,Inf_InfoType_t InfoType,char *PathFile)
|
||||
static void Inf_BuildPathURL (long CrsCod,Inf_InfoType_t InfoType,
|
||||
char PathFile[PATH_MAX + 1])
|
||||
{
|
||||
sprintf (PathFile,"%s/%s/%ld/%s.url",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,
|
||||
Inf_FileNamesForInfoType[InfoType]);
|
||||
snprintf (PathFile,PATH_MAX + 1,
|
||||
"%s/%s/%ld/%s.url",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,
|
||||
Inf_FileNamesForInfoType[InfoType]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1844,7 +1862,7 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
char PathFileHTML[PATH_MAX + 1];
|
||||
FILE *FileMD; // Temporary Markdown file
|
||||
FILE *FileHTML; // Temporary HTML file
|
||||
char MathJaxURL[PATH_MAX];
|
||||
char MathJaxURL[PATH_MAX + 1];
|
||||
char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos
|
||||
int ReturnCode;
|
||||
bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
||||
|
@ -1882,10 +1900,12 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
/***** Store text into a temporary .md file in HTML output directory *****/
|
||||
// TODO: change to another directory?
|
||||
/* Create a unique name for the .md file */
|
||||
sprintf (PathFileMD,"%s/%s/%s.md",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
sprintf (PathFileHTML,"%s/%s/%s.md.html", // Do not use only .html because that is the output temporary file
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
snprintf (PathFileMD,sizeof (PathFileMD),
|
||||
"%s/%s/%s.md",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
snprintf (PathFileHTML,sizeof (PathFileHTML),
|
||||
"%s/%s/%s.md.html", // Do not use only .html because that is the output temporary file
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
|
||||
/* Open Markdown file for writing */
|
||||
if ((FileMD = fopen (PathFileMD,"wb")) == NULL)
|
||||
|
@ -1900,8 +1920,9 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
/***** Convert from Markdown to HTML *****/
|
||||
#ifdef Cfg_MATHJAX_LOCAL
|
||||
// Use the local copy of MathJax
|
||||
sprintf (MathJaxURL,"=%s/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
|
||||
Cfg_URL_SWAD_PUBLIC);
|
||||
snprintf (MathJaxURL,sizeof (MathJaxURL),
|
||||
"=%s/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
|
||||
Cfg_URL_SWAD_PUBLIC);
|
||||
#else
|
||||
// Use the MathJax Content Delivery Network (CDN)
|
||||
MathJaxURL[0] = '\0';
|
||||
|
@ -1909,14 +1930,15 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
// --ascii uses only ascii characters in output
|
||||
// (uses numerical entities instead of UTF-8)
|
||||
// is mandatory in order to convert (with iconv) the UTF-8 output of pandoc to WINDOWS-1252
|
||||
sprintf (Command,"iconv -f WINDOWS-1252 -t UTF-8 %s"
|
||||
" | "
|
||||
"pandoc --ascii --mathjax%s -f markdown -t html5"
|
||||
" | "
|
||||
"iconv -f UTF-8 -t WINDOWS-1252 -o %s",
|
||||
PathFileMD,
|
||||
MathJaxURL,
|
||||
PathFileHTML);
|
||||
snprintf (Command,sizeof (Command),
|
||||
"iconv -f WINDOWS-1252 -t UTF-8 %s"
|
||||
" | "
|
||||
"pandoc --ascii --mathjax%s -f markdown -t html5"
|
||||
" | "
|
||||
"iconv -f UTF-8 -t WINDOWS-1252 -o %s",
|
||||
PathFileMD,
|
||||
MathJaxURL,
|
||||
PathFileHTML);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running command to convert from Markdown to HTML.");
|
||||
|
@ -1969,8 +1991,9 @@ int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer)
|
|||
if (TxtHTML[0])
|
||||
{
|
||||
/***** Create a unique name for the file *****/
|
||||
sprintf (FileNameHTMLTmp,"%s/%s/%s_info.html",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNameHTMLTmp,sizeof (FileNameHTMLTmp),
|
||||
"%s/%s/%s_info.html",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
|
||||
/***** Create a new temporary file for writing and reading *****/
|
||||
if ((FileHTMLTmp = fopen (FileNameHTMLTmp,"w+b")) == NULL)
|
||||
|
@ -2320,7 +2343,9 @@ void Inf_ReceivePagInfo (void)
|
|||
{
|
||||
Fil_RemoveTree (PathRelDirHTML);
|
||||
Fil_CreateDirIfNotExists (PathRelDirHTML);
|
||||
sprintf (PathRelFileHTML,"%s/index.html",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.html",
|
||||
PathRelDirHTML);
|
||||
if (Fil_EndReceptionOfFile (PathRelFileHTML,Param))
|
||||
{
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_HTML_file_has_been_received_successfully);
|
||||
|
@ -2333,21 +2358,25 @@ void Inf_ReceivePagInfo (void)
|
|||
{
|
||||
Fil_RemoveTree (PathRelDirHTML);
|
||||
Fil_CreateDirIfNotExists (PathRelDirHTML);
|
||||
sprintf (PathRelFileZIP,"%s/%s.zip",
|
||||
Gbl.CurrentCrs.PathPriv,
|
||||
Inf_FileNamesForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
snprintf (PathRelFileZIP,sizeof (PathRelFileZIP),
|
||||
"%s/%s.zip",
|
||||
Gbl.CurrentCrs.PathPriv,
|
||||
Inf_FileNamesForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||
|
||||
if (Fil_EndReceptionOfFile (PathRelFileZIP,Param))
|
||||
{
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_ZIP_file_has_been_received_successfully);
|
||||
|
||||
/* Uncompress ZIP */
|
||||
sprintf (StrUnzip,"unzip -qq -o %s -d %s",
|
||||
PathRelFileZIP,PathRelDirHTML);
|
||||
snprintf (StrUnzip,sizeof (StrUnzip),
|
||||
"unzip -qq -o %s -d %s",
|
||||
PathRelFileZIP,PathRelDirHTML);
|
||||
if (system (StrUnzip) == 0)
|
||||
{
|
||||
/* Check if uploaded file is index.html or index.htm */
|
||||
sprintf (PathRelFileHTML,"%s/index.html",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.html",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML))
|
||||
{
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_ZIP_file_has_been_unzipped_successfully);
|
||||
|
@ -2356,7 +2385,9 @@ void Inf_ReceivePagInfo (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf (PathRelFileHTML,"%s/index.htm",PathRelDirHTML);
|
||||
snprintf (PathRelFileHTML,sizeof (PathRelFileHTML),
|
||||
"%s/index.htm",
|
||||
PathRelDirHTML);
|
||||
if (Fil_CheckIfPathExists (PathRelFileHTML))
|
||||
{
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_ZIP_file_has_been_unzipped_successfully);
|
||||
|
|
|
@ -248,7 +248,9 @@ void Ins_DrawInstitutionLogoAndNameWithLink (struct Instit *Ins,Act_Action_t Act
|
|||
Ins_PutParamInsCod (Ins->InsCod);
|
||||
|
||||
/***** Link to action *****/
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,Ins->FullName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Ins->FullName);
|
||||
Act_LinkFormSubmit (Gbl.Title,ClassLink,NULL);
|
||||
|
||||
/***** Draw institution logo *****/
|
||||
|
@ -529,8 +531,9 @@ static void Ins_Configuration (bool PrintView)
|
|||
/* Form to go to see centres of this institution */
|
||||
Act_StartFormGoTo (ActSeeCtr);
|
||||
Ins_PutParamInsCod (Gbl.CurrentIns.Ins.InsCod);
|
||||
sprintf (Gbl.Title,Txt_Centres_of_INSTITUTION_X,
|
||||
Gbl.CurrentIns.Ins.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Centres_of_INSTITUTION_X,
|
||||
Gbl.CurrentIns.Ins.ShrtName);
|
||||
Act_LinkFormSubmit (Gbl.Title,"DAT",NULL);
|
||||
fprintf (Gbl.F.Out,"%u</a>",
|
||||
Ctr_GetNumCtrsInIns (Gbl.CurrentIns.Ins.InsCod));
|
||||
|
@ -670,7 +673,9 @@ static void Ins_ListInstitutions (void)
|
|||
unsigned NumIns;
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (Gbl.Title,Txt_Institutions_of_COUNTRY_X,Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Institutions_of_COUNTRY_X,
|
||||
Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
|
||||
Box_StartBox (NULL,Gbl.Title,Ins_PutIconsListInstitutions,
|
||||
Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -919,8 +924,9 @@ void Ins_EditInstitutions (void)
|
|||
Ins_GetListInstitutions (Gbl.CurrentCty.Cty.CtyCod,Ins_GET_EXTRA_DATA);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (Gbl.Title,Txt_Institutions_of_COUNTRY_X,
|
||||
Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Institutions_of_COUNTRY_X,
|
||||
Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
|
||||
Box_StartBox (NULL,Gbl.Title,Ins_PutIconToViewInstitutions,
|
||||
Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -1711,10 +1717,11 @@ void Ins_RemoveInstitution (void)
|
|||
Brw_RemoveInsFilesFromDB (Ins.InsCod);
|
||||
|
||||
/***** Remove directories of the institution *****/
|
||||
sprintf (PathIns,"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_INS,
|
||||
(unsigned) (Ins.InsCod % 100),
|
||||
(unsigned) Ins.InsCod);
|
||||
snprintf (PathIns,sizeof (PathIns),
|
||||
"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_INS,
|
||||
(unsigned) (Ins.InsCod % 100),
|
||||
(unsigned) Ins.InsCod);
|
||||
Fil_RemoveTree (PathIns);
|
||||
|
||||
/***** Remove institution *****/
|
||||
|
@ -2129,7 +2136,9 @@ static void Ins_ShowAlertAndButtonToGoToIns (void)
|
|||
if (Gbl.Inss.EditingIns.InsCod != Gbl.CurrentIns.Ins.InsCod)
|
||||
{
|
||||
/***** Alert with button to go to degree *****/
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,Gbl.Inss.EditingIns.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Gbl.Inss.EditingIns.ShrtName);
|
||||
Ale_ShowAlertAndButton (Gbl.Alert.Type,Gbl.Alert.Txt,
|
||||
ActSeeCtr,NULL,NULL,Ins_PutParamGoToIns,
|
||||
Btn_CONFIRM_BUTTON,Gbl.Title);
|
||||
|
@ -2549,9 +2558,10 @@ unsigned Ins_ListInssFound (const char *Query)
|
|||
{
|
||||
/***** Start box and table *****/
|
||||
/* Number of institutions found */
|
||||
sprintf (Gbl.Title,"%u %s",
|
||||
NumInss,NumInss == 1 ? Txt_institution :
|
||||
Txt_institutions);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s",
|
||||
NumInss,NumInss == 1 ? Txt_institution :
|
||||
Txt_institutions);
|
||||
Box_StartBoxTable (NULL,Gbl.Title,NULL,
|
||||
NULL,Box_NOT_CLOSABLE,2);
|
||||
|
||||
|
|
107
swad_logo.c
107
swad_logo.c
|
@ -93,11 +93,12 @@ void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText,
|
|||
{
|
||||
Folder = Cfg_FOLDER_DEG;
|
||||
DegCod = Cod;
|
||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (DegCod % 100),
|
||||
(unsigned) DegCod,
|
||||
(unsigned) DegCod);
|
||||
snprintf (PathLogo,sizeof (PathLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (DegCod % 100),
|
||||
(unsigned) DegCod,
|
||||
(unsigned) DegCod);
|
||||
LogoFound = Fil_CheckIfPathExists (PathLogo);
|
||||
if (LogoFound)
|
||||
Cod = DegCod;
|
||||
|
@ -111,11 +112,12 @@ void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText,
|
|||
CtrCod = Deg_GetCtrCodOfDegreeByCod (Cod);
|
||||
else
|
||||
CtrCod = Cod;
|
||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (CtrCod % 100),
|
||||
(unsigned) CtrCod,
|
||||
(unsigned) CtrCod);
|
||||
snprintf (PathLogo,sizeof (PathLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (CtrCod % 100),
|
||||
(unsigned) CtrCod,
|
||||
(unsigned) CtrCod);
|
||||
LogoFound = Fil_CheckIfPathExists (PathLogo);
|
||||
if (LogoFound)
|
||||
Cod = CtrCod;
|
||||
|
@ -131,11 +133,12 @@ void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText,
|
|||
InsCod = Ctr_GetInsCodOfCentreByCod (Cod);
|
||||
else
|
||||
InsCod = Cod;
|
||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (InsCod % 100),
|
||||
(unsigned) InsCod,
|
||||
(unsigned) InsCod);
|
||||
snprintf (PathLogo,sizeof (PathLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (InsCod % 100),
|
||||
(unsigned) InsCod,
|
||||
(unsigned) InsCod);
|
||||
LogoFound = Fil_CheckIfPathExists (PathLogo);
|
||||
if (LogoFound)
|
||||
Cod = InsCod;
|
||||
|
@ -206,11 +209,12 @@ void Log_PutIconToChangeLogo (Sco_Scope_t Scope)
|
|||
}
|
||||
|
||||
/***** Check if logo exists *****/
|
||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
snprintf (PathLogo,sizeof (PathLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
LogoExists = Fil_CheckIfPathExists (PathLogo);
|
||||
|
||||
/***** Link for changing / uploading the logo *****/
|
||||
|
@ -264,11 +268,12 @@ void Log_RequestLogo (Sco_Scope_t Scope)
|
|||
}
|
||||
|
||||
/***** Check if logo exists *****/
|
||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
snprintf (PathLogo,sizeof (PathLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
if (Fil_CheckIfPathExists (PathLogo))
|
||||
{
|
||||
/***** Form to remove photo *****/
|
||||
|
@ -347,22 +352,26 @@ void Log_ReceiveLogo (Sco_Scope_t Scope)
|
|||
}
|
||||
|
||||
/***** Creates directories if not exist *****/
|
||||
sprintf (Path,"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder);
|
||||
Fil_CreateDirIfNotExists (Path);
|
||||
sprintf (Path,"%s/%s/%02u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100));
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%02u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100));
|
||||
Fil_CreateDirIfNotExists (Path);
|
||||
sprintf (Path,"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%02u/%u",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod);
|
||||
Fil_CreateDirIfNotExists (Path);
|
||||
sprintf (Path,"%s/%s/%02u/%u/logo",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%02u/%u/logo",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod);
|
||||
Fil_CreateDirIfNotExists (Path);
|
||||
|
||||
/***** Copy in disk the file received from stdin (really from Gbl.F.Tmp) *****/
|
||||
|
@ -386,11 +395,12 @@ void Log_ReceiveLogo (Sco_Scope_t Scope)
|
|||
else
|
||||
{
|
||||
/* End the reception of logo in a temporary file */
|
||||
sprintf (FileNameLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
snprintf (FileNameLogo,sizeof (FileNameLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
if (!Fil_EndReceptionOfFile (FileNameLogo,Param))
|
||||
Ale_ShowAlert (Ale_WARNING,"Error copying file.");
|
||||
}
|
||||
|
@ -426,10 +436,11 @@ void Log_RemoveLogo (Sco_Scope_t Scope)
|
|||
}
|
||||
|
||||
/***** Remove logo *****/
|
||||
sprintf (FileNameLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
snprintf (FileNameLogo,sizeof (FileNameLogo),
|
||||
"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
Fil_RemoveTree (FileNameLogo);
|
||||
}
|
||||
|
|
36
swad_mail.c
36
swad_mail.c
|
@ -1161,7 +1161,9 @@ void Mai_ShowFormChangeMyEmail (bool IMustFillEmail,bool IShouldConfirmEmail)
|
|||
Lay_StartSection (Mai_EMAIL_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_Email,Acc_PutLinkToRemoveMyAccount,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -1191,7 +1193,9 @@ void Mai_ShowFormChangeOtherUsrEmail (void)
|
|||
Lay_StartSection (Mai_EMAIL_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_Email,NULL,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -1323,7 +1327,9 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
|
|||
/* Email confirmed? */
|
||||
if (Confirmed)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Email_X_confirmed,row[0]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Email_X_confirmed,
|
||||
row[0]);
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s/ok_green16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -1722,15 +1728,16 @@ bool Mai_SendMailMsgToConfirmEmail (void)
|
|||
fclose (Gbl.Msg.FileMail);
|
||||
|
||||
/***** Call the script to send an email *****/
|
||||
sprintf (Command,"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"[%s] %s\" \"%s\"",
|
||||
Cfg_COMMAND_SEND_AUTOMATIC_EMAIL,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_SERVER,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_PORT,
|
||||
Cfg_AUTOMATIC_EMAIL_FROM,
|
||||
Gbl.Config.SMTPPassword,
|
||||
Gbl.Usrs.Me.UsrDat.Email,
|
||||
Cfg_PLATFORM_SHORT_NAME,Txt_Confirmation_of_your_email_NO_HTML,
|
||||
Gbl.Msg.FileNameMail);
|
||||
snprintf (Command,sizeof (Command),
|
||||
"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"[%s] %s\" \"%s\"",
|
||||
Cfg_COMMAND_SEND_AUTOMATIC_EMAIL,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_SERVER,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_PORT,
|
||||
Cfg_AUTOMATIC_EMAIL_FROM,
|
||||
Gbl.Config.SMTPPassword,
|
||||
Gbl.Usrs.Me.UsrDat.Email,
|
||||
Cfg_PLATFORM_SHORT_NAME,Txt_Confirmation_of_your_email_NO_HTML,
|
||||
Gbl.Msg.FileNameMail);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running script to send email.");
|
||||
|
@ -1894,8 +1901,9 @@ void Mai_ConfirmEmail (void)
|
|||
|
||||
void Mai_CreateFileNameMail (void)
|
||||
{
|
||||
sprintf (Gbl.Msg.FileNameMail,"%s/%s/%s_mail.txt",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
snprintf (Gbl.Msg.FileNameMail,sizeof (Gbl.Msg.FileNameMail),
|
||||
"%s/%s/%s_mail.txt",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
if ((Gbl.Msg.FileMail = fopen (Gbl.Msg.FileNameMail,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not open file to send email.");
|
||||
}
|
||||
|
|
56
swad_mark.c
56
swad_mark.c
|
@ -25,9 +25,11 @@
|
|||
/********************************** Headers **********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <linux/limits.h> // For PATH_MAX
|
||||
#include <linux/stddef.h> // For NULL
|
||||
#include <malloc.h> // For malloc
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <string.h> // For string functions
|
||||
#include <unistd.h> // For unlink
|
||||
|
||||
|
@ -628,9 +630,10 @@ void Mrk_ShowMyMarks (void)
|
|||
/***** Get the path of the file of marks *****/
|
||||
Brw_SetFullPathInTree (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||
Gbl.FileBrowser.FilFolLnkName);
|
||||
sprintf (PathPrivate,"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
snprintf (PathPrivate,sizeof (PathPrivate),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
/***** Get number of rows of header or footer *****/
|
||||
Mrk_GetNumRowsHeaderAndFooter (&Marks);
|
||||
|
@ -670,8 +673,9 @@ void Mrk_ShowMyMarks (void)
|
|||
|
||||
/***** Create temporal file to store my marks (in HTML) *****/
|
||||
/* If the private directory does not exist, create it */
|
||||
sprintf (PathMarksPriv,"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MARK);
|
||||
snprintf (PathMarksPriv,sizeof (PathMarksPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MARK);
|
||||
Fil_CreateDirIfNotExists (PathMarksPriv);
|
||||
|
||||
/* First of all, we remove the oldest temporary files.
|
||||
|
@ -681,7 +685,9 @@ void Mrk_ShowMyMarks (void)
|
|||
Fil_RemoveOldTmpFiles (PathMarksPriv,Cfg_TIME_TO_DELETE_MARKS_TMP_FILES,false);
|
||||
|
||||
/* Create a new temporary file *****/
|
||||
sprintf (FileNameUsrMarks,"%s/%s.html",PathMarksPriv,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNameUsrMarks,sizeof (FileNameUsrMarks),
|
||||
"%s/%s.html",
|
||||
PathMarksPriv,Gbl.UniqueNameEncrypted);
|
||||
if ((FileUsrMarks = fopen (FileNameUsrMarks,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not open file for my marks.");
|
||||
|
||||
|
@ -811,18 +817,21 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
if (UsrDat.IDs.Num)
|
||||
{
|
||||
if (GrpCod > 0)
|
||||
sprintf (PathMarks,"%s/%s/%ld/grp/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,GrpCod,
|
||||
FullPathInTreeFromDBMarksTable);
|
||||
snprintf (PathMarks,sizeof (PathMarks),
|
||||
"%s/%s/%ld/grp/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,GrpCod,
|
||||
FullPathInTreeFromDBMarksTable);
|
||||
else
|
||||
sprintf (PathMarks,"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,
|
||||
FullPathInTreeFromDBMarksTable);
|
||||
snprintf (PathMarks,sizeof (PathMarks),
|
||||
"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,
|
||||
FullPathInTreeFromDBMarksTable);
|
||||
|
||||
/***** Create temporal file to store my marks (in HTML) *****/
|
||||
/* If the private directory does not exist, create it */
|
||||
sprintf (PathMarksPriv,"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MARK);
|
||||
snprintf (PathMarksPriv,sizeof (PathMarksPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_MARK);
|
||||
Fil_CreateDirIfNotExists (PathMarksPriv);
|
||||
|
||||
/* First of all, we remove the oldest temporary files.
|
||||
|
@ -832,7 +841,9 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
Fil_RemoveOldTmpFiles (PathMarksPriv,Cfg_TIME_TO_DELETE_MARKS_TMP_FILES,false);
|
||||
|
||||
/* Create a new temporary file *****/
|
||||
sprintf (FileNameUsrMarks,"%s/%s.html",PathMarksPriv,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNameUsrMarks,sizeof (FileNameUsrMarks),
|
||||
"%s/%s.html",
|
||||
PathMarksPriv,Gbl.UniqueNameEncrypted);
|
||||
if ((FileUsrMarks = fopen (FileNameUsrMarks,"wb")))
|
||||
{
|
||||
/***** Get user's marks *****/
|
||||
|
@ -867,8 +878,9 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
else
|
||||
{
|
||||
fclose (FileUsrMarks);
|
||||
if ((*ContentStr = (char *) malloc (9 + strlen (Gbl.Alert.Txt) + 3 + 1)))
|
||||
sprintf (*ContentStr,"<![CDATA[%s]]>",Gbl.Alert.Txt);
|
||||
if (asprintf (ContentStr,"<![CDATA[%s]]>",
|
||||
Gbl.Alert.Txt) < 0)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store string.");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -876,8 +888,9 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
Gbl.Alert.Type = Ale_WARNING;
|
||||
Str_Copy (Gbl.Alert.Txt,"Can not open file of marks.", // TODO: Need translation!
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
if ((*ContentStr = (char *) malloc (9 + strlen (Gbl.Alert.Txt) + 3 + 1)))
|
||||
sprintf (*ContentStr,"<![CDATA[%s]]>",Gbl.Alert.Txt);
|
||||
if (asprintf (ContentStr,"<![CDATA[%s]]>",
|
||||
Gbl.Alert.Txt) < 0)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store string.");
|
||||
}
|
||||
unlink (FileNameUsrMarks); // File with marks is no longer necessary
|
||||
}
|
||||
|
@ -886,8 +899,9 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
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,"<![CDATA[%s]]>",Gbl.Alert.Txt);
|
||||
if (asprintf (ContentStr,"<![CDATA[%s]]>",
|
||||
Gbl.Alert.Txt) < 0)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store string.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -620,7 +620,9 @@ void Msg_PutHiddenParamAnotherRecipient (const struct UsrData *UsrDat)
|
|||
{
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
|
||||
sprintf (NicknameWithArroba,"@%s",UsrDat->Nickname);
|
||||
snprintf (NicknameWithArroba,sizeof (NicknameWithArroba),
|
||||
"@%s",
|
||||
UsrDat->Nickname);
|
||||
Par_PutHiddenParamString ("OtherRecipients",NicknameWithArroba);
|
||||
}
|
||||
|
||||
|
@ -2388,34 +2390,41 @@ static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs)
|
|||
if (Gbl.Msg.NumMsgs == 1)
|
||||
{
|
||||
if (NumUnreadMsgs)
|
||||
sprintf (Gbl.Title,"1 %s, 1 %s",
|
||||
Txt_message_received,Txt_unread_MESSAGE);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"1 %s, 1 %s",
|
||||
Txt_message_received,Txt_unread_MESSAGE);
|
||||
else
|
||||
sprintf (Gbl.Title,"1 %s",
|
||||
Txt_message_received);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"1 %s",
|
||||
Txt_message_received);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NumUnreadMsgs == 0)
|
||||
sprintf (Gbl.Title,"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received);
|
||||
else if (NumUnreadMsgs == 1)
|
||||
sprintf (Gbl.Title,"%u %s, 1 %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||
Txt_unread_MESSAGE);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s, 1 %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||
Txt_unread_MESSAGE);
|
||||
else
|
||||
sprintf (Gbl.Title,"%u %s, %u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||
NumUnreadMsgs,Txt_unread_MESSAGES);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s, %u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||
NumUnreadMsgs,Txt_unread_MESSAGES);
|
||||
}
|
||||
break;
|
||||
case Msg_MESSAGES_SENT:
|
||||
if (Gbl.Msg.NumMsgs == 1)
|
||||
sprintf (Gbl.Title,"1 %s",
|
||||
Txt_message_sent);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"1 %s",
|
||||
Txt_message_sent);
|
||||
else
|
||||
sprintf (Gbl.Title,"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_sent);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_sent);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3230,7 +3239,9 @@ bool Msg_WriteCrsOrgMsg (long CrsCod)
|
|||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
fprintf (Gbl.F.Out,"<div class=\"AUTHOR_TXT\">"
|
||||
"(");
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,Crs.FullName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Crs.FullName);
|
||||
Act_LinkFormSubmit (Gbl.Title,"AUTHOR_TXT",NULL);
|
||||
fprintf (Gbl.F.Out,"%s</a>)"
|
||||
"</div>",
|
||||
|
|
|
@ -289,7 +289,9 @@ void Net_ShowFormMyWebsAndSocialNets (void)
|
|||
Lay_StartSection (Net_MY_WEBS_ID);
|
||||
|
||||
/***** Start box and table *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBoxTable (StrRecordWidth,
|
||||
Txt_Webs_social_networks,Net_PutIconsWebsSocialNetworks,
|
||||
Hlp_PROFILE_Webs,Box_NOT_CLOSABLE,2);
|
||||
|
|
|
@ -246,7 +246,9 @@ static void Nck_ShowFormChangeUsrNickname (const struct UsrData *UsrDat,bool Its
|
|||
NumNicks = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get nicknames of a user");
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_Nickname,Acc_PutLinkToRemoveMyAccount,
|
||||
Hlp_PROFILE_Account,Box_NOT_CLOSABLE);
|
||||
|
||||
|
|
|
@ -389,8 +389,9 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
|
|||
if (TypeNoticesListing == Not_LIST_FULL_NOTICES)
|
||||
{
|
||||
/***** Start box *****/
|
||||
sprintf (StrWidth,"%upx",
|
||||
Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50);
|
||||
snprintf (StrWidth,sizeof (StrWidth),
|
||||
"%upx",
|
||||
Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50);
|
||||
Box_StartBox (StrWidth,
|
||||
Gbl.CurrentCrs.Notices.HighlightNotCod > 0 ? Txt_All_notices :
|
||||
Txt_Notices,
|
||||
|
@ -442,8 +443,10 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
|
|||
case Not_LIST_BRIEF_NOTICES:
|
||||
/***** Link to RSS file *****/
|
||||
/* Create RSS file if not exists */
|
||||
sprintf (PathRelRSSFile,"%s/%s/%ld/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod,Cfg_RSS_FOLDER,Cfg_RSS_FILE);
|
||||
snprintf (PathRelRSSFile,sizeof (PathRelRSSFile),
|
||||
"%s/%s/%ld/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_CRS,
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Cfg_RSS_FOLDER,Cfg_RSS_FILE);
|
||||
if (!Fil_CheckIfPathExists (PathRelRSSFile))
|
||||
RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs);
|
||||
|
||||
|
|
|
@ -1747,16 +1747,17 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
fclose (Gbl.Msg.FileMail);
|
||||
|
||||
/***** Call the command to send an email *****/
|
||||
sprintf (Command,"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"[%s] %s\" \"%s\"",
|
||||
Cfg_COMMAND_SEND_AUTOMATIC_EMAIL,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_SERVER,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_PORT,
|
||||
Cfg_AUTOMATIC_EMAIL_FROM,
|
||||
Gbl.Config.SMTPPassword,
|
||||
ToUsrDat->Email,
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
Txt_Notifications_NO_HTML[ToUsrLanguage],
|
||||
Gbl.Msg.FileNameMail);
|
||||
snprintf (Command,sizeof (Command),
|
||||
"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"[%s] %s\" \"%s\"",
|
||||
Cfg_COMMAND_SEND_AUTOMATIC_EMAIL,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_SERVER,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_PORT,
|
||||
Cfg_AUTOMATIC_EMAIL_FROM,
|
||||
Gbl.Config.SMTPPassword,
|
||||
ToUsrDat->Email,
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
Txt_Notifications_NO_HTML[ToUsrLanguage],
|
||||
Gbl.Msg.FileNameMail);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running script to send email.");
|
||||
|
|
|
@ -234,8 +234,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
sprintf (Gbl.Title,Txt_Page_X_of_Y,
|
||||
1,Pagination->NumPags);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
1,Pagination->NumPags);
|
||||
Act_LinkFormSubmit (Gbl.Title,Font,NULL);
|
||||
}
|
||||
else
|
||||
|
@ -257,7 +258,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
/***** Links to several pages start here *****/
|
||||
if (Pagination->MoreThanOnePage)
|
||||
{
|
||||
sprintf (LinkStyle,"PAG %s",Font);
|
||||
snprintf (LinkStyle,sizeof (LinkStyle),
|
||||
"PAG %s",
|
||||
Font);
|
||||
|
||||
/***** Possible link to page 1 *****/
|
||||
if (Pagination->StartPage > 1)
|
||||
|
@ -342,8 +345,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
sprintf (Gbl.Title,Txt_Page_X_of_Y,
|
||||
1,Pagination->NumPags);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
1,Pagination->NumPags);
|
||||
Act_LinkFormSubmit (Gbl.Title,LinkStyle,NULL);
|
||||
fprintf (Gbl.F.Out,"1"
|
||||
"</a>");
|
||||
|
@ -436,9 +440,10 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
sprintf (Gbl.Title,Txt_Page_X_of_Y,
|
||||
Pagination->LeftPage,
|
||||
Pagination->NumPags);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
Pagination->LeftPage,
|
||||
Pagination->NumPags);
|
||||
Act_LinkFormSubmit (Gbl.Title,LinkStyle,NULL);
|
||||
fprintf (Gbl.F.Out,"%u</a>",
|
||||
Pagination->LeftPage);
|
||||
|
@ -452,8 +457,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
NumPage <= Pagination->EndPage;
|
||||
NumPage++)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Page_X_of_Y,
|
||||
NumPage,Pagination->NumPags);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
NumPage,Pagination->NumPags);
|
||||
if (!LinkToPagCurrent && NumPage == Pagination->CurrentPage)
|
||||
fprintf (Gbl.F.Out,"<span title=\"%s\" class=\"PAG_CUR %s\">"
|
||||
"%u"
|
||||
|
@ -634,8 +640,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
sprintf (Gbl.Title,Txt_Page_X_of_Y,
|
||||
Pagination->RightPage,Pagination->NumPags);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
Pagination->RightPage,Pagination->NumPags);
|
||||
Act_LinkFormSubmit (Gbl.Title,LinkStyle,NULL);
|
||||
fprintf (Gbl.F.Out,"%u</a>",Pagination->RightPage);
|
||||
Act_EndForm ();
|
||||
|
@ -726,8 +733,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
sprintf (Gbl.Title,Txt_Page_X_of_Y,
|
||||
Pagination->NumPags,Pagination->NumPags);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
Pagination->NumPags,Pagination->NumPags);
|
||||
Act_LinkFormSubmit (Gbl.Title,LinkStyle,NULL);
|
||||
fprintf (Gbl.F.Out,"%u</a>",Pagination->NumPags);
|
||||
Act_EndForm ();
|
||||
|
|
|
@ -178,10 +178,12 @@ static void Par_GetBoundary (void)
|
|||
Lay_ShowErrorAndExit ("Delimiter string too long.");
|
||||
|
||||
/***** Create boundary strings *****/
|
||||
sprintf (Gbl.Boundary.StrWithoutCRLF,"--%s",
|
||||
PtrToBoundary);
|
||||
sprintf (Gbl.Boundary.StrWithCRLF,"%c%c%s",
|
||||
0x0D,0x0A,Gbl.Boundary.StrWithoutCRLF);
|
||||
snprintf (Gbl.Boundary.StrWithoutCRLF,sizeof (Gbl.Boundary.StrWithoutCRLF),
|
||||
"--%s",
|
||||
PtrToBoundary);
|
||||
snprintf (Gbl.Boundary.StrWithCRLF,sizeof (Gbl.Boundary.StrWithCRLF),
|
||||
"%c%c%s",
|
||||
0x0D,0x0A,Gbl.Boundary.StrWithoutCRLF);
|
||||
|
||||
/***** Compute lengths *****/
|
||||
Gbl.Boundary.LengthWithoutCRLF = strlen (Gbl.Boundary.StrWithoutCRLF);
|
||||
|
@ -794,15 +796,17 @@ void Par_GetMainParameters (void)
|
|||
Gbl.Prefs.Theme = The_THEME_DEFAULT;
|
||||
|
||||
/***** Set path of theme *****/
|
||||
sprintf (Path,"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,The_ThemeId[Gbl.Prefs.Theme]);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,The_ThemeId[Gbl.Prefs.Theme]);
|
||||
Str_Copy (Gbl.Prefs.PathTheme,Path,
|
||||
PATH_MAX);
|
||||
|
||||
/***** Set path of icon set *****/
|
||||
sprintf (Path,"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
Str_Copy (Gbl.Prefs.PathIconSet,Path,
|
||||
PATH_MAX);
|
||||
}
|
||||
|
|
|
@ -473,16 +473,17 @@ int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_
|
|||
fclose (Gbl.Msg.FileMail);
|
||||
|
||||
/***** Call the script to send an email *****/
|
||||
sprintf (Command,"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"[%s] %s\" \"%s\"",
|
||||
Cfg_COMMAND_SEND_AUTOMATIC_EMAIL,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_SERVER,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_PORT,
|
||||
Cfg_AUTOMATIC_EMAIL_FROM,
|
||||
Gbl.Config.SMTPPassword,
|
||||
Gbl.Usrs.Me.UsrDat.Email,
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
Txt_New_password_NO_HTML[Gbl.Usrs.Me.UsrDat.Prefs.Language],
|
||||
Gbl.Msg.FileNameMail);
|
||||
snprintf (Command,sizeof (Command),
|
||||
"%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"[%s] %s\" \"%s\"",
|
||||
Cfg_COMMAND_SEND_AUTOMATIC_EMAIL,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_SERVER,
|
||||
Cfg_AUTOMATIC_EMAIL_SMTP_PORT,
|
||||
Cfg_AUTOMATIC_EMAIL_FROM,
|
||||
Gbl.Config.SMTPPassword,
|
||||
Gbl.Usrs.Me.UsrDat.Email,
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
Txt_New_password_NO_HTML[Gbl.Usrs.Me.UsrDat.Prefs.Language],
|
||||
Gbl.Msg.FileNameMail);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running script to send email.");
|
||||
|
@ -690,7 +691,9 @@ void Pwd_ShowFormChgMyPwd (void)
|
|||
Act_StartFormAnchor (ActChgPwd,Pwd_PASSWORD_SECTION_ID);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBox (StrRecordWidth,Txt_Password,NULL,
|
||||
Hlp_PROFILE_Password,Box_NOT_CLOSABLE);
|
||||
|
||||
|
|
206
swad_photo.c
206
swad_photo.c
|
@ -609,24 +609,28 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
Act_Action_t NextAction;
|
||||
|
||||
/***** Creates directories if not exist *****/
|
||||
sprintf (PathPhotosPriv,"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO);
|
||||
snprintf (PathPhotosPriv,sizeof (PathPhotosPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO);
|
||||
Fil_CreateDirIfNotExists (PathPhotosPriv);
|
||||
sprintf (PathPhotosPriv,"%s/%s/%02u",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100));
|
||||
snprintf (PathPhotosPriv,sizeof (PathPhotosPriv),
|
||||
"%s/%s/%02u",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100));
|
||||
Fil_CreateDirIfNotExists (PathPhotosPriv);
|
||||
|
||||
/***** Create directories if not exists
|
||||
and remove old temporary files *****/
|
||||
/* Create public directory for photos */
|
||||
sprintf (PathPhotosPubl,"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO);
|
||||
snprintf (PathPhotosPubl,sizeof (PathPhotosPubl),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO);
|
||||
Fil_CreateDirIfNotExists (PathPhotosPubl);
|
||||
|
||||
/* Create temporary directory for photos */
|
||||
sprintf (PathPhotosPubl,"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP);
|
||||
snprintf (PathPhotosPubl,sizeof (PathPhotosPubl),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP);
|
||||
Fil_CreateDirIfNotExists (PathPhotosPubl);
|
||||
|
||||
/* Remove old temporary files */
|
||||
|
@ -653,9 +657,10 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
}
|
||||
|
||||
/* End the reception of photo in a temporary file */
|
||||
sprintf (FileNamePhotoTmp,"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Cfg_FOLDER_PHOTO_TMP,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNamePhotoTmp,sizeof (FileNamePhotoTmp),
|
||||
"%s/%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Cfg_FOLDER_PHOTO_TMP,Gbl.UniqueNameEncrypted);
|
||||
if (!Fil_EndReceptionOfFile (FileNamePhotoTmp,Param))
|
||||
{
|
||||
Ale_ShowAlert (Ale_WARNING,"Error copying file.");
|
||||
|
@ -664,13 +669,16 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
|
||||
/* Copy the original photo received to private directory.
|
||||
The purpose of this copy is only to have a backup used for researching better methods to detect faces in images */
|
||||
sprintf (PathRelPhoto,"%s/%s/%02u/%ld_original.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
snprintf (PathRelPhoto,sizeof (PathRelPhoto),
|
||||
"%s/%s/%02u/%ld_original.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
Fil_FastCopyOfFiles (FileNamePhotoTmp,PathRelPhoto);
|
||||
|
||||
/***** Call to program that makes photo processing / face detection *****/
|
||||
sprintf (Command,Cfg_COMMAND_FACE_DETECTION,FileNamePhotoTmp);
|
||||
snprintf (Command,sizeof (Command),
|
||||
Cfg_COMMAND_FACE_DETECTION,
|
||||
FileNamePhotoTmp);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running command to process photo and detect faces.");
|
||||
|
@ -681,9 +689,10 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
{
|
||||
case 0: // Faces detected
|
||||
/***** Open text file with text for image map *****/
|
||||
sprintf (FileNameTxtMap,"%s/%s/%s/%s_map.txt",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Cfg_FOLDER_PHOTO_TMP,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNameTxtMap,sizeof (FileNameTxtMap),
|
||||
"%s/%s/%s/%s_map.txt",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Cfg_FOLDER_PHOTO_TMP,Gbl.UniqueNameEncrypted);
|
||||
if ((FileTxtMap = fopen (FileNameTxtMap,"rb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not read text file with coordinates of detected faces.");
|
||||
|
||||
|
@ -805,7 +814,9 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
if (BackgroundCode == 1)
|
||||
{
|
||||
NumFace++;
|
||||
sprintf (FormId,"form_%d",NumLastForm + NumFace);
|
||||
snprintf (FormId,sizeof (FormId),
|
||||
"form_%d",
|
||||
NumLastForm + NumFace);
|
||||
fprintf (Gbl.F.Out,"<area shape=\"circle\""
|
||||
" href=\"javascript:document.getElementById('%s').submit();\""
|
||||
" coords=\"%u,%u,%u\">\n",
|
||||
|
@ -818,8 +829,10 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
|
|||
fprintf (Gbl.F.Out,"</map>\n");
|
||||
|
||||
/***** Show map photo *****/
|
||||
sprintf (FileNamePhotoMap,"%s/%s/%s/%s_map.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNamePhotoMap,sizeof (FileNamePhotoMap),
|
||||
"%s/%s/%s/%s_map.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,
|
||||
Gbl.UniqueNameEncrypted);
|
||||
fprintf (Gbl.F.Out,"<div class=\"TIT CENTER_MIDDLE\">"
|
||||
"<img src=\"%s/%s/%s/%s_map.jpg\""
|
||||
" usemap=\"#faces_map\""
|
||||
|
@ -893,14 +906,16 @@ static void Pho_UpdatePhoto1 (struct UsrData *UsrDat)
|
|||
Par_GetParToText ("FileName",Gbl.Usrs.FileNamePhoto,NAME_MAX); // Example of FileNamePhoto: "4924a838630e_016"
|
||||
|
||||
/***** Convert the temporary photo resulting of the processing to the current photo of the user *****/
|
||||
sprintf (PathPhotoTmp,"%s/%s/%s/%s_paso3.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,Gbl.Usrs.FileNamePhoto);
|
||||
snprintf (PathPhotoTmp,sizeof (PathPhotoTmp),
|
||||
"%s/%s/%s/%s_paso3.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,Gbl.Usrs.FileNamePhoto);
|
||||
if (Fil_CheckIfPathExists (PathPhotoTmp)) // The file with the selected photo exists
|
||||
{
|
||||
/* Copy the temporary file of the third (last) step resulting of the processing to the directory of private photos */
|
||||
sprintf (PathRelPhoto,"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
snprintf (PathRelPhoto,sizeof (PathRelPhoto),
|
||||
"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
Fil_FastCopyOfFiles (PathPhotoTmp,PathRelPhoto);
|
||||
|
||||
/* Update public photo name in database */
|
||||
|
@ -1026,7 +1041,7 @@ void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
|
|||
// Returns true if the photo can be shown and false if not.
|
||||
// Public photo means two different things depending on the user's type
|
||||
|
||||
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL)
|
||||
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1])
|
||||
{
|
||||
bool ICanSeePhoto;
|
||||
|
||||
|
@ -1044,7 +1059,7 @@ bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL)
|
|||
// Returns false if photo does not exist
|
||||
// Returns true if link is created successfully
|
||||
|
||||
bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL)
|
||||
bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1])
|
||||
{
|
||||
char PathPublPhoto[PATH_MAX + 1];
|
||||
char PathPrivPhoto[PATH_MAX + 1];
|
||||
|
@ -1052,13 +1067,15 @@ bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL)
|
|||
if (UsrDat->Photo[0])
|
||||
{
|
||||
/***** Make path to public photo *****/
|
||||
sprintf (PathPublPhoto,"%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
snprintf (PathPublPhoto,sizeof (PathPublPhoto),
|
||||
"%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
|
||||
/***** Make path to private photo from public directory *****/
|
||||
sprintf (PathPrivPhoto,"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
snprintf (PathPrivPhoto,sizeof (PathPrivPhoto),
|
||||
"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
|
||||
/***** Create a symbolic link to the private photo, if not exists *****/
|
||||
if (!Fil_CheckIfPathExists (PathPublPhoto))
|
||||
|
@ -1067,8 +1084,9 @@ bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL)
|
|||
" to access to user's private photo");
|
||||
|
||||
/***** Create the public URL of the photo *****/
|
||||
sprintf (PhotoURL,"%s/%s/%s.jpg",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
snprintf (PhotoURL,PATH_MAX + 1,
|
||||
"%s/%s/%s.jpg",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1085,12 +1103,13 @@ bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL)
|
|||
// Returns false if photo does not exist
|
||||
// Returns true if photo exists
|
||||
|
||||
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char *PathPrivRelPhoto)
|
||||
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char PathPrivRelPhoto[PATH_MAX + 1])
|
||||
{
|
||||
/***** Make path to private photo *****/
|
||||
sprintf (PathPrivRelPhoto,"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrCod % 100),UsrCod);
|
||||
snprintf (PathPrivRelPhoto,PATH_MAX + 1,
|
||||
"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrCod % 100),UsrCod);
|
||||
|
||||
return Fil_CheckIfPathExists (PathPrivRelPhoto);
|
||||
}
|
||||
|
@ -1113,16 +1132,18 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
|
|||
Pho_ClearPhotoName (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove public link *****/
|
||||
sprintf (PathPublPhoto,"%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
snprintf (PathPublPhoto,sizeof (PathPublPhoto),
|
||||
"%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
if (Fil_CheckIfPathExists (PathPublPhoto)) // Public link exists
|
||||
if (unlink (PathPublPhoto)) // Remove public link
|
||||
NumErrors++;
|
||||
|
||||
/***** Remove photo *****/
|
||||
sprintf (PathPrivRelPhoto,"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
snprintf (PathPrivRelPhoto,sizeof (PathPrivRelPhoto),
|
||||
"%s/%s/%02u/%ld.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
if (Fil_CheckIfPathExists (PathPrivRelPhoto)) // Photo exists
|
||||
{
|
||||
if (unlink (PathPrivRelPhoto)) // Remove photo
|
||||
|
@ -1130,9 +1151,10 @@ bool Pho_RemovePhoto (struct UsrData *UsrDat)
|
|||
}
|
||||
|
||||
/***** Remove original photo *****/
|
||||
sprintf (PathPrivRelPhoto,"%s/%s/%02u/%ld_original.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
snprintf (PathPrivRelPhoto,sizeof (PathPrivRelPhoto),
|
||||
"%s/%s/%02u/%ld_original.jpg",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
if (Fil_CheckIfPathExists (PathPrivRelPhoto)) // Original photo exists
|
||||
if (unlink (PathPrivRelPhoto)) // Remove original photo
|
||||
NumErrors++;
|
||||
|
@ -1188,8 +1210,9 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
|||
DB_QueryUPDATE (Query,"can not update the name of a user's photo");
|
||||
|
||||
/***** Remove the old symbolic link to photo *****/
|
||||
sprintf (PathPublPhoto,"%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
snprintf (PathPublPhoto,sizeof (PathPublPhoto),
|
||||
"%s/%s/%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,UsrDat->Photo);
|
||||
unlink (PathPublPhoto); // Remove public link
|
||||
|
||||
/***** Update photo name in user's data *****/
|
||||
|
@ -1211,7 +1234,7 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
|||
BrowserTabIs1stTab; // Only in main browser tab
|
||||
bool PutZoomCode = (Zoom == Pho_ZOOM) && // Make zoom
|
||||
BrowserTabIs1stTab; // Only in main browser tab
|
||||
char IdCaption[Act_MAX_BYTES_ID];
|
||||
char IdCaption[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Start form to go to public profile *****/
|
||||
if (PutLinkToPublicProfile)
|
||||
|
@ -1341,21 +1364,25 @@ void Pho_CalcPhotoDegree (void)
|
|||
Gbl.Stat.DegPhotos.TypeOfAverage = Pho_GetPhotoAvgTypeFromForm ();
|
||||
|
||||
/***** Create public directories for average photos if not exist *****/
|
||||
sprintf (PathPhotosPublic,"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO);
|
||||
snprintf (PathPhotosPublic,sizeof (PathPhotosPublic),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO);
|
||||
Fil_CreateDirIfNotExists (PathPhotosPublic);
|
||||
for (TypeOfAverage = (Pho_AvgPhotoTypeOfAverage_t) 0;
|
||||
TypeOfAverage < Pho_NUM_AVERAGE_PHOTO_TYPES;
|
||||
TypeOfAverage++)
|
||||
{
|
||||
sprintf (DirAvgPhotosRelPath[TypeOfAverage],"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Pho_StrAvgPhotoDirs[TypeOfAverage]);
|
||||
snprintf (DirAvgPhotosRelPath[TypeOfAverage],
|
||||
sizeof (DirAvgPhotosRelPath[TypeOfAverage]),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,Pho_StrAvgPhotoDirs[TypeOfAverage]);
|
||||
Fil_CreateDirIfNotExists (DirAvgPhotosRelPath[TypeOfAverage]);
|
||||
}
|
||||
|
||||
/***** Creates private directory for lists of users' photos if not exists *****/
|
||||
sprintf (PathPhotosTmpPriv,"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP);
|
||||
snprintf (PathPhotosTmpPriv,sizeof (PathPhotosTmpPriv),
|
||||
"%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP);
|
||||
Fil_CreateDirIfNotExists (PathPhotosTmpPriv);
|
||||
|
||||
/***** Remove old private files used for lists *****/
|
||||
|
@ -1602,16 +1629,18 @@ static void Pho_ComputeAveragePhoto (long DegCod,Usr_Sex_t Sex,Rol_Role_t Role,
|
|||
*NumStds = *NumStdsWithPhoto = 0;
|
||||
|
||||
/***** Build name for file with average photo *****/
|
||||
sprintf (PathRelAvgPhoto,"%s/%ld_%s.jpg",
|
||||
DirAvgPhotosRelPath,DegCod,Usr_StringsSexDB[Sex]);
|
||||
snprintf (PathRelAvgPhoto,sizeof (PathRelAvgPhoto),
|
||||
"%s/%ld_%s.jpg",
|
||||
DirAvgPhotosRelPath,DegCod,Usr_StringsSexDB[Sex]);
|
||||
|
||||
/***** Remove old file if exists *****/
|
||||
if (Fil_CheckIfPathExists (PathRelAvgPhoto)) // If file exists
|
||||
unlink (PathRelAvgPhoto);
|
||||
|
||||
/***** Build names for text file with photo paths *****/
|
||||
sprintf (FileNamePhotoNames,"%s/%s/%s/%ld.txt",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,DegCod);
|
||||
snprintf (FileNamePhotoNames,sizeof (FileNamePhotoNames),
|
||||
"%s/%s/%s/%ld.txt",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_PHOTO,Cfg_FOLDER_PHOTO_TMP,DegCod);
|
||||
if ((FilePhotoNames = fopen (FileNamePhotoNames,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not open file to compute average photo.");
|
||||
|
||||
|
@ -1639,9 +1668,10 @@ static void Pho_ComputeAveragePhoto (long DegCod,Usr_Sex_t Sex,Rol_Role_t Role,
|
|||
/***** Call to program to calculate average photo *****/
|
||||
if (*NumStdsWithPhoto)
|
||||
{
|
||||
sprintf (StrCallToProgram,"%s %s %s",
|
||||
Pho_StrAvgPhotoPrograms[TypeOfAverage],
|
||||
FileNamePhotoNames,PathRelAvgPhoto);
|
||||
snprintf (StrCallToProgram,sizeof (StrCallToProgram),
|
||||
"%s %s %s",
|
||||
Pho_StrAvgPhotoPrograms[TypeOfAverage],
|
||||
FileNamePhotoNames,PathRelAvgPhoto);
|
||||
ReturnCode = system (StrCallToProgram);
|
||||
if (ReturnCode == -1)
|
||||
Lay_ShowErrorAndExit ("Error when running program that computes the average photo.");
|
||||
|
@ -1969,8 +1999,6 @@ static void Pho_PutLinkToPrintViewOfDegreeStatsParams (void)
|
|||
/*************** Put a link to calculate the stats of degrees ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Pho_MAX_BYTES_ESTIMATED_TIME (128 - 1)
|
||||
|
||||
static void Pho_PutLinkToCalculateDegreeStats (void)
|
||||
{
|
||||
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
||||
|
@ -1982,7 +2010,7 @@ static void Pho_PutLinkToCalculateDegreeStats (void)
|
|||
unsigned NumDeg;
|
||||
struct Degree Deg;
|
||||
long EstimatedTimeToComputeAvgPhotoInMicroseconds;
|
||||
char StrEstimatedTimeToComputeAvgPhoto[Pho_MAX_BYTES_ESTIMATED_TIME + 1];
|
||||
char StrEstimatedTimeToComputeAvgPhoto[Dat_MAX_BYTES_TIME + 1];
|
||||
|
||||
if ((Deg.DegCod = Pho_GetDegWithAvgPhotoLeastRecentlyUpdated ()) > 0)
|
||||
{
|
||||
|
@ -2017,7 +2045,7 @@ static void Pho_PutLinkToCalculateDegreeStats (void)
|
|||
EstimatedTimeToComputeAvgPhotoInMicroseconds = Pho_GetTimeToComputeAvgPhoto (Degs.Lst[NumDeg].DegCod);
|
||||
if (EstimatedTimeToComputeAvgPhotoInMicroseconds == -1L)
|
||||
Str_Copy (StrEstimatedTimeToComputeAvgPhoto,Txt_unknown_TIME,
|
||||
Pho_MAX_BYTES_ESTIMATED_TIME);
|
||||
Dat_MAX_BYTES_TIME);
|
||||
else
|
||||
Sta_WriteTime (StrEstimatedTimeToComputeAvgPhoto,
|
||||
EstimatedTimeToComputeAvgPhotoInMicroseconds);
|
||||
|
@ -2412,7 +2440,7 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
|
|||
char PhotoURL[PATH_MAX + 1];
|
||||
char PhotoCaption[1024 + Hie_MAX_BYTES_SHRT_NAME];
|
||||
bool ShowDegPhoto;
|
||||
char IdCaption[Act_MAX_BYTES_ID];
|
||||
char IdCaption[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Initializations *****/
|
||||
PhotoURL[0] = '\0';
|
||||
|
@ -2427,7 +2455,9 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
|
|||
{
|
||||
Act_StartFormGoTo (ActSeeDegInf);
|
||||
Deg_PutParamDegCod (Deg->DegCod);
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,Deg->FullName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Deg->FullName);
|
||||
Act_LinkFormSubmit (Gbl.Title,NULL,NULL);
|
||||
}
|
||||
|
||||
|
@ -2440,28 +2470,30 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
|
|||
|
||||
if (ShowDegPhoto)
|
||||
{
|
||||
sprintf (PathRelAvgPhoto,"%s/%s/%s/%ld_%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
|
||||
Deg->DegCod,Usr_StringsSexDB[Sex]);
|
||||
snprintf (PathRelAvgPhoto,sizeof (PathRelAvgPhoto),
|
||||
"%s/%s/%s/%ld_%s.jpg",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
|
||||
Deg->DegCod,Usr_StringsSexDB[Sex]);
|
||||
if (Fil_CheckIfPathExists (PathRelAvgPhoto))
|
||||
{
|
||||
sprintf (PhotoURL,"%s/%s/%s/%ld_%s.jpg",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
|
||||
Deg->DegCod,Usr_StringsSexDB[Sex]);
|
||||
if (SeeOrPrint == Pho_DEGREES_SEE)
|
||||
snprintf (PhotoURL,sizeof (PhotoURL),
|
||||
"%s/%s/%s/%ld_%s.jpg",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
|
||||
Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
|
||||
Deg->DegCod,Usr_StringsSexDB[Sex]);
|
||||
if (SeeOrPrint == Pho_DEGREES_SEE)
|
||||
{
|
||||
/***** Hidden div to pass user's name to Javascript *****/
|
||||
sprintf (PhotoCaption,"%s<br />"
|
||||
"%d %s (%s)<br />"
|
||||
"%d %s (%d%%)",
|
||||
Deg->ShrtName,
|
||||
NumStds,Txt_students_ABBREVIATION,Txt_SEX_PLURAL_abc[Sex],
|
||||
NumStdsWithPhoto,Txt_photos,
|
||||
NumStds > 0 ? (int) (((NumStdsWithPhoto * 100.0) / NumStds) + 0.5) :
|
||||
0);
|
||||
snprintf (PhotoCaption,sizeof (PhotoCaption),
|
||||
"%s<br />"
|
||||
"%d %s (%s)<br />"
|
||||
"%d %s (%d%%)",
|
||||
Deg->ShrtName,
|
||||
NumStds,Txt_students_ABBREVIATION,Txt_SEX_PLURAL_abc[Sex],
|
||||
NumStdsWithPhoto,Txt_photos,
|
||||
NumStds > 0 ? (int) (((NumStdsWithPhoto * 100.0) / NumStds) + 0.5) :
|
||||
0);
|
||||
Act_SetUniqueId (IdCaption);
|
||||
fprintf (Gbl.F.Out,"<div id=\"%s\" class=\"NOT_SHOWN\">"
|
||||
"<div class=\"ZOOM_TXT_LINE DAT_N\">"
|
||||
|
|
|
@ -104,9 +104,9 @@ void Pho_UpdateUsrPhoto2 (void);
|
|||
unsigned Pho_UpdateMyClicksWithoutPhoto (void);
|
||||
void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod);
|
||||
|
||||
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL);
|
||||
bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL);
|
||||
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char *PathPrivRelPhoto);
|
||||
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1]);
|
||||
bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1]);
|
||||
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char PathPrivRelPhoto[PATH_MAX + 1]);
|
||||
bool Pho_RemovePhoto (struct UsrData *UsrDat);
|
||||
void Pho_UpdatePhotoName (struct UsrData *UsrDat);
|
||||
void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
||||
|
|
|
@ -114,7 +114,9 @@ void Plg_ListPlugins (void)
|
|||
{
|
||||
Plg = &(Gbl.Plugins.Lst[NumPlg]);
|
||||
|
||||
sprintf (URL,"%s%s",Plg->URL,Gbl.Session.Id);
|
||||
snprintf (URL,sizeof (URL),
|
||||
"%s%s",
|
||||
Plg->URL,Gbl.Session.Id);
|
||||
|
||||
/* Plugin logo */
|
||||
// TODO: Change plugin icons to 32x32
|
||||
|
|
|
@ -110,15 +110,17 @@ void Prf_SeeSocialProfiles (void)
|
|||
/************************** Get public profile URL ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba)
|
||||
char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1],
|
||||
const char *NicknameWithoutArroba)
|
||||
{
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
|
||||
/***** Build URL using nickname *****/
|
||||
sprintf (URL,"%s/%s?usr=@%s",
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
NicknameWithoutArroba);
|
||||
snprintf (URL,Cns_MAX_BYTES_WWW + 1,
|
||||
"%s/%s?usr=@%s",
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
NicknameWithoutArroba);
|
||||
|
||||
return URL;
|
||||
}
|
||||
|
@ -379,7 +381,7 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
|
|||
unsigned NumCrssUsrIsStudent;
|
||||
unsigned NumFiles;
|
||||
unsigned NumPublicFiles;
|
||||
char IdFirstClickTime[Act_MAX_BYTES_ID];
|
||||
char IdFirstClickTime[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Start left list *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"PRF_FIG_LEFT_CONTAINER\">"
|
||||
|
@ -754,8 +756,9 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs)
|
|||
extern const char *Txt_of_PART_OF_A_TOTAL;
|
||||
|
||||
/***** Part of a total and end container *****/
|
||||
sprintf (Gbl.Title,"#%lu %s %lu",
|
||||
Rank,Txt_of_PART_OF_A_TOTAL,NumUsrs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"#%lu %s %lu",
|
||||
Rank,Txt_of_PART_OF_A_TOTAL,NumUsrs);
|
||||
|
||||
/***** Rank in form to go to ranking *****/
|
||||
Act_StartForm (ActSeeUseGbl);
|
||||
|
|
|
@ -51,7 +51,8 @@ struct UsrFigures
|
|||
|
||||
void Prf_SeeSocialProfiles (void);
|
||||
|
||||
char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba);
|
||||
char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1],
|
||||
const char *NicknameWithoutArroba);
|
||||
void Prf_PutLinkMyPublicProfile (void);
|
||||
void Prf_PutLinkRequestAnotherUserProfile (void);
|
||||
void Prf_RequestUserProfile (void);
|
||||
|
|
|
@ -1708,7 +1708,9 @@ static void Prj_ShowOneProjectMembersWithARole (const struct Project *Prj,
|
|||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"CENTER_TOP\" style=\"width:30px;\">");
|
||||
Gbl.Prjs.PrjCod = Prj->PrjCod; // Used to pass project code as a parameter
|
||||
sprintf (Gbl.Title,Txt_Add_USER,Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Add_USER,
|
||||
Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject]);
|
||||
Lay_PutContextualLink (ActionReqAddUsr[RoleInProject],NULL,Prj_PutCurrentParams,
|
||||
"plus64x64.png",
|
||||
Gbl.Title,NULL,
|
||||
|
@ -1905,7 +1907,9 @@ static void Prj_ReqAnotherUsrID (Prj_RoleInProject_t RoleInProject)
|
|||
Lay_ShowErrorAndExit ("Code of project is missing.");
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (Gbl.Title,Txt_Add_USER,Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Add_USER,
|
||||
Txt_PROJECT_ROLES_SINGUL_abc[RoleInProject]);
|
||||
Box_StartBox (NULL,Gbl.Title,NULL,
|
||||
Hlp_ASSESSMENT_Projects_add_user,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -2794,9 +2798,10 @@ void Prj_RemoveProject (void)
|
|||
Brw_RemovePrjFilesFromDB (Prj.PrjCod);
|
||||
|
||||
/***** Remove directory of the project *****/
|
||||
sprintf (PathRelPrj,"%s/%s/%ld/%s/%02u/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Prj.CrsCod,Cfg_FOLDER_PRJ,
|
||||
(unsigned) (Prj.PrjCod % 100),Prj.PrjCod);
|
||||
snprintf (PathRelPrj,sizeof (PathRelPrj),
|
||||
"%s/%s/%ld/%s/%02u/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Prj.CrsCod,Cfg_FOLDER_PRJ,
|
||||
(unsigned) (Prj.PrjCod % 100),Prj.PrjCod);
|
||||
Fil_RemoveTree (PathRelPrj);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
|
|
@ -666,8 +666,9 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
|
|||
Ale_MAX_BYTES_ALERT);
|
||||
else
|
||||
{
|
||||
sprintf (Message_part2,Txt_this_field_is_filled_in_the_records_of_X_students,
|
||||
NumRecords);
|
||||
snprintf (Message_part2,sizeof (Message_part2),
|
||||
Txt_this_field_is_filled_in_the_records_of_X_students,
|
||||
NumRecords);
|
||||
Str_Concat (Gbl.Alert.Txt,Message_part2,
|
||||
Ale_MAX_BYTES_ALERT);
|
||||
}
|
||||
|
@ -1071,7 +1072,9 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
|
|||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
{
|
||||
/* Start container for this user */
|
||||
sprintf (RecordSectionId,"record_%u",NumUsr);
|
||||
snprintf (RecordSectionId,sizeof (RecordSectionId),
|
||||
"record_%u",
|
||||
NumUsr);
|
||||
Lay_StartSection (RecordSectionId);
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_USR\"");
|
||||
if (Gbl.Action.Act == ActPrnRecSevGst &&
|
||||
|
@ -1276,7 +1279,9 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|||
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
||||
|
||||
/* Start container for this user */
|
||||
sprintf (RecordSectionId,"record_%u",NumUsr);
|
||||
snprintf (RecordSectionId,sizeof (RecordSectionId),
|
||||
"record_%u",
|
||||
NumUsr);
|
||||
Lay_StartSection (RecordSectionId);
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_USR\"");
|
||||
if (Gbl.Action.Act == ActPrnRecSevStd &&
|
||||
|
@ -1355,7 +1360,9 @@ static void Rec_ShowRecordOneTchCrs (void)
|
|||
bool ShowOfficeHours;
|
||||
|
||||
/***** Width for office hours *****/
|
||||
sprintf (Width,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (Width,sizeof (Width),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
|
||||
/***** Get if teacher has accepted enrolment in current course *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -1434,7 +1441,9 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
|
|||
char Width[10 + 2 + 1];
|
||||
|
||||
/***** Width for office hours *****/
|
||||
sprintf (Width,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (Width,sizeof (Width),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
|
||||
/***** Assign users listing type depending on current action *****/
|
||||
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_TEACHERS;
|
||||
|
@ -1496,7 +1505,9 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
|
|||
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
||||
|
||||
/* Start container for this user */
|
||||
sprintf (RecordSectionId,"record_%u",NumUsr);
|
||||
snprintf (RecordSectionId,sizeof (RecordSectionId),
|
||||
"record_%u",
|
||||
NumUsr);
|
||||
Lay_StartSection (RecordSectionId);
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_USR\"");
|
||||
if (Gbl.Action.Act == ActPrnRecSevTch &&
|
||||
|
@ -1806,7 +1817,9 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
}
|
||||
|
||||
/***** Start box and table *****/
|
||||
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
||||
snprintf (StrRecordWidth,sizeof (StrRecordWidth),
|
||||
"%upx",
|
||||
Rec_RECORD_WIDTH);
|
||||
Box_StartBoxTable (StrRecordWidth,NULL,NULL,
|
||||
Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2);
|
||||
|
||||
|
@ -1960,7 +1973,9 @@ void Rec_GetFieldsCrsRecordFromForm (void)
|
|||
if (Rec_CheckIfICanEditField (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Visibility))
|
||||
{
|
||||
/* Get text of the form */
|
||||
sprintf (FieldParamName,"Field%ld",Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
snprintf (FieldParamName,sizeof (FieldParamName),
|
||||
"Field%ld",
|
||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod);
|
||||
Par_GetParToHTML (FieldParamName,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text,Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,7 +155,9 @@ void Rep_ReqMyUsageReport (void)
|
|||
Act_StartForm (ActSeeMyUsgRep);
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Report_of_use_of_PLATFORM,
|
||||
Cfg_PLATFORM_SHORT_NAME);
|
||||
Box_StartBox (NULL,Gbl.Title,NULL,
|
||||
Hlp_ANALYTICS_Report,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -260,7 +262,9 @@ static void Rep_PutLinkToMyUsageReport (struct Rep_Report *Report)
|
|||
extern const char *Txt_This_link_will_remain_active_as_long_as_your_user_s_account_exists;
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Report_of_use_of_PLATFORM,
|
||||
Cfg_PLATFORM_SHORT_NAME);
|
||||
Box_StartBox (NULL,Gbl.Title,NULL,
|
||||
Hlp_ANALYTICS_Report,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -333,14 +337,18 @@ static void Rep_GetCurrentDateTimeUTC (struct Rep_Report *Report)
|
|||
if ((gmtime_r (&CurrentTime,&Report->tm_CurrentTime)) != NULL)
|
||||
{
|
||||
/* Date and time as strings */
|
||||
sprintf (Report->CurrentTimeUTC.StrDate,"%04d-%02d-%02d",
|
||||
1900 + Report->tm_CurrentTime.tm_year, // year
|
||||
1 + Report->tm_CurrentTime.tm_mon, // month
|
||||
Report->tm_CurrentTime.tm_mday); // day of the month
|
||||
sprintf (Report->CurrentTimeUTC.StrTime,"%02d:%02d:%02d",
|
||||
Report->tm_CurrentTime.tm_hour, // hours
|
||||
Report->tm_CurrentTime.tm_min, // minutes
|
||||
Report->tm_CurrentTime.tm_sec); // seconds
|
||||
snprintf (Report->CurrentTimeUTC.StrDate,
|
||||
sizeof (Report->CurrentTimeUTC.StrDate),
|
||||
"%04d-%02d-%02d",
|
||||
1900 + Report->tm_CurrentTime.tm_year, // year
|
||||
1 + Report->tm_CurrentTime.tm_mon, // month
|
||||
Report->tm_CurrentTime.tm_mday); // day of the month
|
||||
snprintf (Report->CurrentTimeUTC.StrTime,
|
||||
sizeof (Report->CurrentTimeUTC.StrTime),
|
||||
"%02d:%02d:%02d",
|
||||
Report->tm_CurrentTime.tm_hour, // hours
|
||||
Report->tm_CurrentTime.tm_min, // minutes
|
||||
Report->tm_CurrentTime.tm_sec); // seconds
|
||||
|
||||
/* Date and time as unsigned */
|
||||
Report->CurrentTimeUTC.Date = (1900 + Report->tm_CurrentTime.tm_year) * 10000 +
|
||||
|
@ -362,43 +370,54 @@ static void Rep_CreateNewReportFile (struct Rep_Report *Report)
|
|||
char PathUniqueDirL[PATH_MAX + 1];
|
||||
char PathUniqueDirR[PATH_MAX + 1];
|
||||
char PathFileReport[PATH_MAX + 1];
|
||||
char Permalink[128 +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
NAME_MAX];
|
||||
|
||||
/***** Path for reports *****/
|
||||
sprintf (PathReports,"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP);
|
||||
snprintf (PathReports,sizeof (PathReports),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP);
|
||||
Fil_CreateDirIfNotExists (PathReports);
|
||||
|
||||
/***** Unique directory for the file with the report *****/
|
||||
/* 1. Create a directory using the leftmost 2 chars of a unique name */
|
||||
sprintf (PathUniqueDirL,"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP,
|
||||
Gbl.UniqueNameEncrypted[0],
|
||||
Gbl.UniqueNameEncrypted[1]);
|
||||
snprintf (PathUniqueDirL,sizeof (PathUniqueDirL),
|
||||
"%s/%s/%c%c",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP,
|
||||
Gbl.UniqueNameEncrypted[0],
|
||||
Gbl.UniqueNameEncrypted[1]);
|
||||
Fil_CreateDirIfNotExists (PathUniqueDirL);
|
||||
|
||||
/* 2. Create a directory using the rightmost 41 chars of a unique name */
|
||||
sprintf (PathUniqueDirR,"%s/%s",
|
||||
PathUniqueDirL,
|
||||
&Gbl.UniqueNameEncrypted[2]);
|
||||
snprintf (PathUniqueDirR,sizeof (PathUniqueDirR),
|
||||
"%s/%s",
|
||||
PathUniqueDirL,
|
||||
&Gbl.UniqueNameEncrypted[2]);
|
||||
if (mkdir (PathUniqueDirR,(mode_t) 0xFFF))
|
||||
Lay_ShowErrorAndExit ("Can not create directory for report.");
|
||||
|
||||
/***** Path of the public file with the report */
|
||||
sprintf (Report->FilenameReport,"%s_%06u_%06u.html",
|
||||
Rep_FILENAME_ROOT,Report->CurrentTimeUTC.Date,Report->CurrentTimeUTC.Time);
|
||||
sprintf (PathFileReport,"%s/%s",
|
||||
PathUniqueDirR,Report->FilenameReport);
|
||||
snprintf (Report->FilenameReport,sizeof (Report->FilenameReport),
|
||||
"%s_%06u_%06u.html",
|
||||
Rep_FILENAME_ROOT,Report->CurrentTimeUTC.Date,Report->CurrentTimeUTC.Time);
|
||||
snprintf (PathFileReport,sizeof (PathFileReport),
|
||||
"%s/%s",
|
||||
PathUniqueDirR,Report->FilenameReport);
|
||||
if ((Gbl.F.Rep = fopen (PathFileReport,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not create report file.");
|
||||
|
||||
/***** Permalink *****/
|
||||
sprintf (Report->Permalink,"%s/%s/%c%c/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,
|
||||
Cfg_FOLDER_REP,
|
||||
Gbl.UniqueNameEncrypted[0],
|
||||
Gbl.UniqueNameEncrypted[1],
|
||||
&Gbl.UniqueNameEncrypted[2],
|
||||
Report->FilenameReport);
|
||||
snprintf (Permalink,sizeof (Permalink),
|
||||
"%s/%s/%c%c/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,
|
||||
Cfg_FOLDER_REP,
|
||||
Gbl.UniqueNameEncrypted[0],
|
||||
Gbl.UniqueNameEncrypted[1],
|
||||
&Gbl.UniqueNameEncrypted[2],
|
||||
Report->FilenameReport);
|
||||
Str_Copy (Report->Permalink,Permalink,
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -447,7 +466,9 @@ static void Rep_WriteHeader (const struct Rep_Report *Report)
|
|||
fprintf (Gbl.F.Rep,"<header>");
|
||||
|
||||
/***** Main title *****/
|
||||
sprintf (Gbl.Title,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Report_of_use_of_PLATFORM,
|
||||
Cfg_PLATFORM_SHORT_NAME);
|
||||
fprintf (Gbl.F.Rep,"<h1>%s</h1>"
|
||||
"<ul>",
|
||||
Gbl.Title);
|
||||
|
@ -984,7 +1005,9 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
|
|||
long CrsCod;
|
||||
|
||||
NumCrss = Usr_GetNumCrssOfUsrWithARole (Gbl.Usrs.Me.UsrDat.UsrCod,Role);
|
||||
sprintf (Gbl.Title,Txt_USER_in_COURSE,Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_USER_in_COURSE,
|
||||
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
fprintf (Gbl.F.Rep,"<li>%s %u %s",
|
||||
Gbl.Title,
|
||||
NumCrss,
|
||||
|
@ -1097,8 +1120,9 @@ static void Rep_GetAndWriteMyHistoricCrss (Rol_Role_t Role,
|
|||
if ((NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses of a user")))
|
||||
{
|
||||
/* Heading row */
|
||||
sprintf (Gbl.Title,Txt_Hits_as_a_USER,
|
||||
Txt_ROLES_SINGUL_abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Hits_as_a_USER,
|
||||
Txt_ROLES_SINGUL_abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
|
||||
fprintf (Gbl.F.Rep,"<li>%s:"
|
||||
"<ol>",
|
||||
Gbl.Title);
|
||||
|
@ -1397,8 +1421,9 @@ static void Rep_RemoveUsrReportsFiles (long UsrCod)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Remove report directory and file */
|
||||
sprintf (PathUniqueDirReport,"%s/%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP,row[0],row[1]);
|
||||
snprintf (PathUniqueDirReport,sizeof (PathUniqueDirReport),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_REP,row[0],row[1]);
|
||||
Fil_RemoveTree (PathUniqueDirReport);
|
||||
}
|
||||
|
||||
|
|
|
@ -627,7 +627,9 @@ static unsigned Sch_SearchCountriesInDB (const char *RangeQuery)
|
|||
if (Sch_CheckIfIHavePermissionToSearch (Sch_SEARCH_COUNTRIES))
|
||||
{
|
||||
/***** Split countries string into words *****/
|
||||
sprintf (FieldName,"Name_%s",Txt_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
snprintf (FieldName,sizeof (FieldName),
|
||||
"Name_%s",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
if (Sch_BuildSearchQuery (SearchQuery,FieldName,NULL,NULL))
|
||||
{
|
||||
/***** Query database and list institutions found *****/
|
||||
|
|
|
@ -183,10 +183,10 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
|
||||
static long Soc_ReceiveSocialPost (void);
|
||||
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_BYTES_ID]);
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_BYTES_ID + 1]);
|
||||
static void Soc_PutIconCommentDisabled (void);
|
||||
static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
|
||||
const char IdNewComment[Act_MAX_BYTES_ID]);
|
||||
const char IdNewComment[Act_MAX_BYTES_ID + 1]);
|
||||
static unsigned long Soc_GetNumCommentsInSocialNote (long NotCod);
|
||||
static void Soc_WriteCommentsInSocialNote (const struct SocialNote *SocNot);
|
||||
static void Soc_WriteSocialComment (struct SocialComment *SocCom,
|
||||
|
@ -396,7 +396,9 @@ static void Soc_ShowTimelineUsrHighlightingNot (long NotCod)
|
|||
Query);
|
||||
|
||||
/***** Show timeline *****/
|
||||
sprintf (Gbl.Title,Txt_Timeline_OF_A_USER,Gbl.Usrs.Other.UsrDat.FirstName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Timeline_OF_A_USER,
|
||||
Gbl.Usrs.Other.UsrDat.FirstName);
|
||||
Soc_ShowTimeline (Query,Gbl.Title,NotCod);
|
||||
|
||||
/***** Drop temporary tables *****/
|
||||
|
@ -1271,7 +1273,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
|||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
|
||||
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
|
||||
unsigned NumComments;
|
||||
char IdNewComment[Act_MAX_BYTES_ID];
|
||||
char IdNewComment[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Start box ****/
|
||||
if (ShowNoteAlone)
|
||||
|
@ -1615,7 +1617,7 @@ static void Soc_WriteAuthorNote (const struct UsrData *UsrDat)
|
|||
static void Soc_WriteDateTime (time_t TimeUTC)
|
||||
{
|
||||
extern const char *Txt_Today;
|
||||
char IdDateTime[Act_MAX_BYTES_ID];
|
||||
char IdDateTime[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Create unique Id *****/
|
||||
Act_SetUniqueId (IdDateTime);
|
||||
|
@ -1854,7 +1856,9 @@ static void Soc_PutFormGoToAction (const struct SocialNote *SocNot)
|
|||
}
|
||||
|
||||
/***** Link and end form *****/
|
||||
sprintf (Class,"%s ICO_HIGHLIGHT",The_ClassFormBold[Gbl.Prefs.Theme]);
|
||||
snprintf (Class,sizeof (Class),
|
||||
"%s ICO_HIGHLIGHT",
|
||||
The_ClassFormBold[Gbl.Prefs.Theme]);
|
||||
Act_LinkFormSubmitUnique (Txt_SOCIAL_NOTE[SocNot->NoteType],Class);
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s/%s\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
|
@ -2196,7 +2200,7 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
const char *ClassTextArea,const char *ClassImgTit)
|
||||
{
|
||||
extern const char *Txt_Post;
|
||||
char IdDivImgButton[Act_MAX_BYTES_ID];
|
||||
char IdDivImgButton[Act_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Set unique id for the hidden div *****/
|
||||
Act_SetUniqueId (IdDivImgButton);
|
||||
|
@ -2345,7 +2349,7 @@ static long Soc_ReceiveSocialPost (void)
|
|||
/****** Put an icon to toggle on/off the form to comment a social note *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_BYTES_ID])
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_BYTES_ID + 1])
|
||||
{
|
||||
extern const char *Txt_Comment;
|
||||
|
||||
|
@ -2387,7 +2391,7 @@ static void Soc_PutIconCommentDisabled (void)
|
|||
// All forms in this function and nested functions must have unique identifiers
|
||||
|
||||
static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
|
||||
const char IdNewComment[Act_MAX_BYTES_ID])
|
||||
const char IdNewComment[Act_MAX_BYTES_ID + 1])
|
||||
{
|
||||
extern const char *Txt_New_SOCIAL_comment;
|
||||
bool ShowPhoto = false;
|
||||
|
@ -2713,7 +2717,9 @@ static void Soc_PutDisabledIconShare (unsigned NumShared)
|
|||
extern const char *Txt_SOCIAL_NOTE_Not_shared_by_anyone;
|
||||
|
||||
if (NumShared)
|
||||
sprintf (Gbl.Title,Txt_SOCIAL_NOTE_Shared_by_X_USERS,NumShared);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_SOCIAL_NOTE_Shared_by_X_USERS,
|
||||
NumShared);
|
||||
else
|
||||
Str_Copy (Gbl.Title,Txt_SOCIAL_NOTE_Not_shared_by_anyone,
|
||||
Lay_MAX_BYTES_TITLE);
|
||||
|
@ -2738,7 +2744,9 @@ static void Soc_PutDisabledIconFav (unsigned NumFavs)
|
|||
extern const char *Txt_SOCIAL_NOTE_Not_favourited_by_anyone;
|
||||
|
||||
if (NumFavs)
|
||||
sprintf (Gbl.Title,Txt_SOCIAL_NOTE_Favourited_by_X_USERS,NumFavs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_SOCIAL_NOTE_Favourited_by_X_USERS,
|
||||
NumFavs);
|
||||
else
|
||||
Str_Copy (Gbl.Title,Txt_SOCIAL_NOTE_Not_favourited_by_anyone,
|
||||
Lay_MAX_BYTES_TITLE);
|
||||
|
|
|
@ -484,8 +484,9 @@ void Sta_AskShowCrsHits (void)
|
|||
Gbl.Usrs.LstUsrs[Rol_TCH].NumUsrs;
|
||||
|
||||
/***** Start box *****/
|
||||
sprintf (Gbl.Title,Txt_Statistics_of_visits_to_the_course_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Statistics_of_visits_to_the_course_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
Box_StartBox (NULL,Gbl.Title,NULL,
|
||||
Hlp_ANALYTICS_Visits_visits_to_course,Box_NOT_CLOSABLE);
|
||||
|
||||
|
@ -1694,8 +1695,9 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
|
|||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\" style=\"width:20%%;\">");
|
||||
if (FirstRow > 1)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Show_previous_X_clicks,
|
||||
Gbl.Stat.RowsPerPage);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Show_previous_X_clicks,
|
||||
Gbl.Stat.RowsPerPage);
|
||||
Act_LinkFormSubmit (Gbl.Title,"TIT_TBL",NULL);
|
||||
fprintf (Gbl.F.Out,"<strong><%s</strong></a>",
|
||||
Txt_PAGES_Previous);
|
||||
|
@ -1729,8 +1731,9 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
|
|||
fprintf (Gbl.F.Out,"<td class=\"RIGHT_MIDDLE\" style=\"width:20%%;\">");
|
||||
if (LastRow < NumRows)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Show_next_X_clicks,
|
||||
Gbl.Stat.RowsPerPage);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Show_next_X_clicks,
|
||||
Gbl.Stat.RowsPerPage);
|
||||
Act_LinkFormSubmit (Gbl.Title,"TIT_TBL",NULL);
|
||||
fprintf (Gbl.F.Out,"<strong>%s></strong>"
|
||||
"</a>",
|
||||
|
@ -3932,7 +3935,9 @@ static void Sta_ShowNumHitsPerCourse (unsigned long NumRows,
|
|||
{
|
||||
Act_StartFormGoTo (ActSeeCrsInf);
|
||||
Crs_PutParamCrsCod (Crs.CrsCod);
|
||||
sprintf (Gbl.Title,Txt_Go_to_X,Crs.FullName);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Go_to_X,
|
||||
Crs.FullName);
|
||||
Act_LinkFormSubmit (Gbl.Title,"LOG",NULL);
|
||||
fprintf (Gbl.F.Out,"%s"
|
||||
"</a>",
|
||||
|
@ -5749,15 +5754,19 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf (StrNumCrss,"%d",SizeOfFileZones.NumCrss);
|
||||
sprintf (StrNumFoldersPerCrs,"%.1f",
|
||||
SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.NumFolders /
|
||||
(double) SizeOfFileZones.NumCrss :
|
||||
0.0);
|
||||
sprintf (StrNumFilesPerCrs,"%.1f",
|
||||
SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.NumFiles /
|
||||
(double) SizeOfFileZones.NumCrss :
|
||||
0.0);
|
||||
snprintf (StrNumCrss,sizeof (StrNumCrss),
|
||||
"%d",
|
||||
SizeOfFileZones.NumCrss);
|
||||
snprintf (StrNumFoldersPerCrs,sizeof (StrNumFoldersPerCrs),
|
||||
"%.1f",
|
||||
SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.NumFolders /
|
||||
(double) SizeOfFileZones.NumCrss :
|
||||
0.0);
|
||||
snprintf (StrNumFilesPerCrs,sizeof (StrNumFilesPerCrs),
|
||||
"%.1f",
|
||||
SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.NumFiles /
|
||||
(double) SizeOfFileZones.NumCrss :
|
||||
0.0);
|
||||
Fil_WriteFileSizeFull (SizeOfFileZones.NumCrss ? (double) SizeOfFileZones.Size /
|
||||
(double) SizeOfFileZones.NumCrss :
|
||||
0.0,
|
||||
|
@ -5768,7 +5777,9 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
|
|||
Str_Copy (StrNumGrps,"-",
|
||||
10);
|
||||
else
|
||||
sprintf (StrNumGrps,"%d",SizeOfFileZones.NumGrps);
|
||||
snprintf (StrNumGrps,sizeof (StrNumGrps),
|
||||
"%d",
|
||||
SizeOfFileZones.NumGrps);
|
||||
|
||||
if (SizeOfFileZones.NumUsrs == -1)
|
||||
{
|
||||
|
@ -5783,15 +5794,19 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf (StrNumUsrs,"%d",SizeOfFileZones.NumUsrs);
|
||||
sprintf (StrNumFoldersPerUsr,"%.1f",
|
||||
SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.NumFolders /
|
||||
(double) SizeOfFileZones.NumUsrs :
|
||||
0.0);
|
||||
sprintf (StrNumFilesPerUsr,"%.1f",
|
||||
SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.NumFiles /
|
||||
(double) SizeOfFileZones.NumUsrs :
|
||||
0.0);
|
||||
snprintf (StrNumUsrs,sizeof (StrNumUsrs),
|
||||
"%d",
|
||||
SizeOfFileZones.NumUsrs);
|
||||
snprintf (StrNumFoldersPerUsr,sizeof (StrNumFoldersPerUsr),
|
||||
"%.1f",
|
||||
SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.NumFolders /
|
||||
(double) SizeOfFileZones.NumUsrs :
|
||||
0.0);
|
||||
snprintf (StrNumFilesPerUsr,sizeof (StrNumFilesPerUsr),
|
||||
"%.1f",
|
||||
SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.NumFiles /
|
||||
(double) SizeOfFileZones.NumUsrs :
|
||||
0.0);
|
||||
Fil_WriteFileSizeFull (SizeOfFileZones.NumUsrs ? (double) SizeOfFileZones.Size /
|
||||
(double) SizeOfFileZones.NumUsrs :
|
||||
0.0,
|
||||
|
@ -9919,8 +9934,8 @@ void Sta_WriteTimeToGenerateAndSendPage (void)
|
|||
{
|
||||
extern const char *Txt_PAGE1_Page_generated_in;
|
||||
extern const char *Txt_PAGE2_and_sent_in;
|
||||
char StrTimeGenerationInMicroseconds[64];
|
||||
char StrTimeSendInMicroseconds[64];
|
||||
char StrTimeGenerationInMicroseconds[Dat_MAX_BYTES_TIME + 1];
|
||||
char StrTimeSendInMicroseconds[Dat_MAX_BYTES_TIME + 1];
|
||||
|
||||
Sta_WriteTime (StrTimeGenerationInMicroseconds,Gbl.TimeGenerationInMicroseconds);
|
||||
Sta_WriteTime (StrTimeSendInMicroseconds,Gbl.TimeSendInMicroseconds);
|
||||
|
@ -9933,16 +9948,23 @@ void Sta_WriteTimeToGenerateAndSendPage (void)
|
|||
/********* Write time (given in microseconds) depending on amount ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Sta_WriteTime (char *Str,long TimeInMicroseconds)
|
||||
void Sta_WriteTime (char Str[Dat_MAX_BYTES_TIME],long TimeInMicroseconds)
|
||||
{
|
||||
if (TimeInMicroseconds < 1000L)
|
||||
sprintf (Str,"%ld µs",TimeInMicroseconds);
|
||||
snprintf (Str,Dat_MAX_BYTES_TIME + 1,
|
||||
"%ld µs",
|
||||
TimeInMicroseconds);
|
||||
else if (TimeInMicroseconds < 1000000L)
|
||||
sprintf (Str,"%ld ms",TimeInMicroseconds / 1000);
|
||||
snprintf (Str,Dat_MAX_BYTES_TIME + 1,
|
||||
"%ld ms",
|
||||
TimeInMicroseconds / 1000);
|
||||
else if (TimeInMicroseconds < (60 * 1000000L))
|
||||
sprintf (Str,"%.1f s",(float) TimeInMicroseconds / 1E6);
|
||||
snprintf (Str,Dat_MAX_BYTES_TIME + 1,
|
||||
"%.1f s",
|
||||
(float) TimeInMicroseconds / 1E6);
|
||||
else
|
||||
sprintf (Str,"%ld min, %ld s",
|
||||
TimeInMicroseconds / (60 * 1000000L),
|
||||
(TimeInMicroseconds / 1000000L) % 60);
|
||||
snprintf (Str,Dat_MAX_BYTES_TIME + 1,
|
||||
"%ld min, %ld s",
|
||||
TimeInMicroseconds / (60 * 1000000L),
|
||||
(TimeInMicroseconds / 1000000L) % 60);
|
||||
}
|
||||
|
|
|
@ -189,6 +189,6 @@ void Sta_WriteParamsDatesSeeAccesses (void);
|
|||
void Sta_ComputeTimeToGeneratePage (void);
|
||||
void Sta_ComputeTimeToSendPage (void);
|
||||
void Sta_WriteTimeToGenerateAndSendPage (void);
|
||||
void Sta_WriteTime (char *Str,long TimeInMicroseconds);
|
||||
void Sta_WriteTime (char Str[Dat_MAX_BYTES_TIME],long TimeInMicroseconds);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -300,21 +300,25 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
/* Create id for this form */
|
||||
Gbl.Form.Num++;
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
sprintf (Gbl.Form.UniqueId,"form_%s_%d",
|
||||
Gbl.UniqueNameEncrypted,Gbl.Form.Num);
|
||||
snprintf (Gbl.Form.UniqueId,sizeof (Gbl.Form.UniqueId),
|
||||
"form_%s_%d",
|
||||
Gbl.UniqueNameEncrypted,Gbl.Form.Num);
|
||||
else
|
||||
sprintf (Gbl.Form.Id,"form_%d",Gbl.Form.Num);
|
||||
snprintf (Gbl.Form.Id,sizeof (Gbl.Form.Id),
|
||||
"form_%d",
|
||||
Gbl.Form.Num);
|
||||
|
||||
/* Store first part of anchor */
|
||||
Act_SetParamsForm (ParamsStr,ActSeeOthPubPrf,true);
|
||||
sprintf (Anchor1Nick,"<form method=\"post\" action=\"%s/%s\" id=\"%s\">"
|
||||
"%s"
|
||||
"<input type=\"hidden\" name=\"usr\" value=\"",
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Gbl.Usrs.Me.Logged ? Gbl.Form.UniqueId :
|
||||
Gbl.Form.Id,
|
||||
ParamsStr);
|
||||
snprintf (Anchor1Nick,sizeof (Anchor1Nick),
|
||||
"<form method=\"post\" action=\"%s/%s\" id=\"%s\">"
|
||||
"%s"
|
||||
"<input type=\"hidden\" name=\"usr\" value=\"",
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Gbl.Usrs.Me.Logged ? Gbl.Form.UniqueId :
|
||||
Gbl.Form.Id,
|
||||
ParamsStr);
|
||||
Anchor1NickLength = strlen (Anchor1Nick);
|
||||
if ((Links[NumLinks].Anchor1Nick = (char *) malloc (Anchor1NickLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to insert link.");
|
||||
|
@ -322,12 +326,13 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
Links[NumLinks].Anchor1NickLength = Anchor1NickLength;
|
||||
|
||||
/* Store second part of anchor */
|
||||
sprintf (Anchor2Nick,"\">"
|
||||
"<a href=\"\""
|
||||
" onclick=\"document.getElementById('%s').submit();"
|
||||
"return false;\">",
|
||||
Gbl.Usrs.Me.Logged ? Gbl.Form.UniqueId :
|
||||
Gbl.Form.Id);
|
||||
snprintf (Anchor2Nick,sizeof (Anchor2Nick),
|
||||
"\">"
|
||||
"<a href=\"\""
|
||||
" onclick=\"document.getElementById('%s').submit();"
|
||||
"return false;\">",
|
||||
Gbl.Usrs.Me.Logged ? Gbl.Form.UniqueId :
|
||||
Gbl.Form.Id);
|
||||
Anchor2NickLength = strlen (Anchor2Nick);
|
||||
if ((Links[NumLinks].Anchor2Nick = (char *) malloc (Anchor2NickLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to insert link.");
|
||||
|
@ -1236,7 +1241,8 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
|||
StrSpecialChar[2] = '\0'; // End of string
|
||||
}
|
||||
else
|
||||
sprintf (StrSpecialChar,"""); // Double comilla is stored as HTML code to avoid problems when displaying it
|
||||
Str_Copy (StrSpecialChar,""", // Double comilla is stored as HTML code to avoid problems when displaying it
|
||||
Str_MAX_BYTES_SPECIAL_CHAR);
|
||||
NumPrintableCharsFromReturn++;
|
||||
ThereIsSpaceChar = false;
|
||||
break;
|
||||
|
@ -1260,7 +1266,8 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
|||
StrSpecialChar[2] = '\0'; // End of string
|
||||
}
|
||||
else
|
||||
sprintf (StrSpecialChar,"'"); // Single comilla is stored as HTML entity to avoid problem when querying database (SQL code injection)
|
||||
Str_Copy (StrSpecialChar,"'", // Single comilla is stored as HTML entity to avoid problem when querying database (SQL code injection)
|
||||
Str_MAX_BYTES_SPECIAL_CHAR);
|
||||
NumPrintableCharsFromReturn++;
|
||||
ThereIsSpaceChar = false;
|
||||
break;
|
||||
|
@ -1422,11 +1429,11 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
|||
ThereIsSpaceChar = false;
|
||||
break;
|
||||
default: /* The rest of special chars are stored as special code */
|
||||
sprintf (StrSpecialChar,
|
||||
(ChangeTo == Str_TO_TEXT ||
|
||||
ChangeTo == Str_TO_MARKDOWN) ? "%c" :
|
||||
"&#%u;",
|
||||
SpecialChar);
|
||||
snprintf (StrSpecialChar,sizeof (StrSpecialChar),
|
||||
(ChangeTo == Str_TO_TEXT ||
|
||||
ChangeTo == Str_TO_MARKDOWN) ? "%c" :
|
||||
"&#%u;",
|
||||
SpecialChar);
|
||||
NumPrintableCharsFromReturn++;
|
||||
ThereIsSpaceChar = false;
|
||||
break;
|
||||
|
@ -2874,6 +2881,7 @@ void Str_CreateRandomAlphanumStr (char *Str,size_t Length)
|
|||
/*****************************************************************************/
|
||||
/****************************** Safe string copy *****************************/
|
||||
/*****************************************************************************/
|
||||
// DstSize does not include ending byte '\0'
|
||||
|
||||
void Str_Copy (char *Dst,const char *Src,size_t DstSize)
|
||||
{
|
||||
|
@ -2895,6 +2903,7 @@ void Str_Copy (char *Dst,const char *Src,size_t DstSize)
|
|||
/*****************************************************************************/
|
||||
/************************** Safe string concatenation ************************/
|
||||
/*****************************************************************************/
|
||||
// DstSize does not include ending byte '\0'
|
||||
|
||||
void Str_Concat (char *Dst,const char *Src,size_t DstSize)
|
||||
{
|
||||
|
|
|
@ -2698,8 +2698,9 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
|||
Gbl.Svys.SvyCodToEdit = SvyCod;
|
||||
Gbl.Svys.SvyQstCodToEdit = SvyQst->QstCod;
|
||||
|
||||
sprintf (Gbl.Title,"%s %u",
|
||||
Txt_Question,SvyQst->QstInd + 1); // Question index may be 0, 1, 2, 3,...
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %u",
|
||||
Txt_Question,SvyQst->QstInd + 1); // Question index may be 0, 1, 2, 3,...
|
||||
Box_StartBox (NULL,Gbl.Title,Svy_PutIconToRemoveOneQst,
|
||||
NULL,Box_NOT_CLOSABLE);
|
||||
}
|
||||
|
@ -3006,7 +3007,9 @@ void Svy_ReceiveQst (void)
|
|||
{
|
||||
if (!Svy_AllocateTextChoiceAnswer (&SvyQst,NumAns))
|
||||
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
|
||||
sprintf (AnsStr,"AnsStr%u",NumAns);
|
||||
snprintf (AnsStr,sizeof (AnsStr),
|
||||
"AnsStr%u",
|
||||
NumAns);
|
||||
Par_GetParToHTML (AnsStr,SvyQst.AnsChoice[NumAns].Text,Svy_MAX_BYTES_ANSWER);
|
||||
}
|
||||
|
||||
|
@ -3515,13 +3518,15 @@ static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
|
|||
|
||||
/***** String with the number of users *****/
|
||||
if (MaxUsrs)
|
||||
sprintf (Gbl.Title,"%u (%u%% %s %u)",
|
||||
NumUsrs,
|
||||
(unsigned) ((((float) NumUsrs * 100.0) / (float) MaxUsrs) + 0.5),
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u (%u%% %s %u)",
|
||||
NumUsrs,
|
||||
(unsigned) ((((float) NumUsrs * 100.0) / (float) MaxUsrs) + 0.5),
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
else
|
||||
sprintf (Gbl.Title,"0 (0%% %s %u)",
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"0 (0%% %s %u)",
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
|
||||
/***** Draw bar with a with proportional to the number of clicks *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\" style=\"width:%upx;\">",
|
||||
|
@ -3732,7 +3737,9 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
|
|||
Lay_ShowErrorAndExit ("Error: wrong question code.");
|
||||
|
||||
/* Get possible parameter with the user's answer */
|
||||
sprintf (ParamName,"Ans%010u",(unsigned) QstCod);
|
||||
snprintf (ParamName,sizeof (ParamName),
|
||||
"Ans%010u",
|
||||
(unsigned) QstCod);
|
||||
// Lay_ShowAlert (Lay_INFO,ParamName);
|
||||
Par_GetParMultiToText (ParamName,StrAnswersIndexes,
|
||||
Svy_MAX_ANSWERS_PER_QUESTION * (10 + 1));
|
||||
|
|
|
@ -351,10 +351,11 @@ void Syl_LoadListItemsSyllabusIntoMemory (long CrsCod)
|
|||
unsigned NumItemsWithChildren = 0;
|
||||
|
||||
/* Path of the private directory for the XML file with the syllabus */
|
||||
sprintf (Gbl.Syllabus.PathDir,"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,
|
||||
Gbl.Syllabus.WhichSyllabus == Syl_LECTURES ? Cfg_SYLLABUS_FOLDER_LECTURES :
|
||||
Cfg_SYLLABUS_FOLDER_PRACTICALS);
|
||||
snprintf (Gbl.Syllabus.PathDir,sizeof (Gbl.Syllabus.PathDir),
|
||||
"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,
|
||||
Gbl.Syllabus.WhichSyllabus == Syl_LECTURES ? Cfg_SYLLABUS_FOLDER_LECTURES :
|
||||
Cfg_SYLLABUS_FOLDER_PRACTICALS);
|
||||
|
||||
/***** Open the file with the syllabus *****/
|
||||
Syl_OpenSyllabusFile (Gbl.Syllabus.PathDir,PathFile);
|
||||
|
@ -622,10 +623,10 @@ static void Syl_ShowRowSyllabus (unsigned NumItem,
|
|||
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
|
||||
if (Subtree.MovAllowed)
|
||||
{
|
||||
sprintf (Gbl.Title,
|
||||
LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_up_X_and_its_subsections :
|
||||
Txt_Move_up_X,
|
||||
StrItemCod);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_up_X_and_its_subsections :
|
||||
Txt_Move_up_X,
|
||||
StrItemCod);
|
||||
Lay_PutContextualLink (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActUp_IteSylLec :
|
||||
ActUp_IteSylPra,
|
||||
NULL,Syl_PutParamNumItem,
|
||||
|
@ -642,10 +643,10 @@ static void Syl_ShowRowSyllabus (unsigned NumItem,
|
|||
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
|
||||
if (Subtree.MovAllowed)
|
||||
{
|
||||
sprintf (Gbl.Title,
|
||||
LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_down_X_and_its_subsections :
|
||||
Txt_Move_down_X,
|
||||
StrItemCod);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_down_X_and_its_subsections :
|
||||
Txt_Move_down_X,
|
||||
StrItemCod);
|
||||
Lay_PutContextualLink (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActDwnIteSylLec :
|
||||
ActDwnIteSylPra,
|
||||
NULL,Syl_PutParamNumItem,
|
||||
|
@ -661,7 +662,9 @@ static void Syl_ShowRowSyllabus (unsigned NumItem,
|
|||
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
|
||||
if (Level > 1)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Increase_level_of_X,StrItemCod);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Increase_level_of_X,
|
||||
StrItemCod);
|
||||
Lay_PutContextualLink (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActRgtIteSylLec :
|
||||
ActRgtIteSylPra,
|
||||
NULL,Syl_PutParamNumItem,
|
||||
|
@ -678,7 +681,9 @@ static void Syl_ShowRowSyllabus (unsigned NumItem,
|
|||
if (Level < LastLevel + 1 &&
|
||||
Level < Syl_MAX_LEVELS_SYLLABUS)
|
||||
{
|
||||
sprintf (Gbl.Title,Txt_Decrease_level_of_X,StrItemCod);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Decrease_level_of_X,
|
||||
StrItemCod);
|
||||
Lay_PutContextualLink (Gbl.CurrentCrs.Info.Type == Inf_LECTURES ? ActLftIteSylLec :
|
||||
ActLftIteSylPra,
|
||||
NULL,Syl_PutParamNumItem,
|
||||
|
@ -749,8 +754,9 @@ int Syl_WriteSyllabusIntoHTMLBuffer (char **HTMLBuffer)
|
|||
if (LstItemsSyllabus.NumItems)
|
||||
{
|
||||
/***** Create a unique name for the file *****/
|
||||
sprintf (FileNameHTMLTmp,"%s/%s/%s_syllabus.html",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNameHTMLTmp,sizeof (FileNameHTMLTmp),
|
||||
"%s/%s/%s_syllabus.html",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT,Gbl.UniqueNameEncrypted);
|
||||
|
||||
/***** Create a new temporary file for writing and reading *****/
|
||||
if ((FileHTMLTmp = fopen (FileNameHTMLTmp,"w+b")) == NULL)
|
||||
|
@ -958,7 +964,9 @@ static void Syl_WriteNumItem (char *StrDst,FILE *FileTgt,int Level,int *CodItem)
|
|||
if (FileTgt)
|
||||
fprintf (FileTgt,".");
|
||||
}
|
||||
sprintf (InStr,"%d",CodItem[N]);
|
||||
snprintf (InStr,sizeof (InStr),
|
||||
"%d",
|
||||
CodItem[N]);
|
||||
if (StrDst)
|
||||
Str_Concat (StrDst,InStr,
|
||||
Syl_MAX_BYTES_ITEM_COD);
|
||||
|
@ -1406,7 +1414,9 @@ void Syl_BuildPathFileSyllabus (char *PathFile)
|
|||
{
|
||||
char Path[PATH_MAX + 1 + NAME_MAX + 1];
|
||||
|
||||
sprintf (Path,"%s/%s",Gbl.Syllabus.PathDir,Cfg_SYLLABUS_FILENAME);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.Syllabus.PathDir,Cfg_SYLLABUS_FILENAME);
|
||||
Str_Copy (PathFile,Path,
|
||||
PATH_MAX);
|
||||
}
|
||||
|
|
75
swad_test.c
75
swad_test.c
|
@ -613,17 +613,23 @@ static void Tst_GetQuestionsAndAnswersFromForm (void)
|
|||
NumQst++)
|
||||
{
|
||||
/* Get question code */
|
||||
sprintf (StrQstIndOrAns,"Qst%06u",NumQst);
|
||||
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
||||
"Qst%06u",
|
||||
NumQst);
|
||||
if ((Gbl.Test.QstCodes[NumQst] = Par_GetParToLong (StrQstIndOrAns)) <= 0)
|
||||
Lay_ShowErrorAndExit ("Code of question is missing.");
|
||||
|
||||
/* Get indexes for this question */
|
||||
sprintf (StrQstIndOrAns,"Ind%06u",NumQst);
|
||||
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
||||
"Ind%06u",
|
||||
NumQst);
|
||||
Par_GetParMultiToText (StrQstIndOrAns,Gbl.Test.StrIndexesOneQst[NumQst],
|
||||
Tst_MAX_BYTES_INDEXES_ONE_QST); /* If choice ==> "0", "1", "2",... */
|
||||
|
||||
/* Get answers selected by user for this question */
|
||||
sprintf (StrQstIndOrAns,"Ans%06u",NumQst);
|
||||
snprintf (StrQstIndOrAns,sizeof (StrQstIndOrAns),
|
||||
"Ans%06u",
|
||||
NumQst);
|
||||
Par_GetParMultiToText (StrQstIndOrAns,Gbl.Test.StrAnswersOneQst[NumQst],
|
||||
Tst_MAX_BYTES_ANSWERS_ONE_QST); /* If answer type == T/F ==> " ", "T", "F"; if choice ==> "0", "2",... */
|
||||
}
|
||||
|
@ -1881,7 +1887,9 @@ static void Tst_PutIconEnable (long TagCod,const char *TagTxt)
|
|||
fprintf (Gbl.F.Out,"<td class=\"BM\">");
|
||||
Act_StartForm (ActEnableTag);
|
||||
Par_PutHiddenParamLong ("TagCod",TagCod);
|
||||
sprintf (Gbl.Title,Txt_Tag_X_not_allowed_Click_to_allow_it,TagTxt);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Tag_X_not_allowed_Click_to_allow_it,
|
||||
TagTxt);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/eye-slash-on64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -1903,7 +1911,9 @@ static void Tst_PutIconDisable (long TagCod,const char *TagTxt)
|
|||
fprintf (Gbl.F.Out,"<td class=\"BM\">");
|
||||
Act_StartForm (ActDisableTag);
|
||||
Par_PutHiddenParamLong ("TagCod",TagCod);
|
||||
sprintf (Gbl.Title,Txt_Tag_X_allowed_Click_to_disable_it,TagTxt);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Tag_X_allowed_Click_to_disable_it,
|
||||
TagTxt);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/eye-on64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -2526,17 +2536,23 @@ static unsigned long Tst_GetQuestions (MYSQL_RES **mysql_res)
|
|||
|
||||
Str_Concat (Query," WHERE tst_questions.CrsCod='",
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
sprintf (CrsCodStr,"%ld",Gbl.CurrentCrs.Crs.CrsCod);
|
||||
snprintf (CrsCodStr,sizeof (CrsCodStr),
|
||||
"%ld",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
Str_Concat (Query,CrsCodStr,
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
Str_Concat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('",
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
sprintf (LongStr,"%ld",(long) Gbl.DateRange.TimeUTC[0]);
|
||||
snprintf (LongStr,sizeof (LongStr),
|
||||
"%ld",
|
||||
(long) Gbl.DateRange.TimeUTC[0]);
|
||||
Str_Concat (Query,LongStr,
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
Str_Concat (Query,"') AND tst_questions.EditTime<=FROM_UNIXTIME('",
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
sprintf (LongStr,"%ld",(long) Gbl.DateRange.TimeUTC[1]);
|
||||
snprintf (LongStr,sizeof (LongStr),
|
||||
"%ld",
|
||||
(long) Gbl.DateRange.TimeUTC[1]);
|
||||
Str_Concat (Query,LongStr,
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
Str_Concat (Query,"')",
|
||||
|
@ -2759,7 +2775,9 @@ static unsigned long Tst_GetQuestionsForTest (MYSQL_RES **mysql_res)
|
|||
/* End query */
|
||||
Str_Concat (Query," ORDER BY RAND(NOW()) LIMIT ",
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
sprintf (StrNumQsts,"%u",Gbl.Test.NumQsts);
|
||||
snprintf (StrNumQsts,sizeof (StrNumQsts),
|
||||
"%u",
|
||||
Gbl.Test.NumQsts);
|
||||
Str_Concat (Query,StrNumQsts,
|
||||
Tst_MAX_BYTES_QUERY_TEST);
|
||||
/*
|
||||
|
@ -3768,7 +3786,9 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
|
|||
/***** Write selectors and letter of this option *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"LEFT_TOP\">");
|
||||
sprintf (ParamName,"Ind%06u",NumQst);
|
||||
snprintf (ParamName,sizeof (ParamName),
|
||||
"Ind%06u",
|
||||
NumQst);
|
||||
Par_PutHiddenParamUnsigned (ParamName,Index);
|
||||
fprintf (Gbl.F.Out,"<input type=\"");
|
||||
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE)
|
||||
|
@ -4637,7 +4657,9 @@ static void Tst_WriteParamQstCod (unsigned NumQst,long QstCod)
|
|||
{
|
||||
char ParamName[3 + 6 + 1];
|
||||
|
||||
sprintf (ParamName,"Qst%06u",NumQst);
|
||||
snprintf (ParamName,sizeof (ParamName),
|
||||
"Qst%06u",
|
||||
NumQst);
|
||||
Par_PutHiddenParamLong (ParamName,QstCod);
|
||||
}
|
||||
|
||||
|
@ -4752,7 +4774,9 @@ static bool Tst_GetParamsTst (Tst_ActionToDoWithQuestions_t ActionToDoWithQuesti
|
|||
case Tst_SELECT_QUESTIONS_FOR_GAME:
|
||||
/* The unique allowed type of answer in a game is unique choice */
|
||||
Gbl.Test.AllAnsTypes = false;
|
||||
sprintf (Gbl.Test.ListAnsTypes,"%u",(unsigned) Tst_ANS_UNIQUE_CHOICE);
|
||||
snprintf (Gbl.Test.ListAnsTypes,sizeof (Gbl.Test.ListAnsTypes),
|
||||
"%u",
|
||||
(unsigned) Tst_ANS_UNIQUE_CHOICE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -4950,7 +4974,6 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
extern const char *Txt_Contract;
|
||||
extern const char *Txt_Save;
|
||||
extern const char *Txt_Create_question;
|
||||
char Title[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
@ -4966,8 +4989,10 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
/***** Start box *****/
|
||||
if (Gbl.Test.QstCod > 0) // The question already has assigned a code
|
||||
{
|
||||
sprintf (Title,Txt_Question_code_X,Gbl.Test.QstCod);
|
||||
Box_StartBox (NULL,Title,Tst_PutIconToRemoveOneQst,
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Question_code_X,
|
||||
Gbl.Test.QstCod);
|
||||
Box_StartBox (NULL,Gbl.Title,Tst_PutIconToRemoveOneQst,
|
||||
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
||||
}
|
||||
else
|
||||
|
@ -5231,7 +5256,9 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
'a' + (char) NumOpt);
|
||||
|
||||
/* Icon to expand (show the answer) */
|
||||
sprintf (Gbl.Title,"%s %c)",Txt_Expand,'a' + (char) NumOpt);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %c)",
|
||||
Txt_Expand,'a' + (char) NumOpt);
|
||||
fprintf (Gbl.F.Out,"<a href=\"\" id=\"exp_%u\"",NumOpt);
|
||||
if (DisplayRightColumn) // Answer does not have content
|
||||
fprintf (Gbl.F.Out," style=\"display:none;\""); // Hide icon
|
||||
|
@ -5243,7 +5270,9 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
Gbl.Title,Gbl.Title);
|
||||
|
||||
/* Icon to contract (hide the answer) */
|
||||
sprintf (Gbl.Title,"%s %c)",Txt_Contract,'a' + (char) NumOpt);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %c)",
|
||||
Txt_Contract,'a' + (char) NumOpt);
|
||||
fprintf (Gbl.F.Out,"<a href=\"\" id=\"con_%u\"",NumOpt);
|
||||
if (!DisplayRightColumn) // Answer does not have content
|
||||
fprintf (Gbl.F.Out," style=\"display:none;\""); // Hide icon
|
||||
|
@ -5792,7 +5821,9 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
NumTag < Tst_MAX_TAGS_PER_QUESTION;
|
||||
NumTag++)
|
||||
{
|
||||
sprintf (TagStr,"TagTxt%u",NumTag);
|
||||
snprintf (TagStr,sizeof (TagStr),
|
||||
"TagTxt%u",
|
||||
NumTag);
|
||||
Par_GetParToText (TagStr,Gbl.Test.Tags.Txt[NumTag],Tst_MAX_BYTES_TAG);
|
||||
|
||||
if (Gbl.Test.Tags.Txt[NumTag][0])
|
||||
|
@ -5865,7 +5896,9 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
Lay_ShowErrorAndExit (Gbl.Alert.Txt);
|
||||
|
||||
/* Get answer */
|
||||
sprintf (AnsStr,"AnsStr%u",NumOpt);
|
||||
snprintf (AnsStr,sizeof (AnsStr),
|
||||
"AnsStr%u",
|
||||
NumOpt);
|
||||
Par_GetParToHTML (AnsStr,Gbl.Test.Answer.Options[NumOpt].Text,
|
||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||
if (Gbl.Test.AnswerType == Tst_ANS_TEXT)
|
||||
|
@ -5874,7 +5907,9 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
Str_ReplaceSeveralSpacesForOne (Gbl.Test.Answer.Options[NumOpt].Text);
|
||||
|
||||
/* Get feedback */
|
||||
sprintf (FbStr,"FbStr%u",NumOpt);
|
||||
snprintf (FbStr,sizeof (FbStr),
|
||||
"FbStr%u",
|
||||
NumOpt);
|
||||
Par_GetParToHTML (FbStr,Gbl.Test.Answer.Options[NumOpt].Feedback,
|
||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||
|
||||
|
|
|
@ -180,9 +180,10 @@ void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res)
|
|||
Brw_CreateDirDownloadTmp ();
|
||||
|
||||
/***** Create public XML file with the questions *****/
|
||||
sprintf (PathPubFile,"%s/%s/%s/test.xml",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir);
|
||||
snprintf (PathPubFile,sizeof (PathPubFile),
|
||||
"%s/%s/%s/test.xml",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir);
|
||||
if ((Gbl.Test.XML.FileXML = fopen (PathPubFile,"wb")) == NULL)
|
||||
Lay_ShowErrorAndExit ("Can not open target file.");
|
||||
|
||||
|
@ -406,7 +407,9 @@ void TsI_ImportQstsFromXML (void)
|
|||
bool WrongType = false;
|
||||
|
||||
/***** Creates directory if not exists *****/
|
||||
sprintf (PathTestPriv,"%s/%s",Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_TEST);
|
||||
snprintf (PathTestPriv,sizeof (PathTestPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_TEST);
|
||||
Fil_CreateDirIfNotExists (PathTestPriv);
|
||||
|
||||
/***** Remove old files *****/
|
||||
|
@ -434,7 +437,9 @@ void TsI_ImportQstsFromXML (void)
|
|||
else
|
||||
{
|
||||
/* End the reception of XML in a temporary file */
|
||||
sprintf (FileNameXMLTmp,"%s/%s.xml",PathTestPriv,Gbl.UniqueNameEncrypted);
|
||||
snprintf (FileNameXMLTmp,sizeof (FileNameXMLTmp),
|
||||
"%s/%s.xml",
|
||||
PathTestPriv,Gbl.UniqueNameEncrypted);
|
||||
if (Fil_EndReceptionOfFile (FileNameXMLTmp,Param))
|
||||
/***** Get questions from XML file and store them in database *****/
|
||||
TsI_ReadQuestionsFromXMLFileAndStoreInDB (FileNameXMLTmp);
|
||||
|
|
|
@ -283,10 +283,11 @@ void The_ChangeTheme (void)
|
|||
|
||||
/***** Get param theme *****/
|
||||
Gbl.Prefs.Theme = The_GetParamTheme ();
|
||||
sprintf (Path,"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Cfg_ICON_FOLDER_THEMES,
|
||||
The_ThemeId[Gbl.Prefs.Theme]);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Cfg_ICON_FOLDER_THEMES,
|
||||
The_ThemeId[Gbl.Prefs.Theme]);
|
||||
Str_Copy (Gbl.Prefs.PathTheme,Path,
|
||||
PATH_MAX);
|
||||
|
||||
|
|
79
swad_user.c
79
swad_user.c
|
@ -261,8 +261,9 @@ void Usr_InformAboutNumClicksBeforePhoto (void)
|
|||
Ale_ShowAlert (Ale_WARNING,Txt_You_must_send_your_photo_because_);
|
||||
else if (Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB)
|
||||
{
|
||||
sprintf (Message,Txt_You_can_only_perform_X_further_actions_,
|
||||
Pho_MAX_CLICKS_WITHOUT_PHOTO - Gbl.Usrs.Me.NumAccWithoutPhoto);
|
||||
snprintf (Message,sizeof (Message),
|
||||
Txt_You_can_only_perform_X_further_actions_,
|
||||
Pho_MAX_CLICKS_WITHOUT_PHOTO - Gbl.Usrs.Me.NumAccWithoutPhoto);
|
||||
Ale_ShowAlertAndButton (Ale_WARNING,Message,
|
||||
ActReqMyPho,NULL,NULL,NULL,
|
||||
Btn_CONFIRM_BUTTON,Txt_Upload_photo);
|
||||
|
@ -2520,10 +2521,11 @@ void Usr_CreateBirthdayStrDB (const struct UsrData *UsrDat,
|
|||
Str_Copy (BirthdayStrDB,"NULL", // Without apostrophes
|
||||
Usr_BIRTHDAY_STR_DB_LENGTH);
|
||||
else
|
||||
sprintf (BirthdayStrDB,"'%04u-%02u-%02u'", // With apostrophes
|
||||
UsrDat->Birthday.Year,
|
||||
UsrDat->Birthday.Month,
|
||||
UsrDat->Birthday.Day);
|
||||
snprintf (BirthdayStrDB,Usr_BIRTHDAY_STR_DB_LENGTH + 1,
|
||||
"'%04u-%02u-%02u'", // With apostrophes
|
||||
UsrDat->Birthday.Year,
|
||||
UsrDat->Birthday.Month,
|
||||
UsrDat->Birthday.Day);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3216,16 +3218,18 @@ static void Usr_SetMyPrefsAndRoles (void)
|
|||
Gbl.Prefs.SideCols = Gbl.Usrs.Me.UsrDat.Prefs.SideCols;
|
||||
|
||||
Gbl.Prefs.Theme = Gbl.Usrs.Me.UsrDat.Prefs.Theme;
|
||||
sprintf (Path,"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,
|
||||
The_ThemeId[Gbl.Prefs.Theme]);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_THEMES,
|
||||
The_ThemeId[Gbl.Prefs.Theme]);
|
||||
Str_Copy (Gbl.Prefs.PathTheme,Path,
|
||||
PATH_MAX);
|
||||
|
||||
Gbl.Prefs.IconSet = Gbl.Usrs.Me.UsrDat.Prefs.IconSet;
|
||||
sprintf (Path,"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s/%s",
|
||||
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
|
||||
Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||
Str_Copy (Gbl.Prefs.PathIconSet,Path,
|
||||
PATH_MAX);
|
||||
|
||||
|
@ -3422,7 +3426,9 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
|
|||
Str_Copy (BgColor,"LIGHT_GREEN",
|
||||
Usr_MAX_BYTES_BG_COLOR);
|
||||
else
|
||||
sprintf (BgColor,"COLOR%u",Gbl.RowEvenOdd);
|
||||
snprintf (BgColor,sizeof (BgColor),
|
||||
"COLOR%u",
|
||||
Gbl.RowEvenOdd);
|
||||
|
||||
if (PutCheckBoxToSelectUsr)
|
||||
{
|
||||
|
@ -3874,7 +3880,9 @@ static void Usr_WriteEmail (struct UsrData *UsrDat,const char *BgColor)
|
|||
{
|
||||
ShowEmail = Mai_ICanSeeOtherUsrEmail (UsrDat);
|
||||
if (ShowEmail)
|
||||
sprintf (MailLink,"mailto:%s",UsrDat->Email);
|
||||
snprintf (MailLink,sizeof (MailLink),
|
||||
"mailto:%s",
|
||||
UsrDat->Email);
|
||||
}
|
||||
else
|
||||
ShowEmail = false;
|
||||
|
@ -4317,7 +4325,9 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role,
|
|||
Str_Concat (Query,NumPositiveCods ? " OR GrpCod='" :
|
||||
" GrpCod='",
|
||||
Usr_MAX_BYTES_QUERY_GET_LIST_USRS);
|
||||
sprintf (LongStr,"%ld",GrpCod);
|
||||
snprintf (LongStr,sizeof (LongStr),
|
||||
"%ld",
|
||||
GrpCod);
|
||||
Str_Concat (Query,LongStr,
|
||||
Usr_MAX_BYTES_QUERY_GET_LIST_USRS);
|
||||
Str_Concat (Query,"'",
|
||||
|
@ -4347,7 +4357,9 @@ static void Usr_BuildQueryToGetUsrsLstCrs (Rol_Role_t Role,
|
|||
" FROM crs_grp,crs_grp_usr"
|
||||
" WHERE crs_grp.GrpTypCod='",
|
||||
Usr_MAX_BYTES_QUERY_GET_LIST_USRS);
|
||||
sprintf (LongStr,"%ld",Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod);
|
||||
snprintf (LongStr,sizeof (LongStr),
|
||||
"%ld",
|
||||
Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod);
|
||||
Str_Concat (Query,LongStr,
|
||||
Usr_MAX_BYTES_QUERY_GET_LIST_USRS);
|
||||
Str_Concat (Query,"' AND crs_grp.GrpCod=crs_grp_usr.GrpCod)",
|
||||
|
@ -6825,12 +6837,13 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
|
|||
/***** Start box and table *****/
|
||||
/* Number of users found */
|
||||
Sex = Usr_GetSexOfUsrsLst (Role);
|
||||
sprintf (Gbl.Title,"%u %s",
|
||||
NumUsrs,
|
||||
(Role == Rol_UNK) ? ((NumUsrs == 1) ? Txt_user[Sex] :
|
||||
Txt_users[Sex]) :
|
||||
((NumUsrs == 1) ? Txt_ROLES_SINGUL_abc[Role][Sex] :
|
||||
Txt_ROLES_PLURAL_abc[Role][Sex]));
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s",
|
||||
NumUsrs,
|
||||
(Role == Rol_UNK) ? ((NumUsrs == 1) ? Txt_user[Sex] :
|
||||
Txt_users[Sex]) :
|
||||
((NumUsrs == 1) ? Txt_ROLES_SINGUL_abc[Role][Sex] :
|
||||
Txt_ROLES_PLURAL_abc[Role][Sex]));
|
||||
Box_StartBoxTable (NULL,Gbl.Title,NULL,
|
||||
NULL,Box_NOT_CLOSABLE,2);
|
||||
|
||||
|
@ -8356,21 +8369,27 @@ void Usr_PutSelectorNumColsClassPhoto (void)
|
|||
/********** Build the relative path of a user from his user's code ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Usr_ConstructPathUsr (long UsrCod,char *PathUsr)
|
||||
void Usr_ConstructPathUsr (long UsrCod,char PathUsr[PATH_MAX + 1])
|
||||
{
|
||||
char PathUsrs[PATH_MAX + 1];
|
||||
char PathAboveUsr[PATH_MAX + 1];
|
||||
|
||||
/***** Path for users *****/
|
||||
sprintf (PathUsrs,"%s/%s",Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_USR);
|
||||
snprintf (PathUsrs,sizeof (PathUsrs),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_USR);
|
||||
Fil_CreateDirIfNotExists (PathUsrs);
|
||||
|
||||
/***** Path above user's ID *****/
|
||||
sprintf (PathAboveUsr,"%s/%02u",PathUsrs,(unsigned) (UsrCod % 100));
|
||||
snprintf (PathAboveUsr,sizeof (PathAboveUsr),
|
||||
"%s/%02u",
|
||||
PathUsrs,(unsigned) (UsrCod % 100));
|
||||
Fil_CreateDirIfNotExists (PathAboveUsr);
|
||||
|
||||
/***** Path for user *****/
|
||||
sprintf (PathUsr,"%s/%ld",PathAboveUsr,UsrCod);
|
||||
snprintf (PathUsr,PATH_MAX + 1,
|
||||
"%s/%ld",
|
||||
PathAboveUsr,UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -8503,7 +8522,9 @@ unsigned Usr_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,unsigned Roles)
|
|||
Role++)
|
||||
if (Roles & (1 << Role))
|
||||
{
|
||||
sprintf (UnsignedStr,"%u",(unsigned) Role);
|
||||
snprintf (UnsignedStr,sizeof (UnsignedStr),
|
||||
"%u",
|
||||
(unsigned) Role);
|
||||
if (FirstRole) // Not the first role
|
||||
FirstRole = false;
|
||||
else
|
||||
|
@ -8964,7 +8985,9 @@ void Usr_PrintUsrQRCode (void)
|
|||
/***** Show QR code *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.Nickname[0])
|
||||
{
|
||||
sprintf (NewNicknameWithArroba,"@%s",Gbl.Usrs.Other.UsrDat.Nickname);
|
||||
snprintf (NewNicknameWithArroba,sizeof (NewNicknameWithArroba),
|
||||
"@%s",
|
||||
Gbl.Usrs.Other.UsrDat.Nickname);
|
||||
QR_ImageQRCode (NewNicknameWithArroba);
|
||||
}
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ void Usr_SeeStdClassPhotoPrn (void);
|
|||
void Usr_SeeTchClassPhotoPrn (void);
|
||||
void Usr_PutSelectorNumColsClassPhoto (void);
|
||||
|
||||
void Usr_ConstructPathUsr (long UsrCod,char *PathUsr);
|
||||
void Usr_ConstructPathUsr (long UsrCod,char PathUsr[PATH_MAX + 1]);
|
||||
bool Usr_ChkIfUsrCodExists (long UsrCod);
|
||||
|
||||
void Usr_ShowWarningNoUsersFound (Rol_Role_t Role);
|
||||
|
|
|
@ -2278,10 +2278,10 @@ static void Svc_GetListGrpsInAttendanceEventFromDB (long AttCod,char **ListGroup
|
|||
|
||||
/* Get group code (row[0]) */
|
||||
GrpCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
sprintf (GrpCodStr,
|
||||
NumGrp ? ",%ld" :
|
||||
"%ld",
|
||||
GrpCod);
|
||||
snprintf (GrpCodStr,sizeof (GrpCodStr),
|
||||
NumGrp ? ",%ld" :
|
||||
"%ld",
|
||||
GrpCod);
|
||||
Str_Concat (*ListGroups,GrpCodStr,
|
||||
Length);
|
||||
}
|
||||
|
@ -4099,12 +4099,16 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
/* Add this degree to query */
|
||||
if (FirstDegree)
|
||||
{
|
||||
sprintf (DegreesStr,"%ld",DegCod);
|
||||
snprintf (DegreesStr,sizeof (DegreesStr),
|
||||
"%ld",
|
||||
DegCod);
|
||||
FirstDegree = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (DegStr,",%ld",DegCod);
|
||||
snprintf (DegStr,sizeof (DegStr),
|
||||
",%ld",
|
||||
DegCod);
|
||||
Str_Concat (DegreesStr,DegStr,
|
||||
Svc_MAX_BYTES_DEGREES_STR);
|
||||
}
|
||||
|
@ -4377,18 +4381,22 @@ int swad__getDirectoryTree (struct soap *soap,
|
|||
Gbl.CurrentCrs.Grps.GrpCod = (groupCode > 0) ? (long) groupCode :
|
||||
-1L;
|
||||
|
||||
sprintf (Gbl.CurrentCrs.PathPriv,"%s/%s/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
snprintf (Gbl.CurrentCrs.PathPriv,sizeof (Gbl.CurrentCrs.PathPriv),
|
||||
"%s/%s/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
Brw_InitializeFileBrowser ();
|
||||
Brw_SetFullPathInTree (Brw_RootFolderInternalNames[Gbl.FileBrowser.Type],".");
|
||||
|
||||
/* Check if exists the directory for HTML output. If not exists, create it */
|
||||
sprintf (PathXMLPriv,"%s/%s",Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT);
|
||||
snprintf (PathXMLPriv,sizeof (PathXMLPriv),
|
||||
"%s/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_OUT);
|
||||
Fil_CreateDirIfNotExists (PathXMLPriv);
|
||||
|
||||
/* Create a unique name for the file */
|
||||
sprintf (XMLFileName,"%s/%s.xml",
|
||||
PathXMLPriv,Gbl.UniqueNameEncrypted);
|
||||
snprintf (XMLFileName,sizeof (XMLFileName),
|
||||
"%s/%s.xml",
|
||||
PathXMLPriv,Gbl.UniqueNameEncrypted);
|
||||
|
||||
/* Open file for writing and reading */
|
||||
if ((Gbl.F.XML = fopen (XMLFileName,"w+t")) == NULL)
|
||||
|
@ -4445,8 +4453,12 @@ static void Svc_ListDir (unsigned Level,const char *Path,const char *PathInTree)
|
|||
if (strcmp (FileList[NumFile]->d_name,".") &&
|
||||
strcmp (FileList[NumFile]->d_name,"..")) // Skip directories "." and ".."
|
||||
{
|
||||
sprintf (PathFileRel ,"%s/%s",Path ,FileList[NumFile]->d_name);
|
||||
sprintf (PathFileInExplTree,"%s/%s",PathInTree,FileList[NumFile]->d_name);
|
||||
snprintf (PathFileRel,sizeof (PathFileRel),
|
||||
"%s/%s",
|
||||
Path,FileList[NumFile]->d_name);
|
||||
snprintf (PathFileInExplTree,sizeof (PathFileInExplTree),
|
||||
"%s/%s",
|
||||
PathInTree,FileList[NumFile]->d_name);
|
||||
|
||||
if (!lstat (PathFileRel,&FileStatus)) // On success ==> 0 is returned
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user