mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-03 23:35:23 +02:00
Version 16.149
This commit is contained in:
parent
3f1dd125fb
commit
c596d53b72
|
@ -11695,3 +11695,6 @@ ALTER TABLE surveys DROP COLUMN DegCod;
|
|||
ALTER TABLE surveys DROP COLUMN CrsCod;
|
||||
|
||||
|
||||
|
||||
SELECT LENGTH(Subject) AS Len,COUNT(*) AS N FROM forum_post GROUP BY Len ORDER BY Len DESC;
|
||||
|
||||
|
|
34
swad_ID.c
34
swad_ID.c
|
@ -119,7 +119,7 @@ void ID_GetListIDsFromUsrCod (struct UsrData *UsrDat)
|
|||
|
||||
/* Get ID from row[0] */
|
||||
Str_Copy (UsrDat->IDs.List[NumID].ID,row[0],
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
|
||||
/* Get if ID is confirmed from row[1] */
|
||||
UsrDat->IDs.List[NumID].Confirmed = (row[1][0] == 'Y');
|
||||
|
@ -190,7 +190,7 @@ unsigned ID_GetListUsrCodsFromUsrID (struct UsrData *UsrDat,
|
|||
CheckPassword = true;
|
||||
|
||||
/***** Allocate memory for query string *****/
|
||||
MaxLength = 512 + UsrDat->IDs.Num * (1 + ID_MAX_LENGTH_USR_ID + 1) - 1;
|
||||
MaxLength = 512 + UsrDat->IDs.Num * (1 + ID_MAX_BYTES_USR_ID + 1) - 1;
|
||||
if ((Query = (char *) malloc (MaxLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store list of user's IDs.");
|
||||
|
||||
|
@ -297,7 +297,7 @@ void ID_GetParamOtherUsrIDPlain (void)
|
|||
|
||||
/***** Get parameter *****/
|
||||
Par_GetParToText ("OtherUsrID",Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
||||
Str_ConvertToUpperText (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
||||
|
@ -310,7 +310,7 @@ void ID_GetParamOtherUsrIDPlain (void)
|
|||
/*****************************************************************************/
|
||||
// Returns true if the user's ID string is valid, or false if not
|
||||
// A valid user's ID must...:
|
||||
// 1. Must be ID_MIN_LENGTH_USR_ID <= characters <= ID_MAX_LENGTH_USR_ID.
|
||||
// 1. Must be ID_MIN_BYTES_USR_ID <= characters <= ID_MAX_BYTES_USR_ID.
|
||||
// 2. All characters must be digits or letters
|
||||
// 3. Must have a minimum number of digits
|
||||
|
||||
|
@ -346,9 +346,9 @@ static bool ID_CheckIfUsrIDIsValidUsingMinDigits (const char *UsrID,unsigned Min
|
|||
if (!UsrID[0])
|
||||
return false;
|
||||
Length = strlen (UsrID);
|
||||
if (Length < ID_MIN_LENGTH_USR_ID ||
|
||||
Length > ID_MAX_LENGTH_USR_ID)
|
||||
return false; // 1. Must be ID_MIN_LENGTH_USR_ID <= characters <= ID_MAX_LENGTH_USR_ID
|
||||
if (Length < ID_MIN_BYTES_USR_ID ||
|
||||
Length > ID_MAX_BYTES_USR_ID)
|
||||
return false; // 1. Must be ID_MIN_BYTES_USR_ID <= characters <= ID_MAX_BYTES_USR_ID
|
||||
|
||||
/**** Loop through user's ID *****/
|
||||
for (Ptr = UsrID;
|
||||
|
@ -650,7 +650,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
"<input type=\"text\" id=\"NewID\" name=\"NewID\""
|
||||
" size=\"18\" maxlength=\"%u\" value=\"%s\" />"
|
||||
"</div>",
|
||||
ID_MAX_LENGTH_USR_ID,
|
||||
ID_MAX_BYTES_USR_ID,
|
||||
UsrDat->IDs.Num ? UsrDat->IDs.List[UsrDat->IDs.Num - 1].ID :
|
||||
""); // Show the most recent ID
|
||||
Lay_PutCreateButtonInline (Txt_Add_this_ID);
|
||||
|
@ -721,13 +721,13 @@ static void ID_RemoveUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
extern const char *Txt_ID_X_removed;
|
||||
extern const char *Txt_You_can_not_delete_this_ID;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||
bool ICanRemove;
|
||||
|
||||
if (Usr_ICanEditOtherUsr (UsrDat))
|
||||
{
|
||||
/***** Get user's ID from form *****/
|
||||
Par_GetParToText ("UsrID",UsrID,ID_MAX_LENGTH_USR_ID);
|
||||
Par_GetParToText ("UsrID",UsrID,ID_MAX_BYTES_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrID);
|
||||
Str_ConvertToUpperText (UsrID);
|
||||
|
@ -777,7 +777,7 @@ static bool ID_CheckIfConfirmed (long UsrCod,const char *UsrID)
|
|||
|
||||
static void ID_RemoveUsrIDFromDB (long UsrCod,const char *UsrID)
|
||||
{
|
||||
char Query[256 + ID_MAX_LENGTH_USR_ID];
|
||||
char Query[256 + ID_MAX_BYTES_USR_ID];
|
||||
|
||||
/***** Remove one of my user's IDs *****/
|
||||
sprintf (Query,"DELETE FROM usr_IDs"
|
||||
|
@ -839,7 +839,7 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
extern const char *Txt_The_ID_X_has_been_registered_successfully;
|
||||
extern const char *Txt_The_ID_X_is_not_valid;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char NewID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char NewID[ID_MAX_BYTES_USR_ID + 1];
|
||||
unsigned NumID;
|
||||
bool AlreadyExists;
|
||||
unsigned NumIDFound = 0; // Initialized to avoid warning
|
||||
|
@ -848,7 +848,7 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
if (Usr_ICanEditOtherUsr (UsrDat))
|
||||
{
|
||||
/***** Get new user's ID from form *****/
|
||||
Par_GetParToText ("NewID",NewID,ID_MAX_LENGTH_USR_ID);
|
||||
Par_GetParToText ("NewID",NewID,ID_MAX_BYTES_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (NewID);
|
||||
Str_ConvertToUpperText (NewID);
|
||||
|
@ -919,7 +919,7 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
|
||||
static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed)
|
||||
{
|
||||
char Query[256 + ID_MAX_LENGTH_USR_ID];
|
||||
char Query[256 + ID_MAX_BYTES_USR_ID];
|
||||
|
||||
/***** Update my nickname in database *****/
|
||||
sprintf (Query,"INSERT INTO usr_IDs"
|
||||
|
@ -959,7 +959,7 @@ static void ID_ReqConfOrConfOtherUsrID (ID_ReqConfOrConfID_t ReqConfOrConfID)
|
|||
extern const char *Txt_Do_you_want_to_confirm_the_ID_X;
|
||||
extern const char *Txt_The_ID_X_has_been_confirmed;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||
bool ICanConfirm;
|
||||
bool Found;
|
||||
unsigned NumID;
|
||||
|
@ -975,7 +975,7 @@ static void ID_ReqConfOrConfOtherUsrID (ID_ReqConfOrConfID_t ReqConfOrConfID)
|
|||
if (ICanConfirm)
|
||||
{
|
||||
/***** Get user's ID from form *****/
|
||||
Par_GetParToText ("UsrID",UsrID,ID_MAX_LENGTH_USR_ID);
|
||||
Par_GetParToText ("UsrID",UsrID,ID_MAX_BYTES_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrID);
|
||||
Str_ConvertToUpperText (UsrID);
|
||||
|
@ -1041,7 +1041,7 @@ static void ID_ReqConfOrConfOtherUsrID (ID_ReqConfOrConfID_t ReqConfOrConfID)
|
|||
|
||||
void ID_ConfirmUsrID (const struct UsrData *UsrDat,const char *UsrID)
|
||||
{
|
||||
char Query[256 + ID_MAX_LENGTH_USR_ID];
|
||||
char Query[256 + ID_MAX_BYTES_USR_ID];
|
||||
|
||||
/***** Update database *****/
|
||||
sprintf (Query,"UPDATE usr_IDs SET Confirmed='Y'"
|
||||
|
|
15
swad_ID.h
15
swad_ID.h
|
@ -34,16 +34,21 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#define ID_MIN_DIGITS_AUTOMATIC_DETECT_USR_ID 6 // Used for detect automatically users' IDs inside a text
|
||||
#define ID_MIN_DIGITS_USR_ID 1 // A user's ID must have at least these digits
|
||||
#define ID_MIN_LENGTH_USR_ID 5 // This number MUST be >= 3
|
||||
#define ID_MAX_LENGTH_USR_ID 16
|
||||
|
||||
#define ID_MAX_BYTES_LIST_USRS_IDS (ID_MAX_LENGTH_USR_ID * Cfg_MAX_USRS_IN_LIST * 10)
|
||||
#define ID_MIN_DIGITS_USR_ID 1 // A user's ID must have at least these digits
|
||||
|
||||
#define ID_MIN_CHARS_USR_ID 5 // This number MUST be >= 3
|
||||
#define ID_MIN_BYTES_USR_ID ID_MIN_CHARS_USR_ID
|
||||
|
||||
#define ID_MAX_CHARS_USR_ID 16
|
||||
#define ID_MAX_BYTES_USR_ID ID_MAX_CHARS_USR_ID
|
||||
|
||||
#define ID_MAX_BYTES_LIST_USRS_IDS (ID_MAX_BYTES_USR_ID * Cfg_MAX_USRS_IN_LIST * 10)
|
||||
|
||||
struct ListIDs
|
||||
{
|
||||
bool Confirmed;
|
||||
char ID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char ID[ID_MAX_BYTES_USR_ID + 1];
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -193,7 +193,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
|
|||
/* Write title (first characters) of the notice */
|
||||
Str_Copy (Content,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_LimitLengthHTMLStr (Content,40);
|
||||
Str_LimitLengthHTMLStr (Content,40); // Remove when notice has a Subject
|
||||
fprintf (FileRSS,"<title>%s: ",Txt_Notice);
|
||||
Str_FilePrintStrChangingBRToRetAndNBSPToSpace (FileRSS,Content);
|
||||
fprintf (FileRSS,"</title>\n");
|
||||
|
|
|
@ -153,7 +153,7 @@ static void Acc_ShowFormCheckIfIHaveAccount (const char *Title)
|
|||
" required=\"required\" />"
|
||||
"</label>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],Txt_ID,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_CHARS_USR_ID);
|
||||
Lay_PutConfirmButton (Txt_Check);
|
||||
Act_FormEnd ();
|
||||
|
||||
|
@ -173,7 +173,7 @@ void Acc_CheckIfEmptyAccountExists (void)
|
|||
extern const char *Txt_Check_another_ID;
|
||||
extern const char *Txt_Please_enter_your_ID;
|
||||
extern const char *Txt_Before_creating_a_new_account_check_if_you_have_been_already_registered_with_your_ID;
|
||||
char ID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char ID[ID_MAX_BYTES_USR_ID + 1];
|
||||
unsigned NumUsrs;
|
||||
unsigned NumUsr;
|
||||
struct UsrData UsrDat;
|
||||
|
@ -189,7 +189,7 @@ void Acc_CheckIfEmptyAccountExists (void)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Get new user's ID from form *****/
|
||||
Par_GetParToText ("ID",ID,ID_MAX_LENGTH_USR_ID);
|
||||
Par_GetParToText ("ID",ID,ID_MAX_BYTES_USR_ID);
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (ID);
|
||||
Str_ConvertToUpperText (ID);
|
||||
|
@ -357,7 +357,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWith
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Nickname,
|
||||
1 + Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA,
|
||||
1 + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Txt_HELP_nickname,
|
||||
NewNicknameWithArroba);
|
||||
|
||||
|
@ -571,7 +571,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
|||
/***** Save nickname *****/
|
||||
Nck_UpdateMyNick (NewNicknameWithoutArroba);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
/***** Save email *****/
|
||||
if (Mai_UpdateEmailInDB (&Gbl.Usrs.Me.UsrDat,NewEmail))
|
||||
|
@ -608,7 +608,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES
|
|||
extern const char *Txt_The_email_address_entered_X_is_not_valid;
|
||||
char Query[1024];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
char NewPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char NewPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
bool Error = false;
|
||||
|
||||
/***** Step 1/3: Get new nickname from form *****/
|
||||
|
@ -643,8 +643,8 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES
|
|||
Error = true;
|
||||
sprintf (Gbl.Message,Txt_The_nickname_entered_X_is_not_valid_,
|
||||
NewNicknameWithArroba,
|
||||
Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||
}
|
||||
|
||||
|
@ -675,7 +675,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES
|
|||
}
|
||||
|
||||
/***** Step 3/3: Get new password from form *****/
|
||||
Par_GetParToText ("Paswd",NewPlainPassword,Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd",NewPlainPassword,Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
Cry_EncryptSHA512Base64 (NewPlainPassword,NewEncryptedPassword);
|
||||
if (!Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword,NewEncryptedPassword,-1L)) // New password is good?
|
||||
{
|
||||
|
|
|
@ -4696,7 +4696,7 @@ const char *Act_GetSubtitleAction (Act_Action_t Action)
|
|||
/*****************************************************************************/
|
||||
|
||||
char *Act_GetActionTextFromDB (long ActCod,
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1])
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1])
|
||||
{
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
char Query[1024];
|
||||
|
@ -4712,7 +4712,7 @@ char *Act_GetActionTextFromDB (long ActCod,
|
|||
/***** Get text *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (ActTxt,row[0],
|
||||
Act_MAX_LENGTH_ACTION_TXT);
|
||||
Act_MAX_BYTES_ACTION_TXT);
|
||||
}
|
||||
else // ActCod-Language not found on database
|
||||
ActTxt[0] = '\0';
|
||||
|
@ -4951,7 +4951,7 @@ void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle,
|
|||
/***************************** Get unique Id *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_LENGTH_ID])
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID])
|
||||
{
|
||||
static unsigned CountForThisExecution = 0;
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Act_MAX_LENGTH_ACTION_TXT 255
|
||||
#define Act_MAX_CHARS_ACTION_TXT (256 - 1)
|
||||
#define Act_MAX_BYTES_ACTION_TXT Act_MAX_CHARS_ACTION_TXT
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 12
|
||||
|
||||
#define Act_MAX_LENGTH_ID (32 + Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1)
|
||||
#define Act_MAX_BYTES_ID (32 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1)
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Not asociates with tabs ***************************/
|
||||
|
@ -1545,7 +1546,7 @@ bool Act_CheckIfIHavePermissionToExecuteAction (Act_Action_t Action);
|
|||
const char *Act_GetTitleAction (Act_Action_t Action);
|
||||
const char *Act_GetSubtitleAction (Act_Action_t Action);
|
||||
char *Act_GetActionTextFromDB (long ActCod,
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1]);
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1]);
|
||||
|
||||
void Act_FormGoToStart (Act_Action_t NextAction);
|
||||
void Act_FormStart (Act_Action_t NextAction);
|
||||
|
@ -1565,7 +1566,7 @@ void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,
|
|||
void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle,
|
||||
const char *OnSubmit);
|
||||
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_LENGTH_ID]);
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_BYTES_ID]);
|
||||
|
||||
void Act_AdjustActionWhenNoUsrLogged (void);
|
||||
void Act_AdjustCurrentAction (void);
|
||||
|
|
|
@ -505,7 +505,7 @@ static void Agd_PutIconToViewEditMyFullAgenda (void)
|
|||
|
||||
static void Agd_PutIconToShowQR (void)
|
||||
{
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
|
||||
sprintf (URL,"%s/%s?agd=@%s",
|
||||
|
@ -946,11 +946,11 @@ static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent)
|
|||
|
||||
/* Get the event (row[7]) */
|
||||
Str_Copy (AgdEvent->Event,row[7],
|
||||
Agd_MAX_LENGTH_EVENT);
|
||||
Agd_MAX_BYTES_EVENT);
|
||||
|
||||
/* Get the event (row[8]) */
|
||||
Str_Copy (AgdEvent->Location,row[8],
|
||||
Agd_MAX_LENGTH_LOCATION);
|
||||
Agd_MAX_BYTES_LOCATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1322,7 +1322,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Event,
|
||||
Agd_MAX_LENGTH_EVENT,AgdEvent.Event);
|
||||
Agd_MAX_CHARS_EVENT,AgdEvent.Event);
|
||||
|
||||
/***** Location *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -1337,7 +1337,7 @@ void Agd_RequestCreatOrEditEvent (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Location,
|
||||
Agd_MAX_LENGTH_LOCATION,AgdEvent.Location);
|
||||
Agd_MAX_CHARS_LOCATION,AgdEvent.Location);
|
||||
|
||||
/***** Start and end dates *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimes (AgdEvent.TimeUTC,
|
||||
|
@ -1396,10 +1396,10 @@ void Agd_RecFormEvent (void)
|
|||
AgdEvent.TimeUTC[Agd_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||
|
||||
/***** Get event *****/
|
||||
Par_GetParToText ("Location",AgdEvent.Location,Agd_MAX_LENGTH_LOCATION);
|
||||
Par_GetParToText ("Location",AgdEvent.Location,Agd_MAX_BYTES_LOCATION);
|
||||
|
||||
/***** Get event *****/
|
||||
Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_LENGTH_EVENT);
|
||||
Par_GetParToText ("Event",AgdEvent.Event,Agd_MAX_BYTES_EVENT);
|
||||
|
||||
/***** Get text *****/
|
||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||
|
@ -1471,7 +1471,7 @@ void Agd_RecFormEvent (void)
|
|||
|
||||
static bool Agd_CheckIfSimilarEventExists (struct AgendaEvent *AgdEvent)
|
||||
{
|
||||
char Query[256 + Agd_MAX_LENGTH_EVENT];
|
||||
char Query[256 + Agd_MAX_BYTES_EVENT];
|
||||
|
||||
/***** Get number of events with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM agendas"
|
||||
|
|
|
@ -34,8 +34,11 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Agd_MAX_LENGTH_LOCATION (256-1)
|
||||
#define Agd_MAX_LENGTH_EVENT (256-1)
|
||||
#define Agd_MAX_CHARS_LOCATION (256 - 1)
|
||||
#define Agd_MAX_BYTES_LOCATION (Agd_MAX_CHARS_LOCATION * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Agd_MAX_CHARS_EVENT (256 - 1)
|
||||
#define Agd_MAX_BYTES_EVENT (Agd_MAX_CHARS_EVENT * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Agd_NUM_DATES 2
|
||||
typedef enum
|
||||
|
@ -52,8 +55,8 @@ struct AgendaEvent
|
|||
bool Hidden;
|
||||
time_t TimeUTC[Agd_NUM_DATES];
|
||||
Dat_TimeStatus_t TimeStatus;
|
||||
char Event[Agd_MAX_LENGTH_EVENT + 1];
|
||||
char Location[Agd_MAX_LENGTH_LOCATION + 1];
|
||||
char Event[Agd_MAX_BYTES_EVENT + 1];
|
||||
char Location[Agd_MAX_BYTES_LOCATION + 1];
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -739,11 +739,11 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
|||
|
||||
/* Get the title of the assignment (row[6]) */
|
||||
Str_Copy (Asg->Title,row[6],
|
||||
Asg_MAX_LENGTH_ASSIGNMENT_TITLE);
|
||||
Asg_MAX_CHARS_ASSIGNMENT_TITLE);
|
||||
|
||||
/* Get the folder for the assignment files (row[7]) */
|
||||
Str_Copy (Asg->Folder,row[7],
|
||||
Asg_MAX_LENGTH_FOLDER);
|
||||
Asg_MAX_BYTES_FOLDER);
|
||||
Asg->SendWork = (Asg->Folder[0] != '\0');
|
||||
|
||||
/* Can I do this assignment? */
|
||||
|
@ -1135,7 +1135,7 @@ void Asg_RequestCreatOrEditAsg (void)
|
|||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],Txt_Title,
|
||||
Asg_MAX_LENGTH_ASSIGNMENT_TITLE,Asg.Title);
|
||||
Asg_MAX_CHARS_ASSIGNMENT_TITLE,Asg.Title);
|
||||
|
||||
/***** Assignment start and end dates *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimes (Asg.TimeUTC,Dat_FORM_SECONDS_ON);
|
||||
|
@ -1155,7 +1155,7 @@ void Asg_RequestCreatOrEditAsg (void)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Upload_files_QUESTION,
|
||||
Txt_Folder,
|
||||
Asg_MAX_LENGTH_FOLDER,Asg_MAX_LENGTH_FOLDER,Asg.Folder);
|
||||
Asg_MAX_CHARS_FOLDER,Asg_MAX_CHARS_FOLDER,Asg.Folder);
|
||||
|
||||
/***** Assignment text *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -1285,10 +1285,10 @@ void Asg_RecFormAssignment (void)
|
|||
NewAsg.TimeUTC[Dat_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
|
||||
|
||||
/***** Get assignment title *****/
|
||||
Par_GetParToText ("Title",NewAsg.Title,Asg_MAX_LENGTH_ASSIGNMENT_TITLE);
|
||||
Par_GetParToText ("Title",NewAsg.Title,Asg_MAX_BYTES_ASSIGNMENT_TITLE);
|
||||
|
||||
/***** Get folder name where to send works of the assignment *****/
|
||||
Par_GetParToText ("Folder",NewAsg.Folder,Asg_MAX_LENGTH_FOLDER);
|
||||
Par_GetParToText ("Folder",NewAsg.Folder,Asg_MAX_BYTES_FOLDER);
|
||||
NewAsg.SendWork = (NewAsg.Folder[0]) ? Asg_SEND_WORK :
|
||||
Asg_DO_NOT_SEND_WORK;
|
||||
|
||||
|
|
|
@ -34,9 +34,11 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Asg_MAX_LENGTH_ASSIGNMENT_TITLE (256-1)
|
||||
#define Asg_MAX_CHARS_ASSIGNMENT_TITLE (256 - 1)
|
||||
#define Asg_MAX_BYTES_ASSIGNMENT_TITLE (Asg_MAX_CHARS_ASSIGNMENT_TITLE * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Asg_MAX_LENGTH_FOLDER 32
|
||||
#define Asg_MAX_CHARS_FOLDER 32
|
||||
#define Asg_MAX_BYTES_FOLDER Asg_MAX_CHARS_FOLDER
|
||||
|
||||
#define Asg_NUM_TYPES_SEND_WORK 2
|
||||
typedef enum
|
||||
|
@ -52,9 +54,9 @@ struct Assignment
|
|||
long UsrCod;
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
bool Open;
|
||||
char Title[Asg_MAX_LENGTH_ASSIGNMENT_TITLE + 1];
|
||||
char Title[Asg_MAX_BYTES_ASSIGNMENT_TITLE + 1];
|
||||
Asg_SendWork_t SendWork;
|
||||
char Folder[Asg_MAX_LENGTH_FOLDER + 1];
|
||||
char Folder[Asg_MAX_BYTES_FOLDER + 1];
|
||||
bool IBelongToCrsOrGrps; // I can do this assignment
|
||||
// (it is associated to no groups
|
||||
// or, if associated to groups,
|
||||
|
|
|
@ -748,7 +748,7 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
|
|||
|
||||
/* Get the title of the attendance event (row[8]) */
|
||||
Str_Copy (Att->Title,row[8],
|
||||
Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1103,7 +1103,7 @@ void Att_RequestCreatOrEditAttEvent (void)
|
|||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],Txt_Title,
|
||||
Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE,Att.Title);
|
||||
Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE,Att.Title);
|
||||
|
||||
/***** Assignment start and end dates *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimes (Att.TimeUTC,Dat_FORM_SECONDS_ON);
|
||||
|
@ -1256,7 +1256,7 @@ void Att_RecFormAttEvent (void)
|
|||
ReceivedAtt.CommentTchVisible = Par_GetParToBool ("ComTchVisible");
|
||||
|
||||
/***** Get attendance event title *****/
|
||||
Par_GetParToText ("Title",ReceivedAtt.Title,Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
Par_GetParToText ("Title",ReceivedAtt.Title,Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE);
|
||||
|
||||
/***** Get attendance event text *****/
|
||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||
|
@ -2269,7 +2269,7 @@ void Att_RegisterStudentsInAttEvent (void)
|
|||
Ptr = Gbl.Usrs.Select.Std;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrData.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrData.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrData);
|
||||
if (UsrData.UsrCod > 0) // Student exists in database
|
||||
/***** Mark student to not be removed *****/
|
||||
|
@ -2821,7 +2821,7 @@ static void Att_GetListSelectedUsrCods (unsigned NumStdsInList,long **LstSelecte
|
|||
NumStd < NumStdsInList && *Ptr;
|
||||
NumStd++)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
(*LstSelectedUsrCods)[NumStd] = UsrDat.UsrCod;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE (256-1)
|
||||
#define Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE (256 - 1)
|
||||
#define Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE (Att_MAX_CHARS_ATTENDANCE_EVENT_TITLE * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Att_NUM_DATES 2
|
||||
typedef enum
|
||||
|
@ -52,7 +53,7 @@ struct AttendanceEvent
|
|||
long UsrCod;
|
||||
time_t TimeUTC[Att_NUM_DATES];
|
||||
bool Open;
|
||||
char Title[Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE + 1];
|
||||
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
||||
bool CommentTchVisible;
|
||||
|
||||
/* Fields computed, not associated to the event in database */
|
||||
|
|
|
@ -205,19 +205,19 @@ static void Ban_GetListBanners (const char *Query)
|
|||
|
||||
/* Get the short name of the banner (row[2]) */
|
||||
Str_Copy (Ban->ShrtName,row[2],
|
||||
Ban_MAX_LENGTH_SHRT_NAME);
|
||||
Ban_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the banner (row[3]) */
|
||||
Str_Copy (Ban->FullName,row[3],
|
||||
Ban_MAX_LENGTH_FULL_NAME);
|
||||
Ban_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get the image of the banner (row[4]) */
|
||||
Str_Copy (Ban->Img,row[4],
|
||||
Ban_MAX_LENGTH_IMAGE);
|
||||
Ban_MAX_BYTES_IMAGE);
|
||||
|
||||
/* Get the URL of the banner (row[5]) */
|
||||
Str_Copy (Ban->WWW,row[5],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -262,19 +262,19 @@ void Ban_GetDataOfBannerByCod (struct Banner *Ban)
|
|||
|
||||
/* Get the short name of the banner (row[1]) */
|
||||
Str_Copy (Ban->ShrtName,row[1],
|
||||
Ban_MAX_LENGTH_SHRT_NAME);
|
||||
Ban_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the banner (row[2]) */
|
||||
Str_Copy (Ban->FullName,row[2],
|
||||
Ban_MAX_LENGTH_FULL_NAME);
|
||||
Ban_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get the image of the banner (row[3]) */
|
||||
Str_Copy (Ban->Img,row[3],
|
||||
Ban_MAX_LENGTH_IMAGE);
|
||||
Ban_MAX_BYTES_IMAGE);
|
||||
|
||||
/* Get the URL of the banner (row[4]) */
|
||||
Str_Copy (Ban->WWW,row[4],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -364,7 +364,7 @@ static void Ban_ListBannersForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_SHORT_NAME\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Ban_MAX_LENGTH_SHRT_NAME,Ban->ShrtName,Gbl.Form.Id);
|
||||
Ban_MAX_CHARS_SHRT_NAME,Ban->ShrtName,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -376,7 +376,7 @@ static void Ban_ListBannersForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_FULL_NAME\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Ban_MAX_LENGTH_FULL_NAME,Ban->FullName,Gbl.Form.Id);
|
||||
Ban_MAX_CHARS_FULL_NAME,Ban->FullName,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -387,7 +387,7 @@ static void Ban_ListBannersForEdition (void)
|
|||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Img\""
|
||||
" size=\"12\" maxlength=\"%u\" value=\"%s\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Ban_MAX_LENGTH_IMAGE,Ban->Img,Gbl.Form.Id);
|
||||
Ban_MAX_CHARS_IMAGE,Ban->Img,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -399,7 +399,7 @@ static void Ban_ListBannersForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,Ban->WWW,Gbl.Form.Id);
|
||||
Cns_MAX_CHARS_WWW,Ban->WWW,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
@ -548,9 +548,9 @@ static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
struct Banner *Ban;
|
||||
const char *ParamName = 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 *CurrentBanName = NULL; // Initialized to avoid warning
|
||||
char NewBanName[Ban_MAX_LENGTH_FULL_NAME + 1];
|
||||
char NewBanName[Ban_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
Ban = &Gbl.Banners.EditingBan;
|
||||
switch (ShrtOrFullName)
|
||||
|
@ -558,13 +558,13 @@ static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
case Cns_SHRT_NAME:
|
||||
ParamName = "ShortName";
|
||||
FieldName = "ShortName";
|
||||
MaxLength = Ban_MAX_LENGTH_SHRT_NAME;
|
||||
MaxBytes = Ban_MAX_BYTES_SHRT_NAME;
|
||||
CurrentBanName = Ban->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParamName = "FullName";
|
||||
FieldName = "FullName";
|
||||
MaxLength = Ban_MAX_LENGTH_FULL_NAME;
|
||||
MaxBytes = Ban_MAX_BYTES_FULL_NAME;
|
||||
CurrentBanName = Ban->FullName;
|
||||
break;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Lay_ShowErrorAndExit ("Code of banner is missing.");
|
||||
|
||||
/* Get the new name for the banner */
|
||||
Par_GetParToText (ParamName,NewBanName,MaxLength);
|
||||
Par_GetParToText (ParamName,NewBanName,MaxBytes);
|
||||
|
||||
/***** Get from the database the old names of the banner *****/
|
||||
Ban_GetDataOfBannerByCod (Ban);
|
||||
|
@ -622,7 +622,7 @@ static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (CurrentBanName,NewBanName,
|
||||
MaxLength);
|
||||
MaxBytes);
|
||||
|
||||
Ban_EditBanners ();
|
||||
}
|
||||
|
@ -650,8 +650,8 @@ void Ban_ChangeBannerImg (void)
|
|||
extern const char *Txt_The_new_image_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_image_empty;
|
||||
struct Banner *Ban;
|
||||
char Query[256 + Ban_MAX_LENGTH_IMAGE];
|
||||
char NewImg[Ban_MAX_LENGTH_IMAGE + 1];
|
||||
char Query[256 + Ban_MAX_BYTES_IMAGE];
|
||||
char NewImg[Ban_MAX_BYTES_IMAGE + 1];
|
||||
|
||||
Ban = &Gbl.Banners.EditingBan;
|
||||
|
||||
|
@ -661,7 +661,7 @@ void Ban_ChangeBannerImg (void)
|
|||
Lay_ShowErrorAndExit ("Code of banner is missing.");
|
||||
|
||||
/* Get the new WWW for the banner */
|
||||
Par_GetParToText ("Img",NewImg,Ban_MAX_LENGTH_IMAGE);
|
||||
Par_GetParToText ("Img",NewImg,Ban_MAX_BYTES_IMAGE);
|
||||
|
||||
/***** Check if new image is empty *****/
|
||||
if (NewImg[0])
|
||||
|
@ -681,7 +681,7 @@ void Ban_ChangeBannerImg (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Ban->Img,NewImg,
|
||||
Ban_MAX_LENGTH_IMAGE);
|
||||
Ban_MAX_BYTES_IMAGE);
|
||||
|
||||
Ban_EditBanners ();
|
||||
}
|
||||
|
@ -695,8 +695,8 @@ void Ban_ChangeBannerWWW (void)
|
|||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
struct Banner *Ban;
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Ban = &Gbl.Banners.EditingBan;
|
||||
|
||||
|
@ -706,7 +706,7 @@ void Ban_ChangeBannerWWW (void)
|
|||
Lay_ShowErrorAndExit ("Code of banner is missing.");
|
||||
|
||||
/* Get the new WWW for the banner */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
|
@ -726,7 +726,7 @@ void Ban_ChangeBannerWWW (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Ban->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
Ban_EditBanners ();
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ static void Ban_PutFormToCreateBanner (void)
|
|||
" class=\"INPUT_SHORT_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Ban_MAX_LENGTH_SHRT_NAME,Ban->ShrtName);
|
||||
Ban_MAX_CHARS_SHRT_NAME,Ban->ShrtName);
|
||||
|
||||
/***** Banner full name *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -776,7 +776,7 @@ static void Ban_PutFormToCreateBanner (void)
|
|||
" class=\"INPUT_FULL_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Ban_MAX_LENGTH_FULL_NAME,Ban->FullName);
|
||||
Ban_MAX_CHARS_FULL_NAME,Ban->FullName);
|
||||
|
||||
/***** Banner image *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -784,7 +784,7 @@ static void Ban_PutFormToCreateBanner (void)
|
|||
" size=\"12\" maxlength=\"%u\" value=\"%s\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Ban_MAX_LENGTH_IMAGE,Ban->Img);
|
||||
Ban_MAX_CHARS_IMAGE,Ban->Img);
|
||||
|
||||
/***** Banner WWW *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -794,7 +794,7 @@ static void Ban_PutFormToCreateBanner (void)
|
|||
" required=\"required\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Cns_MAX_LENGTH_WWW,Ban->WWW);
|
||||
Cns_MAX_CHARS_WWW,Ban->WWW);
|
||||
|
||||
/***** Send button and end frame *****/
|
||||
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_banner);
|
||||
|
@ -847,16 +847,16 @@ void Ban_RecFormNewBanner (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get banner short name */
|
||||
Par_GetParToText ("ShortName",Ban->ShrtName,Ban_MAX_LENGTH_SHRT_NAME);
|
||||
Par_GetParToText ("ShortName",Ban->ShrtName,Ban_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get banner full name */
|
||||
Par_GetParToText ("FullName",Ban->FullName,Ban_MAX_LENGTH_FULL_NAME);
|
||||
Par_GetParToText ("FullName",Ban->FullName,Ban_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get banner image */
|
||||
Par_GetParToText ("Img",Ban->Img,Ban_MAX_LENGTH_IMAGE);
|
||||
Par_GetParToText ("Img",Ban->Img,Ban_MAX_BYTES_IMAGE);
|
||||
|
||||
/* Get banner URL */
|
||||
Par_GetParToText ("WWW",Ban->WWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",Ban->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Ban->ShrtName[0] && Ban->FullName[0]) // If there's a banner name
|
||||
{
|
||||
|
@ -894,7 +894,7 @@ void Ban_RecFormNewBanner (void)
|
|||
static void Ban_CreateBanner (struct Banner *Ban)
|
||||
{
|
||||
extern const char *Txt_Created_new_banner_X;
|
||||
char Query[256 + Ban_MAX_LENGTH_SHRT_NAME + Ban_MAX_LENGTH_FULL_NAME + Ban_MAX_LENGTH_IMAGE + Cns_MAX_LENGTH_WWW];
|
||||
char Query[256 + Ban_MAX_BYTES_SHRT_NAME + Ban_MAX_BYTES_FULL_NAME + Ban_MAX_BYTES_IMAGE + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Create a new banner *****/
|
||||
sprintf (Query,"INSERT INTO banners (Hidden,ShortName,FullName,Img,WWW)"
|
||||
|
|
|
@ -33,18 +33,23 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Ban_MAX_LENGTH_SHRT_NAME 32
|
||||
#define Ban_MAX_LENGTH_FULL_NAME 127
|
||||
#define Ban_MAX_LENGTH_IMAGE 255
|
||||
#define Ban_MAX_CHARS_SHRT_NAME 32
|
||||
#define Ban_MAX_BYTES_SHRT_NAME (Ban_MAX_CHARS_SHRT_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Ban_MAX_CHARS_FULL_NAME (128 - 1)
|
||||
#define Ban_MAX_BYTES_FULL_NAME (Ban_MAX_CHARS_FULL_NAME * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Ban_MAX_CHARS_IMAGE (256 - 1)
|
||||
#define Ban_MAX_BYTES_IMAGE Ban_MAX_CHARS_IMAGE
|
||||
|
||||
struct Banner
|
||||
{
|
||||
long BanCod;
|
||||
bool Hidden;
|
||||
char ShrtName[Ban_MAX_LENGTH_SHRT_NAME + 1];
|
||||
char FullName[Ban_MAX_LENGTH_FULL_NAME + 1];
|
||||
char Img[Ban_MAX_LENGTH_IMAGE + 1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char ShrtName[Ban_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Ban_MAX_BYTES_FULL_NAME + 1];
|
||||
char Img[Ban_MAX_BYTES_IMAGE + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -99,7 +99,7 @@ static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod);
|
|||
static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
|
||||
static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,long CtrCod,long InsCod);
|
||||
static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
||||
const char NewWWW[Cns_MAX_LENGTH_WWW + 1]);
|
||||
const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
static void Ctr_PutButtonToGoToCtr (struct Centre *Ctr);
|
||||
|
||||
static void Ctr_PutFormToCreateCentre (void);
|
||||
|
@ -494,7 +494,7 @@ static void Ctr_Configuration (bool PrintView)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,
|
||||
Cns_MAX_CHARS_WWW,
|
||||
Gbl.CurrentCtr.Ctr.WWW,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
|
@ -1044,7 +1044,7 @@ void Ctr_GetListCentres (long InsCod)
|
|||
|
||||
/* Get the URL of the centre (row[7]) */
|
||||
Str_Copy (Ctr->WWW,row[7],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get number of users who claim to belong to this centre (row[8]) */
|
||||
if (sscanf (row[8],"%u",&Ctr->NumUsrsWhoClaimToBelongToCtr) != 1)
|
||||
|
@ -1142,7 +1142,7 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
|||
|
||||
/* Get the URL of the centre (row[6]) */
|
||||
Str_Copy (Ctr->WWW,row[6],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get number of users who claim to belong to this centre (row[7]) */
|
||||
if (sscanf (row[7],"%u",&Ctr->NumUsrsWhoClaimToBelongToCtr) != 1)
|
||||
|
@ -1375,7 +1375,7 @@ static void Ctr_ListCentresForEdition (void)
|
|||
unsigned NumCtr;
|
||||
struct Centre *Ctr;
|
||||
unsigned NumPlc;
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
struct UsrData UsrDat;
|
||||
bool ICanEdit;
|
||||
Ctr_StatusTxt_t StatusTxt;
|
||||
|
@ -1506,13 +1506,13 @@ static void Ctr_ListCentresForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,Ctr->WWW,Gbl.Form.Id);
|
||||
Cns_MAX_CHARS_WWW,Ctr->WWW,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Ctr->WWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
fprintf (Gbl.F.Out,"<div class=\"EXTERNAL_WWW_SHORT\">"
|
||||
"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT\" title=\"%s\">"
|
||||
|
@ -1979,7 +1979,7 @@ void Ctr_ChangeCtrWWW (void)
|
|||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
struct Centre *Ctr;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Ctr = &Gbl.Ctrs.EditingCtr;
|
||||
|
||||
|
@ -1988,7 +1988,7 @@ void Ctr_ChangeCtrWWW (void)
|
|||
Ctr->CtrCod = Ctr_GetAndCheckParamOtherCtrCod ();
|
||||
|
||||
/* Get the new WWW for the centre */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Get data of centre *****/
|
||||
Ctr_GetDataOfCentreByCod (Ctr);
|
||||
|
@ -2000,7 +2000,7 @@ void Ctr_ChangeCtrWWW (void)
|
|||
Ctr_UpdateCtrWWWDB (Ctr->CtrCod,NewWWW);
|
||||
|
||||
Str_Copy (Ctr->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2020,11 +2020,11 @@ void Ctr_ChangeCtrWWWInConfig (void)
|
|||
{
|
||||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new WWW for the centre */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
|
@ -2032,7 +2032,7 @@ void Ctr_ChangeCtrWWWInConfig (void)
|
|||
/***** Update database changing old WWW by new WWW *****/
|
||||
Ctr_UpdateCtrWWWDB (Gbl.CurrentCtr.Ctr.CtrCod,NewWWW);
|
||||
Str_Copy (Gbl.CurrentCtr.Ctr.WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2050,9 +2050,9 @@ void Ctr_ChangeCtrWWWInConfig (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Ctr_UpdateCtrWWWDB (long CtrCod,
|
||||
const char NewWWW[Cns_MAX_LENGTH_WWW + 1])
|
||||
const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE centres SET WWW='%s' WHERE CtrCod='%ld'",
|
||||
|
@ -2461,7 +2461,7 @@ static void Ctr_PutFormToCreateCentre (void)
|
|||
" class=\"INPUT_WWW\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Cns_MAX_LENGTH_WWW,Ctr->WWW);
|
||||
Cns_MAX_CHARS_WWW,Ctr->WWW);
|
||||
|
||||
/***** Number of users who claim to belong to this centre *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -2677,7 +2677,7 @@ static void Ctr_RecFormRequestOrCreateCtr (unsigned Status)
|
|||
Par_GetParToText ("FullName",Ctr->FullName,Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
|
||||
/* Get centre WWW */
|
||||
Par_GetParToText ("WWW",Ctr->WWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",Ctr->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Ctr->ShrtName[0] && Ctr->FullName[0]) // If there's a centre name
|
||||
{
|
||||
|
@ -2725,7 +2725,7 @@ static void Ctr_CreateCentre (struct Centre *Ctr,unsigned Status)
|
|||
char Query[512 +
|
||||
Ctr_MAX_LENGTH_CENTRE_SHRT_NAME +
|
||||
Ctr_MAX_LENGTH_CENTRE_FULL_NAME +
|
||||
Cns_MAX_LENGTH_WWW];
|
||||
Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Create a new centre *****/
|
||||
sprintf (Query,"INSERT INTO centres (InsCod,PlcCod,Status,RequesterUsrCod,"
|
||||
|
|
|
@ -70,7 +70,7 @@ struct Centre
|
|||
long RequesterUsrCod; // User code of the person who requested the creation of this centre
|
||||
char ShrtName[Ctr_MAX_LENGTH_CENTRE_SHRT_NAME + 1];
|
||||
char FullName[Ctr_MAX_LENGTH_CENTRE_FULL_NAME + 1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
unsigned NumUsrsWhoClaimToBelongToCtr; // Number of users who claim to belong in this centre
|
||||
struct ListDegrees Degs; // List of degrees in this centre
|
||||
unsigned NumCrss; // Number of courses in this centre
|
||||
|
|
|
@ -193,6 +193,8 @@
|
|||
// TODO: System admin should view link "Visits to course"
|
||||
// TODO: Un administrador de institución, ¿debería poder cambiar la contraseña de un usuario de esa institución? No lo tengo claro.
|
||||
|
||||
// TODO: Add a '+' icon in list of forum thread to add a new thread.
|
||||
|
||||
// TODO: Subject in forum_post should be VARCHAR(255) in order to be copied directly to SummaryStr
|
||||
// TODO: Add a Subject (VARCHAR(255)) to notices to be used as SummaryStr
|
||||
// TODO: Subject in msg_content and msg_content_deleted should be VARCHAR(255) in order to be copied directly to SummaryStr
|
||||
|
@ -202,13 +204,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.148 (2017-03-06)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.149 (2017-03-07)"
|
||||
#define CSS_FILE "swad16.147.css"
|
||||
#define JS_FILE "swad16.144.js"
|
||||
|
||||
// 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
|
||||
/*
|
||||
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.147.11:Mar 06, 2017 Changes in names of zipped files. (216388 lines)
|
||||
Version 16.147.10:Mar 06, 2017 Changes in layout of users' listing. (216394 lines)
|
||||
|
@ -254,6 +257,8 @@
|
|||
Version 16.142: Feb 27, 2017 Searches are registered anonymously. (213077 lines)
|
||||
1 change necessary in database:
|
||||
CREATE TABLE IF NOT EXISTS log_search (LogCod INT NOT NULL,SearchStr VARCHAR(255) NOT NULL,UNIQUE INDEX(LogCod));
|
||||
If you prefer MyISAM tables:
|
||||
ALTER TABLE log_search ENGINE=MyISAM;
|
||||
|
||||
Version 16.141.2: Feb 26, 2017 Search from top of page always uses system scope. (213039 lines)
|
||||
Version 16.141.1: Feb 26, 2017 Fixed bug in range of dates. (213056 lines)
|
||||
|
|
|
@ -33,19 +33,21 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Cns_MAX_LENGTH_WWW (256 - 1) // Max. length of a URL
|
||||
#define Cns_MAX_CHARS_WWW (256 - 1) // Max. number of chars of a URL
|
||||
#define Cns_MAX_BYTES_WWW Cns_MAX_CHARS_WWW
|
||||
|
||||
#define Cns_MAX_LENGTH_IP (16 - 1) // Max. bytes of an IP address
|
||||
|
||||
#define Cns_MAX_LENGTH_DATE (4 + 1 + 2 + 1 + 2)
|
||||
#define Cns_MAX_BYTES_DATE 19 // Examples: "20030614143857", "14/06/2003 14:38:57"
|
||||
|
||||
#define Cns_MAX_LENGTH_SUBJECT (256 - 1)
|
||||
#define Cns_MAX_BYTES_SUBJECT (Cns_MAX_LENGTH_SUBJECT * Str_MAX_CHARACTER)
|
||||
#define Cns_MAX_CHARS_SUBJECT (256 - 1)
|
||||
#define Cns_MAX_BYTES_SUBJECT (Cns_MAX_CHARS_SUBJECT * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Cns_MAX_BYTES_SUMMARY_STRING (256 - 1)
|
||||
#define Cns_MAX_CHARS_SUMMARY_STRING (256 - 1)
|
||||
#define Cns_MAX_BYTES_SUMMARY_STRING (Cns_MAX_CHARS_SUMMARY_STRING * Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Cns_MAX_BYTES_TEXT ( 64 * 1024 - 1) // Used for subjects and other medium texts
|
||||
#define Cns_MAX_BYTES_TEXT ( 64 * 1024 - 1) // Used for medium texts
|
||||
#define Cns_MAX_BYTES_LONG_TEXT (256 * 1024 - 1) // Used for big contents
|
||||
|
||||
#define Cns_MAX_LENGTH_STRING (128 - 1)
|
||||
|
|
|
@ -48,7 +48,7 @@ int main (void)
|
|||
unsigned NumUsrs = 0;
|
||||
unsigned i;
|
||||
long UsrCod;
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||
char OldPathUsr[PATH_MAX + 1];
|
||||
char Command[1024 + PATH_MAX * 2];
|
||||
|
||||
|
@ -97,7 +97,7 @@ int main (void)
|
|||
if (row[1])
|
||||
{
|
||||
Str_Copy (UsrID,row[1],
|
||||
ID_MAX_LENGTH_USR_ID); // UsrID
|
||||
ID_MAX_BYTES_USR_ID); // UsrID
|
||||
sprintf (OldPathUsr,"%s/%s_backup/%c/%s",
|
||||
PATH_SWAD_PRIVATE,FOLDER_USR,UsrID[strlen (UsrID)-1],UsrID);
|
||||
if (CheckIfPathExists (OldPathUsr))
|
||||
|
|
|
@ -49,7 +49,7 @@ int main (void)
|
|||
unsigned NumPhotos = 0;
|
||||
unsigned i;
|
||||
long UsrCod;
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||
char OldPathPhoto[PATH_MAX + 1];
|
||||
char Command[1024 + PATH_MAX * 2];
|
||||
|
||||
|
@ -98,7 +98,7 @@ int main (void)
|
|||
if (row[1])
|
||||
{
|
||||
Str_Copy (UsrID,row[1],
|
||||
ID_MAX_LENGTH_USR_ID); // UsrID
|
||||
ID_MAX_BYTES_USR_ID); // UsrID
|
||||
sprintf (OldPathPhoto,"%s/%s_backup/%s_original.jpg",
|
||||
PATH_SWAD_PRIVATE,FOLDER_PHOTO,UsrID);
|
||||
if (CheckIfPathExists (OldPathPhoto))
|
||||
|
|
|
@ -52,7 +52,7 @@ int main (void)
|
|||
unsigned NumUsr;
|
||||
long CrsCod;
|
||||
long UsrCod;
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrID[ID_MAX_BYTES_USR_ID + 1];
|
||||
char OldPathUsrs[PATH_MAX + 1];
|
||||
char OldPathUsr[PATH_MAX + 1];
|
||||
char Path02u[PATH_MAX + 1];
|
||||
|
@ -127,7 +127,7 @@ int main (void)
|
|||
if (row[1])
|
||||
{
|
||||
Str_Copy (UsrID,row[1],
|
||||
ID_MAX_LENGTH_USR_ID,62); // UsrID
|
||||
ID_MAX_BYTES_USR_ID,62); // UsrID
|
||||
sprintf (OldPathUsr,"%s_backup/%s",OldPathUsrs,UsrID);
|
||||
if (CheckIfPathExists (OldPathUsr))
|
||||
{
|
||||
|
|
|
@ -1110,7 +1110,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
|
|||
Str_Copy (Cty->Name[Lan],row[1 + Lan],
|
||||
Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
Str_Copy (Cty->WWW[Lan],row[1 + Txt_NUM_LANGUAGES + Lan],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
/* Get number of users who claim to belong to this country */
|
||||
|
@ -1213,7 +1213,7 @@ void Cty_WriteCountryName (long CtyCod,const char *ClassLink)
|
|||
{
|
||||
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
|
||||
char CtyName[Cty_MAX_BYTES_COUNTRY_NAME + 1];
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
bool PutForm = ClassLink &&
|
||||
!Gbl.Form.Inside && // Only if not inside another form
|
||||
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
|
||||
|
@ -1357,7 +1357,7 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
|
|||
Str_Copy (Cty->Name[Gbl.Prefs.Language],row[1],
|
||||
Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
Str_Copy (Cty->WWW[Gbl.Prefs.Language],row[2],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
break;
|
||||
case Cty_GET_EXTRA_DATA:
|
||||
/* Get name and WWW of the country in several languages */
|
||||
|
@ -1368,7 +1368,7 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
|
|||
Str_Copy (Cty->Name[Lan],row[Lan],
|
||||
Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
Str_Copy (Cty->WWW[Lan],row[Txt_NUM_LANGUAGES + Lan],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
/* Get number of users who claim to belong to this country */
|
||||
|
@ -1618,7 +1618,7 @@ static void Cty_ListCountriesForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,
|
||||
Cns_MAX_CHARS_WWW,
|
||||
Cty->WWW[Lan],Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
|
@ -1840,9 +1840,9 @@ void Cty_ChangeCtyWWW (void)
|
|||
{
|
||||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
struct Country *Cty;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
Txt_Language_t Language;
|
||||
|
||||
Cty = &Gbl.Ctys.EditingCty;
|
||||
|
@ -1872,7 +1872,7 @@ void Cty_ChangeCtyWWW (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Cty->WWW[Language],NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
Cty_EditCountries ();
|
||||
}
|
||||
|
||||
|
@ -1994,7 +1994,7 @@ static void Cty_PutFormToCreateCountry (void)
|
|||
"</td>"
|
||||
"</tr>",
|
||||
Txt_STR_LANG_ID[Lan],
|
||||
Cns_MAX_LENGTH_WWW,
|
||||
Cns_MAX_CHARS_WWW,
|
||||
Cty->WWW[Lan]);
|
||||
}
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ void Cty_RecFormNewCountry (void)
|
|||
}
|
||||
|
||||
sprintf (ParamName,"WWW_%s",Txt_STR_LANG_ID[Lan]);
|
||||
Par_GetParToText (ParamName,Cty->WWW[Lan],Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText (ParamName,Cty->WWW[Lan],Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2156,7 +2156,7 @@ void Cty_RecFormNewCountry (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
#define Cty_MAX_LENGTH_SUBQUERY_CTYS_NAME ((1 + Txt_NUM_LANGUAGES) * Cty_MAX_BYTES_COUNTRY_NAME)
|
||||
#define Cty_MAX_LENGTH_SUBQUERY_CTYS_WWW ((1 + Txt_NUM_LANGUAGES) * Cns_MAX_LENGTH_WWW)
|
||||
#define Cty_MAX_LENGTH_SUBQUERY_CTYS_WWW ((1 + Txt_NUM_LANGUAGES) * Cns_MAX_BYTES_WWW)
|
||||
|
||||
static void Cty_CreateCountry (struct Country *Cty)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ struct Country
|
|||
long CtyCod;
|
||||
char Alpha2[2 + 1];
|
||||
char Name[1 + Txt_NUM_LANGUAGES][Cty_MAX_BYTES_COUNTRY_NAME + 1];
|
||||
char WWW [1 + Txt_NUM_LANGUAGES][Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW [1 + Txt_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1];
|
||||
unsigned NumUsrsWhoClaimToBelongToCty;
|
||||
unsigned NumInss;
|
||||
unsigned NumCtrs;
|
||||
|
|
|
@ -537,7 +537,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
unsigned NumDegs;
|
||||
unsigned NumCrs;
|
||||
unsigned NumCrss;
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
const char *ClassNormal;
|
||||
char ClassHighlight[64];
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ extern const char Str_BIN_TO_BASE64URL[64];
|
|||
|
||||
// Pointers to PlainText and EncryptedText can point to the same place
|
||||
void Cry_EncryptSHA256Base64 (const char *PlainText,
|
||||
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
char EncryptedText[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
{
|
||||
int i,j;
|
||||
unsigned char digest256[SHA256_DIGEST_SIZE];
|
||||
|
@ -103,7 +103,7 @@ void Cry_EncryptSHA256Base64 (const char *PlainText,
|
|||
EncryptedText[j++] = Str_BIN_TO_BASE64URL [ (digest256[i + 2] & 0x3F) ];
|
||||
}
|
||||
}
|
||||
EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64] = '\0';
|
||||
EncryptedText[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -143,7 +143,7 @@ void Cry_EncryptSHA512Base64 (const char *PlainText,
|
|||
/*** Create a unique name encrypted, different each time function is called **/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Cry_CreateUniqueNameEncrypted (char UniqueNameEncrypted[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
void Cry_CreateUniqueNameEncrypted (char UniqueNameEncrypted[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
{
|
||||
static unsigned NumCall = 0; // When this function is called several times in the same execution of the program, each time a new name is created
|
||||
char UniqueNamePlain[Cns_MAX_LENGTH_IP + 1 + 10 + 1 + 10 + 1 + 10 + 1];
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 43 // 42,66 base-64 characters store 256 bits
|
||||
#define Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 43 // 42,66 base-64 characters store 256 bits
|
||||
#define Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 86 // 85,33 base-64 characters store 512 bits
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -43,10 +43,10 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
void Cry_EncryptSHA256Base64 (const char *PlainText,
|
||||
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
char EncryptedText[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
void Cry_EncryptSHA512Base64 (const char *PlainText,
|
||||
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1]);
|
||||
|
||||
void Cry_CreateUniqueNameEncrypted (char UniqueNameEncrypted[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
void Cry_CreateUniqueNameEncrypted (char UniqueNameEncrypted[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -107,7 +107,7 @@ static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row);
|
|||
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName);
|
||||
static bool Deg_CheckIfDegNameExistsInCtr (const char *FieldName,const char *Name,long DegCod,long CtrCod);
|
||||
static void Deg_UpdateDegCtrDB (long DegCod,long CtrCod);
|
||||
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_LENGTH_WWW + 1]);
|
||||
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** List pending institutions, centres, degrees and courses **********/
|
||||
|
@ -451,7 +451,7 @@ static void Deg_Configuration (bool PrintView)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,
|
||||
Cns_MAX_CHARS_WWW,
|
||||
Gbl.CurrentDeg.Deg.WWW,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
|
@ -685,7 +685,7 @@ static void Deg_ListDegreesForEdition (void)
|
|||
struct DegreeType *DegTyp;
|
||||
struct Degree *Deg;
|
||||
unsigned NumDegTyp;
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
struct UsrData UsrDat;
|
||||
bool ICanEdit;
|
||||
Deg_StatusTxt_t StatusTxt;
|
||||
|
@ -814,13 +814,13 @@ static void Deg_ListDegreesForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,Deg->WWW,Gbl.Form.Id);
|
||||
Cns_MAX_CHARS_WWW,Deg->WWW,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Deg->WWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
fprintf (Gbl.F.Out,"<div class=\"EXTERNAL_WWW_SHORT\">"
|
||||
"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT\" title=\"%s\">"
|
||||
|
@ -1023,7 +1023,7 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
" class=\"INPUT_WWW\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Cns_MAX_LENGTH_WWW,Deg->WWW);
|
||||
Cns_MAX_CHARS_WWW,Deg->WWW);
|
||||
|
||||
/***** Current number of courses in this degree *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -1166,7 +1166,7 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status)
|
|||
char Query[512 +
|
||||
Deg_MAX_LENGTH_DEGREE_SHRT_NAME +
|
||||
Deg_MAX_LENGTH_DEGREE_FULL_NAME +
|
||||
Cns_MAX_LENGTH_WWW];
|
||||
Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Create a new degree *****/
|
||||
sprintf (Query,"INSERT INTO degrees (CtrCod,DegTypCod,Status,"
|
||||
|
@ -1551,7 +1551,7 @@ static void Deg_RecFormRequestOrCreateDeg (unsigned Status)
|
|||
Lay_ShowAlert (Lay_ERROR,"Wrong type of degree.");
|
||||
|
||||
/* Get degree WWW */
|
||||
Par_GetParToText ("WWW",Deg->WWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",Deg->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Deg->ShrtName[0] && Deg->FullName[0]) // If there's a degree name
|
||||
{
|
||||
|
@ -1736,7 +1736,7 @@ static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row)
|
|||
|
||||
/***** Get WWW (row[7]) *****/
|
||||
Str_Copy (Deg->WWW,row[7],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2113,7 +2113,7 @@ void Deg_ChangeDegWWW (void)
|
|||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
struct Degree *Deg;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Deg = &Gbl.Degs.EditingDeg;
|
||||
|
||||
|
@ -2122,7 +2122,7 @@ void Deg_ChangeDegWWW (void)
|
|||
Deg->DegCod = Deg_GetAndCheckParamOtherDegCod ();
|
||||
|
||||
/* Get the new WWW for the degree */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDataOfDegreeByCod (Deg);
|
||||
|
@ -2133,7 +2133,7 @@ void Deg_ChangeDegWWW (void)
|
|||
/***** Update the table changing old WWW by new WWW *****/
|
||||
Deg_UpdateDegWWWDB (Deg->DegCod,NewWWW);
|
||||
Str_Copy (Deg->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2153,11 +2153,11 @@ void Deg_ChangeDegWWWInConfig (void)
|
|||
{
|
||||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new WWW for the degree */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
|
@ -2165,7 +2165,7 @@ void Deg_ChangeDegWWWInConfig (void)
|
|||
/***** Update the table changing old WWW by new WWW *****/
|
||||
Deg_UpdateDegWWWDB (Gbl.CurrentDeg.Deg.DegCod,NewWWW);
|
||||
Str_Copy (Gbl.CurrentDeg.Deg.WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2182,9 +2182,9 @@ void Deg_ChangeDegWWWInConfig (void)
|
|||
/**************** Update database changing old WWW by new WWW ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_LENGTH_WWW + 1])
|
||||
static void Deg_UpdateDegWWWDB (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE degrees SET WWW='%s' WHERE DegCod='%ld'",
|
||||
|
|
|
@ -75,7 +75,7 @@ struct Degree
|
|||
long RequesterUsrCod; // User code of the person who requested the creation of this degree
|
||||
char ShrtName[Deg_MAX_LENGTH_DEGREE_SHRT_NAME + 1]; // Short name of degree
|
||||
char FullName[Deg_MAX_LENGTH_DEGREE_FULL_NAME + 1]; // Full name of degree
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
struct Course *LstCrss; // List of courses in this degree
|
||||
};
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ void Dpt_GetListDepartments (long InsCod)
|
|||
|
||||
/* Get the URL of the department (row[4]) */
|
||||
Str_Copy (Dpt->WWW,row[4],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get number of teachers in this department (row[5]) */
|
||||
if (sscanf (row[5],"%u",&Dpt->NumTchs) != 1)
|
||||
|
@ -435,7 +435,7 @@ void Dpt_GetDataOfDepartmentByCod (struct Department *Dpt)
|
|||
|
||||
/* Get the URL of the department (row[3]) */
|
||||
Str_Copy (Dpt->WWW,row[3],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get number of teachers in this department (row[4]) */
|
||||
if (sscanf (row[4],"%u",&Dpt->NumTchs) != 1)
|
||||
|
@ -583,7 +583,7 @@ static void Dpt_ListDepartmentsForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,Dpt->WWW,Gbl.Form.Id);
|
||||
Cns_MAX_CHARS_WWW,Dpt->WWW,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -820,8 +820,8 @@ void Dpt_ChangeDptWWW (void)
|
|||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
struct Department *Dpt;
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Dpt = &Gbl.Dpts.EditingDpt;
|
||||
|
||||
|
@ -831,7 +831,7 @@ void Dpt_ChangeDptWWW (void)
|
|||
Lay_ShowErrorAndExit ("Code of department is missing.");
|
||||
|
||||
/* Get the new WWW for the department */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
|
@ -854,7 +854,7 @@ void Dpt_ChangeDptWWW (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Dpt->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
Dpt_EditDepartments ();
|
||||
}
|
||||
|
||||
|
@ -949,7 +949,7 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
" required=\"required\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Cns_MAX_LENGTH_WWW,Dpt->WWW);
|
||||
Cns_MAX_CHARS_WWW,Dpt->WWW);
|
||||
|
||||
/***** Send button and end of frame *****/
|
||||
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_department);
|
||||
|
@ -1025,7 +1025,7 @@ void Dpt_RecFormNewDpt (void)
|
|||
Par_GetParToText ("FullName",Dpt->FullName,Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
|
||||
/* Get department WWW */
|
||||
Par_GetParToText ("WWW",Dpt->WWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",Dpt->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Dpt->ShrtName[0] && Dpt->FullName[0]) // If there's a department name
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ struct Department
|
|||
long InsCod;
|
||||
char ShrtName[Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME + 1];
|
||||
char FullName[Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME + 1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
unsigned NumTchs;
|
||||
};
|
||||
|
||||
|
|
|
@ -1454,7 +1454,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
|||
/***** Find users for this user's ID *****/
|
||||
ID_ReallocateListIDs (&UsrDat,1); // Only one user's ID
|
||||
Str_Copy (UsrDat.IDs.List[0].ID,UsrDat.UsrIDNickOrEmail,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
Str_ConvertToUpperText (UsrDat.IDs.List[0].ID);
|
||||
ID_GetListUsrCodsFromUsrID (&UsrDat,NULL,&ListUsrCods,false);
|
||||
}
|
||||
|
@ -1578,7 +1578,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
|||
/* Find users for this user's ID */
|
||||
ID_ReallocateListIDs (&UsrDat,1); // Only one user's ID
|
||||
Str_Copy (UsrDat.IDs.List[0].ID,UsrDat.UsrIDNickOrEmail,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
Str_ConvertToUpperText (UsrDat.IDs.List[0].ID);
|
||||
ID_GetListUsrCodsFromUsrID (&UsrDat,NULL,&ListUsrCods,false);
|
||||
}
|
||||
|
|
|
@ -2500,7 +2500,7 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
|||
if (Gbl.FileBrowser.Level == 1)
|
||||
// We are in this case: assignments/assignment-folder
|
||||
Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnkName,
|
||||
Asg_MAX_LENGTH_FOLDER);
|
||||
Asg_MAX_BYTES_FOLDER);
|
||||
else
|
||||
{
|
||||
// We are in this case: assignments/assignment-folder/rest-of-path
|
||||
|
@ -2510,7 +2510,7 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
|||
if (*Ptr == '/')
|
||||
Ptr++; // Skip '/'
|
||||
for (i = 0;
|
||||
i < Asg_MAX_LENGTH_FOLDER && *Ptr && *Ptr != '/';
|
||||
i < Asg_MAX_BYTES_FOLDER && *Ptr && *Ptr != '/';
|
||||
i++, Ptr++)
|
||||
Gbl.FileBrowser.Asg.Folder[i] = *Ptr; // Copy assignment folder
|
||||
Gbl.FileBrowser.Asg.Folder[i] = '\0';
|
||||
|
@ -3191,7 +3191,7 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
|
@ -5206,7 +5206,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
|
|||
if (Level == 1) // Main folder of the assignment
|
||||
{
|
||||
Str_Copy (Gbl.FileBrowser.Asg.Folder,FileName,
|
||||
Asg_MAX_LENGTH_FOLDER);
|
||||
Asg_MAX_BYTES_FOLDER);
|
||||
Asg_GetDataOfAssignmentByFolder (&Gbl.FileBrowser.Asg);
|
||||
// The data of this assignment remains in Gbl.FileBrowser.Asg
|
||||
// for all subsequent rows with Level > 1 (files or folders inside this folder),
|
||||
|
|
65
swad_forum.c
65
swad_forum.c
|
@ -315,8 +315,6 @@ static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr
|
|||
static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time);
|
||||
|
||||
static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject);
|
||||
static void For_PutSubjectContent (const char *Label,const char *Field,
|
||||
unsigned NumRows,const char *Content);
|
||||
|
||||
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail);
|
||||
static void For_WriteNumberOfThrs (unsigned NumThrs,unsigned NumThrsWithNewPosts);
|
||||
|
@ -472,7 +470,7 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
|||
if ((Query = malloc (512 +
|
||||
strlen (Subject) +
|
||||
strlen (Content) +
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Img_MAX_BYTES_TITLE)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store database query.");
|
||||
|
||||
|
@ -2296,7 +2294,7 @@ static void For_WriteLinkToForum (For_ForumType_t ForumType,Act_Action_t NextAct
|
|||
unsigned NumThrsWithNewPosts;
|
||||
unsigned NumPosts;
|
||||
const char *Style;
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
|
||||
/***** Get number of threads and number of posts *****/
|
||||
NumThrs = For_GetNumThrsInForum (ForumType);
|
||||
|
@ -3866,9 +3864,36 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject)
|
|||
/***** Subject and content *****/
|
||||
// If writing a reply to a message of an existing thread ==> write subject
|
||||
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\">");
|
||||
For_PutSubjectContent (Txt_MSG_Subject,"Subject", 2,IsReply ? Subject :
|
||||
NULL);
|
||||
For_PutSubjectContent (Txt_MSG_Message,"Content",15,NULL);
|
||||
|
||||
/* Subject */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_MIDDLE\">"
|
||||
"<label for=\"Subject\" class=\"%s\">%s:</label>"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_MIDDLE\">"
|
||||
"<input type=\"text\" id=\"Subject\" name=\"Subject\""
|
||||
" size=\"45\" maxlength=\"%u\" value=\"%s\""
|
||||
" required=\"required\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],Txt_MSG_Subject,
|
||||
Cns_MAX_CHARS_SUBJECT,
|
||||
IsReply ? Subject :
|
||||
"");
|
||||
|
||||
/* Content */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_TOP\">"
|
||||
"<label for=\"Content\" class=\"%s\">%s: </label>"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_TOP\">"
|
||||
"<textarea id=\"Content\" name=\"Content\""
|
||||
" cols=\"72\" rows=\"15\">"
|
||||
"</textarea>"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],Txt_MSG_Message);
|
||||
|
||||
fprintf (Gbl.F.Out,"</table>");
|
||||
|
||||
/***** Help for text editor *****/
|
||||
|
@ -3887,32 +3912,6 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject)
|
|||
Lay_EndRoundFrame ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Put form field for subject or content ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_PutSubjectContent (const char *Label,const char *Field,
|
||||
unsigned NumRows,const char *Content)
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_TOP\">"
|
||||
"<label for=\"%s\" class=\"%s\">%s: </label>"
|
||||
"</td>"
|
||||
"<td class=\"LEFT_TOP\">"
|
||||
"<textarea id=\"%s\" name=\"%s\""
|
||||
" cols=\"72\" rows=\"%u\">",
|
||||
Field,The_ClassForm[Gbl.Prefs.Theme],Label,
|
||||
Field,Field,
|
||||
NumRows);
|
||||
if (Content)
|
||||
fprintf (Gbl.F.Out,"%s",Content);
|
||||
fprintf (Gbl.F.Out,"</textarea>"
|
||||
"</td>"
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Receive message of a forum ***********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -97,7 +97,7 @@ struct Globals
|
|||
{
|
||||
int Num; // Number of form, used in form submit links
|
||||
char Id[32]; // Identifier string used in forms
|
||||
char UniqueId[32 + Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1]; // Unique identifier string used in forms
|
||||
char UniqueId[32 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1]; // Unique identifier string used in forms
|
||||
bool Inside; // Set to true inside a form to avoid nested forms
|
||||
} Form;
|
||||
bool Error;
|
||||
|
@ -146,7 +146,7 @@ struct Globals
|
|||
long TimeSendInMicroseconds;
|
||||
|
||||
char IP[Cns_MAX_LENGTH_IP + 1];
|
||||
char UniqueNameEncrypted[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Used for session id, temporary directory names, etc.
|
||||
char UniqueNameEncrypted[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Used for session id, temporary directory names, etc.
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -294,7 +294,7 @@ struct Globals
|
|||
Rol_Role_t MaxRole;
|
||||
bool RoleHasChanged; // Set when I have changed my role
|
||||
char UsrIdLogin[Usr_MAX_BYTES_USR_LOGIN + 1]; // String to store the ID, nickname or email entered in the user's login
|
||||
char LoginPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char LoginPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
char LoginEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
char PendingPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
char PathDir[PATH_MAX + 1];
|
||||
|
@ -466,7 +466,7 @@ struct Globals
|
|||
struct
|
||||
{
|
||||
Inf_InfoType_t Type;
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
bool MustBeRead[Inf_NUM_INFO_TYPES]; // Students must read info?
|
||||
bool ShowMsgMustBeRead;
|
||||
} Info;
|
||||
|
|
|
@ -144,7 +144,7 @@ void Img_GetImageNameTitleAndURLFromRow (const char *Name,
|
|||
|
||||
/***** Copy image name to struct *****/
|
||||
Str_Copy (Image->Name,Name,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/***** Set status of image file *****/
|
||||
Image->Status = Image->Name[0] ? Img_NAME_STORED_IN_DB :
|
||||
|
@ -197,7 +197,7 @@ void Img_PutImageUploader (int NumImgInForm,const char *ClassImgTitURL)
|
|||
extern const char *Txt_Image_title_attribution;
|
||||
extern const char *Txt_Link;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
char Id[Act_MAX_LENGTH_ID];
|
||||
char Id[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Set names of parameters depending on number of image in form *****/
|
||||
Img_SetParamNames (&ParamUploadImg,NumImgInForm);
|
||||
|
|
|
@ -88,7 +88,7 @@ struct Image
|
|||
{
|
||||
Img_Action_t Action;
|
||||
Img_FileStatus_t Status;
|
||||
char Name[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char Name[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char *Title; // Title/attribution (it must be initialized to NULL
|
||||
// in order to not trying to free it when no memory allocated)
|
||||
char *URL; // URL, i.e. link to original big photo or video
|
||||
|
|
12
swad_info.c
12
swad_info.c
|
@ -916,7 +916,7 @@ static bool Inf_CheckURL (long CrsCod,Inf_InfoType_t InfoType)
|
|||
/***** Check if file with URL exists *****/
|
||||
if ((FileURL = fopen (PathFile,"rb")))
|
||||
{
|
||||
if (fgets (Gbl.CurrentCrs.Info.URL,Cns_MAX_LENGTH_WWW,FileURL) == NULL)
|
||||
if (fgets (Gbl.CurrentCrs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL)
|
||||
Gbl.CurrentCrs.Info.URL[0] = '\0';
|
||||
/* File is not longer needed ==> close it */
|
||||
fclose (FileURL);
|
||||
|
@ -944,7 +944,7 @@ static bool Inf_CheckAndShowURL (void)
|
|||
/***** Check if file with URL exists *****/
|
||||
if ((FileURL = fopen (PathFile,"rb")))
|
||||
{
|
||||
if (fgets (Gbl.CurrentCrs.Info.URL,Cns_MAX_LENGTH_WWW,FileURL) == NULL)
|
||||
if (fgets (Gbl.CurrentCrs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL)
|
||||
Gbl.CurrentCrs.Info.URL[0] = '\0';
|
||||
/* File is not longer needed ==> close it */
|
||||
fclose (FileURL);
|
||||
|
@ -975,7 +975,7 @@ static void Inf_BuildPathURL (long CrsCod,Inf_InfoType_t InfoType,char *PathFile
|
|||
/*****************************************************************************/
|
||||
// This function is called only from web service
|
||||
|
||||
void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_LENGTH_WWW + 1])
|
||||
void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
char PathFile[PATH_MAX + 1];
|
||||
FILE *FileURL;
|
||||
|
@ -989,7 +989,7 @@ void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_LENGTH_WWW + 1])
|
|||
/***** Check if file with URL exists *****/
|
||||
if ((FileURL = fopen (PathFile,"rb")))
|
||||
{
|
||||
if (fgets (TxtBuffer,Cns_MAX_LENGTH_WWW,FileURL) == NULL)
|
||||
if (fgets (TxtBuffer,Cns_MAX_BYTES_WWW,FileURL) == NULL)
|
||||
TxtBuffer[0] = '\0';
|
||||
/* File is not longer needed ==> close it */
|
||||
fclose (FileURL);
|
||||
|
@ -1295,7 +1295,7 @@ void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc)
|
|||
fprintf (Gbl.F.Out,"http://");
|
||||
else
|
||||
{
|
||||
if (fgets (Gbl.CurrentCrs.Info.URL,Cns_MAX_LENGTH_WWW,FileURL) == NULL)
|
||||
if (fgets (Gbl.CurrentCrs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL)
|
||||
Gbl.CurrentCrs.Info.URL[0] = '\0';
|
||||
/* File is not needed now. Close it */
|
||||
fclose (FileURL);
|
||||
|
@ -2206,7 +2206,7 @@ void Inf_ReceiveURLInfo (void)
|
|||
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
|
||||
|
||||
/***** Get parameter with URL *****/
|
||||
Par_GetParToText ("InfoSrcURL",Gbl.CurrentCrs.Info.URL,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("InfoSrcURL",Gbl.CurrentCrs.Info.URL,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Build path to file containing URL *****/
|
||||
Inf_BuildPathURL (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,PathFile);
|
||||
|
|
|
@ -75,7 +75,7 @@ void Inf_ChangeIHaveReadInfo (void);
|
|||
bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void);
|
||||
void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod);
|
||||
int Inf_WritePageIntoHTMLBuffer (char **HTMLBuffer);
|
||||
void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_LENGTH_WWW + 1]);
|
||||
void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_BYTES_WWW + 1]);
|
||||
void Inf_SetInfoSrc (void);
|
||||
void Inf_FormsToSelSendInfo (void);
|
||||
void Inf_FormToEnterIntegratedEditor (Inf_InfoSrc_t InfoSrc);
|
||||
|
|
|
@ -90,7 +90,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 void Ins_UpdateInsNameDB (long InsCod,const char *FieldName,const char *NewInsName);
|
||||
static void Ins_UpdateInsCtyDB (long InsCod,long CtyCod);
|
||||
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_LENGTH_WWW + 1]);
|
||||
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
static void Ins_PutButtonToGoToIns (struct Instit *Ins);
|
||||
|
||||
static void Ins_PutFormToCreateInstitution (void);
|
||||
|
@ -443,7 +443,7 @@ static void Ins_Configuration (bool PrintView)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,
|
||||
Cns_MAX_CHARS_WWW,
|
||||
Gbl.CurrentIns.Ins.WWW,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
|
@ -1038,7 +1038,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
|
||||
/* Get the URL of the institution (row[6]) */
|
||||
Str_Copy (Ins->WWW,row[6],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get extra data */
|
||||
switch (GetExtraData)
|
||||
|
@ -1153,7 +1153,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins,
|
|||
|
||||
/* Get the URL of the institution (row[5]) */
|
||||
Str_Copy (Ins->WWW,row[5],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get extra data */
|
||||
if (GetExtraData == Ins_GET_EXTRA_DATA)
|
||||
|
@ -1390,7 +1390,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
extern const char *Txt_INSTITUTION_STATUS[Ins_NUM_STATUS_TXT];
|
||||
unsigned NumIns;
|
||||
struct Instit *Ins;
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
struct UsrData UsrDat;
|
||||
bool ICanEdit;
|
||||
Ins_StatusTxt_t StatusTxt;
|
||||
|
@ -1490,7 +1490,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,
|
||||
Cns_MAX_CHARS_WWW,
|
||||
Ins->WWW,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
|
@ -1499,7 +1499,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
else
|
||||
{
|
||||
Str_Copy (WWW,Ins->WWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
fprintf (Gbl.F.Out,"<div class=\"EXTERNAL_WWW_SHORT\">"
|
||||
"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT\" title=\"%s\">"
|
||||
|
@ -1945,7 +1945,7 @@ void Ins_ChangeInsWWW (void)
|
|||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
struct Instit *Ins;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Ins = &Gbl.Inss.EditingIns;
|
||||
|
||||
|
@ -1954,7 +1954,7 @@ void Ins_ChangeInsWWW (void)
|
|||
Ins->InsCod = Ins_GetAndCheckParamOtherInsCod ();
|
||||
|
||||
/* Get the new WWW for the institution */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Get data of institution *****/
|
||||
Ins_GetDataOfInstitutionByCod (Ins,Ins_GET_BASIC_DATA);
|
||||
|
@ -1965,7 +1965,7 @@ void Ins_ChangeInsWWW (void)
|
|||
/***** Update database changing old WWW by new WWW *****/
|
||||
Ins_UpdateInsWWWDB (Ins->InsCod,NewWWW);
|
||||
Str_Copy (Ins->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -1985,11 +1985,11 @@ void Ins_ChangeInsWWWInConfig (void)
|
|||
{
|
||||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new WWW for the institution */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
|
@ -1997,7 +1997,7 @@ void Ins_ChangeInsWWWInConfig (void)
|
|||
/***** Update database changing old WWW by new WWW *****/
|
||||
Ins_UpdateInsWWWDB (Gbl.CurrentIns.Ins.InsCod,NewWWW);
|
||||
Str_Copy (Gbl.CurrentIns.Ins.WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2014,9 +2014,9 @@ void Ins_ChangeInsWWWInConfig (void)
|
|||
/**************** Update database changing old WWW by new WWW ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_LENGTH_WWW + 1])
|
||||
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
sprintf (Query,"UPDATE institutions SET WWW='%s' WHERE InsCod='%ld'",
|
||||
|
@ -2214,7 +2214,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
|||
" class=\"INPUT_WWW\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Cns_MAX_LENGTH_WWW,Ins->WWW);
|
||||
Cns_MAX_CHARS_WWW,Ins->WWW);
|
||||
|
||||
/***** Number of users who claim to belong to this institution ****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -2355,7 +2355,7 @@ static void Ins_RecFormRequestOrCreateIns (unsigned Status)
|
|||
Par_GetParToText ("FullName",Ins->FullName,Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
|
||||
/* Get institution WWW */
|
||||
Par_GetParToText ("WWW",Ins->WWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",Ins->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Ins->ShrtName[0] && Ins->FullName[0]) // If there's a institution name
|
||||
{
|
||||
|
@ -2397,7 +2397,7 @@ static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status)
|
|||
char Query[512 +
|
||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME +
|
||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME +
|
||||
Cns_MAX_LENGTH_WWW];
|
||||
Cns_MAX_BYTES_WWW];
|
||||
|
||||
/***** Create a new institution *****/
|
||||
sprintf (Query,"INSERT INTO institutions (CtyCod,Status,RequesterUsrCod,"
|
||||
|
|
|
@ -66,7 +66,7 @@ struct Instit
|
|||
long RequesterUsrCod; // User code of the person who requested the creation of this institution
|
||||
char ShrtName[Ins_MAX_LENGTH_INSTIT_SHRT_NAME + 1];
|
||||
char FullName[Ins_MAX_LENGTH_INSTIT_FULL_NAME + 1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
unsigned NumUsrsWhoClaimToBelongToIns;
|
||||
unsigned NumCtrs;
|
||||
unsigned NumDegs;
|
||||
|
|
18
swad_link.c
18
swad_link.c
|
@ -241,7 +241,7 @@ void Lnk_GetListLinks (void)
|
|||
|
||||
/* Get the URL of the link (row[3]) */
|
||||
Str_Copy (Lnk->WWW,row[3],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -289,7 +289,7 @@ void Lnk_GetDataOfLinkByCod (struct Link *Lnk)
|
|||
|
||||
/* Get the URL of the link (row[2]) */
|
||||
Str_Copy (Lnk->WWW,row[2],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -384,7 +384,7 @@ static void Lnk_ListLinksForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_WWW\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,Lnk->WWW,
|
||||
Cns_MAX_CHARS_WWW,Lnk->WWW,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
|
@ -576,8 +576,8 @@ void Lnk_ChangeLinkWWW (void)
|
|||
extern const char *Txt_The_new_web_address_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_web_address_empty;
|
||||
struct Link *Lnk;
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char NewWWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
char NewWWW[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Lnk = &Gbl.Links.EditingLnk;
|
||||
|
||||
|
@ -587,7 +587,7 @@ void Lnk_ChangeLinkWWW (void)
|
|||
Lay_ShowErrorAndExit ("Code of institutional link is missing.");
|
||||
|
||||
/* Get the new WWW for the link */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new WWW is empty *****/
|
||||
if (NewWWW[0])
|
||||
|
@ -607,7 +607,7 @@ void Lnk_ChangeLinkWWW (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Lnk->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
Lnk_EditLinks ();
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ static void Lnk_PutFormToCreateLink (void)
|
|||
" required=\"required\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Cns_MAX_LENGTH_WWW,Lnk->WWW);
|
||||
Cns_MAX_CHARS_WWW,Lnk->WWW);
|
||||
|
||||
/***** Send button and end frame *****/
|
||||
Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_link);
|
||||
|
@ -726,7 +726,7 @@ void Lnk_RecFormNewLink (void)
|
|||
Par_GetParToText ("FullName",Lnk->FullName,Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
||||
|
||||
/* Get link URL */
|
||||
Par_GetParToText ("WWW",Lnk->WWW,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("WWW",Lnk->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Lnk->ShrtName[0] && Lnk->FullName[0]) // If there's a link name
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ struct Link
|
|||
long LnkCod;
|
||||
char ShrtName[Lnk_MAX_LENGTH_LINK_SHRT_NAME + 1];
|
||||
char FullName[Lnk_MAX_LENGTH_LINK_FULL_NAME + 1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -50,7 +50,7 @@ extern struct Globals Gbl;
|
|||
/***************************** Private constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Mai_LENGTH_EMAIL_CONFIRM_KEY Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64
|
||||
#define Mai_LENGTH_EMAIL_CONFIRM_KEY Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Private types *******************************/
|
||||
|
|
10
swad_mark.c
10
swad_mark.c
|
@ -406,7 +406,7 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
|
|||
|
||||
static bool Mrk_CheckIfCellContainsOnlyIDs (const char *CellContent)
|
||||
{
|
||||
char UsrIDFromTable[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrIDFromTable[ID_MAX_BYTES_USR_ID + 1];
|
||||
const char *Ptr = CellContent;
|
||||
bool UsrIDFound = false;
|
||||
bool StuffNotUsrIDFound = false;
|
||||
|
@ -416,7 +416,7 @@ static bool Mrk_CheckIfCellContainsOnlyIDs (const char *CellContent)
|
|||
while (*Ptr && !StuffNotUsrIDFound)
|
||||
{
|
||||
/* Find next string in text until space, comma or semicolon (leading and trailing spaces are removed) */
|
||||
Str_GetNextStringUntilSeparator (&Ptr,UsrIDFromTable,ID_MAX_LENGTH_USR_ID);
|
||||
Str_GetNextStringUntilSeparator (&Ptr,UsrIDFromTable,ID_MAX_BYTES_USR_ID);
|
||||
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrIDFromTable);
|
||||
|
@ -447,7 +447,7 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
|
|||
unsigned Row;
|
||||
char CellContent[Mrk_MAX_BYTES_IN_CELL_CONTENT + 1];
|
||||
const char *Ptr;
|
||||
char UsrIDFromTable[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char UsrIDFromTable[ID_MAX_BYTES_USR_ID + 1];
|
||||
FILE *FileAllMarks;
|
||||
unsigned NumID;
|
||||
bool UsrIDFound;
|
||||
|
@ -484,7 +484,7 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
|
|||
while (*Ptr && !UsrIDFound)
|
||||
{
|
||||
/* Find next string in text until comma or semicolon (leading and trailing spaces are removed) */
|
||||
Str_GetNextStringUntilSeparator (&Ptr,UsrIDFromTable,ID_MAX_LENGTH_USR_ID);
|
||||
Str_GetNextStringUntilSeparator (&Ptr,UsrIDFromTable,ID_MAX_BYTES_USR_ID);
|
||||
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrIDFromTable);
|
||||
|
@ -534,7 +534,7 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
|
|||
while (*Ptr && !UsrIDFound)
|
||||
{
|
||||
/* Find next string in text until comma or semicolon (leading and trailing spaces are removed) */
|
||||
Str_GetNextStringUntilSeparator (&Ptr,UsrIDFromTable,ID_MAX_LENGTH_USR_ID);
|
||||
Str_GetNextStringUntilSeparator (&Ptr,UsrIDFromTable,ID_MAX_BYTES_USR_ID);
|
||||
|
||||
// Users' IDs are always stored internally in capitals and without leading zeros
|
||||
Str_RemoveLeadingZeros (UsrIDFromTable);
|
||||
|
|
|
@ -420,7 +420,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
|
|||
extern const char *Txt_Other_recipients;
|
||||
extern const char *Txt_Recipients;
|
||||
extern const char *Txt_nicks_emails_or_IDs_separated_by_commas;
|
||||
char Nickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
unsigned Colspan;
|
||||
bool StdsAndTchsWritten = Gbl.CurrentCrs.Crs.CrsCod > 0 && // If there is a course selected
|
||||
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
|
||||
|
@ -728,7 +728,7 @@ void Msg_RecMsgFromUsr (void)
|
|||
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDstData.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDstData.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDstData);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData)) // Get recipient's data from the database
|
||||
{
|
||||
|
@ -1298,7 +1298,7 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
|||
if ((Query = malloc (512 +
|
||||
strlen (Subject) +
|
||||
strlen (Content) +
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Img_MAX_BYTES_TITLE)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store database query.");
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ void Net_ShowWebsAndSocialNets (const struct UsrData *UsrDat)
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
Net_WebsAndSocialNetworks_t NumURL;
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_WEBS\">");
|
||||
|
@ -229,7 +229,7 @@ void Net_ShowWebsAndSocialNets (const struct UsrData *UsrDat)
|
|||
/* Get URL */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (URL,row[0],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Show the web / social network */
|
||||
Net_ShowAWebOrSocialNet (URL,
|
||||
|
@ -296,7 +296,7 @@ void Net_ShowFormMyWebsAndSocialNets (void)
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
Net_WebsAndSocialNetworks_t NumURL;
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Start table *****/
|
||||
Lay_StartRoundFrameTable (NULL,Txt_Webs_social_networks,
|
||||
|
@ -320,7 +320,7 @@ void Net_ShowFormMyWebsAndSocialNets (void)
|
|||
|
||||
/* Get URL */
|
||||
Str_Copy (URL,row[0],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
else
|
||||
URL[0] = '\0';
|
||||
|
@ -352,7 +352,7 @@ void Net_ShowFormMyWebsAndSocialNets (void)
|
|||
" maxlength=\"%u\" value=\"%s\" style=\"width:%upx;\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
(unsigned) NumURL,
|
||||
Cns_MAX_LENGTH_WWW,URL,Net_COL2_WIDTH - 20,
|
||||
Cns_MAX_CHARS_WWW,URL,Net_COL2_WIDTH - 20,
|
||||
Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
|
@ -393,9 +393,9 @@ void Net_UpdateMyWebsAndSocialNets (void)
|
|||
|
||||
static void Net_GetMyWebsAndSocialNetsFromForm (void)
|
||||
{
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
Net_WebsAndSocialNetworks_t Web;
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Get parameter with the type of web / social network *****/
|
||||
Web = (Net_WebsAndSocialNetworks_t)
|
||||
|
@ -405,7 +405,7 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
|
|||
(unsigned long) Net_WEB_SOCIAL_NET_DEFAULT);
|
||||
|
||||
/***** Get URL *****/
|
||||
Par_GetParToText ("URL",URL,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("URL",URL,Cns_MAX_BYTES_WWW);
|
||||
if (URL[0])
|
||||
{
|
||||
/***** Insert or replace web / social network *****/
|
||||
|
|
|
@ -79,9 +79,9 @@ bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba)
|
|||
Length = strlen (NicknameWithoutArroba);
|
||||
|
||||
/***** A nick (without arroba) must have a number of characters
|
||||
Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA *****/
|
||||
if (Length < Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA ||
|
||||
Length > Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA)
|
||||
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA *****/
|
||||
if (Length < Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA ||
|
||||
Length > Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA)
|
||||
return false;
|
||||
|
||||
/***** A nick can have digits, letters and '_' *****/
|
||||
|
@ -102,7 +102,7 @@ bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba)
|
|||
/*****************************************************************************/
|
||||
|
||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||
char Nickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1])
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1])
|
||||
{
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -118,7 +118,7 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
|||
/* Get nickname */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Nickname,row[0],
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
Found = true;
|
||||
}
|
||||
else
|
||||
|
@ -289,7 +289,7 @@ void Nck_ShowFormChangeUsrNickname (void)
|
|||
"<input type=\"text\" id=\"NewNick\" name=\"NewNick\""
|
||||
" size=\"18\" maxlength=\"%u\" value=\"@%s\" />"
|
||||
"</div>",
|
||||
1 + Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA,
|
||||
1 + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Gbl.Usrs.Me.UsrDat.Nickname);
|
||||
Lay_PutCreateButtonInline (NumNicks ? Txt_Change_nickname : // I already have a nickname
|
||||
Txt_Save); // I have no nickname yet);
|
||||
|
@ -306,10 +306,10 @@ void Nck_RemoveNick (void)
|
|||
{
|
||||
extern const char *Txt_Nickname_X_removed;
|
||||
extern const char *Txt_You_can_not_delete_your_current_nickname;
|
||||
char NicknameWithoutArroba[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
|
||||
/***** Get new nickname from form *****/
|
||||
Par_GetParToText ("Nick",NicknameWithoutArroba,Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Par_GetParToText ("Nick",NicknameWithoutArroba,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if (strcasecmp (NicknameWithoutArroba,Gbl.Usrs.Me.UsrDat.Nickname)) // Only if not my current nickname
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ void Nck_UpdateNick (void)
|
|||
// Now we know the new nickname is not already in database and is diffent to the current one
|
||||
Nck_UpdateMyNick (NewNicknameWithoutArroba);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
sprintf (Gbl.Message,Txt_Your_nickname_X_has_been_registered_successfully,
|
||||
NewNicknameWithoutArroba);
|
||||
|
@ -409,8 +409,8 @@ void Nck_UpdateNick (void)
|
|||
Error = true;
|
||||
sprintf (Gbl.Message,Txt_The_nickname_entered_X_is_not_valid_,
|
||||
NewNicknameWithArroba,
|
||||
Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
||||
}
|
||||
|
||||
/***** Show message *****/
|
||||
|
|
|
@ -32,8 +32,11 @@
|
|||
/************************* Public types and constants ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA 3
|
||||
#define Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA 16
|
||||
#define Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA 3
|
||||
#define Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA
|
||||
|
||||
#define Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA 16
|
||||
#define Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA
|
||||
|
||||
#define Nck_MAX_BYTES_NICKNAME_FROM_FORM (128 - 1) // For variables that store characters typed in a form
|
||||
|
||||
|
@ -46,7 +49,7 @@
|
|||
bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba);
|
||||
|
||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||
char Nickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1]);
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1]);
|
||||
long Nck_GetUsrCodFromNickname (const char *Nickname);
|
||||
void Nck_ShowFormChangeUsrNickname (void);
|
||||
|
||||
|
|
|
@ -686,7 +686,7 @@ void Par_GetMainParameters (void)
|
|||
/* Set another user's nickname */
|
||||
Str_RemoveLeadingArrobas (Nickname);
|
||||
Str_Copy (Gbl.Usrs.Other.UsrDat.Nickname,Nickname, // without arroba
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
// This user's code is used to go to public profile
|
||||
// and to refresh old publishings in user's timeline
|
||||
|
@ -702,7 +702,7 @@ void Par_GetMainParameters (void)
|
|||
/* Set another user's nickname */
|
||||
Str_RemoveLeadingArrobas (Nickname);
|
||||
Str_Copy (Gbl.Usrs.Other.UsrDat.Nickname,Nickname, // without arroba
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
// This user's code is used to go to public agenda
|
||||
// If user does not exist ==> UsrCod = -1
|
||||
|
|
|
@ -67,7 +67,7 @@ extern struct Globals Gbl;
|
|||
|
||||
static void Pwd_PutLinkToSendNewPasswdParams (void);
|
||||
|
||||
static void Pwd_CreateANewPassword (char PlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1]);
|
||||
static void Pwd_CreateANewPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1]);
|
||||
|
||||
static bool Pwd_CheckIfPasswdIsUsrIDorName (const char *PlainPassword);
|
||||
static unsigned Pwd_GetNumOtherUsrsWhoUseThisPassword (const char *EncryptedPassword,long UsrCod);
|
||||
|
@ -79,7 +79,8 @@ static unsigned Pwd_GetNumOtherUsrsWhoUseThisPassword (const char *EncryptedPass
|
|||
void Pwd_GetParamUsrPwdLogin (void)
|
||||
{
|
||||
/***** Get plain password from form *****/
|
||||
Par_GetParToText ("UsrPwd",Gbl.Usrs.Me.LoginPlainPassword,Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("UsrPwd",Gbl.Usrs.Me.LoginPlainPassword,
|
||||
Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
|
||||
/***** Encrypt password *****/
|
||||
Cry_EncryptSHA512Base64 (Gbl.Usrs.Me.LoginPlainPassword,Gbl.Usrs.Me.LoginEncryptedPassword);
|
||||
|
@ -160,12 +161,12 @@ void Pwd_ActChgMyPwd1 (void)
|
|||
extern const char *Txt_You_have_not_written_twice_the_same_new_password;
|
||||
extern const char *Txt_Your_password_has_been_changed_successfully;
|
||||
extern const char *Txt_You_have_not_entered_your_password_correctly;
|
||||
char PlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char NewPlainPassword[2][Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
char NewPlainPassword[2][Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
char NewEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
|
||||
/***** Get plain password from form *****/
|
||||
Par_GetParToText ("UsrPwd",PlainPassword,Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("UsrPwd",PlainPassword,Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
|
||||
/***** Encrypt password *****/
|
||||
Cry_EncryptSHA512Base64 (PlainPassword,Gbl.Usrs.Me.LoginEncryptedPassword);
|
||||
|
@ -173,8 +174,8 @@ void Pwd_ActChgMyPwd1 (void)
|
|||
Gbl.Usrs.Error = true;
|
||||
if (Pwd_CheckCurrentPassword ())
|
||||
{
|
||||
Par_GetParToText ("Paswd1",NewPlainPassword[0],Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd2",NewPlainPassword[1],Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd1",NewPlainPassword[0],Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd2",NewPlainPassword[1],Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
|
||||
/***** Check if I have written twice the same password *****/
|
||||
if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
|
||||
|
@ -183,7 +184,7 @@ void Pwd_ActChgMyPwd1 (void)
|
|||
else
|
||||
{
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,
|
||||
NewPlainPassword[0],Pwd_MAX_LENGTH_PLAIN_PASSWORD,true);
|
||||
NewPlainPassword[0],Pwd_MAX_BYTES_PLAIN_PASSWORD,true);
|
||||
Cry_EncryptSHA512Base64 (NewPlainPassword[0],NewEncryptedPassword);
|
||||
if (Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword[0],NewEncryptedPassword,Gbl.Usrs.Me.UsrDat.UsrCod)) // New password is good?
|
||||
{
|
||||
|
@ -280,7 +281,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
|
|||
extern const char *Txt_If_you_have_written_your_ID_nickname_or_email_correctly_;
|
||||
extern const char *Txt_There_are_more_than_one_user_with_the_ID_X_Please_type_a_nick_or_email;
|
||||
struct ListUsrCods ListUsrCods;
|
||||
char NewRandomPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
int ReturnCode;
|
||||
|
||||
/***** Check if user's ID or nickname is not empty *****/
|
||||
|
@ -328,7 +329,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
|
|||
|
||||
// User has typed a user's ID
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.IDs.List[0].ID,Gbl.Usrs.Me.UsrIdLogin,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
Str_ConvertToUpperText (Gbl.Usrs.Me.UsrDat.IDs.List[0].ID);
|
||||
|
||||
/* Get users' codes for this ID */
|
||||
|
@ -391,7 +392,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
|
|||
// Gbl.Usrs.Me.UsrDat must be filled
|
||||
// Return code returned by command
|
||||
|
||||
int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1])
|
||||
int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1])
|
||||
{
|
||||
extern const char *Txt_The_following_password_has_been_assigned_to_you_to_log_in_X_NO_HTML;
|
||||
extern const char *Txt_New_password_NO_HTML[1 + Txt_NUM_LANGUAGES];
|
||||
|
@ -445,16 +446,16 @@ int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_LENGTH_PLAIN
|
|||
/*********************** Create a new random password ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Pwd_CreateANewPassword (char PlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1])
|
||||
static void Pwd_CreateANewPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1])
|
||||
{
|
||||
Str_CreateRandomAlphanumStr (PlainPassword,Pwd_MIN_LENGTH_PLAIN_PASSWORD);
|
||||
Str_CreateRandomAlphanumStr (PlainPassword,Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Set my pending password *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1])
|
||||
void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1])
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
|
@ -483,7 +484,7 @@ void Pwd_UpdateOtherPwd1 (void)
|
|||
extern const char *Txt_You_have_not_written_twice_the_same_new_password;
|
||||
extern const char *Txt_The_X_password_has_been_changed_successfully;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char NewPlainPassword[2][Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char NewPlainPassword[2][Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
char NewEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
|
||||
Gbl.Usrs.Error = true;
|
||||
|
@ -493,8 +494,8 @@ void Pwd_UpdateOtherPwd1 (void)
|
|||
{
|
||||
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
Par_GetParToText ("Paswd1",NewPlainPassword[0],Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd2",NewPlainPassword[1],Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd1",NewPlainPassword[0],Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("Paswd2",NewPlainPassword[1],Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
|
||||
if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
|
||||
// Paswords don't match
|
||||
|
@ -502,7 +503,7 @@ void Pwd_UpdateOtherPwd1 (void)
|
|||
else
|
||||
{
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,
|
||||
NewPlainPassword[0],Pwd_MAX_LENGTH_PLAIN_PASSWORD,true);
|
||||
NewPlainPassword[0],Pwd_MAX_BYTES_PLAIN_PASSWORD,true);
|
||||
Cry_EncryptSHA512Base64 (NewPlainPassword[0],NewEncryptedPassword);
|
||||
if (Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword[0],NewEncryptedPassword,Gbl.Usrs.Other.UsrDat.UsrCod)) // Good password
|
||||
{
|
||||
|
@ -578,7 +579,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
|
|||
|
||||
static bool Pwd_CheckIfPasswdIsUsrIDorName (const char *PlainPassword)
|
||||
{
|
||||
char Query[128 + 3 * Pwd_MAX_LENGTH_PLAIN_PASSWORD];
|
||||
char Query[128 + 3 * Pwd_MAX_BYTES_PLAIN_PASSWORD];
|
||||
bool Found;
|
||||
|
||||
/***** Get if password is found in user's ID from database *****/
|
||||
|
@ -632,10 +633,10 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
|
|||
bool ItsANumber;
|
||||
|
||||
/***** Check length of password *****/
|
||||
if (LengthPassword < Pwd_MIN_LENGTH_PLAIN_PASSWORD) // PlainPassword too short
|
||||
if (LengthPassword < Pwd_MIN_BYTES_PLAIN_PASSWORD) // PlainPassword too short
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_The_password_must_be_at_least_X_characters,
|
||||
Pwd_MIN_LENGTH_PLAIN_PASSWORD);
|
||||
Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -708,13 +709,13 @@ void Pwd_ShowFormChgPwd (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Current_password,
|
||||
Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Pwd_MAX_CHARS_PLAIN_PASSWORD);
|
||||
|
||||
/* Help message */
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td colspan=\"2\">");
|
||||
sprintf (Gbl.Message,Txt_Your_password_must_be_at_least_X_characters_and_can_not_contain_spaces_,
|
||||
Pwd_MIN_LENGTH_PLAIN_PASSWORD);
|
||||
Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
@ -741,7 +742,7 @@ void Pwd_PutFormToGetNewPasswordOnce (void)
|
|||
extern const char *Txt_Password;
|
||||
extern const char *Txt_HELP_password;
|
||||
|
||||
sprintf (Gbl.Message,Txt_HELP_password,Pwd_MIN_LENGTH_PLAIN_PASSWORD);
|
||||
sprintf (Gbl.Message,Txt_HELP_password,Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_MIDDLE\">"
|
||||
"<label for=\"Passwd\" class=\"%s\">%s:</label>"
|
||||
|
@ -754,7 +755,7 @@ void Pwd_PutFormToGetNewPasswordOnce (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Password,
|
||||
Pwd_MAX_LENGTH_PLAIN_PASSWORD,
|
||||
Pwd_MAX_CHARS_PLAIN_PASSWORD,
|
||||
Gbl.Message);
|
||||
}
|
||||
|
||||
|
@ -769,7 +770,7 @@ void Pwd_PutFormToGetNewPasswordTwice (void)
|
|||
extern const char *Txt_HELP_password;
|
||||
extern const char *Txt_Retype_new_password;
|
||||
|
||||
sprintf (Gbl.Message,Txt_HELP_password,Pwd_MIN_LENGTH_PLAIN_PASSWORD);
|
||||
sprintf (Gbl.Message,Txt_HELP_password,Pwd_MIN_CHARS_PLAIN_PASSWORD);
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_MIDDLE\">"
|
||||
"<label for=\"Paswd1\" class=\"%s\">%s:</label>"
|
||||
|
@ -792,11 +793,11 @@ void Pwd_PutFormToGetNewPasswordTwice (void)
|
|||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_New_password,
|
||||
Pwd_MAX_LENGTH_PLAIN_PASSWORD,
|
||||
Pwd_MAX_CHARS_PLAIN_PASSWORD,
|
||||
Gbl.Message,
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Retype_new_password,
|
||||
Pwd_MAX_LENGTH_PLAIN_PASSWORD,
|
||||
Pwd_MAX_CHARS_PLAIN_PASSWORD,
|
||||
Gbl.Message);
|
||||
}
|
||||
|
||||
|
@ -910,7 +911,7 @@ void Pwd_AskForConfirmationOnDangerousAction (void)
|
|||
Txt_I_understand_that_this_action_can_not_be_undone,
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_For_security_enter_your_password,
|
||||
Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Pwd_MAX_CHARS_PLAIN_PASSWORD);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -922,7 +923,7 @@ bool Pwd_GetConfirmationOnDangerousAction (void)
|
|||
{
|
||||
extern const char *Txt_You_have_not_confirmed_the_action;
|
||||
extern const char *Txt_You_have_not_entered_your_password_correctly;
|
||||
char PlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
char EncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
|
||||
/***** Get if consent has been done *****/
|
||||
|
@ -934,7 +935,7 @@ bool Pwd_GetConfirmationOnDangerousAction (void)
|
|||
|
||||
/***** Get my password *****/
|
||||
/* Get plain password from form */
|
||||
Par_GetParToText ("OthUsrPwd",PlainPassword,Pwd_MAX_LENGTH_PLAIN_PASSWORD);
|
||||
Par_GetParToText ("OthUsrPwd",PlainPassword,Pwd_MAX_BYTES_PLAIN_PASSWORD);
|
||||
|
||||
/* Encrypt password */
|
||||
Cry_EncryptSHA512Base64 (PlainPassword,EncryptedPassword);
|
||||
|
|
|
@ -31,8 +31,11 @@
|
|||
/************************* Public types and constants ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Pwd_MIN_LENGTH_PLAIN_PASSWORD 8
|
||||
#define Pwd_MAX_LENGTH_PLAIN_PASSWORD 256
|
||||
#define Pwd_MIN_CHARS_PLAIN_PASSWORD 8
|
||||
#define Pwd_MIN_BYTES_PLAIN_PASSWORD Pwd_MIN_CHARS_PLAIN_PASSWORD
|
||||
|
||||
#define Pwd_MAX_CHARS_PLAIN_PASSWORD (256 - 1)
|
||||
#define Pwd_MAX_BYTES_PLAIN_PASSWORD Pwd_MAX_CHARS_PLAIN_PASSWORD
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
|
@ -50,8 +53,8 @@ void Pwd_ActChgMyPwd2 (void);
|
|||
void Pwd_PutLinkToSendNewPasswd (void);
|
||||
void Pwd_ShowFormSendNewPwd (void);
|
||||
void Pwd_ChkIdLoginAndSendNewPwd (void);
|
||||
int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1]);
|
||||
void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1]);
|
||||
int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1]);
|
||||
void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1]);
|
||||
|
||||
void Pwd_UpdateOtherPwd1 (void);
|
||||
void Pwd_UpdateOtherPwd2 (void);
|
||||
|
|
|
@ -1099,7 +1099,7 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat)
|
|||
|
||||
/***** Update photo name in user's data *****/
|
||||
Str_Copy (UsrDat->Photo,Gbl.UniqueNameEncrypted,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1116,7 +1116,7 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
|||
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
|
||||
bool PutZoomCode = Zoom == Pho_ZOOM && // Make zoom
|
||||
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
|
||||
char IdCaption[Act_MAX_LENGTH_ID];
|
||||
char IdCaption[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Start form to go to public profile *****/
|
||||
if (PutLinkToPublicProfile)
|
||||
|
@ -2325,7 +2325,7 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
|
|||
char PhotoURL[PATH_MAX + 1];
|
||||
char PhotoCaption[512];
|
||||
bool ShowDegPhoto;
|
||||
char IdCaption[Act_MAX_LENGTH_ID];
|
||||
char IdCaption[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Initializations *****/
|
||||
PhotoURL[0] = '\0';
|
||||
|
|
|
@ -79,7 +79,7 @@ void Plg_ListPlugins (void)
|
|||
extern const char *Txt_Plugin;
|
||||
unsigned NumPlg;
|
||||
struct Plugin *Plg;
|
||||
char URL[Cns_MAX_LENGTH_WWW+Ses_LENGTH_SESSION_ID + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + Ses_LENGTH_SESSION_ID + 1];
|
||||
|
||||
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ static void Plg_GetListPlugins (void)
|
|||
|
||||
/* Get the URL of the plugin (row[5]) */
|
||||
Str_Copy (Plg->URL,row[5],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get the IP of the plugin (row[6]) */
|
||||
Str_Copy (Plg->IP,row[6],
|
||||
|
@ -311,7 +311,7 @@ bool Plg_GetDataOfPluginByCod (struct Plugin *Plg)
|
|||
|
||||
/* Get the URL of the plugin (row[4]) */
|
||||
Str_Copy (Plg->URL,row[4],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get the IP of the plugin (row[5]) */
|
||||
Str_Copy (Plg->IP,row[5],
|
||||
|
@ -441,7 +441,7 @@ static void Plg_ListPluginsForEdition (void)
|
|||
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"URL\""
|
||||
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Cns_MAX_LENGTH_WWW,Plg->URL,Gbl.Form.Id);
|
||||
Cns_MAX_CHARS_WWW,Plg->URL,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -741,8 +741,8 @@ void Plg_ChangePlgURL (void)
|
|||
extern const char *Txt_The_new_URL_is_X;
|
||||
extern const char *Txt_You_can_not_leave_the_URL_empty;
|
||||
struct Plugin *Plg;
|
||||
char Query[256 + Cns_MAX_LENGTH_WWW];
|
||||
char NewURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char Query[256 + Cns_MAX_BYTES_WWW];
|
||||
char NewURL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
Plg = &Gbl.Plugins.EditingPlg;
|
||||
|
||||
|
@ -752,7 +752,7 @@ void Plg_ChangePlgURL (void)
|
|||
Lay_ShowErrorAndExit ("Code of plugin is missing.");
|
||||
|
||||
/* Get the new URL for the plugin */
|
||||
Par_GetParToText ("URL",NewURL,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("URL",NewURL,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/***** Check if new URL is empty *****/
|
||||
if (NewURL[0])
|
||||
|
@ -772,7 +772,7 @@ void Plg_ChangePlgURL (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->URL,NewURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,7 @@ static void Plg_PutFormToCreatePlugin (void)
|
|||
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Cns_MAX_LENGTH_WWW,Plg->URL);
|
||||
Cns_MAX_CHARS_WWW,Plg->URL);
|
||||
|
||||
/***** Plugin IP address *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -1003,7 +1003,7 @@ void Plg_RecFormNewPlg (void)
|
|||
Par_GetParToText ("AppKey",Plg->AppKey,Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
|
||||
/* Get plugin URL */
|
||||
Par_GetParToText ("URL",Plg->URL,Cns_MAX_LENGTH_WWW);
|
||||
Par_GetParToText ("URL",Plg->URL,Cns_MAX_BYTES_WWW);
|
||||
|
||||
/* Get plugin IP address */
|
||||
Par_GetParToText ("IP",Plg->IP,Cns_MAX_LENGTH_IP);
|
||||
|
@ -1043,7 +1043,7 @@ static void Plg_CreatePlugin (struct Plugin *Plg)
|
|||
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION +
|
||||
Plg_MAX_LENGTH_PLUGIN_LOGO +
|
||||
Plg_MAX_LENGTH_PLUGIN_APP_KEY +
|
||||
Cns_MAX_LENGTH_WWW +
|
||||
Cns_MAX_BYTES_WWW +
|
||||
Cns_MAX_LENGTH_IP];
|
||||
|
||||
/***** Create a new plugin *****/
|
||||
|
|
|
@ -47,7 +47,7 @@ struct Plugin
|
|||
char Description[Plg_MAX_LENGTH_PLUGIN_DESCRIPTION + 1];
|
||||
char Logo[Plg_MAX_LENGTH_PLUGIN_LOGO + 1];
|
||||
char AppKey[Plg_MAX_LENGTH_PLUGIN_APP_KEY + 1];
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
char IP[Cns_MAX_LENGTH_IP + 1];
|
||||
};
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
|
|||
unsigned NumCrssUsrIsStudent;
|
||||
unsigned NumFiles;
|
||||
unsigned NumPublicFiles;
|
||||
char IdFirstClickTime[Act_MAX_LENGTH_ID];
|
||||
char IdFirstClickTime[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Start left list *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"PRF_FIG_LEFT_CONTAINER\">"
|
||||
|
|
|
@ -995,7 +995,7 @@ void Rec_ListRecordsGsts (void)
|
|||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
{
|
||||
|
@ -1158,7 +1158,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
|
@ -1354,7 +1354,7 @@ void Rec_ListRecordsTchs (void)
|
|||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get from the database the data of the student
|
||||
if (Usr_CheckIfUsrBelongsToCrs (UsrDat.UsrCod,
|
||||
|
|
|
@ -766,7 +766,7 @@ static void Rep_WriteSectionHitsPerAction (struct Rep_Report *Report)
|
|||
Act_Action_t Action;
|
||||
Act_Action_t SuperAction;
|
||||
Tab_Tab_t Tab;
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
unsigned long NumClicks;
|
||||
|
||||
/***** Start of section *****/
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Ses_LENGTH_SESSION_ID Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64
|
||||
#define Ses_LENGTH_SESSION_ID Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64
|
||||
|
||||
#define Con_MIN_TIME_TO_REFRESH_CONNECTED_IN_MS (Cfg_MIN_TIME_TO_REFRESH_CONNECTED * 1000L) // Refresh period of connected users in miliseconds
|
||||
#define Con_MAX_TIME_TO_REFRESH_CONNECTED_IN_MS (Cfg_MAX_TIME_TO_REFRESH_CONNECTED * 1000L) // Refresh period of connected users in miliseconds
|
||||
|
|
|
@ -182,10 +182,10 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
|
||||
static long Soc_ReceiveSocialPost (void);
|
||||
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_LENGTH_ID]);
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_BYTES_ID]);
|
||||
static void Soc_PutIconCommentDisabled (void);
|
||||
static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
|
||||
const char IdNewComment[Act_MAX_LENGTH_ID]);
|
||||
const char IdNewComment[Act_MAX_BYTES_ID]);
|
||||
static unsigned long Soc_GetNumCommentsInSocialNote (long NotCod);
|
||||
static void Soc_WriteCommentsInSocialNote (const struct SocialNote *SocNot);
|
||||
static void Soc_WriteSocialComment (struct SocialComment *SocCom,
|
||||
|
@ -1265,7 +1265,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
|||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
|
||||
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1];
|
||||
unsigned NumComments;
|
||||
char IdNewComment[Act_MAX_LENGTH_ID];
|
||||
char IdNewComment[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Start frame ****/
|
||||
if (ShowNoteAlone)
|
||||
|
@ -1617,7 +1617,7 @@ static void Soc_WriteAuthorNote (const struct UsrData *UsrDat)
|
|||
static void Soc_WriteDateTime (time_t TimeUTC)
|
||||
{
|
||||
extern const char *Txt_Today;
|
||||
char IdDateTime[Act_MAX_LENGTH_ID];
|
||||
char IdDateTime[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Create unique Id *****/
|
||||
Act_SetUniqueId (IdDateTime);
|
||||
|
@ -2190,7 +2190,7 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
const char *ClassTextArea,const char *ClassImgTit)
|
||||
{
|
||||
extern const char *Txt_Post;
|
||||
char IdDivImgButton[Act_MAX_LENGTH_ID];
|
||||
char IdDivImgButton[Act_MAX_BYTES_ID];
|
||||
|
||||
/***** Set unique id for the hidden div *****/
|
||||
Act_SetUniqueId (IdDivImgButton);
|
||||
|
@ -2292,7 +2292,7 @@ static long Soc_ReceiveSocialPost (void)
|
|||
/***** Allocate space for query *****/
|
||||
if ((Query = malloc (256 +
|
||||
strlen (Content) +
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Img_MAX_BYTES_TITLE)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store database query.");
|
||||
|
||||
|
@ -2336,7 +2336,7 @@ static long Soc_ReceiveSocialPost (void)
|
|||
/****** Put an icon to toggle on/off the form to comment a social note *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_LENGTH_ID])
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_BYTES_ID])
|
||||
{
|
||||
extern const char *Txt_Comment;
|
||||
|
||||
|
@ -2378,7 +2378,7 @@ static void Soc_PutIconCommentDisabled (void)
|
|||
// All forms in this function and nested functions must have unique identifiers
|
||||
|
||||
static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
|
||||
const char IdNewComment[Act_MAX_LENGTH_ID])
|
||||
const char IdNewComment[Act_MAX_BYTES_ID])
|
||||
{
|
||||
extern const char *Txt_New_SOCIAL_comment;
|
||||
bool ShowPhoto = false;
|
||||
|
@ -2992,7 +2992,7 @@ static long Soc_ReceiveComment (void)
|
|||
/***** Allocate space for query *****/
|
||||
if ((Query = malloc (256 +
|
||||
strlen (Content) +
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Img_MAX_BYTES_TITLE)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store database query.");
|
||||
|
||||
|
@ -4910,9 +4910,9 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
|
|||
Nickname.Length = (size_t) (Ptr - Nickname.PtrStart);
|
||||
|
||||
/* A nick (without arroba) must have a number of characters
|
||||
Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA */
|
||||
IsNickname = (Nickname.Length >= Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA &&
|
||||
Nickname.Length <= Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA */
|
||||
IsNickname = (Nickname.Length >= Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA &&
|
||||
Nickname.Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if (IsNickname)
|
||||
{
|
||||
|
|
|
@ -774,7 +774,7 @@ static void Sta_WriteSelectorAction (void)
|
|||
Act_Action_t Action;
|
||||
Act_Action_t SuperAction;
|
||||
Tab_Tab_t Tab;
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_TOP\">"
|
||||
|
@ -836,7 +836,7 @@ void Sta_SeeCrsAccesses (void)
|
|||
/******************** Compute and show access statistics ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Sta_MAX_LENGTH_QUERY_ACCESS (1024 + (10 + ID_MAX_LENGTH_USR_ID) * 5000 - 1)
|
||||
#define Sta_MAX_LENGTH_QUERY_ACCESS (1024 + (10 + ID_MAX_BYTES_USR_ID) * 5000 - 1)
|
||||
|
||||
#define Sta_MAX_LENGTH_COUNT_TYPE (256 - 1)
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
|
|||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (UsrDat.UsrCod > 0)
|
||||
{
|
||||
|
@ -1570,7 +1570,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
|
|||
Rol_Role_t RoleFromLog;
|
||||
unsigned UniqueId;
|
||||
long ActCod;
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
|
||||
/***** Initialize estructura of data of the user *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
@ -3053,7 +3053,7 @@ static void Sta_ShowNumHitsPerAction (unsigned long NumRows,
|
|||
struct Sta_Hits Hits;
|
||||
MYSQL_ROW row;
|
||||
long ActCod;
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1];
|
||||
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
|
||||
|
||||
/***** Write heading *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
|
|
@ -114,7 +114,7 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
char ParamsStr[256 + 256 + Ses_LENGTH_SESSION_ID + 256];
|
||||
char Anchor1Nick[256 + 256 + 256 + Ses_LENGTH_SESSION_ID + 256 + 256];
|
||||
char Anchor2Nick[256 + Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64];
|
||||
char Anchor2Nick[256 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64];
|
||||
size_t TxtLength;
|
||||
size_t TxtLengthWithInsertedAnchors;
|
||||
|
||||
|
@ -286,10 +286,10 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
Links[NumLinks].NumActualBytes = (size_t) (PtrSrc - Links[NumLinks].PtrStart);
|
||||
|
||||
/* A nick (without arroba) must have a number of characters
|
||||
Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA */
|
||||
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA */
|
||||
Length = Links[NumLinks].NumActualBytes - 1; // Do not count the initial @
|
||||
IsNickname = (Length >= Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA &&
|
||||
Length <= Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
IsNickname = (Length >= Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA &&
|
||||
Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if (IsNickname)
|
||||
{
|
||||
|
@ -2263,38 +2263,6 @@ void Str_GetNextStringUntilSeparator (const char **StrSrc,char *StrDst,size_t Ma
|
|||
StrDst[i] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Get from file FileSrc the next string until separator ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Str_GetNextStringFromFileUntilSeparator (FILE *FileSrc,char *StrDst)
|
||||
{
|
||||
int i = 0;
|
||||
int Ch;
|
||||
|
||||
/***** Skip separators *****/
|
||||
do
|
||||
Ch = fgetc (FileSrc);
|
||||
while (Ch != EOF &&
|
||||
(isspace (Ch) ||
|
||||
Ch == 0xA0 || // Unicode translation for
|
||||
Ch == (int) ',' ||
|
||||
Ch == (int) ';')); // Skip spaces, puntuación, etc.
|
||||
|
||||
/***** Copy string while no separator found *****/
|
||||
while (Ch != EOF &&
|
||||
!(isspace (Ch) ||
|
||||
Ch == 0xA0 || // Unicode translation for
|
||||
Ch == (int) ',' ||
|
||||
Ch == (int) ';'))
|
||||
{
|
||||
if (i < ID_MAX_LENGTH_USR_ID)
|
||||
StrDst[i++] = (char) Ch;
|
||||
Ch = fgetc (FileSrc);
|
||||
}
|
||||
StrDst[i] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Get from StrSrc into StrDst the next string until comma **********/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#define Str_LENGTH_STR_HEX 3 // Length of the string #XX
|
||||
#define Str_MAX_LENGTH_SPEC_CHAR_HTML 6 // Length of the string &#DDD;
|
||||
#define Str_MAX_CHARACTER 6 // max (Str_LENGTH_STR_HEX,Str_MAX_LENGTH_SPEC_CHAR_HTML)
|
||||
#define Str_MAX_LENGTH_SPEC_CHAR_HTML 8 // Length of the string &#DDDDD;
|
||||
#define Str_MAX_BYTES_PER_CHAR 8 // max (Str_LENGTH_STR_HEX,Str_MAX_LENGTH_SPEC_CHAR_HTML)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types *******************************/
|
||||
|
@ -97,7 +97,6 @@ char *Str_GetCellFromHTMLTableSkipComments (FILE *FileSrc,char *Str,int MaxLengt
|
|||
char *Str_GetNextStrFromFileConvertingToLower (FILE *FileSrc,char *Str, int N);
|
||||
void Str_GetNextStringUntilSpace (const char **StrSrc,char *StrDst,size_t MaxLength);
|
||||
void Str_GetNextStringUntilSeparator (const char **StrSrc,char *StrDst,size_t MaxLength);
|
||||
void Str_GetNextStringFromFileUntilSeparator (FILE *FileSrc,char *StrDst);
|
||||
void Str_GetNextStringUntilComma (const char **StrSrc,char *StrDst,size_t MaxLength);
|
||||
void Str_ReplaceSeveralSpacesForOne (char *Str);
|
||||
void Str_CopyStrChangingSpaces (const char *StringWithSpaces,char *StringWithoutSpaces,unsigned MaxLength);
|
||||
|
|
|
@ -50,7 +50,7 @@ extern struct Globals Gbl;
|
|||
/*****************************************************************************/
|
||||
|
||||
#define Svy_MAX_LENGTH_ANSWER 1000
|
||||
#define Svy_MAX_BYTES_ANSWER (Svy_MAX_LENGTH_ANSWER * Str_MAX_CHARACTER)
|
||||
#define Svy_MAX_BYTES_ANSWER (Svy_MAX_LENGTH_ANSWER * Str_MAX_BYTES_PER_CHAR)
|
||||
#define Svy_MAX_BYTES_LIST_ANSWER_TYPES (10 + (Svy_NUM_ANS_TYPES - 1) * (1 + 10))
|
||||
|
||||
const char *Svy_StrAnswerTypesDB[Svy_NUM_ANS_TYPES] =
|
||||
|
|
|
@ -56,7 +56,7 @@ extern struct Globals Gbl;
|
|||
#define Syl_MAX_LENGTH_ITEM_COD (Syl_MAX_LEVELS_SYLLABUS * (10 + 1) - 1)
|
||||
|
||||
#define Syl_MAX_LENGTH_TEXT_ITEM 1024
|
||||
#define Syl_MAX_BYTES_TEXT_ITEM (Syl_MAX_LENGTH_TEXT_ITEM*Str_MAX_CHARACTER)
|
||||
#define Syl_MAX_BYTES_TEXT_ITEM (Syl_MAX_LENGTH_TEXT_ITEM*Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Syl_WIDTH_NUM_SYLLABUS 20
|
||||
|
||||
|
|
|
@ -6009,7 +6009,7 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
|||
if ((Query = malloc (512 +
|
||||
Gbl.Test.Stem.Length +
|
||||
Gbl.Test.Feedback.Length +
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Img_MAX_BYTES_TITLE)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store database query.");
|
||||
|
||||
|
@ -7070,7 +7070,7 @@ void Tst_ShowUsrsTestResults (void)
|
|||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
#define Tst_MAX_QUESTIONS_PER_TEST 100 // Absolute maximum number of questions in a test
|
||||
#define Tst_MAX_TAGS_PER_QUESTION 5
|
||||
#define Tst_MAX_LENGTH_TAG (256 -1)
|
||||
#define Tst_MAX_BYTES_TAG (Tst_MAX_LENGTH_TAG*Str_MAX_CHARACTER)
|
||||
#define Tst_MAX_BYTES_TAG (Tst_MAX_LENGTH_TAG*Str_MAX_BYTES_PER_CHAR)
|
||||
#define Tst_MAX_OPTIONS_PER_QUESTION 10
|
||||
#define Tst_MAX_SIZE_INDEXES_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (10 + 1))
|
||||
#define Tst_MAX_SIZE_ANSWERS_ONE_QST (Tst_MAX_OPTIONS_PER_QUESTION * (10 + 1))
|
||||
|
||||
#define Tst_MAX_LENGTH_ANSWER 1000
|
||||
#define Tst_MAX_BYTES_ANSWER_OR_FEEDBACK (Tst_MAX_LENGTH_ANSWER*Str_MAX_CHARACTER)
|
||||
#define Tst_MAX_BYTES_ANSWER_OR_FEEDBACK (Tst_MAX_LENGTH_ANSWER*Str_MAX_BYTES_PER_CHAR)
|
||||
|
||||
#define Tst_CONFIG_DEFAULT_MIN_QUESTIONS 1
|
||||
#define Tst_CONFIG_DEFAULT_DEF_QUESTIONS 20 // Number of questions to be generated by default in a self-assessment test
|
||||
|
|
32
swad_user.c
32
swad_user.c
|
@ -434,7 +434,7 @@ void Usr_GetEncryptedUsrCodFromUsrCod (struct UsrData *UsrDat) // TODO: Remove t
|
|||
/***** Get encrypted user's code *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (UsrDat->EncryptedUsrCod,row[0],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -483,7 +483,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
|
||||
/* Get encrypted user's code */
|
||||
Str_Copy (UsrDat->EncryptedUsrCod,row[0],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get encrypted password */
|
||||
Str_Copy (UsrDat->Password,row[1],
|
||||
|
@ -550,7 +550,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
|
||||
/* Get rest of data */
|
||||
Str_Copy (UsrDat->Photo,row[10],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[11]);
|
||||
UsrDat->ProfileVisibility = Pri_GetVisibilityFromStr (row[12]);
|
||||
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[13]);
|
||||
|
@ -2070,7 +2070,7 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) ())
|
|||
Gbl.Prefs.IconsURL,
|
||||
Txt_Password,
|
||||
Txt_Password,
|
||||
Pwd_MAX_LENGTH_PLAIN_PASSWORD,
|
||||
Pwd_MAX_CHARS_PLAIN_PASSWORD,
|
||||
Txt_password);
|
||||
|
||||
/***** Send button and end table and frame *****/
|
||||
|
@ -2374,7 +2374,7 @@ unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *Lis
|
|||
|
||||
Str_Copy (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,
|
||||
Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
Str_ConvertToUpperText (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID);
|
||||
|
||||
/* Check if user's ID exists in database */
|
||||
|
@ -2412,7 +2412,7 @@ void Usr_PutParamOtherUsrCodEncrypted (void)
|
|||
Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
}
|
||||
|
||||
void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
{
|
||||
Par_PutHiddenParamString ("OtherUsrCod",EncryptedUsrCod);
|
||||
}
|
||||
|
@ -2424,7 +2424,7 @@ void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_LENGTH_ENCRYPTE
|
|||
void Usr_GetParamOtherUsrCodEncrypted (struct UsrData *UsrDat)
|
||||
{
|
||||
Par_GetParToText ("OtherUsrCod",UsrDat->EncryptedUsrCod,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
if (UsrDat->EncryptedUsrCod[0]) // If parameter exists...
|
||||
{
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (UsrDat);
|
||||
|
@ -2681,7 +2681,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void)
|
|||
ID_ReallocateListIDs (&Gbl.Usrs.Me.UsrDat,1);
|
||||
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.IDs.List[0].ID,Gbl.Usrs.Me.UsrIdLogin,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
Str_ConvertToUpperText (Gbl.Usrs.Me.UsrDat.IDs.List[0].ID);
|
||||
|
||||
/* Check if user's ID exists in database, and get user's data */
|
||||
|
@ -4879,7 +4879,7 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop
|
|||
|
||||
/* Get encrypted user's code (row[1]) */
|
||||
Str_Copy (UsrInList->EncryptedUsrCod,row[1],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get encrypted password (row[2]) */
|
||||
Str_Copy (UsrInList->Password,row[2],
|
||||
|
@ -4902,7 +4902,7 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop
|
|||
|
||||
/* Get user's photo (row[7]) */
|
||||
Str_Copy (UsrInList->Photo,row[7],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get user's photo visibility (row[8]) */
|
||||
UsrInList->PhotoVisibility = Pri_GetVisibilityFromStr (row[8]);
|
||||
|
@ -5002,7 +5002,7 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList
|
|||
{
|
||||
UsrDat->UsrCod = UsrInList->UsrCod;
|
||||
Str_Copy (UsrDat->EncryptedUsrCod,UsrInList->EncryptedUsrCod,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Str_Copy (UsrDat->Surname1,UsrInList->Surname1,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2,UsrInList->Surname2,
|
||||
|
@ -5011,7 +5011,7 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList
|
|||
Usr_MAX_BYTES_NAME);
|
||||
UsrDat->Sex = UsrInList->Sex;
|
||||
Str_Copy (UsrDat->Photo,UsrInList->Photo,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
UsrDat->PhotoVisibility = UsrInList->PhotoVisibility;
|
||||
UsrDat->CtyCod = UsrInList->CtyCod;
|
||||
UsrDat->InsCod = UsrInList->InsCod;
|
||||
|
@ -5292,7 +5292,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
|||
ID_ReallocateListIDs (&UsrDat,1);
|
||||
|
||||
Str_Copy (UsrDat.IDs.List[0].ID,UsrIDNickOrEmail,
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
|
||||
/***** Check if a user exists having this user's ID *****/
|
||||
if (ID_GetListUsrCodsFromUsrID (&UsrDat,NULL,&ListUsrCods,false))
|
||||
|
@ -5380,14 +5380,14 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
|||
bool Usr_FindUsrCodInListOfSelectedUsrs (const char *EncryptedUsrCodToFind)
|
||||
{
|
||||
const char *Ptr;
|
||||
char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
|
||||
if (Gbl.Usrs.Select.All)
|
||||
{
|
||||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
if (!strcmp (EncryptedUsrCodToFind,EncryptedUsrCod))
|
||||
return true; // Found!
|
||||
}
|
||||
|
@ -5409,7 +5409,7 @@ unsigned Usr_CountNumUsrsInListOfSelectedUsrs (void)
|
|||
Ptr = Gbl.Usrs.Select.All;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
if (UsrDat.UsrCod > 0)
|
||||
NumUsrs++;
|
||||
|
|
14
swad_user.h
14
swad_user.h
|
@ -77,7 +77,7 @@
|
|||
|
||||
#define Usr_LIST_WITH_PHOTOS_DEF false
|
||||
|
||||
#define Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS (Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 * Cfg_MAX_USRS_IN_LIST)
|
||||
#define Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS (Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 * Cfg_MAX_USRS_IN_LIST)
|
||||
|
||||
#define Usr_NUM_MAIN_FIELDS_DATA_USR 8
|
||||
|
||||
|
@ -119,14 +119,14 @@ typedef enum
|
|||
struct UsrData
|
||||
{
|
||||
long UsrCod;
|
||||
char EncryptedUsrCod [Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char EncryptedUsrCod [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char UsrIDNickOrEmail[Usr_MAX_BYTES_USR_LOGIN + 1]; // String to store the ID, nickname or email
|
||||
struct
|
||||
{
|
||||
struct ListIDs *List;
|
||||
unsigned Num;
|
||||
} IDs;
|
||||
char Nickname [Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
char Nickname [Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
||||
char Password [Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
Rol_Role_t RoleInCurrentCrsDB;
|
||||
int Roles; // Check always if filled/calculated
|
||||
|
@ -140,7 +140,7 @@ struct UsrData
|
|||
Usr_Sex_t Sex;
|
||||
char Email [Usr_MAX_BYTES_USR_EMAIL + 1];
|
||||
bool EmailConfirmed;
|
||||
char Photo [Cry_LENGTH_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 ProfileVisibility; // Who can see user's public profile
|
||||
long CtyCod; // Country
|
||||
|
@ -185,13 +185,13 @@ struct UsrLast
|
|||
struct UsrInList
|
||||
{
|
||||
long UsrCod;
|
||||
char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||
char Password[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
char Surname1 [Usr_MAX_BYTES_NAME + 1];
|
||||
char Surname2 [Usr_MAX_BYTES_NAME + 1];
|
||||
char FirstName[Usr_MAX_BYTES_NAME + 1];
|
||||
Usr_Sex_t Sex;
|
||||
char Photo[Cry_LENGTH_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
|
||||
long CtyCod; // Country
|
||||
long InsCod; // Institution
|
||||
|
@ -303,7 +303,7 @@ unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *Lis
|
|||
|
||||
void Usr_PutParamMyUsrCodEncrypted (void);
|
||||
void Usr_PutParamOtherUsrCodEncrypted (void);
|
||||
void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
void Usr_GetParamOtherUsrCodEncrypted (struct UsrData *UsrDat);
|
||||
void Usr_GetParamOtherUsrCodEncryptedAndGetListIDs (void);
|
||||
bool Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (void);
|
||||
|
|
|
@ -192,7 +192,7 @@ Svc_Role_t Svc_RolRole_to_SvcRole[Rol_NUM_ROLES] =
|
|||
Svc_ROLE_UNKNOWN, // Rol_SYS_ADM
|
||||
};
|
||||
|
||||
#define Svc_LENGTH_WS_KEY Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64
|
||||
#define Svc_LENGTH_WS_KEY Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************************* Data types ********************************/
|
||||
|
@ -204,11 +204,11 @@ Svc_Role_t Svc_RolRole_to_SvcRole[Rol_NUM_ROLES] =
|
|||
|
||||
static int Svc_GetPlgCodFromAppKey (const char *appKey);
|
||||
static int Svc_CheckIdSession (const char *IdSession);
|
||||
static int Svc_CheckWSKey (char WSKey[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
static int Svc_CheckWSKey (char WSKey[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
|
||||
static int Svc_CheckCourseAndGroupCodes (long CrsCod,long GrpCod);
|
||||
static int Svc_GenerateNewWSKey (long UsrCod,
|
||||
char WSKey[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
char WSKey[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
|
||||
static int Svc_RemoveOldWSKeys (void);
|
||||
static int Svc_GetCurrentDegCodFromCurrentCrsCod (void);
|
||||
static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod);
|
||||
|
@ -371,7 +371,7 @@ static int Svc_CheckIdSession (const char *IdSession)
|
|||
/************** Check if a web service key exists in database ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static int Svc_CheckWSKey (char WSKey[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
static int Svc_CheckWSKey (char WSKey[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -443,7 +443,7 @@ static int Svc_CheckCourseAndGroupCodes (long CrsCod,long GrpCod)
|
|||
/*****************************************************************************/
|
||||
|
||||
static int Svc_GenerateNewWSKey (long UsrCod,
|
||||
char WSKey[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
char WSKey[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1])
|
||||
{
|
||||
int ReturnCode;
|
||||
char Query[512];
|
||||
|
@ -454,7 +454,7 @@ static int Svc_GenerateNewWSKey (long UsrCod,
|
|||
|
||||
/***** Create a unique name for the key *****/
|
||||
Str_Copy (WSKey,Gbl.UniqueNameEncrypted,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/***** Check that key does not exist in database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM ws_keys WHERE WSKey='%s'",
|
||||
|
@ -562,7 +562,7 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
|
||||
/* Get user's photo */
|
||||
Str_Copy (UsrDat->Photo,row[3],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get user's brithday */
|
||||
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[4]);
|
||||
|
@ -688,7 +688,7 @@ int swad__createAccount (struct soap *soap,
|
|||
/***** Save nickname *****/
|
||||
Nck_UpdateMyNick (NewNicknameWithoutArroba);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNicknameWithoutArroba,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
/***** Save email *****/
|
||||
if (Mai_UpdateEmailInDB (&Gbl.Usrs.Me.UsrDat,userEmail))
|
||||
|
@ -773,7 +773,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRows;
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
bool UsrFound;
|
||||
|
||||
/***** Initializations *****/
|
||||
|
@ -782,12 +782,12 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
|
||||
/***** Allocate space for strings *****/
|
||||
loginByUserPasswordKeyOut->wsKey = (char *) soap_malloc (Gbl.soap,Svc_LENGTH_WS_KEY + 1);
|
||||
loginByUserPasswordKeyOut->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1);
|
||||
loginByUserPasswordKeyOut->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_LENGTH_USR_ID + 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->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
loginByUserPasswordKeyOut->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
loginByUserPasswordKeyOut->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
loginByUserPasswordKeyOut->userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_LENGTH_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);
|
||||
|
||||
/***** Default values returned on error *****/
|
||||
|
@ -879,12 +879,12 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
|
||||
Str_Copy (loginByUserPasswordKeyOut->userNickname,
|
||||
Gbl.Usrs.Me.UsrDat.Nickname,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
||||
Str_Copy (loginByUserPasswordKeyOut->userID,
|
||||
Gbl.Usrs.Me.UsrDat.IDs.List[0].ID, // TODO: What user's ID?
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
|
||||
Str_Copy (loginByUserPasswordKeyOut->userSurname1,
|
||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
||||
|
@ -898,7 +898,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
Str_Copy (loginByUserPasswordKeyOut->userBirthday,
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
|
||||
|
@ -939,7 +939,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRows;
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
bool UsrFound;
|
||||
|
||||
/***** Initializations *****/
|
||||
|
@ -948,12 +948,12 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
|
||||
/***** Allocate space for strings *****/
|
||||
loginBySessionKeyOut->wsKey = (char *) soap_malloc (Gbl.soap,Svc_LENGTH_WS_KEY + 1);
|
||||
loginBySessionKeyOut->userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1);
|
||||
loginBySessionKeyOut->userID = (char *) soap_malloc (Gbl.soap,ID_MAX_LENGTH_USR_ID + 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->userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
loginBySessionKeyOut->userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
loginBySessionKeyOut->userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
loginBySessionKeyOut->userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_LENGTH_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->degreeName = (char *) soap_malloc (Gbl.soap,Deg_MAX_LENGTH_DEGREE_FULL_NAME + 1);
|
||||
loginBySessionKeyOut->courseName = (char *) soap_malloc (Gbl.soap,Crs_MAX_LENGTH_COURSE_FULL_NAME + 1);
|
||||
|
@ -1032,12 +1032,12 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
loginBySessionKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
|
||||
Str_Copy (loginBySessionKeyOut->userNickname,Gbl.Usrs.Me.UsrDat.Nickname,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
||||
Str_Copy (loginBySessionKeyOut->userID,
|
||||
Gbl.Usrs.Me.UsrDat.IDs.List[0].ID, // TODO: What user's ID?
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
ID_MAX_BYTES_USR_ID);
|
||||
|
||||
Str_Copy (loginBySessionKeyOut->userSurname1,
|
||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
||||
|
@ -1051,7 +1051,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
Str_Copy (loginBySessionKeyOut->userBirthday,
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
|
||||
|
@ -1083,7 +1083,7 @@ int swad__getNewPassword (struct soap *soap,
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRows;
|
||||
char NewRandomPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
char NewRandomPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||
|
||||
/***** Initializations *****/
|
||||
Gbl.soap = soap;
|
||||
|
@ -1360,7 +1360,7 @@ int swad__getCourseInfo (struct soap *soap,
|
|||
Result = Inf_WritePageIntoHTMLBuffer (&(getCourseInfo->infoTxt));
|
||||
break;
|
||||
case Inf_INFO_SRC_URL: // Link to a web page
|
||||
getCourseInfo->infoTxt = (char *) soap_malloc (Gbl.soap,Cns_MAX_LENGTH_WWW + 1);
|
||||
getCourseInfo->infoTxt = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||
Inf_WriteURLIntoTxtBuffer (getCourseInfo->infoTxt);
|
||||
break;
|
||||
}
|
||||
|
@ -2005,7 +2005,7 @@ int swad__sendMyGroups (struct soap *soap,
|
|||
|
||||
static void Svc_CopyUsrData (struct swad__user *Usr,struct UsrData *UsrDat,bool UsrIDIsVisible)
|
||||
{
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
const char *FirstID;
|
||||
size_t Length;
|
||||
|
||||
|
@ -2068,7 +2068,7 @@ int swad__getAttendanceEvents (struct soap *soap,
|
|||
MYSQL_ROW row;
|
||||
int NumAttEvent;
|
||||
long AttCod;
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
long StartTime;
|
||||
long EndTime;
|
||||
size_t Length;
|
||||
|
@ -2353,7 +2353,7 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
|||
"Request forbidden",
|
||||
"Title of attendance event is empty");
|
||||
Str_Copy (Att.Title,title,
|
||||
Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE);
|
||||
|
||||
/* Create a list of groups selected */
|
||||
Svc_GetLstGrpsSel (groups);
|
||||
|
@ -2493,7 +2493,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRow,NumRows;
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
size_t Length;
|
||||
|
||||
/***** Initializations *****/
|
||||
|
@ -2808,7 +2808,7 @@ int swad__getNotifications (struct soap *soap,
|
|||
long NtfCod;
|
||||
Ntf_NotifyEvent_t NotifyEvent;
|
||||
long EventTime;
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
struct Instit Ins;
|
||||
struct Centre Ctr;
|
||||
struct Degree Deg;
|
||||
|
@ -2891,10 +2891,10 @@ int swad__getNotifications (struct soap *soap,
|
|||
|
||||
if (Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Crs.CrsCod)) // Get some user's data from database
|
||||
{
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1);
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname = (char *) soap_malloc (Gbl.soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname,
|
||||
Gbl.Usrs.Other.UsrDat.Nickname,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1,
|
||||
|
@ -2912,10 +2912,10 @@ int swad__getNotifications (struct soap *soap,
|
|||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_LENGTH_WWW + 1);
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto,
|
||||
PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3248,7 +3248,7 @@ int swad__sendMessage (struct soap *soap,
|
|||
Str_RemoveLeadingArrobas (Nickname);
|
||||
|
||||
/* Check for overflow in query */
|
||||
if (strlen (Query) + Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 32 >
|
||||
if (strlen (Query) + Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 32 >
|
||||
Svc_MAX_LENGTH_QUERY_RECIPIENTS)
|
||||
return soap_sender_fault (Gbl.soap,
|
||||
"Can not send message",
|
||||
|
@ -4449,7 +4449,7 @@ static bool Svc_WriteRowFileBrowser (unsigned Level,Brw_FileType_t FileType,cons
|
|||
extern const char *Txt_NEW_LINE;
|
||||
extern const char *Txt_LICENSES[Brw_NUM_LICENSES];
|
||||
struct FileMetadata FileMetadata;
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Is this row hidden or visible? *****/
|
||||
if (Gbl.FileBrowser.Type == Brw_SHOW_DOCUM_CRS ||
|
||||
|
@ -4525,8 +4525,8 @@ int swad__getFile (struct soap *soap,
|
|||
extern const char *Txt_LICENSES[Brw_NUM_LICENSES];
|
||||
int ReturnCode;
|
||||
struct FileMetadata FileMetadata;
|
||||
char URL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_LENGTH_WWW + 1];
|
||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
||||
/***** Initializations *****/
|
||||
Gbl.soap = soap;
|
||||
|
@ -4534,10 +4534,10 @@ int swad__getFile (struct soap *soap,
|
|||
|
||||
/***** Allocate space for strings *****/
|
||||
getFileOut->fileName = (char *) soap_malloc (Gbl.soap,NAME_MAX + 1);
|
||||
getFileOut->URL = (char *) soap_malloc (Gbl.soap,Cns_MAX_LENGTH_WWW + 1);
|
||||
getFileOut->URL = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||
getFileOut->license = (char *) soap_malloc (Gbl.soap,Brw_MAX_LENGTH_LICENSE + 1);
|
||||
getFileOut->publisherName = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_FULL_NAME + 1);
|
||||
getFileOut->publisherPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_LENGTH_WWW + 1);
|
||||
getFileOut->publisherPhoto = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_WWW + 1);
|
||||
|
||||
/***** Default values returned on error *****/
|
||||
getFileOut->fileName[0] = '\0';
|
||||
|
@ -4647,7 +4647,7 @@ int swad__getFile (struct soap *soap,
|
|||
NAME_MAX);
|
||||
|
||||
Str_Copy (getFileOut->URL,URL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
|
||||
getFileOut->size = (int) FileMetadata.Size;
|
||||
|
||||
|
@ -4666,7 +4666,7 @@ int swad__getFile (struct soap *soap,
|
|||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||
Str_Copy (getFileOut->publisherPhoto,PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cns_MAX_BYTES_WWW);
|
||||
}
|
||||
|
||||
return SOAP_OK;
|
||||
|
|
|
@ -178,7 +178,7 @@ void ZIP_CreateZIPAsgWrk (void)
|
|||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user