mirror of https://github.com/acanas/swad-core.git
Version 16.151
This commit is contained in:
parent
266cb4e32e
commit
9dbbd79bbe
27
swad_MFU.c
27
swad_MFU.c
|
@ -45,8 +45,11 @@
|
||||||
/***************************** Private constants *****************************/
|
/***************************** Private constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define MFU_MAX_LENGTH_TAB (128 - 1)
|
#define MFU_MAX_CHARS_TAB (128 - 1)
|
||||||
#define MFU_MAX_LENGTH_MENU (128 - 1)
|
#define MFU_MAX_BYTES_TAB (MFU_MAX_CHARS_TAB * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
|
#define MFU_MAX_CHARS_MENU (128 - 1)
|
||||||
|
#define MFU_MAX_BYTES_MENU (MFU_MAX_CHARS_MENU * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Internal types *******************************/
|
/****************************** Internal types *******************************/
|
||||||
|
@ -215,9 +218,9 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
||||||
Act_Action_t Action;
|
Act_Action_t Action;
|
||||||
Act_Action_t SuperAction;
|
Act_Action_t SuperAction;
|
||||||
const char *Title;
|
const char *Title;
|
||||||
char TabStr[MFU_MAX_LENGTH_TAB + 1];
|
char TabStr[MFU_MAX_BYTES_TAB + 1];
|
||||||
char MenuStr[MFU_MAX_LENGTH_MENU + 1];
|
char MenuStr[MFU_MAX_BYTES_MENU + 1];
|
||||||
char TabMenuStr[MFU_MAX_LENGTH_TAB + 6 + MFU_MAX_LENGTH_MENU + 1];
|
char TabMenuStr[MFU_MAX_BYTES_TAB + 6 + MFU_MAX_BYTES_MENU + 1];
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_My_frequent_actions,NULL,Hlp_STATS_Frequent);
|
Lay_StartRoundFrame (NULL,Txt_My_frequent_actions,NULL,Hlp_STATS_Frequent);
|
||||||
|
@ -236,9 +239,9 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
||||||
/* Action string */
|
/* Action string */
|
||||||
SuperAction = Act_Actions[Action].SuperAction;
|
SuperAction = Act_Actions[Action].SuperAction;
|
||||||
Str_Copy (TabStr,Txt_TABS_TXT[Act_Actions[SuperAction].Tab],
|
Str_Copy (TabStr,Txt_TABS_TXT[Act_Actions[SuperAction].Tab],
|
||||||
MFU_MAX_LENGTH_TAB);
|
MFU_MAX_BYTES_TAB);
|
||||||
Str_Copy (MenuStr,Title,
|
Str_Copy (MenuStr,Title,
|
||||||
MFU_MAX_LENGTH_MENU);
|
MFU_MAX_BYTES_MENU);
|
||||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
||||||
|
|
||||||
/* Icon and text */
|
/* Icon and text */
|
||||||
|
@ -274,9 +277,9 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
||||||
Act_Action_t Action;
|
Act_Action_t Action;
|
||||||
Act_Action_t SuperAction;
|
Act_Action_t SuperAction;
|
||||||
const char *Title;
|
const char *Title;
|
||||||
char TabStr[MFU_MAX_LENGTH_TAB + 1];
|
char TabStr[MFU_MAX_BYTES_TAB + 1];
|
||||||
char MenuStr[MFU_MAX_LENGTH_MENU + 1];
|
char MenuStr[MFU_MAX_BYTES_MENU + 1];
|
||||||
char TabMenuStr[MFU_MAX_LENGTH_TAB + 6 + MFU_MAX_LENGTH_MENU + 1];
|
char TabMenuStr[MFU_MAX_BYTES_TAB + 6 + MFU_MAX_BYTES_MENU + 1];
|
||||||
|
|
||||||
/***** Start div and link *****/
|
/***** Start div and link *****/
|
||||||
fprintf (Gbl.F.Out,"<div id=\"MFU_actions\">");
|
fprintf (Gbl.F.Out,"<div id=\"MFU_actions\">");
|
||||||
|
@ -300,9 +303,9 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
||||||
/* Action string */
|
/* Action string */
|
||||||
SuperAction = Act_Actions[Action].SuperAction;
|
SuperAction = Act_Actions[Action].SuperAction;
|
||||||
Str_Copy (TabStr,Txt_TABS_TXT[Act_Actions[SuperAction].Tab],
|
Str_Copy (TabStr,Txt_TABS_TXT[Act_Actions[SuperAction].Tab],
|
||||||
MFU_MAX_LENGTH_TAB);
|
MFU_MAX_BYTES_TAB);
|
||||||
Str_Copy (MenuStr,Title,
|
Str_Copy (MenuStr,Title,
|
||||||
MFU_MAX_LENGTH_MENU);
|
MFU_MAX_BYTES_MENU);
|
||||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
||||||
|
|
||||||
/* Icon and text */
|
/* Icon and text */
|
||||||
|
|
|
@ -204,13 +204,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.150 (2017-03-07)"
|
#define Log_PLATFORM_VERSION "SWAD 16.151 (2017-03-07)"
|
||||||
#define CSS_FILE "swad16.147.css"
|
#define CSS_FILE "swad16.147.css"
|
||||||
#define JS_FILE "swad16.144.js"
|
#define JS_FILE "swad16.144.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.151: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216422 lines)
|
||||||
Version 16.150: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216409 lines)
|
Version 16.150: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216409 lines)
|
||||||
Version 16.149: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216385 lines)
|
Version 16.149: Mar 07, 2017 Code refactoring related to number of chars and bytes. (216385 lines)
|
||||||
Version 16.148: Mar 06, 2017 Code refactoring in notifications. (216393 lines)
|
Version 16.148: Mar 06, 2017 Code refactoring in notifications. (216393 lines)
|
||||||
|
|
|
@ -330,7 +330,7 @@ void Enr_WriteFormToReqAnotherUsrID (Act_Action_t NextAction)
|
||||||
"</label>",
|
"</label>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
Txt_nick_email_or_ID,
|
Txt_nick_email_or_ID,
|
||||||
Usr_MAX_BYTES_USR_LOGIN);
|
Usr_MAX_CHARS_USR_LOGIN);
|
||||||
|
|
||||||
/***** Send button*****/
|
/***** Send button*****/
|
||||||
Lay_PutConfirmButton (Txt_Continue);
|
Lay_PutConfirmButton (Txt_Continue);
|
||||||
|
@ -1420,7 +1420,8 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
||||||
UsrDat.UsrCod = -1L;
|
UsrDat.UsrCod = -1L;
|
||||||
|
|
||||||
/* Find next string in text */
|
/* Find next string in text */
|
||||||
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,Usr_MAX_BYTES_USR_LOGIN);
|
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
|
||||||
|
Usr_MAX_BYTES_USR_LOGIN);
|
||||||
|
|
||||||
/* Reset default list of users' codes */
|
/* Reset default list of users' codes */
|
||||||
ListUsrCods.NumUsrs = 0;
|
ListUsrCods.NumUsrs = 0;
|
||||||
|
@ -1542,7 +1543,8 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
||||||
ItLooksLikeAUsrID = false;
|
ItLooksLikeAUsrID = false;
|
||||||
|
|
||||||
/* Find next string in text */
|
/* Find next string in text */
|
||||||
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,Usr_MAX_BYTES_USR_LOGIN);
|
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
|
||||||
|
Usr_MAX_BYTES_USR_LOGIN);
|
||||||
|
|
||||||
/* Reset default list of users' codes */
|
/* Reset default list of users' codes */
|
||||||
ListUsrCods.NumUsrs = 0;
|
ListUsrCods.NumUsrs = 0;
|
||||||
|
|
|
@ -11139,7 +11139,7 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t Qu
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// This function may be called inside a web service, so don't report error
|
// 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_NAME + 1) * 3 + 100 + Fil_MAX_BYTES_FILE_SIZE_STRING)
|
#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[Cns_MAX_BYTES_SUMMARY_STRING + 1],
|
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
|
||||||
char **ContentStr,
|
char **ContentStr,
|
||||||
|
|
|
@ -602,10 +602,10 @@ struct Globals
|
||||||
long CrsCod;
|
long CrsCod;
|
||||||
char ShrtName[Crs_MAX_BYTES_COURSE_SHRT_NAME + 1];
|
char ShrtName[Crs_MAX_BYTES_COURSE_SHRT_NAME + 1];
|
||||||
} Courses[Crs_MAX_COURSES_PER_USR]; // Distinct courses in my messages sent or received
|
} Courses[Crs_MAX_COURSES_PER_USR]; // Distinct courses in my messages sent or received
|
||||||
long FilterCrsCod; // Show only messages sent from this course code
|
long FilterCrsCod; // Show only messages sent from this course code
|
||||||
char FilterCrsShrtName[Crs_MAX_BYTES_COURSE_SHRT_NAME + 1];
|
char FilterCrsShrtName[Crs_MAX_BYTES_COURSE_SHRT_NAME + 1];
|
||||||
char FilterFromTo[Usr_MAX_LENGTH_USR_NAME_OR_SURNAME * 3 + 1]; // Show only messages from/to these users
|
char FilterFromTo[Usr_MAX_BYTES_FULL_NAME + 1]; // Show only messages from/to these users
|
||||||
char FilterContent[Msg_MAX_LENGTH_FILTER_CONTENT + 1]; // Show only messages that match this content
|
char FilterContent[Msg_MAX_BYTES_FILTER_CONTENT + 1]; // Show only messages that match this content
|
||||||
bool ShowOnlyUnreadMsgs; // Show only unread messages (this option is applicable only for received messages)
|
bool ShowOnlyUnreadMsgs; // Show only unread messages (this option is applicable only for received messages)
|
||||||
long ExpandedMsgCod; // The current expanded message code
|
long ExpandedMsgCod; // The current expanded message code
|
||||||
struct
|
struct
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
/***************************** Public constants ******************************/
|
/***************************** Public constants ******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Hie_MAX_LENGTH_LOCATION_SHORT_NAME 32
|
|
||||||
#define Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR (Hie_MAX_LENGTH_LOCATION_SHORT_NAME * Str_MAX_LENGTH_SPEC_CHAR_HTML)
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************* Public types ********************************/
|
/******************************* Public types ********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -310,7 +310,7 @@ void Hld_GetListHolidays (void)
|
||||||
|
|
||||||
/* Get the full name of the place (row[2]) */
|
/* Get the full name of the place (row[2]) */
|
||||||
Str_Copy (Hld->PlaceFullName,row[2],
|
Str_Copy (Hld->PlaceFullName,row[2],
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
|
|
||||||
/* Get type (row[3]) */
|
/* Get type (row[3]) */
|
||||||
Hld->HldTyp = Hld_GetTypeOfHoliday (row[3]);
|
Hld->HldTyp = Hld_GetTypeOfHoliday (row[3]);
|
||||||
|
@ -335,7 +335,7 @@ void Hld_GetListHolidays (void)
|
||||||
|
|
||||||
/* Get the name of the holiday/non school period (row[6]) */
|
/* Get the name of the holiday/non school period (row[6]) */
|
||||||
Str_Copy (Hld->Name,row[6],
|
Str_Copy (Hld->Name,row[6],
|
||||||
Hld_MAX_LENGTH_HOLIDAY_NAME);
|
Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ static void Hld_GetDataOfHolidayByCod (struct Holiday *Hld)
|
||||||
|
|
||||||
/* Get the full name of the place (row[1]) */
|
/* Get the full name of the place (row[1]) */
|
||||||
Str_Copy (Hld->PlaceFullName,row[1],
|
Str_Copy (Hld->PlaceFullName,row[1],
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
|
|
||||||
/* Get type (row[2]) */
|
/* Get type (row[2]) */
|
||||||
Hld->HldTyp = Hld_GetTypeOfHoliday (row[2]);
|
Hld->HldTyp = Hld_GetTypeOfHoliday (row[2]);
|
||||||
|
@ -427,7 +427,7 @@ static void Hld_GetDataOfHolidayByCod (struct Holiday *Hld)
|
||||||
|
|
||||||
/* Get the name of the holiday/non school period (row[5]) */
|
/* Get the name of the holiday/non school period (row[5]) */
|
||||||
Str_Copy (Hld->Name,row[5],
|
Str_Copy (Hld->Name,row[5],
|
||||||
Hld_MAX_LENGTH_HOLIDAY_NAME);
|
Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -596,7 +596,7 @@ static void Hld_ListHolidaysForEdition (void)
|
||||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Name\""
|
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Name\""
|
||||||
" size=\"20\" maxlength=\"%u\" value=\"%s\""
|
" size=\"20\" maxlength=\"%u\" value=\"%s\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Hld_MAX_LENGTH_HOLIDAY_NAME,Hld->Name,Gbl.Form.Id);
|
Hld_MAX_CHARS_HOLIDAY_NAME,Hld->Name,Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
@ -694,7 +694,7 @@ void Hld_ChangeHolidayPlace (void)
|
||||||
/***** Show the form again *****/
|
/***** Show the form again *****/
|
||||||
Hld->PlcCod = NewPlace.PlcCod;
|
Hld->PlcCod = NewPlace.PlcCod;
|
||||||
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
|
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
Hld_EditHolidays ();
|
Hld_EditHolidays ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ void Hld_RenameHoliday (void)
|
||||||
extern const char *Txt_The_name_of_the_holiday_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_holiday_X_has_not_changed;
|
||||||
char Query[512];
|
char Query[512];
|
||||||
struct Holiday *Hld;
|
struct Holiday *Hld;
|
||||||
char NewHldName[Hld_MAX_LENGTH_HOLIDAY_NAME + 1];
|
char NewHldName[Hld_MAX_BYTES_HOLIDAY_NAME + 1];
|
||||||
|
|
||||||
Hld = &Gbl.Hlds.EditingHld;
|
Hld = &Gbl.Hlds.EditingHld;
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ void Hld_RenameHoliday (void)
|
||||||
Lay_ShowErrorAndExit ("Code of holiday is missing.");
|
Lay_ShowErrorAndExit ("Code of holiday is missing.");
|
||||||
|
|
||||||
/* Get the new name for the holiday */
|
/* Get the new name for the holiday */
|
||||||
Par_GetParToText ("Name",NewHldName,Hld_MAX_LENGTH_HOLIDAY_NAME);
|
Par_GetParToText ("Name",NewHldName,Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||||
|
|
||||||
/***** Get from the database the old names of the holiday *****/
|
/***** Get from the database the old names of the holiday *****/
|
||||||
Hld_GetDataOfHolidayByCod (Hld);
|
Hld_GetDataOfHolidayByCod (Hld);
|
||||||
|
@ -890,7 +890,7 @@ void Hld_RenameHoliday (void)
|
||||||
|
|
||||||
/***** Show the form again *****/
|
/***** Show the form again *****/
|
||||||
Str_Copy (Hld->Name,NewHldName,
|
Str_Copy (Hld->Name,NewHldName,
|
||||||
Hld_MAX_LENGTH_HOLIDAY_NAME);
|
Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||||
Hld_EditHolidays ();
|
Hld_EditHolidays ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,7 +1005,7 @@ static void Hld_PutFormToCreateHoliday (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td></td>"
|
"<td></td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Hld_MAX_LENGTH_HOLIDAY_NAME,Hld->Name);
|
Hld_MAX_CHARS_HOLIDAY_NAME,Hld->Name);
|
||||||
|
|
||||||
/***** Send button and end of frame *****/
|
/***** Send button and end of frame *****/
|
||||||
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_holiday);
|
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_holiday);
|
||||||
|
@ -1099,7 +1099,7 @@ void Hld_RecFormNewHoliday (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get holiday name *****/
|
/***** Get holiday name *****/
|
||||||
Par_GetParToText ("Name",Hld->Name,Hld_MAX_LENGTH_HOLIDAY_NAME);
|
Par_GetParToText ("Name",Hld->Name,Hld_MAX_BYTES_HOLIDAY_NAME);
|
||||||
|
|
||||||
/***** Create the new holiday or write warning message *****/
|
/***** Create the new holiday or write warning message *****/
|
||||||
if (Hld->Name[0]) // If there's a holiday name
|
if (Hld->Name[0]) // If there's a holiday name
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Hld_MAX_LENGTH_HOLIDAY_NAME 127
|
#define Hld_MAX_CHARS_HOLIDAY_NAME (128 - 1)
|
||||||
|
#define Hld_MAX_BYTES_HOLIDAY_NAME (Hld_MAX_CHARS_HOLIDAY_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
#define Hld_NUM_TYPES_HOLIDAY 2
|
#define Hld_NUM_TYPES_HOLIDAY 2
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -54,11 +55,11 @@ struct Holiday
|
||||||
{
|
{
|
||||||
long HldCod;
|
long HldCod;
|
||||||
long PlcCod;
|
long PlcCod;
|
||||||
char PlaceFullName[Plc_MAX_LENGTH_PLACE_FULL_NAME + 1];
|
char PlaceFullName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
||||||
Hld_HolidayType_t HldTyp;
|
Hld_HolidayType_t HldTyp;
|
||||||
struct Date StartDate;
|
struct Date StartDate;
|
||||||
struct Date EndDate;
|
struct Date EndDate;
|
||||||
char Name[Hld_MAX_LENGTH_HOLIDAY_NAME + 1];
|
char Name[Hld_MAX_BYTES_HOLIDAY_NAME + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define Hld_NUM_ORDERS 2
|
#define Hld_NUM_ORDERS 2
|
||||||
|
|
|
@ -351,13 +351,13 @@ void Img_SetParamNames (struct ParamUploadImg *ParamUploadImg,int NumImgInForm)
|
||||||
if (NumImgInForm < 0) // One unique image in form ==> no suffix needed
|
if (NumImgInForm < 0) // One unique image in form ==> no suffix needed
|
||||||
{
|
{
|
||||||
Str_Copy (ParamUploadImg->Action,"ImgAct",
|
Str_Copy (ParamUploadImg->Action,"ImgAct",
|
||||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
Img_MAX_BYTES_PARAM_UPLOAD_IMG);
|
||||||
Str_Copy (ParamUploadImg->File ,"ImgFil",
|
Str_Copy (ParamUploadImg->File ,"ImgFil",
|
||||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
Img_MAX_BYTES_PARAM_UPLOAD_IMG);
|
||||||
Str_Copy (ParamUploadImg->Title ,"ImgTit",
|
Str_Copy (ParamUploadImg->Title ,"ImgTit",
|
||||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
Img_MAX_BYTES_PARAM_UPLOAD_IMG);
|
||||||
Str_Copy (ParamUploadImg->URL ,"ImgURL",
|
Str_Copy (ParamUploadImg->URL ,"ImgURL",
|
||||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
Img_MAX_BYTES_PARAM_UPLOAD_IMG);
|
||||||
}
|
}
|
||||||
else // Several images in form ==> add suffix
|
else // Several images in form ==> add suffix
|
||||||
{
|
{
|
||||||
|
|
10
swad_image.h
10
swad_image.h
|
@ -100,13 +100,13 @@ struct Image
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Parameters used in a form to upload an image *****/
|
/***** Parameters used in a form to upload an image *****/
|
||||||
#define Img_MAX_LENGTH_PARAM_UPLOAD_IMG (16 - 1)
|
#define Img_MAX_BYTES_PARAM_UPLOAD_IMG (16 - 1)
|
||||||
struct ParamUploadImg
|
struct ParamUploadImg
|
||||||
{
|
{
|
||||||
char Action[Img_MAX_LENGTH_PARAM_UPLOAD_IMG + 1];
|
char Action[Img_MAX_BYTES_PARAM_UPLOAD_IMG + 1];
|
||||||
char File [Img_MAX_LENGTH_PARAM_UPLOAD_IMG + 1];
|
char File [Img_MAX_BYTES_PARAM_UPLOAD_IMG + 1];
|
||||||
char Title [Img_MAX_LENGTH_PARAM_UPLOAD_IMG + 1];
|
char Title [Img_MAX_BYTES_PARAM_UPLOAD_IMG + 1];
|
||||||
char URL [Img_MAX_LENGTH_PARAM_UPLOAD_IMG + 1];
|
char URL [Img_MAX_BYTES_PARAM_UPLOAD_IMG + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -385,7 +385,7 @@ static void Ins_Configuration (bool PrintView)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_FULL_NAME\""
|
" class=\"INPUT_FULL_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME,
|
Ins_MAX_CHARS_INSTIT_FULL_NAME,
|
||||||
Gbl.CurrentIns.Ins.FullName,
|
Gbl.CurrentIns.Ins.FullName,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
@ -414,7 +414,7 @@ static void Ins_Configuration (bool PrintView)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME,
|
Ins_MAX_CHARS_INSTIT_SHRT_NAME,
|
||||||
Gbl.CurrentIns.Ins.ShrtName,
|
Gbl.CurrentIns.Ins.ShrtName,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
@ -1030,11 +1030,11 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
||||||
|
|
||||||
/* Get the short name of the institution (row[4]) */
|
/* Get the short name of the institution (row[4]) */
|
||||||
Str_Copy (Ins->ShrtName,row[4],
|
Str_Copy (Ins->ShrtName,row[4],
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
Ins_MAX_BYTES_INSTIT_SHRT_NAME);
|
||||||
|
|
||||||
/* Get the full name of the institution (row[5]) */
|
/* Get the full name of the institution (row[5]) */
|
||||||
Str_Copy (Ins->FullName,row[5],
|
Str_Copy (Ins->FullName,row[5],
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
Ins_MAX_BYTES_INSTIT_FULL_NAME);
|
||||||
|
|
||||||
/* Get the URL of the institution (row[6]) */
|
/* Get the URL of the institution (row[6]) */
|
||||||
Str_Copy (Ins->WWW,row[6],
|
Str_Copy (Ins->WWW,row[6],
|
||||||
|
@ -1145,11 +1145,11 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins,
|
||||||
|
|
||||||
/* Get the short name of the institution (row[3]) */
|
/* Get the short name of the institution (row[3]) */
|
||||||
Str_Copy (Ins->ShrtName,row[3],
|
Str_Copy (Ins->ShrtName,row[3],
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
Ins_MAX_BYTES_INSTIT_SHRT_NAME);
|
||||||
|
|
||||||
/* Get the full name of the institution (row[4]) */
|
/* Get the full name of the institution (row[4]) */
|
||||||
Str_Copy (Ins->FullName,row[4],
|
Str_Copy (Ins->FullName,row[4],
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
Ins_MAX_BYTES_INSTIT_FULL_NAME);
|
||||||
|
|
||||||
/* Get the URL of the institution (row[5]) */
|
/* Get the URL of the institution (row[5]) */
|
||||||
Str_Copy (Ins->WWW,row[5],
|
Str_Copy (Ins->WWW,row[5],
|
||||||
|
@ -1194,7 +1194,7 @@ void Ins_GetShortNameOfInstitutionByCod (struct Instit *Ins)
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
long InsCod;
|
long InsCod;
|
||||||
char ShrtName[Ins_MAX_LENGTH_INSTIT_SHRT_NAME + 1];
|
char ShrtName[Ins_MAX_BYTES_INSTIT_SHRT_NAME + 1];
|
||||||
} Cached =
|
} Cached =
|
||||||
{
|
{
|
||||||
-1L,
|
-1L,
|
||||||
|
@ -1217,7 +1217,7 @@ void Ins_GetShortNameOfInstitutionByCod (struct Instit *Ins)
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
Str_Copy (Cached.ShrtName,row[0],
|
Str_Copy (Cached.ShrtName,row[0],
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
Ins_MAX_BYTES_INSTIT_SHRT_NAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Cached.ShrtName[0] = '\0';
|
Cached.ShrtName[0] = '\0';
|
||||||
|
@ -1227,7 +1227,7 @@ void Ins_GetShortNameOfInstitutionByCod (struct Instit *Ins)
|
||||||
}
|
}
|
||||||
|
|
||||||
Str_Copy (Ins->ShrtName,Cached.ShrtName,
|
Str_Copy (Ins->ShrtName,Cached.ShrtName,
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
Ins_MAX_BYTES_INSTIT_SHRT_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,7 +1245,7 @@ static void Ins_GetFullNameAndCtyOfInstitutionByCod (struct Instit *Ins,
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
long InsCod;
|
long InsCod;
|
||||||
char FullName[Ins_MAX_LENGTH_INSTIT_FULL_NAME + 1];
|
char FullName[Ins_MAX_BYTES_INSTIT_FULL_NAME + 1];
|
||||||
char CtyName[Cty_MAX_BYTES_COUNTRY_NAME + 1];
|
char CtyName[Cty_MAX_BYTES_COUNTRY_NAME + 1];
|
||||||
} Cached =
|
} Cached =
|
||||||
{
|
{
|
||||||
|
@ -1276,7 +1276,7 @@ static void Ins_GetFullNameAndCtyOfInstitutionByCod (struct Instit *Ins,
|
||||||
|
|
||||||
/* Get the full name of this institution (row[0]) */
|
/* Get the full name of this institution (row[0]) */
|
||||||
Str_Copy (Cached.FullName,row[0],
|
Str_Copy (Cached.FullName,row[0],
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
Ins_MAX_BYTES_INSTIT_FULL_NAME);
|
||||||
|
|
||||||
/* Get the name of the country (row[1]) */
|
/* Get the name of the country (row[1]) */
|
||||||
Str_Copy (Cached.CtyName,row[1],
|
Str_Copy (Cached.CtyName,row[1],
|
||||||
|
@ -1293,7 +1293,7 @@ static void Ins_GetFullNameAndCtyOfInstitutionByCod (struct Instit *Ins,
|
||||||
}
|
}
|
||||||
|
|
||||||
Str_Copy (Ins->FullName,Cached.FullName,
|
Str_Copy (Ins->FullName,Cached.FullName,
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
Ins_MAX_BYTES_INSTIT_FULL_NAME);
|
||||||
Str_Copy (CtyName,Cached.CtyName,
|
Str_Copy (CtyName,Cached.CtyName,
|
||||||
Cty_MAX_BYTES_COUNTRY_NAME);
|
Cty_MAX_BYTES_COUNTRY_NAME);
|
||||||
}
|
}
|
||||||
|
@ -1453,7 +1453,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME,Ins->ShrtName,
|
Ins_MAX_CHARS_INSTIT_SHRT_NAME,Ins->ShrtName,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
@ -1471,7 +1471,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_FULL_NAME\""
|
" class=\"INPUT_FULL_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME,
|
Ins_MAX_CHARS_INSTIT_FULL_NAME,
|
||||||
Ins->FullName,
|
Ins->FullName,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
@ -1765,28 +1765,28 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
|
||||||
extern const char *Txt_The_name_of_the_institution_X_has_not_changed;
|
extern const char *Txt_The_name_of_the_institution_X_has_not_changed;
|
||||||
const char *ParamName = NULL; // Initialized to avoid warning
|
const char *ParamName = NULL; // Initialized to avoid warning
|
||||||
const char *FieldName = NULL; // Initialized to avoid warning
|
const char *FieldName = NULL; // Initialized to avoid warning
|
||||||
unsigned MaxLength = 0; // Initialized to avoid warning
|
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||||
char *CurrentInsName = NULL; // Initialized to avoid warning
|
char *CurrentInsName = NULL; // Initialized to avoid warning
|
||||||
char NewInsName[Ins_MAX_LENGTH_INSTIT_FULL_NAME + 1];
|
char NewInsName[Ins_MAX_BYTES_INSTIT_FULL_NAME + 1];
|
||||||
|
|
||||||
switch (ShrtOrFullName)
|
switch (ShrtOrFullName)
|
||||||
{
|
{
|
||||||
case Cns_SHRT_NAME:
|
case Cns_SHRT_NAME:
|
||||||
ParamName = "ShortName";
|
ParamName = "ShortName";
|
||||||
FieldName = "ShortName";
|
FieldName = "ShortName";
|
||||||
MaxLength = Ins_MAX_LENGTH_INSTIT_SHRT_NAME;
|
MaxBytes = Ins_MAX_BYTES_INSTIT_SHRT_NAME;
|
||||||
CurrentInsName = Ins->ShrtName;
|
CurrentInsName = Ins->ShrtName;
|
||||||
break;
|
break;
|
||||||
case Cns_FULL_NAME:
|
case Cns_FULL_NAME:
|
||||||
ParamName = "FullName";
|
ParamName = "FullName";
|
||||||
FieldName = "FullName";
|
FieldName = "FullName";
|
||||||
MaxLength = Ins_MAX_LENGTH_INSTIT_FULL_NAME;
|
MaxBytes = Ins_MAX_BYTES_INSTIT_FULL_NAME;
|
||||||
CurrentInsName = Ins->FullName;
|
CurrentInsName = Ins->FullName;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Get the new name for the institution from form *****/
|
/***** Get the new name for the institution from form *****/
|
||||||
Par_GetParToText (ParamName,NewInsName,MaxLength);
|
Par_GetParToText (ParamName,NewInsName,MaxBytes);
|
||||||
|
|
||||||
/***** Get from the database the old names of the institution *****/
|
/***** Get from the database the old names of the institution *****/
|
||||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
||||||
|
@ -1820,7 +1820,7 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
|
||||||
CurrentInsName,NewInsName);
|
CurrentInsName,NewInsName);
|
||||||
|
|
||||||
/* Change current institution name in order to display it properly */
|
/* Change current institution name in order to display it properly */
|
||||||
Str_Copy (CurrentInsName,NewInsName,MaxLength);
|
Str_Copy (CurrentInsName,NewInsName,MaxBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // The same name
|
else // The same name
|
||||||
|
@ -1835,7 +1835,7 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO
|
||||||
|
|
||||||
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod)
|
static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Name,long InsCod,long CtyCod)
|
||||||
{
|
{
|
||||||
char Query[256 + Ins_MAX_LENGTH_INSTIT_FULL_NAME];
|
char Query[256 + Ins_MAX_BYTES_INSTIT_FULL_NAME];
|
||||||
|
|
||||||
/***** Get number of institutions in current country with a name from database *****/
|
/***** Get number of institutions in current country with a name from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM institutions"
|
sprintf (Query,"SELECT COUNT(*) FROM institutions"
|
||||||
|
@ -1850,7 +1850,7 @@ static bool Ins_CheckIfInsNameExistsInCty (const char *FieldName,const char *Nam
|
||||||
|
|
||||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
|
static void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName)
|
||||||
{
|
{
|
||||||
char Query[128 + Ins_MAX_LENGTH_INSTIT_FULL_NAME];
|
char Query[128 + Ins_MAX_BYTES_INSTIT_FULL_NAME];
|
||||||
|
|
||||||
/***** Update institution changing old name by new name */
|
/***** Update institution changing old name by new name */
|
||||||
sprintf (Query,"UPDATE institutions SET %s='%s' WHERE InsCod='%ld'",
|
sprintf (Query,"UPDATE institutions SET %s='%s' WHERE InsCod='%ld'",
|
||||||
|
@ -2196,7 +2196,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME,Ins->ShrtName);
|
Ins_MAX_CHARS_INSTIT_SHRT_NAME,Ins->ShrtName);
|
||||||
|
|
||||||
/***** Institution full name *****/
|
/***** Institution full name *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||||
|
@ -2205,7 +2205,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
||||||
" class=\"INPUT_FULL_NAME\""
|
" class=\"INPUT_FULL_NAME\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME,Ins->FullName);
|
Ins_MAX_CHARS_INSTIT_FULL_NAME,Ins->FullName);
|
||||||
|
|
||||||
/***** Institution WWW *****/
|
/***** Institution WWW *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||||
|
@ -2349,10 +2349,10 @@ static void Ins_RecFormRequestOrCreateIns (unsigned Status)
|
||||||
Ins->CtyCod = Gbl.CurrentCty.Cty.CtyCod;
|
Ins->CtyCod = Gbl.CurrentCty.Cty.CtyCod;
|
||||||
|
|
||||||
/* Get institution short name */
|
/* Get institution short name */
|
||||||
Par_GetParToText ("ShortName",Ins->ShrtName,Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
Par_GetParToText ("ShortName",Ins->ShrtName,Ins_MAX_BYTES_INSTIT_SHRT_NAME);
|
||||||
|
|
||||||
/* Get institution full name */
|
/* Get institution full name */
|
||||||
Par_GetParToText ("FullName",Ins->FullName,Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
Par_GetParToText ("FullName",Ins->FullName,Ins_MAX_BYTES_INSTIT_FULL_NAME);
|
||||||
|
|
||||||
/* Get institution WWW */
|
/* Get institution WWW */
|
||||||
Par_GetParToText ("WWW",Ins->WWW,Cns_MAX_BYTES_WWW);
|
Par_GetParToText ("WWW",Ins->WWW,Cns_MAX_BYTES_WWW);
|
||||||
|
@ -2395,8 +2395,8 @@ static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Created_new_institution_X;
|
extern const char *Txt_Created_new_institution_X;
|
||||||
char Query[512 +
|
char Query[512 +
|
||||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME +
|
Ins_MAX_BYTES_INSTIT_SHRT_NAME +
|
||||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME +
|
Ins_MAX_BYTES_INSTIT_FULL_NAME +
|
||||||
Cns_MAX_BYTES_WWW];
|
Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new institution *****/
|
/***** Create a new institution *****/
|
||||||
|
|
|
@ -55,8 +55,11 @@ typedef enum
|
||||||
|
|
||||||
#define Ins_MAX_INSTITS_PER_USR 10 // Used in list of my institutions
|
#define Ins_MAX_INSTITS_PER_USR 10 // Used in list of my institutions
|
||||||
|
|
||||||
#define Ins_MAX_LENGTH_INSTIT_SHRT_NAME 32
|
#define Ins_MAX_CHARS_INSTIT_SHRT_NAME 32
|
||||||
#define Ins_MAX_LENGTH_INSTIT_FULL_NAME 1024
|
#define Ins_MAX_BYTES_INSTIT_SHRT_NAME (Ins_MAX_CHARS_INSTIT_SHRT_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
|
#define Ins_MAX_CHARS_INSTIT_FULL_NAME (128 - 1)
|
||||||
|
#define Ins_MAX_BYTES_INSTIT_FULL_NAME (Ins_MAX_CHARS_INSTIT_FULL_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
struct Instit
|
struct Instit
|
||||||
{
|
{
|
||||||
|
@ -64,8 +67,8 @@ struct Instit
|
||||||
long CtyCod;
|
long CtyCod;
|
||||||
Ins_Status_t Status; // Institution status
|
Ins_Status_t Status; // Institution status
|
||||||
long RequesterUsrCod; // User code of the person who requested the creation of this institution
|
long RequesterUsrCod; // User code of the person who requested the creation of this institution
|
||||||
char ShrtName[Ins_MAX_LENGTH_INSTIT_SHRT_NAME + 1];
|
char ShrtName[Ins_MAX_BYTES_INSTIT_SHRT_NAME + 1];
|
||||||
char FullName[Ins_MAX_LENGTH_INSTIT_FULL_NAME + 1];
|
char FullName[Ins_MAX_BYTES_INSTIT_FULL_NAME + 1];
|
||||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
unsigned NumUsrsWhoClaimToBelongToIns;
|
unsigned NumUsrsWhoClaimToBelongToIns;
|
||||||
unsigned NumCtrs;
|
unsigned NumCtrs;
|
||||||
|
|
32
swad_link.c
32
swad_link.c
|
@ -233,11 +233,11 @@ void Lnk_GetListLinks (void)
|
||||||
|
|
||||||
/* Get the short name of the link (row[1]) */
|
/* Get the short name of the link (row[1]) */
|
||||||
Str_Copy (Lnk->ShrtName,row[1],
|
Str_Copy (Lnk->ShrtName,row[1],
|
||||||
Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
Lnk_MAX_BYTES_LINK_SHRT_NAME);
|
||||||
|
|
||||||
/* Get the full name of the link (row[2]) */
|
/* Get the full name of the link (row[2]) */
|
||||||
Str_Copy (Lnk->FullName,row[2],
|
Str_Copy (Lnk->FullName,row[2],
|
||||||
Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
Lnk_MAX_BYTES_LINK_FULL_NAME);
|
||||||
|
|
||||||
/* Get the URL of the link (row[3]) */
|
/* Get the URL of the link (row[3]) */
|
||||||
Str_Copy (Lnk->WWW,row[3],
|
Str_Copy (Lnk->WWW,row[3],
|
||||||
|
@ -281,11 +281,11 @@ void Lnk_GetDataOfLinkByCod (struct Link *Lnk)
|
||||||
|
|
||||||
/* Get the short name of the link (row[0]) */
|
/* Get the short name of the link (row[0]) */
|
||||||
Str_Copy (Lnk->ShrtName,row[0],
|
Str_Copy (Lnk->ShrtName,row[0],
|
||||||
Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
Lnk_MAX_BYTES_LINK_SHRT_NAME);
|
||||||
|
|
||||||
/* Get the full name of the link (row[1]) */
|
/* Get the full name of the link (row[1]) */
|
||||||
Str_Copy (Lnk->FullName,row[1],
|
Str_Copy (Lnk->FullName,row[1],
|
||||||
Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
Lnk_MAX_BYTES_LINK_FULL_NAME);
|
||||||
|
|
||||||
/* Get the URL of the link (row[2]) */
|
/* Get the URL of the link (row[2]) */
|
||||||
Str_Copy (Lnk->WWW,row[2],
|
Str_Copy (Lnk->WWW,row[2],
|
||||||
|
@ -358,7 +358,7 @@ static void Lnk_ListLinksForEdition (void)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Lnk_MAX_LENGTH_LINK_SHRT_NAME,Lnk->ShrtName,
|
Lnk_MAX_CHARS_LINK_SHRT_NAME,Lnk->ShrtName,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
@ -371,7 +371,7 @@ static void Lnk_ListLinksForEdition (void)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_FULL_NAME\""
|
" class=\"INPUT_FULL_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Lnk_MAX_LENGTH_LINK_FULL_NAME,Lnk->FullName,
|
Lnk_MAX_CHARS_LINK_FULL_NAME,Lnk->FullName,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
@ -475,9 +475,9 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
struct Link *Lnk;
|
struct Link *Lnk;
|
||||||
const char *ParamName = NULL; // Initialized to avoid warning
|
const char *ParamName = NULL; // Initialized to avoid warning
|
||||||
const char *FieldName = NULL; // Initialized to avoid warning
|
const char *FieldName = NULL; // Initialized to avoid warning
|
||||||
unsigned MaxLength = 0; // Initialized to avoid warning
|
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||||
char *CurrentLnkName = NULL; // Initialized to avoid warning
|
char *CurrentLnkName = NULL; // Initialized to avoid warning
|
||||||
char NewLnkName[Lnk_MAX_LENGTH_LINK_FULL_NAME + 1];
|
char NewLnkName[Lnk_MAX_BYTES_LINK_FULL_NAME + 1];
|
||||||
|
|
||||||
Lnk = &Gbl.Links.EditingLnk;
|
Lnk = &Gbl.Links.EditingLnk;
|
||||||
switch (ShrtOrFullName)
|
switch (ShrtOrFullName)
|
||||||
|
@ -485,13 +485,13 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
case Cns_SHRT_NAME:
|
case Cns_SHRT_NAME:
|
||||||
ParamName = "ShortName";
|
ParamName = "ShortName";
|
||||||
FieldName = "ShortName";
|
FieldName = "ShortName";
|
||||||
MaxLength = Lnk_MAX_LENGTH_LINK_SHRT_NAME;
|
MaxBytes = Lnk_MAX_BYTES_LINK_SHRT_NAME;
|
||||||
CurrentLnkName = Lnk->ShrtName;
|
CurrentLnkName = Lnk->ShrtName;
|
||||||
break;
|
break;
|
||||||
case Cns_FULL_NAME:
|
case Cns_FULL_NAME:
|
||||||
ParamName = "FullName";
|
ParamName = "FullName";
|
||||||
FieldName = "FullName";
|
FieldName = "FullName";
|
||||||
MaxLength = Lnk_MAX_LENGTH_LINK_FULL_NAME;
|
MaxBytes = Lnk_MAX_BYTES_LINK_FULL_NAME;
|
||||||
CurrentLnkName = Lnk->FullName;
|
CurrentLnkName = Lnk->FullName;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
Lay_ShowErrorAndExit ("Code of institutional link is missing.");
|
Lay_ShowErrorAndExit ("Code of institutional link is missing.");
|
||||||
|
|
||||||
/* Get the new name for the link */
|
/* Get the new name for the link */
|
||||||
Par_GetParToText (ParamName,NewLnkName,MaxLength);
|
Par_GetParToText (ParamName,NewLnkName,MaxBytes);
|
||||||
|
|
||||||
/***** Get from the database the old names of the link *****/
|
/***** Get from the database the old names of the link *****/
|
||||||
Lnk_GetDataOfLinkByCod (Lnk);
|
Lnk_GetDataOfLinkByCod (Lnk);
|
||||||
|
@ -549,7 +549,7 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
|
|
||||||
/***** Show the form again *****/
|
/***** Show the form again *****/
|
||||||
Str_Copy (CurrentLnkName,NewLnkName,
|
Str_Copy (CurrentLnkName,NewLnkName,
|
||||||
MaxLength);
|
MaxBytes);
|
||||||
Lnk_EditLinks ();
|
Lnk_EditLinks ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ static void Lnk_PutFormToCreateLink (void)
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Lnk_MAX_LENGTH_LINK_SHRT_NAME,Lnk->ShrtName);
|
Lnk_MAX_CHARS_LINK_SHRT_NAME,Lnk->ShrtName);
|
||||||
|
|
||||||
/***** Link full name *****/
|
/***** Link full name *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
@ -654,7 +654,7 @@ static void Lnk_PutFormToCreateLink (void)
|
||||||
" class=\"INPUT_FULL_NAME\""
|
" class=\"INPUT_FULL_NAME\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Lnk_MAX_LENGTH_LINK_FULL_NAME,Lnk->FullName);
|
Lnk_MAX_CHARS_LINK_FULL_NAME,Lnk->FullName);
|
||||||
|
|
||||||
/***** Link WWW *****/
|
/***** Link WWW *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
@ -720,10 +720,10 @@ void Lnk_RecFormNewLink (void)
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get link short name */
|
/* Get link short name */
|
||||||
Par_GetParToText ("ShortName",Lnk->ShrtName,Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
Par_GetParToText ("ShortName",Lnk->ShrtName,Lnk_MAX_BYTES_LINK_SHRT_NAME);
|
||||||
|
|
||||||
/* Get link full name */
|
/* Get link full name */
|
||||||
Par_GetParToText ("FullName",Lnk->FullName,Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
Par_GetParToText ("FullName",Lnk->FullName,Lnk_MAX_BYTES_LINK_FULL_NAME);
|
||||||
|
|
||||||
/* Get link URL */
|
/* Get link URL */
|
||||||
Par_GetParToText ("WWW",Lnk->WWW,Cns_MAX_BYTES_WWW);
|
Par_GetParToText ("WWW",Lnk->WWW,Cns_MAX_BYTES_WWW);
|
||||||
|
|
11
swad_link.h
11
swad_link.h
|
@ -31,14 +31,17 @@
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Lnk_MAX_LENGTH_LINK_SHRT_NAME 32
|
#define Lnk_MAX_CHARS_LINK_SHRT_NAME 32
|
||||||
#define Lnk_MAX_LENGTH_LINK_FULL_NAME 127
|
#define Lnk_MAX_BYTES_LINK_SHRT_NAME (Lnk_MAX_CHARS_LINK_SHRT_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
|
#define Lnk_MAX_CHARS_LINK_FULL_NAME (128 - 1)
|
||||||
|
#define Lnk_MAX_BYTES_LINK_FULL_NAME (Lnk_MAX_CHARS_LINK_FULL_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
struct Link
|
struct Link
|
||||||
{
|
{
|
||||||
long LnkCod;
|
long LnkCod;
|
||||||
char ShrtName[Lnk_MAX_LENGTH_LINK_SHRT_NAME + 1];
|
char ShrtName[Lnk_MAX_BYTES_LINK_SHRT_NAME + 1];
|
||||||
char FullName[Lnk_MAX_LENGTH_LINK_FULL_NAME + 1];
|
char FullName[Lnk_MAX_BYTES_LINK_FULL_NAME + 1];
|
||||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
56
swad_mail.c
56
swad_mail.c
|
@ -67,8 +67,8 @@ extern struct Globals Gbl;
|
||||||
static void Mai_GetParamMaiOrder (void);
|
static void Mai_GetParamMaiOrder (void);
|
||||||
static void Mai_PutIconToEditMailDomains (void);
|
static void Mai_PutIconToEditMailDomains (void);
|
||||||
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
||||||
static void Mai_GetMailDomain (const char *Email,char MailDomain[Mai_MAX_LENGTH_MAIL_DOMAIN + 1]);
|
static void Mai_GetMailDomain (const char *Email,char MailDomain[Mai_MAX_BYTES_MAIL_DOMAIN + 1]);
|
||||||
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Mai_MAX_LENGTH_MAIL_DOMAIN + 1]);
|
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Mai_MAX_BYTES_MAIL_DOMAIN + 1]);
|
||||||
|
|
||||||
static void Mai_ListMailDomainsForEdition (void);
|
static void Mai_ListMailDomainsForEdition (void);
|
||||||
static void Mai_PutParamMaiCod (long MaiCod);
|
static void Mai_PutParamMaiCod (long MaiCod);
|
||||||
|
@ -288,11 +288,11 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
|
||||||
|
|
||||||
/* Get the mail domain (row[1]) */
|
/* Get the mail domain (row[1]) */
|
||||||
Str_Copy (Mai->Domain,row[1],
|
Str_Copy (Mai->Domain,row[1],
|
||||||
Mai_MAX_LENGTH_MAIL_DOMAIN);
|
Mai_MAX_BYTES_MAIL_DOMAIN);
|
||||||
|
|
||||||
/* Get the mail domain info (row[2]) */
|
/* Get the mail domain info (row[2]) */
|
||||||
Str_Copy (Mai->Info,row[2],
|
Str_Copy (Mai->Info,row[2],
|
||||||
Mai_MAX_LENGTH_MAIL_INFO);
|
Mai_MAX_BYTES_MAIL_INFO);
|
||||||
|
|
||||||
/* Get number of users (row[3]) */
|
/* Get number of users (row[3]) */
|
||||||
if (sscanf (row[3],"%u",&(Mai->NumUsrs)) != 1)
|
if (sscanf (row[3],"%u",&(Mai->NumUsrs)) != 1)
|
||||||
|
@ -317,7 +317,7 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
|
||||||
|
|
||||||
bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
char MailDomain[Mai_MAX_LENGTH_MAIL_DOMAIN + 1];
|
char MailDomain[Mai_MAX_BYTES_MAIL_DOMAIN + 1];
|
||||||
|
|
||||||
/***** Check #1: is my email address confirmed? *****/
|
/***** Check #1: is my email address confirmed? *****/
|
||||||
if (!UsrDat->EmailConfirmed)
|
if (!UsrDat->EmailConfirmed)
|
||||||
|
@ -332,7 +332,7 @@ bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
||||||
/********************** Get mailbox from email address ***********************/
|
/********************** Get mailbox from email address ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mai_GetMailDomain (const char *Email,char MailDomain[Mai_MAX_LENGTH_MAIL_DOMAIN + 1])
|
static void Mai_GetMailDomain (const char *Email,char MailDomain[Mai_MAX_BYTES_MAIL_DOMAIN + 1])
|
||||||
{
|
{
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ static void Mai_GetMailDomain (const char *Email,char MailDomain[Mai_MAX_LENGTH_
|
||||||
Ptr++; // Skip '@'
|
Ptr++; // Skip '@'
|
||||||
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
|
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
|
||||||
Str_Copy (MailDomain,Ptr,
|
Str_Copy (MailDomain,Ptr,
|
||||||
Mai_MAX_LENGTH_MAIL_DOMAIN);
|
Mai_MAX_BYTES_MAIL_DOMAIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ static void Mai_GetMailDomain (const char *Email,char MailDomain[Mai_MAX_LENGTH_
|
||||||
/************ Check if a mail domain is allowed for notifications ************/
|
/************ Check if a mail domain is allowed for notifications ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Mai_MAX_LENGTH_MAIL_DOMAIN + 1])
|
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Mai_MAX_BYTES_MAIL_DOMAIN + 1])
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
|
@ -414,11 +414,11 @@ void Mai_GetDataOfMailDomainByCod (struct Mail *Mai)
|
||||||
|
|
||||||
/* Get the short name of the mail (row[0]) */
|
/* Get the short name of the mail (row[0]) */
|
||||||
Str_Copy (Mai->Domain,row[0],
|
Str_Copy (Mai->Domain,row[0],
|
||||||
Mai_MAX_LENGTH_MAIL_DOMAIN);
|
Mai_MAX_BYTES_MAIL_DOMAIN);
|
||||||
|
|
||||||
/* Get the full name of the mail (row[1]) */
|
/* Get the full name of the mail (row[1]) */
|
||||||
Str_Copy (Mai->Info,row[1],
|
Str_Copy (Mai->Info,row[1],
|
||||||
Mai_MAX_LENGTH_MAIL_INFO);
|
Mai_MAX_BYTES_MAIL_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -487,7 +487,7 @@ static void Mai_ListMailDomainsForEdition (void)
|
||||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Domain\""
|
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Domain\""
|
||||||
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Mai_MAX_LENGTH_MAIL_DOMAIN,Mai->Domain,
|
Mai_MAX_CHARS_MAIL_DOMAIN,Mai->Domain,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
@ -499,7 +499,7 @@ static void Mai_ListMailDomainsForEdition (void)
|
||||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Info\""
|
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Info\""
|
||||||
" size=\"40\" maxlength=\"%u\" value=\"%s\""
|
" size=\"40\" maxlength=\"%u\" value=\"%s\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Mai_MAX_LENGTH_MAIL_INFO,Mai->Info,
|
Mai_MAX_CHARS_MAIL_INFO,Mai->Info,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
@ -596,9 +596,9 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
struct Mail *Mai;
|
struct Mail *Mai;
|
||||||
const char *ParamName = NULL; // Initialized to avoid warning
|
const char *ParamName = NULL; // Initialized to avoid warning
|
||||||
const char *FieldName = NULL; // Initialized to avoid warning
|
const char *FieldName = NULL; // Initialized to avoid warning
|
||||||
unsigned MaxLength = 0; // Initialized to avoid warning
|
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||||
char *CurrentMaiName = NULL; // Initialized to avoid warning
|
char *CurrentMaiName = NULL; // Initialized to avoid warning
|
||||||
char NewMaiName[Mai_MAX_LENGTH_MAIL_INFO + 1];
|
char NewMaiName[Mai_MAX_BYTES_MAIL_INFO + 1];
|
||||||
|
|
||||||
Mai = &Gbl.Mails.EditingMai;
|
Mai = &Gbl.Mails.EditingMai;
|
||||||
switch (ShrtOrFullName)
|
switch (ShrtOrFullName)
|
||||||
|
@ -606,13 +606,13 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
case Cns_SHRT_NAME:
|
case Cns_SHRT_NAME:
|
||||||
ParamName = "Domain";
|
ParamName = "Domain";
|
||||||
FieldName = "Domain";
|
FieldName = "Domain";
|
||||||
MaxLength = Mai_MAX_LENGTH_MAIL_DOMAIN;
|
MaxBytes = Mai_MAX_BYTES_MAIL_DOMAIN;
|
||||||
CurrentMaiName = Mai->Domain;
|
CurrentMaiName = Mai->Domain;
|
||||||
break;
|
break;
|
||||||
case Cns_FULL_NAME:
|
case Cns_FULL_NAME:
|
||||||
ParamName = "Info";
|
ParamName = "Info";
|
||||||
FieldName = "Info";
|
FieldName = "Info";
|
||||||
MaxLength = Mai_MAX_LENGTH_MAIL_INFO;
|
MaxBytes = Mai_MAX_BYTES_MAIL_INFO;
|
||||||
CurrentMaiName = Mai->Info;
|
CurrentMaiName = Mai->Info;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
Lay_ShowErrorAndExit ("Code of mail domain is missing.");
|
Lay_ShowErrorAndExit ("Code of mail domain is missing.");
|
||||||
|
|
||||||
/* Get the new name for the mail */
|
/* Get the new name for the mail */
|
||||||
Par_GetParToText (ParamName,NewMaiName,MaxLength);
|
Par_GetParToText (ParamName,NewMaiName,MaxBytes);
|
||||||
|
|
||||||
/***** Get from the database the old names of the mail *****/
|
/***** Get from the database the old names of the mail *****/
|
||||||
Mai_GetDataOfMailDomainByCod (Mai);
|
Mai_GetDataOfMailDomainByCod (Mai);
|
||||||
|
@ -670,7 +670,7 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
|
|
||||||
/***** Show the form again *****/
|
/***** Show the form again *****/
|
||||||
Str_Copy (CurrentMaiName,NewMaiName,
|
Str_Copy (CurrentMaiName,NewMaiName,
|
||||||
MaxLength);
|
MaxBytes);
|
||||||
Mai_EditMailDomains ();
|
Mai_EditMailDomains ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +728,7 @@ static void Mai_PutFormToCreateMailDomain (void)
|
||||||
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Mai_MAX_LENGTH_MAIL_DOMAIN,Mai->Domain);
|
Mai_MAX_CHARS_MAIL_DOMAIN,Mai->Domain);
|
||||||
|
|
||||||
/***** Mail domain info *****/
|
/***** Mail domain info *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
@ -738,7 +738,7 @@ static void Mai_PutFormToCreateMailDomain (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td></td>"
|
"<td></td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Mai_MAX_LENGTH_MAIL_INFO,Mai->Info);
|
Mai_MAX_CHARS_MAIL_INFO,Mai->Info);
|
||||||
|
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
|
@ -792,10 +792,10 @@ void Mai_RecFormNewMailDomain (void)
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get mail short name */
|
/* Get mail short name */
|
||||||
Par_GetParToText ("Domain",Mai->Domain,Mai_MAX_LENGTH_MAIL_DOMAIN);
|
Par_GetParToText ("Domain",Mai->Domain,Mai_MAX_BYTES_MAIL_DOMAIN);
|
||||||
|
|
||||||
/* Get mail full name */
|
/* Get mail full name */
|
||||||
Par_GetParToText ("Info",Mai->Info,Mai_MAX_LENGTH_MAIL_INFO);
|
Par_GetParToText ("Info",Mai->Info,Mai_MAX_BYTES_MAIL_INFO);
|
||||||
|
|
||||||
if (Mai->Domain[0] && Mai->Info[0]) // If there's a mail name
|
if (Mai->Domain[0] && Mai->Info[0]) // If there's a mail name
|
||||||
{
|
{
|
||||||
|
@ -846,7 +846,7 @@ static void Mai_CreateMailDomain (struct Mail *Mai)
|
||||||
/****** List the emails of all the students to creates an email message ******/
|
/****** List the emails of all the students to creates an email message ******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Mai_MAX_LENGTH_STR_ADDR (32 * 5000)
|
#define Mai_MAX_BYTES_STR_ADDR (256 * 1024 - 1)
|
||||||
|
|
||||||
void Mai_ListEmails (void)
|
void Mai_ListEmails (void)
|
||||||
{
|
{
|
||||||
|
@ -859,7 +859,7 @@ void Mai_ListEmails (void)
|
||||||
unsigned NumUsr;
|
unsigned NumUsr;
|
||||||
unsigned NumStdsWithEmail;
|
unsigned NumStdsWithEmail;
|
||||||
unsigned NumAcceptedStdsWithEmail;
|
unsigned NumAcceptedStdsWithEmail;
|
||||||
char StrAddresses[Mai_MAX_LENGTH_STR_ADDR + 1];
|
char StrAddresses[Mai_MAX_BYTES_STR_ADDR + 1]; // TODO: Use malloc depending on the number of students
|
||||||
unsigned int LengthStrAddr = 0;
|
unsigned int LengthStrAddr = 0;
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
|
|
||||||
|
@ -906,16 +906,16 @@ void Mai_ListEmails (void)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,", ");
|
fprintf (Gbl.F.Out,", ");
|
||||||
LengthStrAddr ++;
|
LengthStrAddr ++;
|
||||||
if (LengthStrAddr > Mai_MAX_LENGTH_STR_ADDR)
|
if (LengthStrAddr > Mai_MAX_BYTES_STR_ADDR)
|
||||||
Lay_ShowErrorAndExit ("The space allocated to store email addresses is full.");
|
Lay_ShowErrorAndExit ("The space allocated to store email addresses is full.");
|
||||||
Str_Concat (StrAddresses,",",
|
Str_Concat (StrAddresses,",",
|
||||||
Mai_MAX_LENGTH_STR_ADDR);
|
Mai_MAX_BYTES_STR_ADDR);
|
||||||
}
|
}
|
||||||
LengthStrAddr += strlen (UsrDat.Email);
|
LengthStrAddr += strlen (UsrDat.Email);
|
||||||
if (LengthStrAddr > Mai_MAX_LENGTH_STR_ADDR)
|
if (LengthStrAddr > Mai_MAX_BYTES_STR_ADDR)
|
||||||
Lay_ShowErrorAndExit ("The space allocated to store email addresses is full.");
|
Lay_ShowErrorAndExit ("The space allocated to store email addresses is full.");
|
||||||
Str_Concat (StrAddresses,UsrDat.Email,
|
Str_Concat (StrAddresses,UsrDat.Email,
|
||||||
Mai_MAX_LENGTH_STR_ADDR);
|
Mai_MAX_BYTES_STR_ADDR);
|
||||||
fprintf (Gbl.F.Out,"<a href=\"mailto:%s?subject=%s\">%s</a>",
|
fprintf (Gbl.F.Out,"<a href=\"mailto:%s?subject=%s\">%s</a>",
|
||||||
UsrDat.Email,Gbl.CurrentCrs.Crs.FullName,UsrDat.Email);
|
UsrDat.Email,Gbl.CurrentCrs.Crs.FullName,UsrDat.Email);
|
||||||
|
|
||||||
|
|
11
swad_mail.h
11
swad_mail.h
|
@ -33,8 +33,11 @@
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Mai_MAX_LENGTH_MAIL_DOMAIN (128 - 1)
|
#define Mai_MAX_CHARS_MAIL_DOMAIN (128 - 1)
|
||||||
#define Mai_MAX_LENGTH_MAIL_INFO (128 - 1)
|
#define Mai_MAX_BYTES_MAIL_DOMAIN (Mai_MAX_CHARS_MAIL_DOMAIN * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
|
#define Mai_MAX_CHARS_MAIL_INFO (128 - 1)
|
||||||
|
#define Mai_MAX_BYTES_MAIL_INFO (Mai_MAX_CHARS_MAIL_INFO * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
#define Mai_NUM_ORDERS 3
|
#define Mai_NUM_ORDERS 3
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -48,8 +51,8 @@ typedef enum
|
||||||
struct Mail
|
struct Mail
|
||||||
{
|
{
|
||||||
long MaiCod;
|
long MaiCod;
|
||||||
char Domain[Mai_MAX_LENGTH_MAIL_DOMAIN + 1];
|
char Domain[Mai_MAX_BYTES_MAIL_DOMAIN + 1];
|
||||||
char Info[Mai_MAX_LENGTH_MAIL_INFO + 1];
|
char Info[Mai_MAX_BYTES_MAIL_INFO + 1];
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ extern struct Globals Gbl;
|
||||||
/***************************** Private constants *****************************/
|
/***************************** Private constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Msg_MAX_LENGTH_MESSAGES_QUERY 4096
|
#define Msg_MAX_BYTES_MESSAGES_QUERY (4 * 1024 - 1)
|
||||||
|
|
||||||
// Forum images will be saved with:
|
// Forum images will be saved with:
|
||||||
// - maximum width of Msg_IMAGE_SAVED_MAX_HEIGHT
|
// - maximum width of Msg_IMAGE_SAVED_MAX_HEIGHT
|
||||||
|
@ -103,7 +103,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void);
|
||||||
static void Msg_WriteFormSubjectAndContentMsgToUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]);
|
static void Msg_WriteFormSubjectAndContentMsgToUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]);
|
||||||
static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs);
|
static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs);
|
||||||
|
|
||||||
static void Msg_MakeFilterFromToSubquery (char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1]);
|
static void Msg_MakeFilterFromToSubquery (char FilterFromToSubquery[Msg_MAX_BYTES_MESSAGES_QUERY + 1]);
|
||||||
|
|
||||||
static void Msg_ExpandSentMsg (long MsgCod);
|
static void Msg_ExpandSentMsg (long MsgCod);
|
||||||
static void Msg_ExpandReceivedMsg (long MsgCod);
|
static void Msg_ExpandReceivedMsg (long MsgCod);
|
||||||
|
@ -641,7 +641,6 @@ void Msg_RecMsgFromUsr (void)
|
||||||
unsigned NumRecipientsToBeNotifiedByEMail = 0;
|
unsigned NumRecipientsToBeNotifiedByEMail = 0;
|
||||||
struct UsrData UsrDstData;
|
struct UsrData UsrDstData;
|
||||||
int NumErrors = 0;
|
int NumErrors = 0;
|
||||||
char *ListUsrsDst;
|
|
||||||
long NewMsgCod = -1L; // Initiliazed to avoid warning
|
long NewMsgCod = -1L; // Initiliazed to avoid warning
|
||||||
bool MsgAlreadyInserted = false;
|
bool MsgAlreadyInserted = false;
|
||||||
bool CreateNotif;
|
bool CreateNotif;
|
||||||
|
@ -701,12 +700,6 @@ void Msg_RecMsgFromUsr (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Allocate space to store a list of recipients with the following format:
|
|
||||||
"FirstName Surname1 Surname2; FirstName Surname1 Surname2; FirstName Surname1 Surname2" *****/
|
|
||||||
if ((ListUsrsDst = (char *) malloc (((Usr_MAX_BYTES_NAME + 1) * 3 + 1)*NumRecipients)) == NULL)
|
|
||||||
Lay_ShowErrorAndExit ("Not enough memory to store email addresses of recipients.");
|
|
||||||
ListUsrsDst[0] = '\0';
|
|
||||||
|
|
||||||
/***** Initialize structure with user's data *****/
|
/***** Initialize structure with user's data *****/
|
||||||
Usr_UsrDataConstructor (&UsrDstData);
|
Usr_UsrDataConstructor (&UsrDstData);
|
||||||
|
|
||||||
|
@ -799,9 +792,6 @@ void Msg_RecMsgFromUsr (void)
|
||||||
Usr_UsrDataDestructor (&UsrDstData);
|
Usr_UsrDataDestructor (&UsrDstData);
|
||||||
|
|
||||||
/***** Free memory *****/
|
/***** Free memory *****/
|
||||||
/* Free memory used for list of recipients' names */
|
|
||||||
free (ListUsrsDst);
|
|
||||||
|
|
||||||
/* Free memory used for list of users */
|
/* Free memory used for list of users */
|
||||||
Usr_FreeListOtherRecipients ();
|
Usr_FreeListOtherRecipients ();
|
||||||
Usr_FreeListsSelectedUsrsCods ();
|
Usr_FreeListsSelectedUsrsCods ();
|
||||||
|
@ -941,7 +931,7 @@ void Msg_ReqDelAllSntMsgs (void)
|
||||||
|
|
||||||
void Msg_DelAllRecMsgs (void)
|
void Msg_DelAllRecMsgs (void)
|
||||||
{
|
{
|
||||||
char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char FilterFromToSubquery[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
unsigned long NumMsgs;
|
unsigned long NumMsgs;
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
|
@ -963,7 +953,7 @@ void Msg_DelAllRecMsgs (void)
|
||||||
|
|
||||||
void Msg_DelAllSntMsgs (void)
|
void Msg_DelAllSntMsgs (void)
|
||||||
{
|
{
|
||||||
char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char FilterFromToSubquery[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
unsigned long NumMsgs;
|
unsigned long NumMsgs;
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
|
@ -1028,7 +1018,7 @@ void Msg_GetParamFilterFromTo (void)
|
||||||
{
|
{
|
||||||
/***** Get "from"/"to" filter *****/
|
/***** Get "from"/"to" filter *****/
|
||||||
Par_GetParToText ("FilterFromTo",Gbl.Msg.FilterFromTo,
|
Par_GetParToText ("FilterFromTo",Gbl.Msg.FilterFromTo,
|
||||||
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME * 3);
|
Usr_MAX_BYTES_FULL_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1039,17 +1029,17 @@ void Msg_GetParamFilterContent (void)
|
||||||
{
|
{
|
||||||
/***** Get content filter *****/
|
/***** Get content filter *****/
|
||||||
Par_GetParToText ("FilterContent",Gbl.Msg.FilterContent,
|
Par_GetParToText ("FilterContent",Gbl.Msg.FilterContent,
|
||||||
Msg_MAX_LENGTH_FILTER_CONTENT);
|
Msg_MAX_BYTES_FILTER_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* Make "from"/"to" subquery *************************/
|
/************************* Make "from"/"to" subquery *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Msg_MakeFilterFromToSubquery (char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1])
|
static void Msg_MakeFilterFromToSubquery (char FilterFromToSubquery[Msg_MAX_BYTES_MESSAGES_QUERY + 1])
|
||||||
{
|
{
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
char SearchWord[Usr_MAX_LENGTH_USR_NAME_OR_SURNAME + 1];
|
char SearchWord[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
|
|
||||||
/***** Split "from"/"to" string into words *****/
|
/***** Split "from"/"to" string into words *****/
|
||||||
if (Gbl.Msg.FilterFromTo[0])
|
if (Gbl.Msg.FilterFromTo[0])
|
||||||
|
@ -1057,19 +1047,20 @@ static void Msg_MakeFilterFromToSubquery (char FilterFromToSubquery[Msg_MAX_LENG
|
||||||
Ptr = Gbl.Msg.FilterFromTo;
|
Ptr = Gbl.Msg.FilterFromTo;
|
||||||
Str_Copy (FilterFromToSubquery,
|
Str_Copy (FilterFromToSubquery,
|
||||||
" AND CONCAT(usr_data.FirstName,usr_data.Surname1,usr_data.Surname2) LIKE '",
|
" AND CONCAT(usr_data.FirstName,usr_data.Surname1,usr_data.Surname2) LIKE '",
|
||||||
Msg_MAX_LENGTH_MESSAGES_QUERY);
|
Msg_MAX_BYTES_MESSAGES_QUERY);
|
||||||
while (*Ptr)
|
while (*Ptr)
|
||||||
{
|
{
|
||||||
Str_GetNextStringUntilSpace (&Ptr,SearchWord,Usr_MAX_LENGTH_USR_NAME_OR_SURNAME);
|
Str_GetNextStringUntilSpace (&Ptr,SearchWord,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
if (strlen (FilterFromToSubquery) + strlen (SearchWord) + 512 > Msg_MAX_LENGTH_MESSAGES_QUERY) // Prevent string overflow
|
if (strlen (FilterFromToSubquery) + strlen (SearchWord) + 512 >
|
||||||
|
Msg_MAX_BYTES_MESSAGES_QUERY) // Prevent string overflow
|
||||||
break;
|
break;
|
||||||
Str_Concat (FilterFromToSubquery,"%",
|
Str_Concat (FilterFromToSubquery,"%",
|
||||||
Msg_MAX_LENGTH_MESSAGES_QUERY);
|
Msg_MAX_BYTES_MESSAGES_QUERY);
|
||||||
Str_Concat (FilterFromToSubquery,SearchWord,
|
Str_Concat (FilterFromToSubquery,SearchWord,
|
||||||
Msg_MAX_LENGTH_MESSAGES_QUERY);
|
Msg_MAX_BYTES_MESSAGES_QUERY);
|
||||||
}
|
}
|
||||||
Str_Concat (FilterFromToSubquery,"%'",
|
Str_Concat (FilterFromToSubquery,"%'",
|
||||||
Msg_MAX_LENGTH_MESSAGES_QUERY);
|
Msg_MAX_BYTES_MESSAGES_QUERY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
FilterFromToSubquery[0] = '\0';
|
FilterFromToSubquery[0] = '\0';
|
||||||
|
@ -1342,7 +1333,7 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
||||||
static unsigned long Msg_DelSomeRecOrSntMsgsUsr (Msg_TypeOfMessages_t TypeOfMessages,long UsrCod,
|
static unsigned long Msg_DelSomeRecOrSntMsgsUsr (Msg_TypeOfMessages_t TypeOfMessages,long UsrCod,
|
||||||
long FilterCrsCod,const char *FilterFromToSubquery)
|
long FilterCrsCod,const char *FilterFromToSubquery)
|
||||||
{
|
{
|
||||||
char Query[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char Query[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long MsgNum,NumMsgs;
|
unsigned long MsgNum,NumMsgs;
|
||||||
|
@ -1582,8 +1573,8 @@ static bool Msg_CheckIfReceivedMsgIsDeletedForAllItsRecipients (long MsgCod)
|
||||||
|
|
||||||
static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromToSubquery)
|
static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromToSubquery)
|
||||||
{
|
{
|
||||||
char SubQuery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char SubQuery[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
char Query[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char Query[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
|
|
||||||
/***** Get number of unread messages from database *****/
|
/***** Get number of unread messages from database *****/
|
||||||
if (FilterCrsCod >= 0) // If origin course selected
|
if (FilterCrsCod >= 0) // If origin course selected
|
||||||
|
@ -1675,8 +1666,8 @@ static void Msg_ShowSentOrReceivedMessages (void)
|
||||||
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
||||||
extern const char *Txt_Filter;
|
extern const char *Txt_Filter;
|
||||||
extern const char *Txt_Update_messages;
|
extern const char *Txt_Update_messages;
|
||||||
char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char FilterFromToSubquery[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
char Query[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char Query[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long NumRow;
|
unsigned long NumRow;
|
||||||
|
@ -1871,7 +1862,7 @@ static void Msg_PutLinkToViewBannedUsers(void)
|
||||||
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCod,
|
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCod,
|
||||||
long FilterCrsCod,const char *FilterFromToSubquery)
|
long FilterCrsCod,const char *FilterFromToSubquery)
|
||||||
{
|
{
|
||||||
char SubQuery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1];
|
char SubQuery[Msg_MAX_BYTES_MESSAGES_QUERY + 1];
|
||||||
char *PtrQuery;
|
char *PtrQuery;
|
||||||
const char *StrUnreadMsg;
|
const char *StrUnreadMsg;
|
||||||
|
|
||||||
|
@ -2592,7 +2583,7 @@ void Msg_ShowFormToFilterMsgs (void)
|
||||||
"</td>",
|
"</td>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
TxtFromTo[Gbl.Msg.TypeOfMessages],
|
TxtFromTo[Gbl.Msg.TypeOfMessages],
|
||||||
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME * 3,Gbl.Msg.FilterFromTo);
|
Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME * 3,Gbl.Msg.FilterFromTo);
|
||||||
|
|
||||||
/***** Filter message content *****/
|
/***** Filter message content *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||||
|
@ -2604,7 +2595,7 @@ void Msg_ShowFormToFilterMsgs (void)
|
||||||
"</td>",
|
"</td>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
Txt_MSG_Message,
|
Txt_MSG_Message,
|
||||||
Msg_MAX_LENGTH_FILTER_CONTENT,Gbl.Msg.FilterContent);
|
Msg_MAX_CHARS_FILTER_CONTENT,Gbl.Msg.FilterContent);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
fprintf (Gbl.F.Out,"</tr>"
|
fprintf (Gbl.F.Out,"</tr>"
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Msg_MAX_LENGTH_FILTER_CONTENT 80
|
#define Msg_MAX_CHARS_FILTER_CONTENT (128 - 1)
|
||||||
|
#define Msg_MAX_BYTES_FILTER_CONTENT (Msg_MAX_CHARS_FILTER_CONTENT * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************** Public types *******************************/
|
/******************************** Public types *******************************/
|
||||||
|
|
|
@ -79,7 +79,7 @@ typedef enum
|
||||||
} Net_WebsAndSocialNetworks_t;
|
} Net_WebsAndSocialNetworks_t;
|
||||||
#define Net_WEB_SOCIAL_NET_DEFAULT Net_WWW
|
#define Net_WEB_SOCIAL_NET_DEFAULT Net_WWW
|
||||||
|
|
||||||
#define Net_MAX_LENGTH_NETWORK_NAME 32
|
#define Net_MAX_BYTES_NETWORK_NAME 32
|
||||||
|
|
||||||
const char *Net_WebsAndSocialNetworksDB[Net_NUM_WEBS_AND_SOCIAL_NETWORKS] =
|
const char *Net_WebsAndSocialNetworksDB[Net_NUM_WEBS_AND_SOCIAL_NETWORKS] =
|
||||||
{
|
{
|
||||||
|
@ -443,7 +443,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
||||||
unsigned NumRows;
|
unsigned NumRows;
|
||||||
unsigned NumRow;
|
unsigned NumRow;
|
||||||
Net_WebsAndSocialNetworks_t Web;
|
Net_WebsAndSocialNetworks_t Web;
|
||||||
char NetName[Net_MAX_LENGTH_NETWORK_NAME + 1];
|
char NetName[Net_MAX_BYTES_NETWORK_NAME + 1];
|
||||||
unsigned NumUsrsTotalInPlatform;
|
unsigned NumUsrsTotalInPlatform;
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
||||||
|
|
||||||
/* Get web / social network (row[0]) */
|
/* Get web / social network (row[0]) */
|
||||||
Str_Copy (NetName,row[0],
|
Str_Copy (NetName,row[0],
|
||||||
Net_MAX_LENGTH_NETWORK_NAME);
|
Net_MAX_BYTES_NETWORK_NAME);
|
||||||
for (Web = (Net_WebsAndSocialNetworks_t) 0;
|
for (Web = (Net_WebsAndSocialNetworks_t) 0;
|
||||||
Web < Net_NUM_WEBS_AND_SOCIAL_NETWORKS;
|
Web < Net_NUM_WEBS_AND_SOCIAL_NETWORKS;
|
||||||
Web++)
|
Web++)
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern struct Globals Gbl;
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
// strings are limited to Ntf_MAX_LENGTH_NOTIFY_EVENT characters
|
// strings are limited to Ntf_MAX_BYTES_NOTIFY_EVENT characters
|
||||||
|
|
||||||
const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
|
const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,9 +33,10 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Ntf_MAX_LENGTH_NOTIFY_EVENT 32
|
#define Ntf_MAX_BYTES_NOTIFY_EVENT 32
|
||||||
|
|
||||||
#define Ntf_MAX_LENGTH_NOTIFY_LOCATION (1024 - 1)
|
#define Ntf_MAX_CHARS_NOTIFY_LOCATION (128 - 1)
|
||||||
|
#define Ntf_MAX_BYTES_NOTIFY_LOCATION (1024 + Ntf_MAX_CHARS_NOTIFY_LOCATION * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************** Public types *******************************/
|
/******************************** Public types *******************************/
|
||||||
|
|
|
@ -70,18 +70,18 @@ static bool Par_CheckIsParamCanBeUsedInGETMethod (const char *ParamName);
|
||||||
/*** Read all parameters passed to this CGI and store for later processing ***/
|
/*** Read all parameters passed to this CGI and store for later processing ***/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Par_MAX_LENGTH_METHOD (256 - 1)
|
#define Par_MAX_BYTES_METHOD (128 - 1)
|
||||||
#define Par_MAX_LENGTH_CONTENT_TYPE (256 - 1)
|
#define Par_MAX_BYTES_CONTENT_TYPE (128 - 1)
|
||||||
|
|
||||||
bool Par_GetQueryString (void)
|
bool Par_GetQueryString (void)
|
||||||
{
|
{
|
||||||
char Method[Par_MAX_LENGTH_METHOD + 1];
|
char Method[Par_MAX_BYTES_METHOD + 1];
|
||||||
char ContentType[Par_MAX_LENGTH_CONTENT_TYPE + 1];
|
char ContentType[Par_MAX_BYTES_CONTENT_TYPE + 1];
|
||||||
char UnsignedLongStr[10 + 1];
|
char UnsignedLongStr[10 + 1];
|
||||||
unsigned long UnsignedLong;
|
unsigned long UnsignedLong;
|
||||||
|
|
||||||
Str_Copy (Method,getenv ("REQUEST_METHOD"),
|
Str_Copy (Method,getenv ("REQUEST_METHOD"),
|
||||||
Par_MAX_LENGTH_METHOD);
|
Par_MAX_BYTES_METHOD);
|
||||||
|
|
||||||
if (!strcmp (Method,"GET"))
|
if (!strcmp (Method,"GET"))
|
||||||
{
|
{
|
||||||
|
@ -122,7 +122,7 @@ bool Par_GetQueryString (void)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Str_Copy (ContentType,getenv ("CONTENT_TYPE"),
|
Str_Copy (ContentType,getenv ("CONTENT_TYPE"),
|
||||||
Par_MAX_LENGTH_CONTENT_TYPE);
|
Par_MAX_BYTES_CONTENT_TYPE);
|
||||||
|
|
||||||
if (!strncmp (ContentType,"multipart/form-data",strlen ("multipart/form-data")))
|
if (!strncmp (ContentType,"multipart/form-data",strlen ("multipart/form-data")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -261,7 +261,7 @@ void Pwd_ShowFormSendNewPwd (void)
|
||||||
" size=\"8\" maxlength=\"%u\" value=\"%s\" />"
|
" size=\"8\" maxlength=\"%u\" value=\"%s\" />"
|
||||||
"</label>",
|
"</label>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],Txt_nick_email_or_ID,
|
The_ClassForm[Gbl.Prefs.Theme],Txt_nick_email_or_ID,
|
||||||
Usr_MAX_LENGTH_USR_LOGIN,Gbl.Usrs.Me.UsrIdLogin);
|
Usr_MAX_CHARS_USR_LOGIN,Gbl.Usrs.Me.UsrIdLogin);
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Get_a_new_password);
|
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Get_a_new_password);
|
||||||
|
|
10
swad_photo.c
10
swad_photo.c
|
@ -1884,7 +1884,8 @@ static void Pho_PutLinkToPrintViewOfDegreeStatsParams (void)
|
||||||
/*************** Put a link to calculate the stats of degrees ****************/
|
/*************** Put a link to calculate the stats of degrees ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Pho_MAX_LENGTH_ESTIMATED_TIME (64 - 1)
|
#define Pho_MAX_BYTES_ESTIMATED_TIME (128 - 1)
|
||||||
|
|
||||||
static void Pho_PutLinkToCalculateDegreeStats (void)
|
static void Pho_PutLinkToCalculateDegreeStats (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
||||||
|
@ -1896,7 +1897,7 @@ static void Pho_PutLinkToCalculateDegreeStats (void)
|
||||||
unsigned NumDeg;
|
unsigned NumDeg;
|
||||||
struct Degree Deg;
|
struct Degree Deg;
|
||||||
long EstimatedTimeToComputeAvgPhotoInMicroseconds;
|
long EstimatedTimeToComputeAvgPhotoInMicroseconds;
|
||||||
char StrEstimatedTimeToComputeAvgPhoto[Pho_MAX_LENGTH_ESTIMATED_TIME + 1];
|
char StrEstimatedTimeToComputeAvgPhoto[Pho_MAX_BYTES_ESTIMATED_TIME + 1];
|
||||||
|
|
||||||
if ((Deg.DegCod = Pho_GetDegWithAvgPhotoLeastRecentlyUpdated ()) > 0)
|
if ((Deg.DegCod = Pho_GetDegWithAvgPhotoLeastRecentlyUpdated ()) > 0)
|
||||||
{
|
{
|
||||||
|
@ -1931,9 +1932,10 @@ static void Pho_PutLinkToCalculateDegreeStats (void)
|
||||||
EstimatedTimeToComputeAvgPhotoInMicroseconds = Pho_GetTimeToComputeAvgPhoto (Degs.Lst[NumDeg].DegCod);
|
EstimatedTimeToComputeAvgPhotoInMicroseconds = Pho_GetTimeToComputeAvgPhoto (Degs.Lst[NumDeg].DegCod);
|
||||||
if (EstimatedTimeToComputeAvgPhotoInMicroseconds == -1L)
|
if (EstimatedTimeToComputeAvgPhotoInMicroseconds == -1L)
|
||||||
Str_Copy (StrEstimatedTimeToComputeAvgPhoto,Txt_unknown_TIME,
|
Str_Copy (StrEstimatedTimeToComputeAvgPhoto,Txt_unknown_TIME,
|
||||||
Pho_MAX_LENGTH_ESTIMATED_TIME);
|
Pho_MAX_BYTES_ESTIMATED_TIME);
|
||||||
else
|
else
|
||||||
Sta_WriteTime (StrEstimatedTimeToComputeAvgPhoto,EstimatedTimeToComputeAvgPhotoInMicroseconds);
|
Sta_WriteTime (StrEstimatedTimeToComputeAvgPhoto,
|
||||||
|
EstimatedTimeToComputeAvgPhotoInMicroseconds);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s (%s: %s)</option>",
|
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s (%s: %s)</option>",
|
||||||
Degs.Lst[NumDeg].DegCod,
|
Degs.Lst[NumDeg].DegCod,
|
||||||
|
|
40
swad_place.c
40
swad_place.c
|
@ -317,11 +317,11 @@ void Plc_GetListPlaces (void)
|
||||||
|
|
||||||
/* Get the short name of the place (row[1]) */
|
/* Get the short name of the place (row[1]) */
|
||||||
Str_Copy (Plc->ShrtName,row[1],
|
Str_Copy (Plc->ShrtName,row[1],
|
||||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
||||||
|
|
||||||
/* Get the full name of the place (row[2]) */
|
/* Get the full name of the place (row[2]) */
|
||||||
Str_Copy (Plc->FullName,row[2],
|
Str_Copy (Plc->FullName,row[2],
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
|
|
||||||
/* Get number of centres in this place (row[3]) */
|
/* Get number of centres in this place (row[3]) */
|
||||||
if (sscanf (row[3],"%u",&Plc->NumCtrs) != 1)
|
if (sscanf (row[3],"%u",&Plc->NumCtrs) != 1)
|
||||||
|
@ -357,16 +357,16 @@ void Plc_GetDataOfPlaceByCod (struct Place *Plc)
|
||||||
if (Plc->PlcCod < 0)
|
if (Plc->PlcCod < 0)
|
||||||
{
|
{
|
||||||
Str_Copy (Plc->ShrtName,Txt_Place_unspecified,
|
Str_Copy (Plc->ShrtName,Txt_Place_unspecified,
|
||||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
||||||
Str_Copy (Plc->FullName,Txt_Place_unspecified,
|
Str_Copy (Plc->FullName,Txt_Place_unspecified,
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
}
|
}
|
||||||
else if (Plc->PlcCod == 0)
|
else if (Plc->PlcCod == 0)
|
||||||
{
|
{
|
||||||
Str_Copy (Plc->ShrtName,Txt_Another_place,
|
Str_Copy (Plc->ShrtName,Txt_Another_place,
|
||||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
||||||
Str_Copy (Plc->FullName,Txt_Another_place,
|
Str_Copy (Plc->FullName,Txt_Another_place,
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
}
|
}
|
||||||
else if (Plc->PlcCod > 0)
|
else if (Plc->PlcCod > 0)
|
||||||
{
|
{
|
||||||
|
@ -396,11 +396,11 @@ void Plc_GetDataOfPlaceByCod (struct Place *Plc)
|
||||||
|
|
||||||
/* Get the short name of the place (row[0]) */
|
/* Get the short name of the place (row[0]) */
|
||||||
Str_Copy (Plc->ShrtName,row[0],
|
Str_Copy (Plc->ShrtName,row[0],
|
||||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
||||||
|
|
||||||
/* Get the full name of the place (row[1]) */
|
/* Get the full name of the place (row[1]) */
|
||||||
Str_Copy (Plc->FullName,row[1],
|
Str_Copy (Plc->FullName,row[1],
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
|
|
||||||
/* Get number of centres in this place (row[2]) */
|
/* Get number of centres in this place (row[2]) */
|
||||||
if (sscanf (row[2],"%u",&Plc->NumCtrs) != 1)
|
if (sscanf (row[2],"%u",&Plc->NumCtrs) != 1)
|
||||||
|
@ -479,7 +479,7 @@ static void Plc_ListPlacesForEdition (void)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME,Plc->ShrtName,Gbl.Form.Id);
|
Plc_MAX_CHARS_PLACE_SHRT_NAME,Plc->ShrtName,Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ static void Plc_ListPlacesForEdition (void)
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"INPUT_FULL_NAME\""
|
" class=\"INPUT_FULL_NAME\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME,Plc->FullName,Gbl.Form.Id);
|
Plc_MAX_CHARS_PLACE_FULL_NAME,Plc->FullName,Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
|
@ -595,9 +595,9 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
struct Place *Plc;
|
struct Place *Plc;
|
||||||
const char *ParamName = NULL; // Initialized to avoid warning
|
const char *ParamName = NULL; // Initialized to avoid warning
|
||||||
const char *FieldName = NULL; // Initialized to avoid warning
|
const char *FieldName = NULL; // Initialized to avoid warning
|
||||||
unsigned MaxLength = 0; // Initialized to avoid warning
|
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||||
char *CurrentPlcName = NULL; // Initialized to avoid warning
|
char *CurrentPlcName = NULL; // Initialized to avoid warning
|
||||||
char NewPlcName[Plc_MAX_LENGTH_PLACE_FULL_NAME + 1];
|
char NewPlcName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
||||||
|
|
||||||
Plc = &Gbl.Plcs.EditingPlc;
|
Plc = &Gbl.Plcs.EditingPlc;
|
||||||
switch (ShrtOrFullName)
|
switch (ShrtOrFullName)
|
||||||
|
@ -605,13 +605,13 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
case Cns_SHRT_NAME:
|
case Cns_SHRT_NAME:
|
||||||
ParamName = "ShortName";
|
ParamName = "ShortName";
|
||||||
FieldName = "ShortName";
|
FieldName = "ShortName";
|
||||||
MaxLength = Plc_MAX_LENGTH_PLACE_SHRT_NAME;
|
MaxBytes = Plc_MAX_BYTES_PLACE_SHRT_NAME;
|
||||||
CurrentPlcName = Plc->ShrtName;
|
CurrentPlcName = Plc->ShrtName;
|
||||||
break;
|
break;
|
||||||
case Cns_FULL_NAME:
|
case Cns_FULL_NAME:
|
||||||
ParamName = "FullName";
|
ParamName = "FullName";
|
||||||
FieldName = "FullName";
|
FieldName = "FullName";
|
||||||
MaxLength = Plc_MAX_LENGTH_PLACE_FULL_NAME;
|
MaxBytes = Plc_MAX_BYTES_PLACE_FULL_NAME;
|
||||||
CurrentPlcName = Plc->FullName;
|
CurrentPlcName = Plc->FullName;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +622,7 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
Lay_ShowErrorAndExit ("Code of place is missing.");
|
Lay_ShowErrorAndExit ("Code of place is missing.");
|
||||||
|
|
||||||
/* Get the new name for the place */
|
/* Get the new name for the place */
|
||||||
Par_GetParToText (ParamName,NewPlcName,MaxLength);
|
Par_GetParToText (ParamName,NewPlcName,MaxBytes);
|
||||||
|
|
||||||
/***** Get from the database the old names of the place *****/
|
/***** Get from the database the old names of the place *****/
|
||||||
Plc_GetDataOfPlaceByCod (Plc);
|
Plc_GetDataOfPlaceByCod (Plc);
|
||||||
|
@ -669,7 +669,7 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
|
|
||||||
/***** Show the form again *****/
|
/***** Show the form again *****/
|
||||||
Str_Copy (CurrentPlcName,NewPlcName,
|
Str_Copy (CurrentPlcName,NewPlcName,
|
||||||
MaxLength);
|
MaxBytes);
|
||||||
Plc_EditPlaces ();
|
Plc_EditPlaces ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ static void Plc_PutFormToCreatePlace (void)
|
||||||
" class=\"INPUT_SHORT_NAME\""
|
" class=\"INPUT_SHORT_NAME\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME,Plc->ShrtName);
|
Plc_MAX_CHARS_PLACE_SHRT_NAME,Plc->ShrtName);
|
||||||
|
|
||||||
/***** Place full name *****/
|
/***** Place full name *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
@ -740,7 +740,7 @@ static void Plc_PutFormToCreatePlace (void)
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
Plc_MAX_LENGTH_PLACE_FULL_NAME,Plc->FullName);
|
Plc_MAX_CHARS_PLACE_FULL_NAME,Plc->FullName);
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_place);
|
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_place);
|
||||||
|
@ -795,10 +795,10 @@ void Plc_RecFormNewPlace (void)
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get place short name */
|
/* Get place short name */
|
||||||
Par_GetParToText ("ShortName",Plc->ShrtName,Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
Par_GetParToText ("ShortName",Plc->ShrtName,Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
||||||
|
|
||||||
/* Get place full name */
|
/* Get place full name */
|
||||||
Par_GetParToText ("FullName",Plc->FullName,Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
Par_GetParToText ("FullName",Plc->FullName,Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||||
|
|
||||||
if (Plc->ShrtName[0] && Plc->FullName[0]) // If there's a place name
|
if (Plc->ShrtName[0] && Plc->FullName[0]) // If there's a place name
|
||||||
{
|
{
|
||||||
|
|
11
swad_place.h
11
swad_place.h
|
@ -31,15 +31,18 @@
|
||||||
/************************** Public types and constants ***********************/
|
/************************** Public types and constants ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Plc_MAX_LENGTH_PLACE_SHRT_NAME 32
|
#define Plc_MAX_CHARS_PLACE_SHRT_NAME 32
|
||||||
#define Plc_MAX_LENGTH_PLACE_FULL_NAME 127
|
#define Plc_MAX_BYTES_PLACE_SHRT_NAME (Plc_MAX_CHARS_PLACE_SHRT_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
|
#define Plc_MAX_CHARS_PLACE_FULL_NAME (128 - 1)
|
||||||
|
#define Plc_MAX_BYTES_PLACE_FULL_NAME (Plc_MAX_CHARS_PLACE_FULL_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
struct Place
|
struct Place
|
||||||
{
|
{
|
||||||
long PlcCod;
|
long PlcCod;
|
||||||
long InsCod;
|
long InsCod;
|
||||||
char ShrtName[Plc_MAX_LENGTH_PLACE_SHRT_NAME + 1];
|
char ShrtName[Plc_MAX_BYTES_PLACE_SHRT_NAME + 1];
|
||||||
char FullName[Plc_MAX_LENGTH_PLACE_FULL_NAME + 1];
|
char FullName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
||||||
unsigned NumCtrs;
|
unsigned NumCtrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,12 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Plg_MAX_LENGTH_PLUGIN_NAME 127
|
#define Plg_MAX_LENGTH_PLUGIN_NAME (128 - 1)
|
||||||
|
|
||||||
#define Plg_MAX_LENGTH_PLUGIN_DESCRIPTION 1023
|
#define Plg_MAX_LENGTH_PLUGIN_DESCRIPTION 1023
|
||||||
|
|
||||||
#define Plg_MAX_LENGTH_PLUGIN_LOGO 16
|
#define Plg_MAX_LENGTH_PLUGIN_LOGO 16
|
||||||
|
|
||||||
#define Plg_MAX_LENGTH_PLUGIN_APP_KEY 16
|
#define Plg_MAX_LENGTH_PLUGIN_APP_KEY 16
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -2959,7 +2959,7 @@ static void Rec_ShowSurname1 (struct UsrData *UsrDat,
|
||||||
" id=\"Surname1\" name=\"Surname1\""
|
" id=\"Surname1\" name=\"Surname1\""
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"REC_C2_BOT_INPUT\"",
|
" class=\"REC_C2_BOT_INPUT\"",
|
||||||
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME,
|
Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME,
|
||||||
UsrDat->Surname1);
|
UsrDat->Surname1);
|
||||||
if (TypeOfView == Rec_SHA_MY_RECORD_FORM)
|
if (TypeOfView == Rec_SHA_MY_RECORD_FORM)
|
||||||
fprintf (Gbl.F.Out," required=\"required\"");
|
fprintf (Gbl.F.Out," required=\"required\"");
|
||||||
|
@ -2995,7 +2995,7 @@ static void Rec_ShowSurname2 (struct UsrData *UsrDat,
|
||||||
" id=\"Surname2\" name=\"Surname2\""
|
" id=\"Surname2\" name=\"Surname2\""
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"REC_C2_BOT_INPUT\" />",
|
" class=\"REC_C2_BOT_INPUT\" />",
|
||||||
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME,
|
Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME,
|
||||||
UsrDat->Surname2);
|
UsrDat->Surname2);
|
||||||
else if (UsrDat->Surname2[0])
|
else if (UsrDat->Surname2[0])
|
||||||
fprintf (Gbl.F.Out,"<strong>%s</strong>",UsrDat->Surname2);
|
fprintf (Gbl.F.Out,"<strong>%s</strong>",UsrDat->Surname2);
|
||||||
|
@ -3032,7 +3032,7 @@ static void Rec_ShowFirstName (struct UsrData *UsrDat,
|
||||||
" id=\"FirstName\" name=\"FirstName\""
|
" id=\"FirstName\" name=\"FirstName\""
|
||||||
" maxlength=\"%u\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"REC_C2_BOT_INPUT\"",
|
" class=\"REC_C2_BOT_INPUT\"",
|
||||||
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME,
|
Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME,
|
||||||
UsrDat->FirstName);
|
UsrDat->FirstName);
|
||||||
if (TypeOfView == Rec_SHA_MY_RECORD_FORM)
|
if (TypeOfView == Rec_SHA_MY_RECORD_FORM)
|
||||||
fprintf (Gbl.F.Out," required=\"required\"");
|
fprintf (Gbl.F.Out," required=\"required\"");
|
||||||
|
@ -3581,26 +3581,31 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
|
||||||
|
|
||||||
void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat)
|
void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
char Surname1 [Usr_MAX_BYTES_NAME + 1]; // Temporary surname 1
|
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary surname 1
|
||||||
char FirstName[Usr_MAX_BYTES_NAME + 1]; // Temporary first name
|
char FirstName[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary first name
|
||||||
|
|
||||||
/***** Get surname 1 *****/
|
/***** Get surname 1 *****/
|
||||||
Par_GetParToText ("Surname1",Surname1,Usr_MAX_BYTES_NAME);
|
Par_GetParToText ("Surname1",Surname1,
|
||||||
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_ConvertToTitleType (Surname1);
|
Str_ConvertToTitleType (Surname1);
|
||||||
// Surname 1 is mandatory, so avoid overwriting surname 1 with empty string
|
// Surname 1 is mandatory, so avoid overwriting surname 1 with empty string
|
||||||
if (Surname1[0]) // New surname 1 not empty
|
if (Surname1[0]) // New surname 1 not empty
|
||||||
Str_Copy (UsrDat->Surname1,Surname1,Usr_MAX_BYTES_NAME);
|
Str_Copy (UsrDat->Surname1,Surname1,
|
||||||
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/***** Get surname 2 *****/
|
/***** Get surname 2 *****/
|
||||||
Par_GetParToText ("Surname2",UsrDat->Surname2,Usr_MAX_BYTES_NAME);
|
Par_GetParToText ("Surname2",UsrDat->Surname2,
|
||||||
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_ConvertToTitleType (UsrDat->Surname2);
|
Str_ConvertToTitleType (UsrDat->Surname2);
|
||||||
|
|
||||||
/***** Get first name *****/
|
/***** Get first name *****/
|
||||||
Par_GetParToText ("FirstName",FirstName,Usr_MAX_BYTES_NAME);
|
Par_GetParToText ("FirstName",FirstName,
|
||||||
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_ConvertToTitleType (FirstName);
|
Str_ConvertToTitleType (FirstName);
|
||||||
// First name is mandatory, so avoid overwriting first name with empty string
|
// First name is mandatory, so avoid overwriting first name with empty string
|
||||||
if (Surname1[0]) // New first name not empty
|
if (Surname1[0]) // New first name not empty
|
||||||
Str_Copy (UsrDat->FirstName,FirstName,Usr_MAX_BYTES_NAME);
|
Str_Copy (UsrDat->FirstName,FirstName,
|
||||||
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/***** Build full name *****/
|
/***** Build full name *****/
|
||||||
Usr_BuildFullName (UsrDat);
|
Usr_BuildFullName (UsrDat);
|
||||||
|
|
20
swad_user.c
20
swad_user.c
|
@ -500,11 +500,11 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
||||||
|
|
||||||
/* Get name */
|
/* Get name */
|
||||||
Str_Copy (UsrDat->Surname1,row[2],
|
Str_Copy (UsrDat->Surname1,row[2],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (UsrDat->Surname2,row[3],
|
Str_Copy (UsrDat->Surname2,row[3],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (UsrDat->FirstName,row[4],
|
Str_Copy (UsrDat->FirstName,row[4],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/* Get sex */
|
/* Get sex */
|
||||||
UsrDat->Sex = Usr_GetSexFromStr (row[5]);
|
UsrDat->Sex = Usr_GetSexFromStr (row[5]);
|
||||||
|
@ -2054,7 +2054,7 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) ())
|
||||||
Gbl.Prefs.IconsURL,
|
Gbl.Prefs.IconsURL,
|
||||||
Txt_User[Usr_SEX_UNKNOWN],
|
Txt_User[Usr_SEX_UNKNOWN],
|
||||||
Txt_User[Usr_SEX_UNKNOWN],
|
Txt_User[Usr_SEX_UNKNOWN],
|
||||||
Usr_MAX_LENGTH_USR_LOGIN,
|
Usr_MAX_CHARS_USR_LOGIN,
|
||||||
Txt_nick_email_or_ID,
|
Txt_nick_email_or_ID,
|
||||||
Gbl.Usrs.Me.UsrIdLogin);
|
Gbl.Usrs.Me.UsrIdLogin);
|
||||||
|
|
||||||
|
@ -4887,15 +4887,15 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop
|
||||||
|
|
||||||
/* Get user's surname 1 (row[3]) */
|
/* Get user's surname 1 (row[3]) */
|
||||||
Str_Copy (UsrInList->Surname1,row[3],
|
Str_Copy (UsrInList->Surname1,row[3],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/* Get user's surname 2 (row[4]) */
|
/* Get user's surname 2 (row[4]) */
|
||||||
Str_Copy (UsrInList->Surname2,row[4],
|
Str_Copy (UsrInList->Surname2,row[4],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/* Get user's first name (row[5]) */
|
/* Get user's first name (row[5]) */
|
||||||
Str_Copy (UsrInList->FirstName,row[5],
|
Str_Copy (UsrInList->FirstName,row[5],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/* Get user's sex (row[6]) */
|
/* Get user's sex (row[6]) */
|
||||||
UsrInList->Sex = Usr_GetSexFromStr (row[6]);
|
UsrInList->Sex = Usr_GetSexFromStr (row[6]);
|
||||||
|
@ -5004,11 +5004,11 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList
|
||||||
Str_Copy (UsrDat->EncryptedUsrCod,UsrInList->EncryptedUsrCod,
|
Str_Copy (UsrDat->EncryptedUsrCod,UsrInList->EncryptedUsrCod,
|
||||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||||
Str_Copy (UsrDat->Surname1,UsrInList->Surname1,
|
Str_Copy (UsrDat->Surname1,UsrInList->Surname1,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (UsrDat->Surname2,UsrInList->Surname2,
|
Str_Copy (UsrDat->Surname2,UsrInList->Surname2,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (UsrDat->FirstName,UsrInList->FirstName,
|
Str_Copy (UsrDat->FirstName,UsrInList->FirstName,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
UsrDat->Sex = UsrInList->Sex;
|
UsrDat->Sex = UsrInList->Sex;
|
||||||
Str_Copy (UsrDat->Photo,UsrInList->Photo,
|
Str_Copy (UsrDat->Photo,UsrInList->Photo,
|
||||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||||
|
|
34
swad_user.h
34
swad_user.h
|
@ -53,20 +53,20 @@
|
||||||
#define Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 12
|
#define Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 12
|
||||||
#define Usr_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 60
|
#define Usr_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 60
|
||||||
|
|
||||||
#define Usr_MAX_LENGTH_USR_NAME_OR_SURNAME 32
|
#define Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME 32
|
||||||
#define Usr_MAX_BYTES_NAME 32
|
#define Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME (Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
#define Usr_MAX_BYTES_SURNAMES (Usr_MAX_BYTES_NAME + 1 + Usr_MAX_BYTES_NAME)
|
#define Usr_MAX_BYTES_SURNAMES (Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1 + Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME)
|
||||||
// Surname1 +' '+ Surname2
|
// Surname1 +' '+ Surname2
|
||||||
#define Usr_MAX_BYTES_FULL_NAME (Usr_MAX_BYTES_NAME + 1 + Usr_MAX_BYTES_NAME + 6 + Usr_MAX_BYTES_NAME)
|
#define Usr_MAX_BYTES_FULL_NAME (Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1 + Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 6 + Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME)
|
||||||
// Surname1 +' '+ Surname2 + ','+' ' + FirstName
|
// Surname1 +' '+ Surname2 + ','+' ' + FirstName
|
||||||
// Surname1 +' '+ Surname2 + '<br />' + FirstName
|
// Surname1 +' '+ Surname2 + '<br />' + FirstName
|
||||||
|
|
||||||
#define Usr_MAX_CHARS_USR_EMAIL (128 - 1)
|
#define Usr_MAX_CHARS_USR_EMAIL (128 - 1)
|
||||||
#define Usr_MAX_BYTES_USR_EMAIL Usr_MAX_CHARS_USR_EMAIL
|
#define Usr_MAX_BYTES_USR_EMAIL Usr_MAX_CHARS_USR_EMAIL
|
||||||
|
|
||||||
#define Usr_MAX_LENGTH_USR_LOGIN (128 - 1) // @nick, email or ID
|
#define Usr_MAX_CHARS_USR_LOGIN Usr_MAX_CHARS_USR_EMAIL // Maximum number of chars of @nick, email or ID
|
||||||
#define Usr_MAX_BYTES_USR_LOGIN (128 - 1)
|
#define Usr_MAX_BYTES_USR_LOGIN (Usr_MAX_CHARS_USR_LOGIN * Str_MAX_BYTES_PER_CHAR)
|
||||||
|
|
||||||
#define Usr_BIRTHDAY_STR_DB_LENGTH (4 + 1 + 2 + 1 + 2) // "'%04u-%02u-%02u'"
|
#define Usr_BIRTHDAY_STR_DB_LENGTH (4 + 1 + 2 + 1 + 2) // "'%04u-%02u-%02u'"
|
||||||
|
|
||||||
|
@ -134,9 +134,9 @@ struct UsrData
|
||||||
// >=0 ==> filled/calculated
|
// >=0 ==> filled/calculated
|
||||||
// <0 ==> not yet filled/calculated
|
// <0 ==> not yet filled/calculated
|
||||||
bool Accepted; // User has accepted joining to current course?
|
bool Accepted; // User has accepted joining to current course?
|
||||||
char Surname1 [Usr_MAX_BYTES_NAME + 1];
|
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
char Surname2 [Usr_MAX_BYTES_NAME + 1];
|
char Surname2 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
char FirstName [Usr_MAX_BYTES_NAME + 1];
|
char FirstName [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
char FullName [Usr_MAX_BYTES_FULL_NAME + 1];
|
char FullName [Usr_MAX_BYTES_FULL_NAME + 1];
|
||||||
Usr_Sex_t Sex;
|
Usr_Sex_t Sex;
|
||||||
char Email [Usr_MAX_BYTES_USR_EMAIL + 1];
|
char Email [Usr_MAX_BYTES_USR_EMAIL + 1];
|
||||||
|
@ -188,9 +188,9 @@ struct UsrInList
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||||
char Password[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
char Password[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||||
char Surname1 [Usr_MAX_BYTES_NAME + 1];
|
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
char Surname2 [Usr_MAX_BYTES_NAME + 1];
|
char Surname2 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
char FirstName[Usr_MAX_BYTES_NAME + 1];
|
char FirstName[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
Usr_Sex_t Sex;
|
Usr_Sex_t Sex;
|
||||||
char Photo[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo
|
char Photo[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo
|
||||||
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
|
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
|
||||||
|
|
|
@ -554,11 +554,11 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
||||||
|
|
||||||
/* Get user's name */
|
/* Get user's name */
|
||||||
Str_Copy (UsrDat->Surname1,row[0],
|
Str_Copy (UsrDat->Surname1,row[0],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (UsrDat->Surname2,row[1],
|
Str_Copy (UsrDat->Surname2,row[1],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (UsrDat->FirstName,row[2],
|
Str_Copy (UsrDat->FirstName,row[2],
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
/* Get user's photo */
|
/* Get user's photo */
|
||||||
Str_Copy (UsrDat->Photo,row[3],
|
Str_Copy (UsrDat->Photo,row[3],
|
||||||
|
@ -784,9 +784,9 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
loginByUserPasswordKeyOut->wsKey = (char *) soap_malloc (Gbl.soap,Svc_LENGTH_WS_KEY + 1);
|
loginByUserPasswordKeyOut->wsKey = (char *) soap_malloc (Gbl.soap,Svc_LENGTH_WS_KEY + 1);
|
||||||
loginByUserPasswordKeyOut->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
loginByUserPasswordKeyOut->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
||||||
loginByUserPasswordKeyOut->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_BYTES_USR_ID + 1);
|
loginByUserPasswordKeyOut->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_BYTES_USR_ID + 1);
|
||||||
loginByUserPasswordKeyOut->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
loginByUserPasswordKeyOut->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginByUserPasswordKeyOut->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
loginByUserPasswordKeyOut->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginByUserPasswordKeyOut->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
loginByUserPasswordKeyOut->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginByUserPasswordKeyOut->userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
loginByUserPasswordKeyOut->userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
loginByUserPasswordKeyOut->userBirthday = (char *) soap_malloc (Gbl.soap,Dat_LENGTH_YYYYMMDD + 1);
|
loginByUserPasswordKeyOut->userBirthday = (char *) soap_malloc (Gbl.soap,Dat_LENGTH_YYYYMMDD + 1);
|
||||||
|
|
||||||
|
@ -888,13 +888,13 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
|
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userSurname1,
|
Str_Copy (loginByUserPasswordKeyOut->userSurname1,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
Gbl.Usrs.Me.UsrDat.Surname1,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userSurname2,
|
Str_Copy (loginByUserPasswordKeyOut->userSurname2,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname2,
|
Gbl.Usrs.Me.UsrDat.Surname2,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userFirstname,
|
Str_Copy (loginByUserPasswordKeyOut->userFirstname,
|
||||||
Gbl.Usrs.Me.UsrDat.FirstName,
|
Gbl.Usrs.Me.UsrDat.FirstName,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,
|
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,
|
||||||
|
@ -950,9 +950,9 @@ int swad__loginBySessionKey (struct soap *soap,
|
||||||
loginBySessionKeyOut->wsKey = (char *) soap_malloc (Gbl.soap,Svc_LENGTH_WS_KEY + 1);
|
loginBySessionKeyOut->wsKey = (char *) soap_malloc (Gbl.soap,Svc_LENGTH_WS_KEY + 1);
|
||||||
loginBySessionKeyOut->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
loginBySessionKeyOut->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
||||||
loginBySessionKeyOut->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_BYTES_USR_ID + 1);
|
loginBySessionKeyOut->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_BYTES_USR_ID + 1);
|
||||||
loginBySessionKeyOut->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
loginBySessionKeyOut->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginBySessionKeyOut->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
loginBySessionKeyOut->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginBySessionKeyOut->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
loginBySessionKeyOut->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginBySessionKeyOut->userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
loginBySessionKeyOut->userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
loginBySessionKeyOut->userBirthday = (char *) soap_malloc (Gbl.soap,Dat_LENGTH_YYYYMMDD + 1);
|
loginBySessionKeyOut->userBirthday = (char *) soap_malloc (Gbl.soap,Dat_LENGTH_YYYYMMDD + 1);
|
||||||
loginBySessionKeyOut->degreeName = (char *) soap_malloc (Gbl.soap,Deg_MAX_BYTES_DEGREE_FULL_NAME + 1);
|
loginBySessionKeyOut->degreeName = (char *) soap_malloc (Gbl.soap,Deg_MAX_BYTES_DEGREE_FULL_NAME + 1);
|
||||||
|
@ -1041,13 +1041,13 @@ int swad__loginBySessionKey (struct soap *soap,
|
||||||
|
|
||||||
Str_Copy (loginBySessionKeyOut->userSurname1,
|
Str_Copy (loginBySessionKeyOut->userSurname1,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
Gbl.Usrs.Me.UsrDat.Surname1,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (loginBySessionKeyOut->userSurname2,
|
Str_Copy (loginBySessionKeyOut->userSurname2,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname2,
|
Gbl.Usrs.Me.UsrDat.Surname2,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Str_Copy (loginBySessionKeyOut->userFirstname,
|
Str_Copy (loginBySessionKeyOut->userFirstname,
|
||||||
Gbl.Usrs.Me.UsrDat.FirstName,
|
Gbl.Usrs.Me.UsrDat.FirstName,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||||
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,
|
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,
|
||||||
|
@ -2871,10 +2871,10 @@ int swad__getNotifications (struct soap *soap,
|
||||||
|
|
||||||
/* Get notification event type (row[1]) */
|
/* Get notification event type (row[1]) */
|
||||||
NotifyEvent = Ntf_GetNotifyEventFromDB ((const char *) row[1]);
|
NotifyEvent = Ntf_GetNotifyEventFromDB ((const char *) row[1]);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType = (char *) soap_malloc (Gbl.soap,Ntf_MAX_LENGTH_NOTIFY_EVENT + 1);
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType = (char *) soap_malloc (Gbl.soap,Ntf_MAX_BYTES_NOTIFY_EVENT + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType,
|
||||||
Ntf_WSNotifyEvents[NotifyEvent],
|
Ntf_WSNotifyEvents[NotifyEvent],
|
||||||
Ntf_MAX_LENGTH_NOTIFY_EVENT);
|
Ntf_MAX_BYTES_NOTIFY_EVENT);
|
||||||
|
|
||||||
/* Get time of the event (row[2]) */
|
/* Get time of the event (row[2]) */
|
||||||
EventTime = 0L;
|
EventTime = 0L;
|
||||||
|
@ -2896,20 +2896,20 @@ int swad__getNotifications (struct soap *soap,
|
||||||
Gbl.Usrs.Other.UsrDat.Nickname,
|
Gbl.Usrs.Other.UsrDat.Nickname,
|
||||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||||
|
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname1,
|
Gbl.Usrs.Other.UsrDat.Surname1,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname2,
|
Gbl.Usrs.Other.UsrDat.Surname2,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname,
|
||||||
Gbl.Usrs.Other.UsrDat.FirstName,
|
Gbl.Usrs.Other.UsrDat.FirstName,
|
||||||
Usr_MAX_BYTES_NAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
|
@ -2943,7 +2943,7 @@ int swad__getNotifications (struct soap *soap,
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventCode = (int) Cod;
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventCode = (int) Cod;
|
||||||
|
|
||||||
/* Set location */
|
/* Set location */
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].location = (char *) soap_malloc (Gbl.soap,Ntf_MAX_LENGTH_NOTIFY_LOCATION + 1);
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].location = (char *) soap_malloc (Gbl.soap,Ntf_MAX_BYTES_NOTIFY_LOCATION + 1);
|
||||||
|
|
||||||
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
||||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||||
|
@ -2971,7 +2971,7 @@ int swad__getNotifications (struct soap *soap,
|
||||||
Txt_Institution,Ins.ShrtName);
|
Txt_Institution,Ins.ShrtName);
|
||||||
else
|
else
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"-",
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"-",
|
||||||
Ntf_MAX_LENGTH_NOTIFY_LOCATION);
|
Ntf_MAX_BYTES_NOTIFY_LOCATION);
|
||||||
|
|
||||||
/* Get status (row[9]) */
|
/* Get status (row[9]) */
|
||||||
if (sscanf (row[9],"%u",&Status) != 1)
|
if (sscanf (row[9],"%u",&Status) != 1)
|
||||||
|
|
Loading…
Reference in New Issue