mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 16:25:29 +02:00
Version 18.6.5
This commit is contained in:
parent
ffcd8b0abe
commit
2f2c0b731c
|
@ -359,6 +359,9 @@ ps2pdf source.ps destination.pdf
|
|||
#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.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)
|
||||
|
|
|
@ -25,10 +25,12 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <dirent.h> // For scandir, etc.
|
||||
#include <errno.h> // For errno
|
||||
#include <linux/limits.h> // For PATH_MAX
|
||||
#include <linux/stddef.h> // For NULL
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <stdlib.h> // For exit, system, malloc, free, etc
|
||||
#include <string.h> // For string functions
|
||||
#include <time.h> // For time
|
||||
|
@ -6070,7 +6072,9 @@ void Brw_SetFullPathInTree (const char *PathInTreeUntilFileOrFolder,const char *
|
|||
if (!PathInTreeUntilFileOrFolder[0])
|
||||
Gbl.FileBrowser.Priv.FullPathInTree[0] = '\0';
|
||||
else if (strcmp (FilFolLnkName,"."))
|
||||
sprintf (Gbl.FileBrowser.Priv.FullPathInTree,"%s/%s",
|
||||
snprintf (Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
sizeof (Gbl.FileBrowser.Priv.FullPathInTree),
|
||||
"%s/%s",
|
||||
PathInTreeUntilFileOrFolder,FilFolLnkName);
|
||||
else // It's the root folder
|
||||
Str_Copy (Gbl.FileBrowser.Priv.FullPathInTree,PathInTreeUntilFileOrFolder,
|
||||
|
@ -6156,7 +6160,8 @@ static bool Brw_CheckIfCanPasteIn (unsigned Level)
|
|||
if (Gbl.FileBrowser.Clipboard.IsThisTree) // We are in the same tree of the clipboard ==> we can paste or not depending on the subtree
|
||||
{
|
||||
/***** Construct the name of the file or folder destination *****/
|
||||
sprintf (PathDstWithFile,"%s/%s",
|
||||
snprintf (PathDstWithFile,sizeof (PathDstWithFile),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
Gbl.FileBrowser.Clipboard.FileName);
|
||||
|
||||
|
@ -6186,7 +6191,9 @@ static void Brw_PutIconRemoveFile (const char PathInTree[PATH_MAX + 1],
|
|||
Brw_PutParamsFileBrowser (Brw_ActAskRemoveFile[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Gbl.FileBrowser.FileType,-1L);
|
||||
sprintf (Gbl.Title,Txt_Remove_FILE_OR_LINK_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Remove_FILE_OR_LINK_X,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/remove-on64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"CONTEXT_OPT ICO_HIGHLIGHT ICO20x20\" />",
|
||||
|
@ -6219,7 +6226,9 @@ static void Brw_PutIconRemoveDir (const char PathInTree[PATH_MAX + 1],
|
|||
Brw_PutParamsFileBrowser (Brw_ActRemoveFolder[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Brw_IS_FOLDER,-1L);
|
||||
sprintf (Gbl.Title,Txt_Remove_folder_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Remove_folder_X,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/remove-on64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"CONTEXT_OPT ICO_HIGHLIGHT ICO20x20\" />",
|
||||
|
@ -6250,7 +6259,9 @@ static void Brw_PutIconCopy (const char PathInTree[PATH_MAX + 1],
|
|||
Brw_PutParamsFileBrowser (Brw_ActCopy[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Gbl.FileBrowser.FileType,-1L);
|
||||
sprintf (Gbl.Title,Txt_Copy_FOLDER_FILE_OR_LINK_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Copy_FOLDER_FILE_OR_LINK_X,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/copy_on16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -6278,7 +6289,9 @@ static void Brw_PutIconPasteOn (const char PathInTree[PATH_MAX + 1],
|
|||
Brw_PutParamsFileBrowser (Brw_ActPaste[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Brw_IS_FOLDER,-1L);
|
||||
sprintf (Gbl.Title,Txt_Paste_in_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Paste_in_X,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/paste_on16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -6393,7 +6406,7 @@ static void Brw_PutIconToExpandFolder (const char *FileBrowserId,const char *Row
|
|||
const char *FileNameToShow)
|
||||
{
|
||||
extern const char *Txt_Expand;
|
||||
char JavaScriptFunctionToExpandFolder[256 + Brw_MAX_ROW_ID];
|
||||
char JavaScriptFuncToExpandFolder[256 + Brw_MAX_ROW_ID];
|
||||
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"expand_%s_%s\"",
|
||||
|
@ -6403,15 +6416,18 @@ static void Brw_PutIconToExpandFolder (const char *FileBrowserId,const char *Row
|
|||
fprintf (Gbl.F.Out,">");
|
||||
|
||||
/***** Form and icon *****/
|
||||
sprintf (JavaScriptFunctionToExpandFolder,"ExpandFolder('%s_%s')",
|
||||
snprintf (JavaScriptFuncToExpandFolder,sizeof (JavaScriptFuncToExpandFolder),
|
||||
"ExpandFolder('%s_%s')",
|
||||
FileBrowserId,RowId);
|
||||
Act_StartFormAnchorOnSubmit (Brw_ActExpandFolder[Gbl.FileBrowser.Type],
|
||||
FileBrowserId,
|
||||
JavaScriptFunctionToExpandFolder); // JavaScript function to unhide rows
|
||||
JavaScriptFuncToExpandFolder); // JavaScript function to unhide rows
|
||||
Brw_PutParamsFileBrowser (Brw_ActExpandFolder[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Brw_IS_FOLDER,-1L);
|
||||
sprintf (Gbl.Title,"%s %s",Txt_Expand,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %s",
|
||||
Txt_Expand,FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/expand64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -6435,7 +6451,7 @@ static void Brw_PutIconToContractFolder (const char *FileBrowserId,const char *R
|
|||
const char *FileNameToShow)
|
||||
{
|
||||
extern const char *Txt_Contract;
|
||||
char JavaScriptFunctionToContractFolder[256 + Brw_MAX_ROW_ID];
|
||||
char JavaScriptFuncToContractFolder[256 + Brw_MAX_ROW_ID];
|
||||
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"contract_%s_%s\"",
|
||||
|
@ -6445,15 +6461,18 @@ static void Brw_PutIconToContractFolder (const char *FileBrowserId,const char *R
|
|||
fprintf (Gbl.F.Out,">");
|
||||
|
||||
/***** Form and icon *****/
|
||||
sprintf (JavaScriptFunctionToContractFolder,"ContractFolder('%s_%s')",
|
||||
snprintf (JavaScriptFuncToContractFolder,sizeof (JavaScriptFuncToContractFolder),
|
||||
"ContractFolder('%s_%s')",
|
||||
FileBrowserId,RowId);
|
||||
Act_StartFormAnchorOnSubmit (Brw_ActContractFolder[Gbl.FileBrowser.Type],
|
||||
FileBrowserId,
|
||||
JavaScriptFunctionToContractFolder); // JavaScript function to hide rows
|
||||
JavaScriptFuncToContractFolder); // JavaScript function to hide rows
|
||||
Brw_PutParamsFileBrowser (Brw_ActContractFolder[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Brw_IS_FOLDER,-1L);
|
||||
sprintf (Gbl.Title,"%s %s",Txt_Contract,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %s",
|
||||
Txt_Contract,FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/contract64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -6479,7 +6498,9 @@ static void Brw_PutIconShow (unsigned Level,const char *PathInTree,const char *F
|
|||
Brw_PutParamsFileBrowser (ActUnk,
|
||||
PathInTree,FileName,
|
||||
Gbl.FileBrowser.FileType,-1L);
|
||||
sprintf (Gbl.Title,Txt_Show_FOLDER_FILE_OR_LINK_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Show_FOLDER_FILE_OR_LINK_X,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/eye-slash-%s64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -6505,7 +6526,9 @@ static void Brw_PutIconHide (unsigned Level,const char *PathInTree,const char *F
|
|||
Brw_PutParamsFileBrowser (ActUnk,
|
||||
PathInTree,FileName,
|
||||
Gbl.FileBrowser.FileType,-1L);
|
||||
sprintf (Gbl.Title,Txt_Hide_FOLDER_FILE_OR_LINK_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Hide_FOLDER_FILE_OR_LINK_X,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/eye-%s64x64.png\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO20x20\" />",
|
||||
|
@ -6674,7 +6697,9 @@ static void Brw_PutIconFolderWithPlus (const char *FileBrowserId,const char *Row
|
|||
Brw_PutParamsFileBrowser (Brw_ActFormCreate[Gbl.FileBrowser.Type],
|
||||
PathInTree,FileName,
|
||||
Brw_IS_FOLDER,-1L);
|
||||
sprintf (Gbl.Title,Txt_Upload_file_or_create_folder_in_FOLDER,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Upload_file_or_create_folder_in_FOLDER,
|
||||
FileNameToShow);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\""
|
||||
" src=\"%s/folder-%s-plus16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
|
@ -6727,7 +6752,8 @@ static void Brw_PutIconFileWithLinkToViewMetadata (unsigned Size,
|
|||
FileMetadata->FilCod);
|
||||
|
||||
/***** Name and link of the file or folder *****/
|
||||
sprintf (Gbl.Title,Txt_View_data_of_FILE_OR_LINK_X,
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_View_data_of_FILE_OR_LINK_X,
|
||||
FileNameToShow);
|
||||
|
||||
/* Link to the form and to the file */
|
||||
|
@ -6864,7 +6890,8 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic,
|
|||
Gbl.FileBrowser.FileType,-1L);
|
||||
|
||||
/* Link to the form and to the file */
|
||||
sprintf (Gbl.Title,(Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ||
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
(Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ||
|
||||
Gbl.FileBrowser.Type == Brw_SHOW_MRK_GRP) ? Txt_Check_marks_in_file_X :
|
||||
Txt_Download_FILE_OR_LINK_X,
|
||||
FileNameToShow);
|
||||
|
@ -6929,7 +6956,8 @@ void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile,
|
|||
char Link[PATH_MAX + 1];
|
||||
|
||||
/***** Create, into temporary public directory, a symbolic link to file *****/
|
||||
sprintf (Link,"%s/%s/%s/%s",
|
||||
snprintf (Link,sizeof (Link),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,FileName);
|
||||
if (symlink (FullPathIncludingFile,Link) != 0)
|
||||
|
@ -7151,7 +7179,8 @@ void Brw_RemFileFromTree (void)
|
|||
|
||||
if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this file?
|
||||
{
|
||||
sprintf (Path,"%s/%s",
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
|
@ -7206,7 +7235,8 @@ void Brw_RemFolderFromTree (void)
|
|||
|
||||
if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this folder?
|
||||
{
|
||||
sprintf (Path,"%s/%s",
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
|
@ -7293,7 +7323,8 @@ void Brw_RemSubtreeInFileBrowser (void)
|
|||
|
||||
if (Brw_CheckIfICanEditFileOrFolder (Gbl.FileBrowser.Level)) // Can I remove this subtree?
|
||||
{
|
||||
sprintf (Path,"%s/%s",
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
|
@ -7428,49 +7459,56 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
case Brw_ADMI_DOC_INS:
|
||||
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,false);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_documents_management_area,
|
||||
Txt_institution,Ins.ShrtName);
|
||||
break;
|
||||
case Brw_ADMI_SHR_INS:
|
||||
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,false);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_shared_files_area,
|
||||
Txt_institution,Ins.ShrtName);
|
||||
break;
|
||||
case Brw_ADMI_DOC_CTR:
|
||||
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Ctr_GetDataOfCentreByCod (&Ctr);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_documents_management_area,
|
||||
Txt_centre,Ctr.ShrtName);
|
||||
break;
|
||||
case Brw_ADMI_SHR_CTR:
|
||||
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Ctr_GetDataOfCentreByCod (&Ctr);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_shared_files_area,
|
||||
Txt_centre,Ctr.ShrtName);
|
||||
break;
|
||||
case Brw_ADMI_DOC_DEG:
|
||||
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Deg_GetDataOfDegreeByCod (&Deg);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_documents_management_area,
|
||||
Txt_degree,Deg.ShrtName);
|
||||
break;
|
||||
case Brw_ADMI_SHR_DEG:
|
||||
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Deg_GetDataOfDegreeByCod (&Deg);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_shared_files_area,
|
||||
Txt_degree,Deg.ShrtName);
|
||||
break;
|
||||
case Brw_ADMI_DOC_CRS:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_documents_management_area,
|
||||
Txt_course,Crs.ShrtName);
|
||||
break;
|
||||
|
@ -7479,7 +7517,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
Crs.CrsCod = GrpDat.CrsCod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
Txt_documents_management_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
|
||||
|
@ -7487,7 +7526,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
case Brw_ADMI_TCH_CRS:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_teachers_files_area,
|
||||
Txt_course,Crs.ShrtName);
|
||||
break;
|
||||
|
@ -7496,7 +7536,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
Crs.CrsCod = GrpDat.CrsCod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
Txt_teachers_files_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
|
||||
|
@ -7504,7 +7545,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
case Brw_ADMI_SHR_CRS:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_shared_files_area,
|
||||
Txt_course,Crs.ShrtName);
|
||||
break;
|
||||
|
@ -7513,7 +7555,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
Crs.CrsCod = GrpDat.CrsCod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
Txt_shared_files_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
|
||||
|
@ -7521,7 +7564,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
case Brw_ADMI_ASG_USR:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_assignments_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_user[Gbl.Usrs.Me.UsrDat.Sex],Gbl.Usrs.Me.UsrDat.FullName);
|
||||
|
@ -7529,7 +7573,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
case Brw_ADMI_WRK_USR:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_works_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_user[Gbl.Usrs.Me.UsrDat.Sex],Gbl.Usrs.Me.UsrDat.FullName);
|
||||
|
@ -7540,7 +7585,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_assignments_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_user[UsrDat.Sex],UsrDat.FullName);
|
||||
|
@ -7552,7 +7598,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Usr_UsrDataConstructor (&UsrDat);
|
||||
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
|
||||
Usr_GetAllUsrDataFromUsrCod (&UsrDat);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Txt_works_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_user[UsrDat.Sex],UsrDat.FullName);
|
||||
|
@ -7565,7 +7612,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Prj_GetDataOfProjectByCod (&Prj);
|
||||
Crs.CrsCod = Prj.CrsCod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
|
||||
Gbl.FileBrowser.Clipboard.FileBrowser == Brw_ADMI_DOC_PRJ ? Txt_project_documents :
|
||||
Txt_project_assessment,
|
||||
Txt_course,Crs.ShrtName,
|
||||
|
@ -7575,7 +7623,8 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
case Brw_ADMI_MRK_CRS:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_marks_management_area,
|
||||
Txt_course,Crs.ShrtName);
|
||||
break;
|
||||
|
@ -7584,13 +7633,15 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
Crs.CrsCod = GrpDat.CrsCod;
|
||||
Crs_GetDataOfCourseByCod (&Crs);
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
|
||||
Txt_marks_management_area,
|
||||
Txt_course,Crs.ShrtName,
|
||||
Txt_group,GrpDat.GrpTypName,GrpDat.GrpName);
|
||||
break;
|
||||
case Brw_ADMI_BRF_USR:
|
||||
sprintf (TxtClipboardZone,"%s, %s <strong>%s</strong>",
|
||||
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
|
||||
"%s, %s <strong>%s</strong>",
|
||||
Txt_temporary_private_storage_area,
|
||||
Txt_user[Gbl.Usrs.Me.UsrDat.Sex],Gbl.Usrs.Me.UsrDat.FullName);
|
||||
break;
|
||||
|
@ -8417,7 +8468,8 @@ static void Brw_PasteClipboard (void)
|
|||
case Brw_ADMI_SHR_INS:
|
||||
Ins.InsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
if (Ins_GetDataOfInstitutionByCod (&Ins,false))
|
||||
sprintf (PathOrg,"%s/%s/%02u/%u/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%02u/%u/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_INS,
|
||||
(unsigned) (Ins.InsCod % 100),
|
||||
(unsigned) Ins.InsCod,
|
||||
|
@ -8429,7 +8481,8 @@ static void Brw_PasteClipboard (void)
|
|||
case Brw_ADMI_SHR_CTR:
|
||||
Ctr.CtrCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
if (Ctr_GetDataOfCentreByCod (&Ctr))
|
||||
sprintf (PathOrg,"%s/%s/%02u/%u/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%02u/%u/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CTR,
|
||||
(unsigned) (Ctr.CtrCod % 100),
|
||||
(unsigned) Ctr.CtrCod,
|
||||
|
@ -8441,7 +8494,8 @@ static void Brw_PasteClipboard (void)
|
|||
case Brw_ADMI_SHR_DEG:
|
||||
Deg.DegCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
if (Deg_GetDataOfDegreeByCod (&Deg))
|
||||
sprintf (PathOrg,"%s/%s/%02u/%u/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%02u/%u/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_DEG,
|
||||
(unsigned) (Deg.DegCod % 100),
|
||||
(unsigned) Deg.DegCod,
|
||||
|
@ -8455,7 +8509,8 @@ static void Brw_PasteClipboard (void)
|
|||
case Brw_ADMI_MRK_CRS:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
if (Crs_GetDataOfCourseByCod (&Crs))
|
||||
sprintf (PathOrg,"%s/%s/%ld/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,
|
||||
Gbl.FileBrowser.Clipboard.Path);
|
||||
else
|
||||
|
@ -8469,7 +8524,8 @@ static void Brw_PasteClipboard (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
Crs.CrsCod = GrpDat.CrsCod;
|
||||
if (Crs_GetDataOfCourseByCod (&Crs))
|
||||
sprintf (PathOrg,"%s/%s/%ld/%s/%ld/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%ld/%s/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,Cfg_FOLDER_GRP,
|
||||
GrpDat.GrpCod,
|
||||
Gbl.FileBrowser.Clipboard.Path);
|
||||
|
@ -8480,7 +8536,8 @@ static void Brw_PasteClipboard (void)
|
|||
case Brw_ADMI_WRK_USR:
|
||||
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
if (Crs_GetDataOfCourseByCod (&Crs))
|
||||
sprintf (PathOrg,"%s/%s/%ld/%s/%02u/%ld/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%ld/%s/%02u/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,Cfg_FOLDER_USR,
|
||||
(unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100),
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -8493,7 +8550,8 @@ static void Brw_PasteClipboard (void)
|
|||
PrjCod = Gbl.FileBrowser.Clipboard.Cod;
|
||||
Crs.CrsCod = Prj_GetCourseOfProject (PrjCod);
|
||||
if (Crs_GetDataOfCourseByCod (&Crs))
|
||||
sprintf (PathOrg,"%s/%s/%ld/%s/%02u/%ld/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s/%ld/%s/%02u/%ld/%s",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,Cfg_FOLDER_PRJ,
|
||||
(unsigned) (PrjCod % 100),
|
||||
PrjCod,
|
||||
|
@ -8502,7 +8560,8 @@ static void Brw_PasteClipboard (void)
|
|||
Lay_ShowErrorAndExit ("The copy source does not exist.");
|
||||
break;
|
||||
case Brw_ADMI_BRF_USR:
|
||||
sprintf (PathOrg,"%s/%s",
|
||||
snprintf (PathOrg,sizeof (PathOrg),
|
||||
"%s/%s",
|
||||
Gbl.Usrs.Me.PathDir,
|
||||
Gbl.FileBrowser.Clipboard.Path);
|
||||
break;
|
||||
|
@ -8652,10 +8711,13 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg,
|
|||
PATH_MAX);
|
||||
else // Origin of copy is a file or folder inside the root folder
|
||||
// for example "sha/folder1/file1"
|
||||
sprintf (PathDstInTreeWithFile,"%s/%s",PathDstInTree,FileNameOrg);
|
||||
snprintf (PathDstInTreeWithFile,sizeof (PathDstInTreeWithFile),
|
||||
"%s/%s",
|
||||
PathDstInTree,FileNameOrg);
|
||||
|
||||
/***** Construct the relative path of the destination file or folder *****/
|
||||
sprintf (PathDstWithFile,"%s/%s",
|
||||
snprintf (PathDstWithFile,sizeof (PathDstWithFile),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
PathDstInTreeWithFile);
|
||||
|
||||
|
@ -8803,7 +8865,9 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg,
|
|||
strcmp (FileList[NumFile]->d_name,".") &&
|
||||
strcmp (FileList[NumFile]->d_name,"..")) // Skip directories "." and ".."
|
||||
{
|
||||
sprintf (PathInFolderOrg,"%s/%s",PathOrg,FileList[NumFile]->d_name);
|
||||
snprintf (PathInFolderOrg,sizeof (PathInFolderOrg),
|
||||
"%s/%s",
|
||||
PathOrg,FileList[NumFile]->d_name);
|
||||
/* Recursive call to this function */
|
||||
if (!Brw_PasteTreeIntoFolder (LevelOrg + 1,
|
||||
PathInFolderOrg,
|
||||
|
@ -9158,7 +9222,8 @@ void Brw_RecFolderFileBrowser (void)
|
|||
if (Str_ConvertFilFolLnkNameToValid (Gbl.FileBrowser.NewFilFolLnkName))
|
||||
{
|
||||
/* In Gbl.FileBrowser.NewFilFolLnkName is the name of the new folder */
|
||||
sprintf (Path,"%s/%s",
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
|
@ -9194,7 +9259,8 @@ void Brw_RecFolderFileBrowser (void)
|
|||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
/* Add entry to the table of files/folders */
|
||||
sprintf (PathCompleteInTreeIncludingFolder,"%s/%s",
|
||||
snprintf (PathCompleteInTreeIncludingFolder,sizeof (PathCompleteInTreeIncludingFolder),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
Brw_AddPathToDB (Gbl.Usrs.Me.UsrDat.UsrCod,Brw_IS_FOLDER,
|
||||
|
@ -9266,10 +9332,12 @@ void Brw_RenFolderFileBrowser (void)
|
|||
if (strcmp (Gbl.FileBrowser.FilFolLnkName,Gbl.FileBrowser.NewFilFolLnkName)) // The name has changed
|
||||
{
|
||||
/* Gbl.FileBrowser.FilFolLnkName holds the new name of the folder */
|
||||
sprintf (OldPathInTree,"%s/%s",
|
||||
snprintf (OldPathInTree,sizeof (OldPathInTree),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||
Gbl.FileBrowser.FilFolLnkName);
|
||||
sprintf (OldPath,"%s/%s",
|
||||
snprintf (OldPath,sizeof (OldPath),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
OldPathInTree);
|
||||
|
||||
|
@ -9278,10 +9346,12 @@ void Brw_RenFolderFileBrowser (void)
|
|||
strlen (Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk) + 1 +
|
||||
strlen (Gbl.FileBrowser.NewFilFolLnkName) > PATH_MAX)
|
||||
Lay_ShowErrorAndExit ("Path is too long.");
|
||||
sprintf (NewPathInTree,"%s/%s",
|
||||
snprintf (NewPathInTree,sizeof (NewPathInTree),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathInTreeUntilFilFolLnk,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
sprintf (NewPath,"%s/%s",
|
||||
snprintf (NewPath,sizeof (NewPath),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
NewPathInTree);
|
||||
|
||||
|
@ -9456,10 +9526,13 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
if (Str_ConvertFilFolLnkNameToValid (Gbl.FileBrowser.NewFilFolLnkName)) // Gbl.Alert.Txt contains feedback text
|
||||
{
|
||||
/* Gbl.FileBrowser.NewFilFolLnkName holds the name of the new file */
|
||||
sprintf (Path,"%s/%s",
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
if (strlen (Path) + 1 + strlen (Gbl.FileBrowser.NewFilFolLnkName) + strlen (".tmp") > PATH_MAX)
|
||||
if (strlen (Path) + 1 +
|
||||
strlen (Gbl.FileBrowser.NewFilFolLnkName) +
|
||||
strlen (".tmp") > PATH_MAX)
|
||||
Lay_ShowErrorAndExit ("Path is too long.");
|
||||
Str_Concat (Path,"/",
|
||||
PATH_MAX);
|
||||
|
@ -9477,7 +9550,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
else // Destination file does not exist
|
||||
{
|
||||
/* End receiving the file */
|
||||
sprintf (PathTmp,"%s.tmp",Path);
|
||||
snprintf (PathTmp,sizeof (PathTmp),
|
||||
"%s.tmp",
|
||||
Path);
|
||||
FileIsValid = Fil_EndReceptionOfFile (PathTmp,Param); // Gbl.Alert.Txt contains feedback text
|
||||
|
||||
/* Check if the content of the file of marks is valid */
|
||||
|
@ -9521,7 +9596,9 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
/* Add entry to the table of files/folders */
|
||||
sprintf (PathCompleteInTreeIncludingFile,"%s/%s",
|
||||
snprintf (PathCompleteInTreeIncludingFile,
|
||||
sizeof (PathCompleteInTreeIncludingFile),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
Gbl.FileBrowser.NewFilFolLnkName);
|
||||
FilCod = Brw_AddPathToDB (Gbl.Usrs.Me.UsrDat.UsrCod,Brw_IS_FILE,
|
||||
|
@ -9665,7 +9742,8 @@ void Brw_RecLinkFileBrowser (void)
|
|||
if (Str_ConvertFilFolLnkNameToValid (FileName)) // Gbl.Alert.Txt contains feedback text
|
||||
{
|
||||
/* The name of the file with the link will be the FileName.url */
|
||||
sprintf (Path,"%s/%s",
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
if (strlen (Path) + 1 + strlen (FileName) + strlen (".url") > PATH_MAX)
|
||||
|
@ -9718,7 +9796,9 @@ void Brw_RecLinkFileBrowser (void)
|
|||
Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (Gbl.FileBrowser.Priv.FullPathInTree);
|
||||
|
||||
/* Add entry to the table of files/folders */
|
||||
sprintf (PathCompleteInTreeIncludingFile,"%s/%s.url",
|
||||
snprintf (PathCompleteInTreeIncludingFile,
|
||||
sizeof (PathCompleteInTreeIncludingFile),
|
||||
"%s/%s.url",
|
||||
Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
FileName);
|
||||
FilCod = Brw_AddPathToDB (Gbl.Usrs.Me.UsrDat.UsrCod,Brw_IS_LINK,
|
||||
|
@ -10670,7 +10750,9 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
|
|||
FileMetadata->FileType,-1L);
|
||||
|
||||
/* Link begin */
|
||||
sprintf (Gbl.Title,Txt_Check_marks_in_file_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Check_marks_in_file_X,
|
||||
FileNameToShow);
|
||||
Act_LinkFormSubmit (Gbl.Title,"FILENAME_TXT",NULL);
|
||||
Brw_PutIconFile (32,FileMetadata->FileType,FileMetadata->FilFolLnkName);
|
||||
|
||||
|
@ -10726,7 +10808,9 @@ static void Brw_WriteSmallLinkToDownloadFile (const char *URL,Brw_FileType_t Fil
|
|||
FileType,-1L);
|
||||
|
||||
/* Link begin */
|
||||
sprintf (Gbl.Title,Txt_Check_marks_in_file_X,FileNameToShow);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Check_marks_in_file_X,
|
||||
FileNameToShow);
|
||||
Act_LinkFormSubmit (Gbl.Title,"DAT",NULL);
|
||||
|
||||
/* Name of the file of marks, link end and form end */
|
||||
|
@ -10750,7 +10834,8 @@ void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char
|
|||
char URLWithSpaces[PATH_MAX + 1];
|
||||
|
||||
/***** Construct absolute path to file in the private directory *****/
|
||||
sprintf (FullPathIncludingFile,"%s/%s/%s",
|
||||
snprintf (FullPathIncludingFile,sizeof (FullPathIncludingFile),
|
||||
"%s/%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
PathInTree,FileName);
|
||||
|
||||
|
@ -10774,7 +10859,8 @@ void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char
|
|||
Brw_CreateTmpPublicLinkToPrivateFile (FullPathIncludingFile,FileName);
|
||||
|
||||
/***** Create URL pointing to symbolic link *****/
|
||||
sprintf (URLWithSpaces,"%s/%s/%s/%s",
|
||||
snprintf (URLWithSpaces,sizeof (URLWithSpaces),
|
||||
"%s/%s/%s/%s",
|
||||
Cfg_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||
Gbl.FileBrowser.TmpPubDir,
|
||||
FileName);
|
||||
|
@ -11250,7 +11336,9 @@ bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata)
|
|||
char Path[PATH_MAX + 1 + PATH_MAX + 1];
|
||||
struct stat FileStatus;
|
||||
|
||||
sprintf (Path,"%s/%s",Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
snprintf (Path,sizeof (Path),
|
||||
"%s/%s",
|
||||
Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
FileMetadata->FullPathInTree);
|
||||
if (lstat (Path,&FileStatus)) // On success ==> 0 is returned
|
||||
{
|
||||
|
@ -12334,7 +12422,8 @@ void Brw_RemoveGrpZones (long CrsCod,long GrpCod)
|
|||
Brw_RemoveGrpFilesFromDB (GrpCod);
|
||||
|
||||
/***** Remove group zones *****/
|
||||
sprintf (PathGrpFileZones,"%s/%s/%ld/grp/%ld",
|
||||
snprintf (PathGrpFileZones,sizeof (PathGrpFileZones),
|
||||
"%s/%s/%ld/grp/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,CrsCod,GrpCod);
|
||||
Fil_RemoveTree (PathGrpFileZones);
|
||||
}
|
||||
|
@ -12351,7 +12440,8 @@ void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs)
|
|||
Brw_RemoveWrkFilesFromDB (Crs->CrsCod,UsrDat->UsrCod);
|
||||
|
||||
/***** Remove the folder for this user inside the course *****/
|
||||
sprintf (PathUsrInCrs,"%s/%s/%ld/usr/%02u/%ld",
|
||||
snprintf (PathUsrInCrs,sizeof (PathUsrInCrs),
|
||||
"%s/%s/%ld/usr/%02u/%ld",
|
||||
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs->CrsCod,
|
||||
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
|
||||
Fil_RemoveTree (PathUsrInCrs);
|
||||
|
@ -12397,8 +12487,6 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat)
|
|||
/*****************************************************************************/
|
||||
// This function may be called inside a web service, so don't report error
|
||||
|
||||
#define Brw_MAX_BYTES_FILE_CONTENT_STR (100 + NAME_MAX + 100 + PATH_MAX + 100 + Usr_MAX_BYTES_FULL_NAME + 100 + Fil_MAX_BYTES_FILE_SIZE_STRING)
|
||||
|
||||
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||
char **ContentStr,
|
||||
long FilCod,bool GetContent)
|
||||
|
@ -12426,8 +12514,6 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
|
||||
/***** Copy some file metadata into content string *****/
|
||||
if (GetContent && ContentStr)
|
||||
{
|
||||
if ((*ContentStr = (char *) malloc (Brw_MAX_BYTES_FILE_CONTENT_STR)))
|
||||
{
|
||||
/* Get publisher */
|
||||
if (FileMetadata.PublisherUsrCod > 0)
|
||||
|
@ -12441,20 +12527,21 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
|||
/* Unknown publisher */
|
||||
FileHasPublisher = false;
|
||||
|
||||
sprintf (*ContentStr,"%s: %s<br />" // File name
|
||||
if (asprintf (ContentStr,"%s: %s<br />" // File name
|
||||
"%s: %s<br />" // File path
|
||||
"%s: %s", // Publisher
|
||||
Txt_Filename,FileMetadata.FilFolLnkName,
|
||||
Txt_Folder,FileMetadata.PathInTreeUntilFilFolLnk, // TODO: Fix bug: do not write internal name (for example "comun")
|
||||
Txt_Uploaded_by,FileHasPublisher ? PublisherUsrDat.FullName :
|
||||
Txt_ROLES_SINGUL_Abc[Rol_UNK][Usr_SEX_UNKNOWN]);
|
||||
Txt_Uploaded_by,
|
||||
FileHasPublisher ? PublisherUsrDat.FullName :
|
||||
Txt_ROLES_SINGUL_Abc[Rol_UNK][Usr_SEX_UNKNOWN]) < 0)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store string.");
|
||||
|
||||
/* Free memory used for publisher's data */
|
||||
if (FileMetadata.PublisherUsrCod > 0)
|
||||
Usr_UsrDataDestructor (&PublisherUsrDat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** List documents found ***************************/
|
||||
|
|
Loading…
Reference in New Issue
Block a user