mirror of https://github.com/acanas/swad-core.git
Version 16.118
This commit is contained in:
parent
22475d77da
commit
a70828bbc5
|
@ -118,7 +118,8 @@ void ID_GetListIDsFromUsrCod (struct UsrData *UsrDat)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get ID from row[0] */
|
||||
Str_Copy (UsrDat->IDs.List[NumID].ID,row[0],ID_MAX_LENGTH_USR_ID);
|
||||
Str_Copy (UsrDat->IDs.List[NumID].ID,row[0],
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
|
||||
/* Get if ID is confirmed from row[1] */
|
||||
UsrDat->IDs.List[NumID].Confirmed = (row[1][0] == 'Y');
|
||||
|
@ -197,7 +198,8 @@ unsigned ID_GetListUsrCodsFromUsrID (struct UsrData *UsrDat,
|
|||
Str_Copy (Query,CheckPassword ? "SELECT DISTINCT(usr_IDs.UsrCod) FROM usr_IDs,usr_data"
|
||||
" WHERE usr_IDs.UsrID IN (" :
|
||||
"SELECT DISTINCT(UsrCod) FROM usr_IDs"
|
||||
" WHERE UsrID IN (",MaxLength);
|
||||
" WHERE UsrID IN (",
|
||||
MaxLength);
|
||||
for (NumID = 0;
|
||||
NumID < UsrDat->IDs.Num;
|
||||
NumID++)
|
||||
|
|
|
@ -237,7 +237,8 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
|||
SuperAction = Act_Actions[Action].SuperAction;
|
||||
Str_Copy (TabStr,Txt_TABS_TXT[Act_Actions[SuperAction].Tab],
|
||||
MFU_MAX_LENGTH_TAB);
|
||||
Str_Copy (MenuStr,Title,MFU_MAX_LENGTH_MENU);
|
||||
Str_Copy (MenuStr,Title,
|
||||
MFU_MAX_LENGTH_MENU);
|
||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
||||
|
||||
/* Icon and text */
|
||||
|
@ -300,7 +301,8 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions)
|
|||
SuperAction = Act_Actions[Action].SuperAction;
|
||||
Str_Copy (TabStr,Txt_TABS_TXT[Act_Actions[SuperAction].Tab],
|
||||
MFU_MAX_LENGTH_TAB);
|
||||
Str_Copy (MenuStr,Title,MFU_MAX_LENGTH_MENU);
|
||||
Str_Copy (MenuStr,Title,
|
||||
MFU_MAX_LENGTH_MENU);
|
||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
||||
|
||||
/* Icon and text */
|
||||
|
|
|
@ -191,7 +191,8 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
|
|||
fprintf (FileRSS,"<item>\n");
|
||||
|
||||
/* Write title (first characters) of the notice */
|
||||
Str_Copy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Content,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_LimitLengthHTMLStr (Content,40);
|
||||
fprintf (FileRSS,"<title>%s: ",Txt_Notice);
|
||||
Str_FilePrintStrChangingBRToRetAndNBSPToSpace (FileRSS,Content);
|
||||
|
@ -202,7 +203,8 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Course *Crs)
|
|||
Cfg_URL_SWAD_CGI,Crs->CrsCod);
|
||||
|
||||
/* Write full content of the notice */
|
||||
Str_Copy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Content,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,40);
|
||||
fprintf (FileRSS,"<description><![CDATA[<p><em>%s %s %s:</em></p><p>%s</p>]]></description>\n",
|
||||
UsrDat.FirstName,UsrDat.Surname1,UsrDat.Surname2,Content);
|
||||
|
|
|
@ -73,7 +73,7 @@ static void Acc_ShowFormCheckIfIHaveAccount (const char *Title);
|
|||
static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrData *UsrDat);
|
||||
static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWithoutArroba,
|
||||
const char *NewEmail);
|
||||
static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba,
|
||||
static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1],
|
||||
char *NewEmail,
|
||||
char *NewEncryptedPassword);
|
||||
static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat);
|
||||
|
@ -331,7 +331,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWith
|
|||
extern const char *Txt_HELP_nickname;
|
||||
extern const char *Txt_HELP_email;
|
||||
extern const char *Txt_Email;
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
|
||||
/***** Form to enter some data of the new user *****/
|
||||
Act_FormStart (ActCreUsrAcc);
|
||||
|
@ -548,7 +548,7 @@ static void Acc_PrintAccountSeparator (void)
|
|||
|
||||
bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||
{
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
char NewEmail[Usr_MAX_BYTES_USR_EMAIL + 1];
|
||||
char NewEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
|
||||
|
@ -575,7 +575,8 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
|||
if (Mai_UpdateEmailInDB (&Gbl.Usrs.Me.UsrDat,NewEmail))
|
||||
{
|
||||
/* Email updated sucessfully */
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,NewEmail,Usr_MAX_BYTES_USR_EMAIL);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,NewEmail,
|
||||
Usr_MAX_BYTES_USR_EMAIL);
|
||||
|
||||
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
|
||||
}
|
||||
|
@ -595,7 +596,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
|||
/*****************************************************************************/
|
||||
// Return false on error
|
||||
|
||||
static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba,
|
||||
static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1],
|
||||
char *NewEmail,
|
||||
char *NewEncryptedPassword)
|
||||
{
|
||||
|
@ -604,16 +605,17 @@ static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba,
|
|||
extern const char *Txt_The_email_address_X_had_been_registered_by_another_user;
|
||||
extern const char *Txt_The_email_address_entered_X_is_not_valid;
|
||||
char Query[1024];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
char NewPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD + 1];
|
||||
bool Error = false;
|
||||
|
||||
/***** Step 1/3: Get new nickname from form *****/
|
||||
Par_GetParToText ("NewNick",NewNicknameWithArroba,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Par_GetParToText ("NewNick",NewNicknameWithArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
|
||||
/* Remove arrobas at the beginning */
|
||||
Str_Copy (NewNicknameWithoutArroba,NewNicknameWithArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
Str_RemoveLeadingArrobas (NewNicknameWithoutArroba);
|
||||
|
||||
/* Create a new version of the nickname with arroba */
|
||||
|
|
|
@ -4593,7 +4593,8 @@ const char *Act_GetSubtitleAction (Act_Action_t Action)
|
|||
/********************* Get text for action from database *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
char *Act_GetActionTextFromDB (long ActCod,char *Txt)
|
||||
char *Act_GetActionTextFromDB (long ActCod,
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1])
|
||||
{
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
char Query[1024];
|
||||
|
@ -4608,15 +4609,16 @@ char *Act_GetActionTextFromDB (long ActCod,char *Txt)
|
|||
{
|
||||
/***** Get text *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Txt,row[0],Act_MAX_LENGTH_ACTION_TXT);
|
||||
Str_Copy (ActTxt,row[0],
|
||||
Act_MAX_LENGTH_ACTION_TXT);
|
||||
}
|
||||
else // ActCod-Language not found on database
|
||||
Txt[0] = '\0';
|
||||
ActTxt[0] = '\0';
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return Txt;
|
||||
return ActTxt;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1512,7 +1512,8 @@ struct Act_Actions
|
|||
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 *Txt);
|
||||
char *Act_GetActionTextFromDB (long ActCod,
|
||||
char ActTxt[Act_MAX_LENGTH_ACTION_TXT + 1]);
|
||||
|
||||
void Act_FormGoToStart (Act_Action_t NextAction);
|
||||
void Act_FormStart (Act_Action_t NextAction);
|
||||
|
|
|
@ -96,7 +96,8 @@ static void Agd_PutFormsToRemEditOneEvent (struct AgendaEvent *AgdEvent);
|
|||
static void Agd_PutParams (void);
|
||||
static void Agd_GetListEvents (Agd_AgendaType_t AgendaType);
|
||||
static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent);
|
||||
static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent,char *Txt);
|
||||
static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
static void Agd_PutParamAgdCod (long AgdCod);
|
||||
static bool Agd_CheckIfSimilarEventExists (struct AgendaEvent *AgdEvent);
|
||||
static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt);
|
||||
|
@ -114,7 +115,7 @@ void Agd_PutFormLogInToShowUsrAgenda (void)
|
|||
|
||||
void Agd_PutParamAgd (void)
|
||||
{
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
|
||||
sprintf (Nickname,"@%s",Gbl.Usrs.Other.UsrDat.Nickname);
|
||||
Par_PutHiddenParamString ("agd",Nickname);
|
||||
|
@ -947,10 +948,12 @@ static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent)
|
|||
Dat_PRESENT));
|
||||
|
||||
/* Get the event (row[7]) */
|
||||
Str_Copy (AgdEvent->Event,row[7],Agd_MAX_LENGTH_EVENT);
|
||||
Str_Copy (AgdEvent->Event,row[7],
|
||||
Agd_MAX_LENGTH_EVENT);
|
||||
|
||||
/* Get the event (row[8]) */
|
||||
Str_Copy (AgdEvent->Location,row[8],Agd_MAX_LENGTH_LOCATION);
|
||||
Str_Copy (AgdEvent->Location,row[8],
|
||||
Agd_MAX_LENGTH_LOCATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -989,7 +992,8 @@ void Agd_FreeListEvents (void)
|
|||
/*********************** Get event text from database ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent,char *Txt)
|
||||
static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -1007,7 +1011,8 @@ static void Agd_GetEventTxtFromDB (struct AgendaEvent *AgdEvent,char *Txt)
|
|||
{
|
||||
/* Get info text */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Txt,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Txt,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
else
|
||||
Txt[0] = '\0';
|
||||
|
|
|
@ -149,10 +149,12 @@ void Ann_ShowAllAnnouncements (void)
|
|||
Lay_ShowErrorAndExit ("Error when reading roles of announcement.");
|
||||
|
||||
/* Get the content (row[3]) */
|
||||
Str_Copy (Subject,row[3],Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (Subject,row[3],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
|
||||
/* Get the content (row[4]) and insert links */
|
||||
Str_Copy (Content,row[4],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Content,row[4],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
||||
|
||||
/* Show the announcement */
|
||||
|
@ -241,10 +243,12 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
|
|||
Lay_ShowErrorAndExit ("Wrong code of announcement.");
|
||||
|
||||
/* Get the content (row[1]) */
|
||||
Str_Copy (Subject,row[1],Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (Subject,row[1],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
|
||||
/* Get the content (row[2]) and insert links */
|
||||
Str_Copy (Content,row[2],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Content,row[2],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
||||
|
||||
/* Show the announcement */
|
||||
|
|
|
@ -452,8 +452,10 @@ static void Asg_WriteAsgAuthor (struct Assignment *Asg)
|
|||
"PHOTO15x20",Pho_ZOOM,false);
|
||||
|
||||
/***** Write name *****/
|
||||
Str_Copy (FirstName,UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Surnames,UsrDat.Surname1,Usr_MAX_BYTES_SURNAMES);
|
||||
Str_Copy (FirstName,UsrDat.FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Surnames,UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_SURNAMES);
|
||||
if (UsrDat.Surname2[0])
|
||||
{
|
||||
Str_Concat (Surnames," ",Usr_MAX_BYTES_SURNAMES);
|
||||
|
@ -776,10 +778,12 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
|||
Asg->Open = (row[5][0] == '1');
|
||||
|
||||
/* Get the title of the assignment (row[6]) */
|
||||
Str_Copy (Asg->Title,row[6],Asg_MAX_LENGTH_ASSIGNMENT_TITLE);
|
||||
Str_Copy (Asg->Title,row[6],
|
||||
Asg_MAX_LENGTH_ASSIGNMENT_TITLE);
|
||||
|
||||
/* Get the folder for the assignment files (row[7]) */
|
||||
Str_Copy (Asg->Folder,row[7],Asg_MAX_LENGTH_FOLDER);
|
||||
Str_Copy (Asg->Folder,row[7],
|
||||
Asg_MAX_LENGTH_FOLDER);
|
||||
Asg->SendWork = (Asg->Folder[0] != '\0');
|
||||
|
||||
/* Can I do this assignment? */
|
||||
|
@ -848,7 +852,8 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT
|
|||
{
|
||||
/* Get info text */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Txt,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Txt,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
else
|
||||
Txt[0] = '\0';
|
||||
|
@ -871,6 +876,7 @@ void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **Cont
|
|||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
size_t Length;
|
||||
|
||||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
|
@ -887,18 +893,19 @@ void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **Cont
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Get summary *****/
|
||||
Str_Copy (SummaryStr,row[0],Cns_MAX_BYTES_TEXT);
|
||||
|
||||
Str_Copy (SummaryStr,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
/***** Get content *****/
|
||||
if (GetContent)
|
||||
{
|
||||
if ((*ContentStr = (char *) malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL)
|
||||
Length = strlen (row[1]);
|
||||
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||
|
||||
Str_Copy (*ContentStr,row[1],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (*ContentStr,row[1],
|
||||
Length);
|
||||
}
|
||||
}
|
||||
mysql_free_result (mysql_res);
|
||||
|
|
|
@ -107,7 +107,9 @@ static void Att_GetNumStdsTotalWhoAreInAttEvent (struct AttendanceEvent *Att);
|
|||
static unsigned Att_GetNumStdsFromAListWhoAreInAttEvent (long AttCod,long LstSelectedUsrCods[],unsigned NumStdsInList);
|
||||
static bool Att_CheckIfUsrIsInTableAttUsr (long AttCod,long UsrCod,bool *Present);
|
||||
static bool Att_CheckIfUsrIsPresentInAttEvent (long AttCod,long UsrCod);
|
||||
static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long UsrCod,char *CommentStd,char *CommentTch);
|
||||
static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long UsrCod,
|
||||
char CommentStd[Cns_MAX_BYTES_TEXT + 1],
|
||||
char CommentTch[Cns_MAX_BYTES_TEXT + 1]);
|
||||
static void Att_RegUsrInAttEventChangingComments (long AttCod,long UsrCod,bool Present,
|
||||
const char *CommentStd,const char *CommentTch);
|
||||
static void Att_RemoveUsrFromAttEvent (long AttCod,long UsrCod);
|
||||
|
@ -141,7 +143,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat);
|
|||
|
||||
void Att_SeeAttEvents (void)
|
||||
{
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
|
||||
/***** Get parameters *****/
|
||||
Att_GetParamAttOrderType ();
|
||||
|
@ -492,8 +494,10 @@ static void Att_WriteAttEventAuthor (struct AttendanceEvent *Att)
|
|||
"PHOTO15x20",Pho_ZOOM,false);
|
||||
|
||||
/***** Write name *****/
|
||||
Str_Copy (FirstName,UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Surnames,UsrDat.Surname1,Usr_MAX_BYTES_SURNAMES);
|
||||
Str_Copy (FirstName,UsrDat.FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Surnames,UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_SURNAMES);
|
||||
if (UsrDat.Surname2[0])
|
||||
{
|
||||
Str_Concat (Surnames," ",Usr_MAX_BYTES_SURNAMES);
|
||||
|
@ -785,7 +789,8 @@ bool Att_GetDataOfAttEventByCod (struct AttendanceEvent *Att)
|
|||
Att->CommentTchVisible = (row[7][0] == 'Y');
|
||||
|
||||
/* Get the title of the attendance event (row[8]) */
|
||||
Str_Copy (Att->Title,row[8],Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
Str_Copy (Att->Title,row[8],
|
||||
Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -856,7 +861,8 @@ static void Att_GetAttEventTxtFromDB (long AttCod,char Txt[Cns_MAX_BYTES_TEXT +
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get info text */
|
||||
Str_Copy (Txt,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Txt,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
else
|
||||
Txt[0] = '\0';
|
||||
|
@ -2493,7 +2499,9 @@ static bool Att_CheckIfUsrIsPresentInAttEvent (long AttCod,long UsrCod)
|
|||
/***************** Check if a student attended to an event *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long UsrCod,char *CommentStd,char *CommentTch)
|
||||
static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long UsrCod,
|
||||
char CommentStd[Cns_MAX_BYTES_TEXT + 1],
|
||||
char CommentTch[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -2514,10 +2522,12 @@ static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long Us
|
|||
Present = (row[0][0] == 'Y');
|
||||
|
||||
/* Get student's comment (row[1]) */
|
||||
Str_Copy (CommentStd,row[1],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (CommentStd,row[1],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Get teacher's comment (row[2]) */
|
||||
Str_Copy (CommentTch,row[2],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (CommentTch,row[2],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
else // User is not present
|
||||
{
|
||||
|
|
|
@ -204,16 +204,20 @@ static void Ban_GetListBanners (const char *Query)
|
|||
Ban->Hidden = (row[1][0] == 'Y');
|
||||
|
||||
/* Get the short name of the banner (row[2]) */
|
||||
Str_Copy (Ban->ShrtName,row[2],Ban_MAX_LENGTH_SHRT_NAME);
|
||||
Str_Copy (Ban->ShrtName,row[2],
|
||||
Ban_MAX_LENGTH_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the banner (row[3]) */
|
||||
Str_Copy (Ban->FullName,row[3],Ban_MAX_LENGTH_FULL_NAME);
|
||||
Str_Copy (Ban->FullName,row[3],
|
||||
Ban_MAX_LENGTH_FULL_NAME);
|
||||
|
||||
/* Get the image of the banner (row[4]) */
|
||||
Str_Copy (Ban->Img,row[4],Ban_MAX_LENGTH_IMAGE);
|
||||
Str_Copy (Ban->Img,row[4],
|
||||
Ban_MAX_LENGTH_IMAGE);
|
||||
|
||||
/* Get the URL of the banner (row[5]) */
|
||||
Str_Copy (Ban->WWW,row[5],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ban->WWW,row[5],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -257,16 +261,20 @@ void Ban_GetDataOfBannerByCod (struct Banner *Ban)
|
|||
Ban->Hidden = (row[0][0] == 'Y');
|
||||
|
||||
/* Get the short name of the banner (row[1]) */
|
||||
Str_Copy (Ban->ShrtName,row[1],Ban_MAX_LENGTH_SHRT_NAME);
|
||||
Str_Copy (Ban->ShrtName,row[1],
|
||||
Ban_MAX_LENGTH_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the banner (row[2]) */
|
||||
Str_Copy (Ban->FullName,row[2],Ban_MAX_LENGTH_FULL_NAME);
|
||||
Str_Copy (Ban->FullName,row[2],
|
||||
Ban_MAX_LENGTH_FULL_NAME);
|
||||
|
||||
/* Get the image of the banner (row[3]) */
|
||||
Str_Copy (Ban->Img,row[3],Ban_MAX_LENGTH_IMAGE);
|
||||
Str_Copy (Ban->Img,row[3],
|
||||
Ban_MAX_LENGTH_IMAGE);
|
||||
|
||||
/* Get the URL of the banner (row[4]) */
|
||||
Str_Copy (Ban->WWW,row[4],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ban->WWW,row[4],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -616,7 +624,8 @@ static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (CurrentBanName,NewBanName,MaxLength);
|
||||
Str_Copy (CurrentBanName,NewBanName,
|
||||
MaxLength);
|
||||
|
||||
Ban_EditBanners ();
|
||||
}
|
||||
|
@ -674,7 +683,8 @@ void Ban_ChangeBannerImg (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_image_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Ban->Img,NewImg,Ban_MAX_LENGTH_IMAGE);
|
||||
Str_Copy (Ban->Img,NewImg,
|
||||
Ban_MAX_LENGTH_IMAGE);
|
||||
|
||||
Ban_EditBanners ();
|
||||
}
|
||||
|
@ -718,7 +728,8 @@ void Ban_ChangeBannerWWW (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_web_address_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Ban->WWW,NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ban->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
Ban_EditBanners ();
|
||||
}
|
||||
|
|
|
@ -1038,13 +1038,16 @@ void Ctr_GetListCentres (long InsCod)
|
|||
Ctr->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
||||
|
||||
/* Get the short name of the centre (row[5]) */
|
||||
Str_Copy (Ctr->ShrtName,row[5],Ctr_MAX_LENGTH_CENTRE_SHRT_NAME);
|
||||
Str_Copy (Ctr->ShrtName,row[5],
|
||||
Ctr_MAX_LENGTH_CENTRE_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the centre (row[6]) */
|
||||
Str_Copy (Ctr->FullName,row[6],Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
Str_Copy (Ctr->FullName,row[6],
|
||||
Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
|
||||
/* Get the URL of the centre (row[7]) */
|
||||
Str_Copy (Ctr->WWW,row[7],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ctr->WWW,row[7],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get number of users who claim to belong to this centre (row[8]) */
|
||||
if (sscanf (row[8],"%u",&Ctr->NumUsrsWhoClaimToBelongToCtr) != 1)
|
||||
|
@ -1133,13 +1136,16 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
|||
Ctr->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
||||
/* Get the short name of the centre (row[4]) */
|
||||
Str_Copy (Ctr->ShrtName,row[4],Ctr_MAX_LENGTH_CENTRE_SHRT_NAME);
|
||||
Str_Copy (Ctr->ShrtName,row[4],
|
||||
Ctr_MAX_LENGTH_CENTRE_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the centre (row[5]) */
|
||||
Str_Copy (Ctr->FullName,row[5],Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
Str_Copy (Ctr->FullName,row[5],
|
||||
Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
|
||||
/* Get the URL of the centre (row[6]) */
|
||||
Str_Copy (Ctr->WWW,row[6],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ctr->WWW,row[6],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get number of users who claim to belong to this centre (row[7]) */
|
||||
if (sscanf (row[7],"%u",&Ctr->NumUsrsWhoClaimToBelongToCtr) != 1)
|
||||
|
@ -1217,7 +1223,8 @@ void Ctr_GetShortNameOfCentreByCod (struct Centre *Ctr)
|
|||
/***** Get the short name of this centre *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
Str_Copy (Ctr->ShrtName,row[0],Ctr_MAX_LENGTH_CENTRE_SHRT_NAME);
|
||||
Str_Copy (Ctr->ShrtName,row[0],
|
||||
Ctr_MAX_LENGTH_CENTRE_SHRT_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1252,11 +1259,10 @@ static void Ctr_GetPhotoAttribution (long CtrCod,char **PhotoAttribution)
|
|||
if (row[0][0])
|
||||
{
|
||||
Length = strlen (row[0]);
|
||||
|
||||
if (((*PhotoAttribution) = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for photo attribution.");
|
||||
|
||||
Str_Copy (*PhotoAttribution,row[0],Length);
|
||||
Str_Copy (*PhotoAttribution,row[0],
|
||||
Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1369,7 @@ void Ctr_WriteSelectorOfCentre (void)
|
|||
/*************************** List all the centres ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Ctr_MAX_LENGTH_WWW_ON_SCREEN 10
|
||||
#define Ctr_MAX_LENGTH_WWW_ON_SCREEN 15
|
||||
|
||||
static void Ctr_ListCentresForEdition (void)
|
||||
{
|
||||
|
@ -1374,7 +1380,7 @@ static void Ctr_ListCentresForEdition (void)
|
|||
unsigned NumCtr;
|
||||
struct Centre *Ctr;
|
||||
unsigned NumPlc;
|
||||
char WWW[Ctr_MAX_LENGTH_WWW_ON_SCREEN+1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
struct UsrData UsrDat;
|
||||
bool ICanEdit;
|
||||
Ctr_StatusTxt_t StatusTxt;
|
||||
|
@ -1510,12 +1516,14 @@ static void Ctr_ListCentresForEdition (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Ctr->WWW,Ctr_MAX_LENGTH_WWW_ON_SCREEN);
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\" class=\"DAT\" title=\"%s\">%s",
|
||||
Str_Copy (WWW,Ctr->WWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Str_LimitLengthHTMLStr (WWW,Ctr_MAX_LENGTH_WWW_ON_SCREEN);
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT\" title=\"%s\">"
|
||||
"%s"
|
||||
"</a>",
|
||||
Ctr->WWW,Ctr->WWW,WWW);
|
||||
if (strlen (Ctr->WWW) > Ctr_MAX_LENGTH_WWW_ON_SCREEN)
|
||||
fprintf (Gbl.F.Out,"…");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -1950,7 +1958,8 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
CurrentCtrName,NewCtrName);
|
||||
|
||||
/* Change current centre name in order to display it properly */
|
||||
Str_Copy (CurrentCtrName,NewCtrName,MaxLength);
|
||||
Str_Copy (CurrentCtrName,NewCtrName,
|
||||
MaxLength);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
|
@ -2003,7 +2012,8 @@ void Ctr_ChangeCtrWWW (void)
|
|||
/***** Update database changing old WWW by new WWW *****/
|
||||
Ctr_UpdateCtrWWWDB (Ctr->CtrCod,NewWWW);
|
||||
|
||||
Str_Copy (Ctr->WWW,NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ctr->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2034,7 +2044,8 @@ 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);
|
||||
Str_Copy (Gbl.CurrentCtr.Ctr.WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
|
|
@ -184,18 +184,22 @@
|
|||
// TODO: Draw future dates in attendance, surveys, assignments in blue?
|
||||
// TODO: Fix bug in generate a test: after entering a number of questions with empty tags and type of answers, number of questions is not remembered
|
||||
// TODO: Fix bug when editing a test question with images: when "Change image" is selected but no image is uploades, other images (for example in answers) are lost
|
||||
// TODO: Fix bug when creating a new attendance event: if title is repeated, form is cleared
|
||||
// TODO: Fix bug: When registering an administrator, the user's name changes are ignored
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.117 (2017-01-16)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.118 (2017-01-16)"
|
||||
#define CSS_FILE "swad16.111.5.css"
|
||||
#define JS_FILE "swad16.114.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.118: Jan 17, 2017 Code refactoring related to string copy. (211676 lines)
|
||||
Version 16.117.1: Jan 16, 2017 Code refactoring related to string concatenation. (211229 lines)
|
||||
Version 16.117: Jan 16, 2017 Code refactoring related to string concatenation. (211244 lines)
|
||||
Version 16.116: Jan 15, 2017 Code refactoring related to string copy. (211195 lines)
|
||||
Version 16.115: Jan 15, 2017 Code refactoring related to string copy. (211046 lines)
|
||||
|
|
27
swad_chat.c
27
swad_chat.c
|
@ -372,6 +372,10 @@ static unsigned Cht_GetNumUsrsInChatRoom (const char *RoomCode)
|
|||
/******************************* Enter a chat room ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Cht_MAX_LENGTH_ROOM_CODES ((2 + Deg_MAX_DEGREES_PER_USR + Crs_MAX_COURSES_PER_USR) * MAX_LENGTH_ROOM_CODE)
|
||||
#define Cht_MAX_LENGTH_ROOM_SHRT_NAMES ((2 + Deg_MAX_DEGREES_PER_USR + Crs_MAX_COURSES_PER_USR) * MAX_LENGTH_ROOM_SHRT_NAME)
|
||||
#define Cht_MAX_LENGTH_ROOM_FULL_NAMES ((2 + Deg_MAX_DEGREES_PER_USR + Crs_MAX_COURSES_PER_USR) * MAX_LENGTH_ROOM_FULL_NAME)
|
||||
|
||||
void Cht_OpenChatWindow (void)
|
||||
{
|
||||
extern const char *Txt_SEX_PLURAL_Abc[Usr_NUM_SEXS];
|
||||
|
@ -393,9 +397,9 @@ void Cht_OpenChatWindow (void)
|
|||
char ThisRoomCode [MAX_LENGTH_ROOM_CODE + 1];
|
||||
char ThisRoomShortName[MAX_LENGTH_ROOM_SHRT_NAME + 1];
|
||||
char ThisRoomFullName [MAX_LENGTH_ROOM_FULL_NAME + 1];
|
||||
char ListRoomCodes [(2 + Deg_MAX_DEGREES_PER_USR + Crs_MAX_COURSES_PER_USR) * MAX_LENGTH_ROOM_CODE + 1];
|
||||
char ListRoomShortNames[(2 + Deg_MAX_DEGREES_PER_USR + Crs_MAX_COURSES_PER_USR) * MAX_LENGTH_ROOM_SHRT_NAME + 1];
|
||||
char ListRoomFullNames [(2 + Deg_MAX_DEGREES_PER_USR + Crs_MAX_COURSES_PER_USR) * MAX_LENGTH_ROOM_FULL_NAME + 1];
|
||||
char ListRoomCodes [Cht_MAX_LENGTH_ROOM_CODES + 1];
|
||||
char ListRoomShortNames[Cht_MAX_LENGTH_ROOM_SHRT_NAMES + 1];
|
||||
char ListRoomFullNames [Cht_MAX_LENGTH_ROOM_FULL_NAMES + 1];
|
||||
FILE *FileChat;
|
||||
|
||||
/***** Get the code and the nombre of the room *****/
|
||||
|
@ -415,19 +419,22 @@ void Cht_OpenChatWindow (void)
|
|||
Usr_GetMyCourses ();
|
||||
|
||||
/***** Build my user's name *****/
|
||||
Str_Copy (UsrName,Gbl.Usrs.Me.UsrDat.Surname1,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrName,Gbl.Usrs.Me.UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_FULL_NAME);
|
||||
if (Gbl.Usrs.Me.UsrDat.Surname2[0])
|
||||
{
|
||||
Str_Concat (UsrName," ",Usr_MAX_BYTES_NAME);
|
||||
Str_Concat (UsrName,Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_NAME);
|
||||
Str_Concat (UsrName," ",Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_Concat (UsrName,Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_FULL_NAME);
|
||||
}
|
||||
Str_Concat (UsrName,", ",Usr_MAX_BYTES_NAME);
|
||||
Str_Concat (UsrName,Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Concat (UsrName,", ",Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_Concat (UsrName,Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/***** Build the lists of available rooms *****/
|
||||
sprintf (ListRoomCodes,"#%s",RoomCode);
|
||||
Str_Copy (ListRoomShortNames,RoomShortName,sizeof (ListRoomShortNames) - 1);
|
||||
Str_Copy (ListRoomFullNames ,RoomFullName,sizeof (ListRoomFullNames) - 1);
|
||||
Str_Copy (ListRoomShortNames,RoomShortName,
|
||||
Cht_MAX_LENGTH_ROOM_SHRT_NAMES);
|
||||
Str_Copy (ListRoomFullNames ,RoomFullName,
|
||||
Cht_MAX_LENGTH_ROOM_FULL_NAMES);
|
||||
|
||||
if (strcmp (RoomCode,"GBL_USR"))
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "swad_database.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_hierarchy.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_photo.h"
|
||||
#include "swad_role.h"
|
||||
|
@ -457,7 +458,7 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
|
|||
{
|
||||
extern const char *The_ClassConnected[The_NUM_THEMES];
|
||||
extern const char *Txt_from;
|
||||
char LocationName[Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR + 1];
|
||||
char LocationName[Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR + 1];
|
||||
struct ConnectedUsrs Usrs;
|
||||
|
||||
/***** Set location name depending on scope *****/
|
||||
|
@ -465,42 +466,42 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
|
|||
{
|
||||
case Sco_SCOPE_SYS: // Show connected users in the whole platform
|
||||
Str_Copy (LocationName,Cfg_PLATFORM_SHORT_NAME,
|
||||
Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
break;
|
||||
case Sco_SCOPE_CTY: // Show connected users in the current country
|
||||
if (Gbl.CurrentCty.Cty.CtyCod <= 0) // There is no country selected
|
||||
return;
|
||||
|
||||
Str_Copy (LocationName,Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language],
|
||||
Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
break;
|
||||
case Sco_SCOPE_INS: // Show connected users in the current institution
|
||||
if (Gbl.CurrentIns.Ins.InsCod <= 0) // There is no institution selected
|
||||
return;
|
||||
|
||||
Str_Copy (LocationName,Gbl.CurrentIns.Ins.ShrtName,
|
||||
Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
break;
|
||||
case Sco_SCOPE_CTR: // Show connected users in the current centre
|
||||
if (Gbl.CurrentCtr.Ctr.CtrCod <= 0) // There is no centre selected
|
||||
return;
|
||||
|
||||
Str_Copy (LocationName,Gbl.CurrentCtr.Ctr.ShrtName,
|
||||
Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
break;
|
||||
case Sco_SCOPE_DEG: // Show connected users in the current degree
|
||||
if (Gbl.CurrentDeg.Deg.DegCod <= 0) // There is no degree selected
|
||||
return;
|
||||
|
||||
Str_Copy (LocationName,Gbl.CurrentDeg.Deg.ShrtName,
|
||||
Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
break;
|
||||
case Sco_SCOPE_CRS: // Show connected users in the current course
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod <= 0) // There is no course selected
|
||||
return;
|
||||
|
||||
Str_Copy (LocationName,Gbl.CurrentCrs.Crs.ShrtName,
|
||||
Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// Author: Antonio Cañas Vargas
|
||||
// Compile with: gcc -Wall -O1 swad_convert_BRIEFs.c -o swad_convert_BRIEFs -lmysqlclient -L/usr/lib64/mysql
|
||||
|
||||
#include "swad_ID.h"
|
||||
|
||||
#include <mysql/mysql.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
@ -46,7 +48,7 @@ int main (void)
|
|||
unsigned NumUsrs = 0;
|
||||
unsigned i;
|
||||
long UsrCod;
|
||||
char UsrID[16 + 1];
|
||||
char UsrID[ID_MAX_LENGTH_USR_ID + 1];
|
||||
char OldPathUsr[PATH_MAX + 1];
|
||||
char Command[1024 + PATH_MAX * 2];
|
||||
|
||||
|
@ -94,8 +96,8 @@ int main (void)
|
|||
if (sscanf (row[0],"%ld",&UsrCod) == 1) // UsrCod
|
||||
if (row[1])
|
||||
{
|
||||
Str_Copy (UsrID,row[1],16); // UsrID
|
||||
|
||||
Str_Copy (UsrID,row[1],
|
||||
ID_MAX_LENGTH_USR_ID); // UsrID
|
||||
sprintf (OldPathUsr,"%s/%s_backup/%c/%s",
|
||||
PATH_SWAD_PRIVATE,FOLDER_USR,UsrID[strlen (UsrID)-1],UsrID);
|
||||
if (CheckIfPathExists (OldPathUsr))
|
||||
|
|
|
@ -97,7 +97,8 @@ int main (void)
|
|||
if (sscanf (row[0],"%ld",&UsrCod) == 1) // UsrCod
|
||||
if (row[1])
|
||||
{
|
||||
Str_Copy (UsrID,row[1],ID_MAX_LENGTH_USR_ID); // UsrID
|
||||
Str_Copy (UsrID,row[1],
|
||||
ID_MAX_LENGTH_USR_ID); // UsrID
|
||||
sprintf (OldPathPhoto,"%s/%s_backup/%s_original.jpg",
|
||||
PATH_SWAD_PRIVATE,FOLDER_PHOTO,UsrID);
|
||||
if (CheckIfPathExists (OldPathPhoto))
|
||||
|
|
|
@ -126,8 +126,8 @@ int main (void)
|
|||
if (sscanf (row[0],"%ld",&UsrCod) == 1) // UsrCod
|
||||
if (row[1])
|
||||
{
|
||||
Str_Copy (UsrID,row[1],ID_MAX_LENGTH_USR_ID); // UsrID
|
||||
|
||||
Str_Copy (UsrID,row[1],
|
||||
ID_MAX_LENGTH_USR_ID,62); // UsrID
|
||||
sprintf (OldPathUsr,"%s_backup/%s",OldPathUsrs,UsrID);
|
||||
if (CheckIfPathExists (OldPathUsr))
|
||||
{
|
||||
|
|
|
@ -1033,7 +1033,8 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
|
|||
Lay_ShowErrorAndExit ("Wrong code of country.");
|
||||
|
||||
/* Get Alpha-2 country code (row[1]) */
|
||||
Str_Copy (Cty->Alpha2,row[1],2);
|
||||
Str_Copy (Cty->Alpha2,row[1],
|
||||
2);
|
||||
|
||||
switch (GetExtraData)
|
||||
{
|
||||
|
@ -1292,7 +1293,8 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get Alpha-2 country code (row[0]) */
|
||||
Str_Copy (Cty->Alpha2,row[0],2);
|
||||
Str_Copy (Cty->Alpha2,row[0],
|
||||
2);
|
||||
|
||||
switch (GetExtraData)
|
||||
{
|
||||
|
@ -1300,7 +1302,8 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
|
|||
/* Get name and WWW of the country in current language */
|
||||
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);
|
||||
Str_Copy (Cty->WWW[Gbl.Prefs.Language],row[2],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
break;
|
||||
case Cty_GET_EXTRA_DATA:
|
||||
/* Get name and WWW of the country in several languages */
|
||||
|
@ -1362,7 +1365,8 @@ void Cty_GetCountryName (long CtyCod,char CtyName[Cty_MAX_BYTES_COUNTRY_NAME+1])
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get the name of the country */
|
||||
Str_Copy (CtyName,row[0],Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
Str_Copy (CtyName,row[0],
|
||||
Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1399,8 +1403,8 @@ static void Cty_GetMapAttribution (long CtyCod,char **MapAttribution)
|
|||
Length = strlen (row[0]);
|
||||
if (((*MapAttribution) = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for map attribution.");
|
||||
|
||||
Str_Copy (*MapAttribution,row[0],Length);
|
||||
Str_Copy (*MapAttribution,row[0],
|
||||
Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1709,7 +1713,8 @@ void Cty_RenameCountry (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Cty->Name[Language],NewCtyName,Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
Str_Copy (Cty->Name[Language],NewCtyName,
|
||||
Cty_MAX_BYTES_COUNTRY_NAME);
|
||||
Cty_EditCountries ();
|
||||
}
|
||||
|
||||
|
@ -1796,7 +1801,8 @@ void Cty_ChangeCtyWWW (void)
|
|||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Cty->WWW[Language],NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Cty->WWW[Language],NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Cty_EditCountries ();
|
||||
}
|
||||
|
||||
|
|
|
@ -643,7 +643,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
Highlight ? ClassHighlight :
|
||||
ClassNormal,NULL);
|
||||
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShrtName,20,NULL,true);
|
||||
Str_Copy (InsFullName,Ins.FullName,Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
Str_Copy (InsFullName,Ins.FullName,
|
||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
Str_LimitLengthHTMLStr (InsFullName,Crs_MAX_BYTES_TXT_LINK);
|
||||
fprintf (Gbl.F.Out," %s</a>",InsFullName);
|
||||
Act_FormEnd ();
|
||||
|
@ -678,7 +679,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
Highlight ? ClassHighlight :
|
||||
ClassNormal,NULL);
|
||||
Log_DrawLogo (Sco_SCOPE_CTR,Ctr.CtrCod,Ctr.ShrtName,20,NULL,true);
|
||||
Str_Copy (CtrFullName,Ctr.FullName,Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
Str_Copy (CtrFullName,Ctr.FullName,
|
||||
Ctr_MAX_LENGTH_CENTRE_FULL_NAME);
|
||||
Str_LimitLengthHTMLStr (CtrFullName,Crs_MAX_BYTES_TXT_LINK);
|
||||
fprintf (Gbl.F.Out," %s</a>",CtrFullName);
|
||||
Act_FormEnd ();
|
||||
|
@ -713,7 +715,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
Highlight ? ClassHighlight :
|
||||
ClassNormal,NULL);
|
||||
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShrtName,20,NULL,true);
|
||||
Str_Copy (DegFullName,Deg.FullName,Deg_MAX_LENGTH_DEGREE_FULL_NAME);
|
||||
Str_Copy (DegFullName,Deg.FullName,
|
||||
Deg_MAX_LENGTH_DEGREE_FULL_NAME);
|
||||
Str_LimitLengthHTMLStr (DegFullName,Crs_MAX_BYTES_TXT_LINK);
|
||||
fprintf (Gbl.F.Out," %s</a>",DegFullName);
|
||||
Act_FormEnd ();
|
||||
|
@ -2103,7 +2106,8 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
|
|||
Crs->Year = Deg_ConvStrToYear (row[2]);
|
||||
|
||||
/***** Get institutional course code (row[3]) *****/
|
||||
Str_Copy (Crs->InstitutionalCrsCod,row[3],Crs_LENGTH_INSTITUTIONAL_CRS_COD);
|
||||
Str_Copy (Crs->InstitutionalCrsCod,row[3],
|
||||
Crs_LENGTH_INSTITUTIONAL_CRS_COD);
|
||||
|
||||
/***** Get course status (row[4]) *****/
|
||||
if (sscanf (row[4],"%u",&(Crs->Status)) != 1)
|
||||
|
@ -2113,10 +2117,12 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
|
|||
Crs->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||
|
||||
/***** Get the short name of the course (row[6]) *****/
|
||||
Str_Copy (Crs->ShrtName,row[6],Crs_MAX_LENGTH_COURSE_SHRT_NAME);
|
||||
Str_Copy (Crs->ShrtName,row[6],
|
||||
Crs_MAX_LENGTH_COURSE_SHRT_NAME);
|
||||
|
||||
/***** Get the full name of the course (row[7]) *****/
|
||||
Str_Copy (Crs->FullName,row[7],Crs_MAX_LENGTH_COURSE_FULL_NAME);
|
||||
Str_Copy (Crs->FullName,row[7],
|
||||
Crs_MAX_LENGTH_COURSE_FULL_NAME);
|
||||
|
||||
/***** Get number of teachers *****/
|
||||
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TEACHER,Crs->CrsCod);
|
||||
|
@ -2155,8 +2161,10 @@ static void Crs_GetShortNamesByCod (long CrsCod,
|
|||
/***** Get the short name of this course *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
Str_Copy (CrsShortName,row[0],Crs_MAX_LENGTH_COURSE_SHRT_NAME);
|
||||
Str_Copy (DegShortName,row[1],Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
Str_Copy (CrsShortName,row[0],
|
||||
Crs_MAX_LENGTH_COURSE_SHRT_NAME);
|
||||
Str_Copy (DegShortName,row[1],
|
||||
Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -2381,8 +2389,7 @@ void Crs_ChangeInsCrsCod (void)
|
|||
else
|
||||
{
|
||||
Gbl.Error = true;
|
||||
Str_Copy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_You_dont_have_permission_to_edit_this_course);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2588,8 +2595,7 @@ void Crs_ChangeCrsYear (void)
|
|||
else
|
||||
{
|
||||
Gbl.Error = true;
|
||||
Str_Copy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_You_dont_have_permission_to_edit_this_course);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2733,7 +2739,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
CurrentCrsName,NewCrsName);
|
||||
|
||||
/* Change current course name in order to display it properly */
|
||||
Str_Copy (CurrentCrsName,NewCrsName,MaxLength);
|
||||
Str_Copy (CurrentCrsName,NewCrsName,
|
||||
MaxLength);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
|
@ -2744,8 +2751,7 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
else
|
||||
{
|
||||
Gbl.Error = true;
|
||||
Str_Copy (Gbl.Message,Txt_You_dont_have_permission_to_edit_this_course,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_You_dont_have_permission_to_edit_this_course);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,8 @@ bool Dat_GetDateFromYYYYMMDD (struct Date *Date,const char *YYYYMMDD)
|
|||
if (YYYYMMDD[0])
|
||||
if (sscanf (YYYYMMDD,"%04u%02u%02u",&(Date->Year),&(Date->Month),&(Date->Day)) == 3)
|
||||
{
|
||||
Str_Copy (Date->YYYYMMDD,YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||
Str_Copy (Date->YYYYMMDD,YYYYMMDD,
|
||||
Dat_LENGTH_YYYYMMDD);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1263,7 +1264,8 @@ void Dat_AssignDate (struct Date *DateDst,struct Date *DateSrc)
|
|||
DateDst->Month = DateSrc->Month;
|
||||
DateDst->Day = DateSrc->Day;
|
||||
DateDst->Week = DateSrc->Week;
|
||||
Str_Copy (DateDst->YYYYMMDD,DateSrc->YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||
Str_Copy (DateDst->YYYYMMDD,DateSrc->YYYYMMDD,
|
||||
Dat_LENGTH_YYYYMMDD);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -677,7 +677,7 @@ void Deg_ShowDegsOfCurrentCtr (void)
|
|||
/********************* List current degrees for edition **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Deg_MAX_LENGTH_WWW_ON_SCREEN 10
|
||||
#define Deg_MAX_LENGTH_WWW_ON_SCREEN 15
|
||||
|
||||
static void Deg_ListDegreesForEdition (void)
|
||||
{
|
||||
|
@ -688,7 +688,7 @@ static void Deg_ListDegreesForEdition (void)
|
|||
struct DegreeType *DegTyp;
|
||||
struct Degree *Deg;
|
||||
unsigned NumDegTyp;
|
||||
char WWW[Deg_MAX_LENGTH_WWW_ON_SCREEN+1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
struct UsrData UsrDat;
|
||||
bool ICanEdit;
|
||||
Deg_StatusTxt_t StatusTxt;
|
||||
|
@ -822,13 +822,14 @@ static void Deg_ListDegreesForEdition (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Deg->WWW,Deg_MAX_LENGTH_WWW_ON_SCREEN);
|
||||
Str_Copy (WWW,Deg->WWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Str_LimitLengthHTMLStr (WWW,Deg_MAX_LENGTH_WWW_ON_SCREEN);
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT\" title=\"%s\">%s",
|
||||
" class=\"DAT\" title=\"%s\">"
|
||||
"%s"
|
||||
"</a>",
|
||||
Deg->WWW,Deg->WWW,WWW);
|
||||
if (strlen (Deg->WWW) > Deg_MAX_LENGTH_WWW_ON_SCREEN)
|
||||
fprintf (Gbl.F.Out,"…");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -1737,13 +1738,16 @@ static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row)
|
|||
Deg->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
||||
|
||||
/***** Get degree short name (row[5]) *****/
|
||||
Str_Copy (Deg->ShrtName,row[5],Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
Str_Copy (Deg->ShrtName,row[5],
|
||||
Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
|
||||
/***** Get degree full name (row[6]) *****/
|
||||
Str_Copy (Deg->FullName,row[6],Deg_MAX_LENGTH_DEGREE_FULL_NAME);
|
||||
Str_Copy (Deg->FullName,row[6],
|
||||
Deg_MAX_LENGTH_DEGREE_FULL_NAME);
|
||||
|
||||
/***** Get WWW (row[7]) *****/
|
||||
Str_Copy (Deg->WWW,row[7],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Deg->WWW,row[7],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1768,7 +1772,8 @@ void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg)
|
|||
/***** Get the short name of this degree *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
Str_Copy (Deg->ShrtName,row[0],Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
Str_Copy (Deg->ShrtName,row[0],
|
||||
Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -2006,7 +2011,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
CurrentDegName,NewDegName);
|
||||
|
||||
/* Change current degree name in order to display it properly */
|
||||
Str_Copy (CurrentDegName,NewDegName,MaxLength);
|
||||
Str_Copy (CurrentDegName,NewDegName,
|
||||
MaxLength);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
|
@ -2137,7 +2143,8 @@ 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);
|
||||
Str_Copy (Deg->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -2168,7 +2175,8 @@ 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);
|
||||
Str_Copy (Gbl.CurrentDeg.Deg.WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
|
|
@ -43,9 +43,6 @@
|
|||
#define Deg_MAX_LENGTH_DEGREE_SHRT_NAME 32
|
||||
#define Deg_MAX_LENGTH_DEGREE_FULL_NAME (128 - 1)
|
||||
|
||||
#define Deg_MAX_LENGTH_LOCATION_SHORT_NAME 32
|
||||
#define Deg_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR (Deg_MAX_LENGTH_LOCATION_SHORT_NAME * Str_MAX_LENGTH_SPEC_CHAR_HTML)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -650,7 +650,8 @@ bool DT_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get the name of the degree type (row[0]) */
|
||||
Str_Copy (DegTyp->DegTypName,row[0],Deg_MAX_LENGTH_DEGREE_TYPE_NAME);
|
||||
Str_Copy (DegTyp->DegTypName,row[0],
|
||||
Deg_MAX_LENGTH_DEGREE_TYPE_NAME);
|
||||
|
||||
/* Count number of degrees of this type */
|
||||
DegTyp->NumDegs = DT_CountNumDegsOfType (DegTyp->DegTypCod);
|
||||
|
@ -785,7 +786,8 @@ void DT_RenameDegreeType (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (DegTyp->DegTypName,NewNameDegTyp,Deg_MAX_LENGTH_DEGREE_TYPE_NAME);
|
||||
Str_Copy (DegTyp->DegTypName,NewNameDegTyp,
|
||||
Deg_MAX_LENGTH_DEGREE_TYPE_NAME);
|
||||
DT_ReqEditDegreeTypes ();
|
||||
}
|
||||
|
||||
|
|
|
@ -351,13 +351,16 @@ void Dpt_GetListDepartments (long InsCod)
|
|||
Lay_ShowErrorAndExit ("Wrong code of institution.");
|
||||
|
||||
/* Get the short name of the department (row[2]) */
|
||||
Str_Copy (Dpt->ShrtName,row[2],MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
Str_Copy (Dpt->ShrtName,row[2],
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the department (row[3]) */
|
||||
Str_Copy (Dpt->FullName,row[3],MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
Str_Copy (Dpt->FullName,row[3],
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
|
||||
/* Get the URL of the department (row[4]) */
|
||||
Str_Copy (Dpt->WWW,row[4],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Dpt->WWW,row[4],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get number of teachers in this department (row[5]) */
|
||||
if (sscanf (row[5],"%u",&Dpt->NumTchs) != 1)
|
||||
|
@ -392,9 +395,9 @@ void Dpt_GetDataOfDepartmentByCod (struct Department *Dpt)
|
|||
if (Dpt->DptCod == 0)
|
||||
{
|
||||
Str_Copy (Dpt->ShrtName,Txt_Another_department,
|
||||
MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
Str_Copy (Dpt->FullName,Txt_Another_department,
|
||||
MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
}
|
||||
else if (Dpt->DptCod > 0)
|
||||
{
|
||||
|
@ -426,13 +429,16 @@ void Dpt_GetDataOfDepartmentByCod (struct Department *Dpt)
|
|||
Dpt->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get the short name of the department (row[1]) */
|
||||
Str_Copy (Dpt->ShrtName,row[1],MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
Str_Copy (Dpt->ShrtName,row[1],
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the department (row[2]) */
|
||||
Str_Copy (Dpt->FullName,row[2],MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
Str_Copy (Dpt->FullName,row[2],
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
|
||||
/* Get the URL of the department (row[3]) */
|
||||
Str_Copy (Dpt->WWW,row[3],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Dpt->WWW,row[3],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get number of teachers in this department (row[4]) */
|
||||
if (sscanf (row[4],"%u",&Dpt->NumTchs) != 1)
|
||||
|
@ -556,7 +562,7 @@ static void Dpt_ListDepartmentsForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_SHORT_NAME\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
MAX_LENGTH_DEPARTMENT_SHRT_NAME,Dpt->ShrtName,Gbl.Form.Id);
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME,Dpt->ShrtName,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -568,7 +574,7 @@ static void Dpt_ListDepartmentsForEdition (void)
|
|||
" maxlength=\"%u\" value=\"%s\""
|
||||
" class=\"INPUT_FULL_NAME\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
MAX_LENGTH_DEPARTMENT_FULL_NAME,Dpt->FullName,Gbl.Form.Id);
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME,Dpt->FullName,Gbl.Form.Id);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -720,7 +726,7 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
const char *FieldName = NULL; // Initialized to avoid warning
|
||||
size_t MaxLength = 0; // Initialized to avoid warning
|
||||
char *CurrentDptName = NULL; // Initialized to avoid warning
|
||||
char NewDptName[MAX_LENGTH_DEPARTMENT_FULL_NAME + 1];
|
||||
char NewDptName[Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME + 1];
|
||||
|
||||
Dpt = &Gbl.Dpts.EditingDpt;
|
||||
switch (ShrtOrFullName)
|
||||
|
@ -728,13 +734,13 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
case Cns_SHRT_NAME:
|
||||
ParamName = "ShortName";
|
||||
FieldName = "ShortName";
|
||||
MaxLength = MAX_LENGTH_DEPARTMENT_SHRT_NAME;
|
||||
MaxLength = Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME;
|
||||
CurrentDptName = Dpt->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParamName = "FullName";
|
||||
FieldName = "FullName";
|
||||
MaxLength = MAX_LENGTH_DEPARTMENT_FULL_NAME;
|
||||
MaxLength = Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME;
|
||||
CurrentDptName = Dpt->FullName;
|
||||
break;
|
||||
}
|
||||
|
@ -791,7 +797,8 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (CurrentDptName,NewDptName,MaxLength);
|
||||
Str_Copy (CurrentDptName,NewDptName,
|
||||
MaxLength);
|
||||
Dpt_EditDepartments ();
|
||||
}
|
||||
|
||||
|
@ -852,7 +859,8 @@ void Dpt_ChangeDptWWW (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Dpt->WWW,NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Dpt->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Dpt_EditDepartments ();
|
||||
}
|
||||
|
||||
|
@ -928,7 +936,7 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
" class=\"INPUT_SHORT_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
MAX_LENGTH_DEPARTMENT_SHRT_NAME,Dpt->ShrtName);
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME,Dpt->ShrtName);
|
||||
|
||||
/***** Department full name *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -937,7 +945,7 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
" class=\"INPUT_FULL_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
MAX_LENGTH_DEPARTMENT_FULL_NAME,Dpt->FullName);
|
||||
Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME,Dpt->FullName);
|
||||
|
||||
/***** Department WWW *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -1017,10 +1025,10 @@ void Dpt_RecFormNewDpt (void)
|
|||
Dpt->InsCod = Ins_GetAndCheckParamOtherInsCod ();
|
||||
|
||||
/* Get department short name */
|
||||
Par_GetParToText ("ShortName",Dpt->ShrtName,MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
Par_GetParToText ("ShortName",Dpt->ShrtName,Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME);
|
||||
|
||||
/* Get department full name */
|
||||
Par_GetParToText ("FullName",Dpt->FullName,MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
Par_GetParToText ("FullName",Dpt->FullName,Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME);
|
||||
|
||||
/* Get department WWW */
|
||||
Par_GetParToText ("WWW",Dpt->WWW,Cns_MAX_LENGTH_WWW);
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define MAX_LENGTH_DEPARTMENT_SHRT_NAME 32
|
||||
#define MAX_LENGTH_DEPARTMENT_FULL_NAME (256 - 1)
|
||||
#define Dpt_MAX_LENGTH_DEPARTMENT_SHRT_NAME 32
|
||||
#define Dpt_MAX_LENGTH_DEPARTMENT_FULL_NAME (256 - 1)
|
||||
|
||||
struct Department
|
||||
{
|
||||
long DptCod;
|
||||
long InsCod;
|
||||
char ShrtName[MAX_LENGTH_DEPARTMENT_SHRT_NAME + 1];
|
||||
char FullName[MAX_LENGTH_DEPARTMENT_FULL_NAME + 1];
|
||||
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];
|
||||
unsigned NumTchs;
|
||||
};
|
||||
|
|
24
swad_exam.c
24
swad_exam.c
|
@ -946,7 +946,8 @@ static void Exa_GetDataExamAnnouncementFromDB (void)
|
|||
Lay_ShowErrorAndExit ("Wrong year.");
|
||||
|
||||
/* Exam session (row[4]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Session,row[4],Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Session,row[4],
|
||||
Cns_MAX_BYTES_STRING);
|
||||
|
||||
/* Date of exam announcement (row[5]) */
|
||||
if (sscanf (row[5],"%04u-%02u-%02u %02u:%02u:%02u",
|
||||
|
@ -967,25 +968,32 @@ static void Exa_GetDataExamAnnouncementFromDB (void)
|
|||
Lay_ShowErrorAndExit ("Wrong duration of exam.");
|
||||
|
||||
/* Place (row[8]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Place,row[8],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Place,row[8],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Exam mode (row[9]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Mode,row[9],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Mode,row[9],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Structure (row[10]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Structure,row[10],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.Structure,row[10],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Documentation required (row[11]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.DocRequired,row[11],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.DocRequired,row[11],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Material required (row[12]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.MatRequired,row[12],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.MatRequired,row[12],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Material allowed (row[13]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.MatAllowed,row[13],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.MatAllowed,row[13],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Other information for students (row[14]) */
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.OtherInfo,row[14],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Gbl.ExamAnns.ExaDat.OtherInfo,row[14],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
|
|
@ -326,7 +326,9 @@ void Fil_CreateUpdateFile (const char CurrentName[PATH_MAX + 1],
|
|||
{
|
||||
size_t LengthFileRoot = Str_GetLengthRootFileName (CurrentName);
|
||||
|
||||
Str_Copy (NewName,CurrentName,LengthFileRoot);
|
||||
Str_Copy (NewName,CurrentName,
|
||||
PATH_MAX);
|
||||
NewName[LengthFileRoot] = '\0';
|
||||
sprintf (OldName,"%s%s",NewName,ExtensionOldName);
|
||||
Str_Concat (NewName,".new",PATH_MAX);
|
||||
|
||||
|
|
|
@ -1523,7 +1523,9 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic,
|
|||
static void Brw_GetFileNameToShow (Brw_FileBrowser_t FileBrowser,unsigned Level,
|
||||
Brw_FileType_t FileType,
|
||||
const char *FileName,char *FileNameToShow);
|
||||
static void Brw_LimitLengthFileNameToShow (Brw_FileType_t FileType,const char *FileName,char *FileNameToShow);
|
||||
static void Brw_LimitLengthFileNameToShow (Brw_FileType_t FileType,
|
||||
const char FileName[NAME_MAX + 1],
|
||||
char FileNameToShow[NAME_MAX + 1]);
|
||||
static void Brw_WriteDatesAssignment (void);
|
||||
static void Brw_WriteFileSizeAndDate (struct FileMetadata *FileMetadata);
|
||||
static void Brw_WriteFileOrFolderPublisher (unsigned Level,unsigned long UsrCod);
|
||||
|
@ -2606,7 +2608,8 @@ static void Brw_SetPathFileBrowser (void)
|
|||
case Brw_SHOW_MARKS_CRS:
|
||||
case Brw_ADMI_MARKS_CRS:
|
||||
Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.CurrentCrs.PathPriv,PATH_MAX);
|
||||
Gbl.CurrentCrs.PathPriv,
|
||||
PATH_MAX);
|
||||
break;
|
||||
case Brw_SHOW_DOCUM_GRP:
|
||||
case Brw_ADMI_DOCUM_GRP:
|
||||
|
@ -2657,7 +2660,8 @@ static void Brw_SetPathFileBrowser (void)
|
|||
break;
|
||||
case Brw_ADMI_BRIEF_USR:
|
||||
Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder,
|
||||
Gbl.Usrs.Me.PathDir,PATH_MAX);
|
||||
Gbl.Usrs.Me.PathDir,
|
||||
PATH_MAX);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -4798,7 +4802,8 @@ void Brw_CreateDirDownloadTmp (void)
|
|||
if (NumDir)
|
||||
sprintf (Gbl.FileBrowser.TmpPubDir,"%s_%u",Gbl.UniqueNameEncrypted,NumDir);
|
||||
else
|
||||
Str_Copy (Gbl.FileBrowser.TmpPubDir,Gbl.UniqueNameEncrypted,NAME_MAX);
|
||||
Str_Copy (Gbl.FileBrowser.TmpPubDir,Gbl.UniqueNameEncrypted,
|
||||
NAME_MAX);
|
||||
sprintf (PathPubDirTmp,"%s/%s",PathFileBrowserTmpPubl,Gbl.FileBrowser.TmpPubDir);
|
||||
if (mkdir (PathPubDirTmp,(mode_t) 0xFFF))
|
||||
Lay_ShowErrorAndExit ("Can not create a temporary folder for download.");
|
||||
|
@ -5207,7 +5212,8 @@ 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);
|
||||
Str_Copy (Gbl.FileBrowser.Asg.Folder,FileName,
|
||||
Asg_MAX_LENGTH_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),
|
||||
|
@ -5343,8 +5349,8 @@ void Brw_SetFullPathInTree (const char *PathInTreeUntilFileOrFolder,const char *
|
|||
sprintf (Gbl.FileBrowser.Priv.FullPathInTree,"%s/%s",
|
||||
PathInTreeUntilFileOrFolder,FilFolLnkName);
|
||||
else // It's the root folder
|
||||
Str_Copy (Gbl.FileBrowser.Priv.FullPathInTree,
|
||||
PathInTreeUntilFileOrFolder,PATH_MAX);
|
||||
Str_Copy (Gbl.FileBrowser.Priv.FullPathInTree,PathInTreeUntilFileOrFolder,
|
||||
PATH_MAX);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -5985,19 +5991,24 @@ static void Brw_GetFileNameToShow (Brw_FileBrowser_t FileBrowser,unsigned Level,
|
|||
/*****************************************************************************/
|
||||
/*************** Limit the length of the filename to be shown ****************/
|
||||
/*****************************************************************************/
|
||||
// FileNameToShow must have at least NAME_MAX+1 bytes
|
||||
|
||||
static void Brw_LimitLengthFileNameToShow (Brw_FileType_t FileType,const char *FileName,char *FileNameToShow)
|
||||
static void Brw_LimitLengthFileNameToShow (Brw_FileType_t FileType,
|
||||
const char FileName[NAME_MAX + 1],
|
||||
char FileNameToShow[NAME_MAX + 1])
|
||||
{
|
||||
size_t NumCharsToCopy;
|
||||
size_t NumChars;
|
||||
|
||||
/***** Limit length of the name of the file *****/
|
||||
NumCharsToCopy = strlen (FileName);
|
||||
/***** Copy file name *****/
|
||||
Str_Copy (FileNameToShow,FileName,
|
||||
NAME_MAX);
|
||||
|
||||
/***** Remove .url if link *****/
|
||||
NumChars = strlen (FileNameToShow);
|
||||
if (FileType == Brw_IS_LINK) // It's a link (URL inside a .url file)
|
||||
NumCharsToCopy -= 4; // Remove .url
|
||||
if (NumCharsToCopy > NAME_MAX)
|
||||
NumCharsToCopy = NAME_MAX;
|
||||
Str_Copy (FileNameToShow,FileName,NumCharsToCopy);
|
||||
NumChars -= 4; // Remove .url
|
||||
FileNameToShow[NumChars] = '\0';
|
||||
|
||||
/***** Limit length of the file name to show *****/
|
||||
Str_LimitLengthHTMLStr (FileNameToShow,60);
|
||||
}
|
||||
|
||||
|
@ -6707,7 +6718,8 @@ static bool Brw_GetMyClipboard (void)
|
|||
Gbl.FileBrowser.Clipboard.FileType = (Brw_FileType_t) UnsignedNum;
|
||||
|
||||
/* Get file path (row[4]) */
|
||||
Str_Copy (Gbl.FileBrowser.Clipboard.Path,row[4],PATH_MAX);
|
||||
Str_Copy (Gbl.FileBrowser.Clipboard.Path,row[4],
|
||||
PATH_MAX);
|
||||
Str_SplitFullPathIntoPathAndFileName (Gbl.FileBrowser.Clipboard.Path,
|
||||
PathUntilFileName,
|
||||
Gbl.FileBrowser.Clipboard.FileName);
|
||||
|
@ -6902,7 +6914,8 @@ static void Brw_InsFoldersInPathAndUpdOtherFoldersInExpandedFolders (const char
|
|||
// if (strcmp (Path,Brw_RootFolderInternalNames[Gbl.FileBrowser.Type])) // Don't insert root folder
|
||||
|
||||
/***** Make a copy to keep Path unchanged *****/
|
||||
Str_Copy (CopyOfPath,Path,PATH_MAX);
|
||||
Str_Copy (CopyOfPath,Path,
|
||||
PATH_MAX);
|
||||
|
||||
/***** Insert paths in table of expanded folders if they are not yet there *****/
|
||||
do
|
||||
|
@ -7670,7 +7683,8 @@ static bool Brw_PasteTreeIntoFolder (unsigned LevelOrg,
|
|||
if (LevelOrg == 0) // Origin of copy is the root folder,
|
||||
// for example "sha"
|
||||
// ==> do not copy the root folder itself into destination
|
||||
Str_Copy (PathDstInTreeWithFile,PathDstInTree,PATH_MAX);
|
||||
Str_Copy (PathDstInTreeWithFile,PathDstInTree,
|
||||
PATH_MAX);
|
||||
else // Origin of copy is a file or folder inside the root folder
|
||||
// for example "sha/folder1/file1"
|
||||
sprintf (PathDstInTreeWithFile,"%s/%s",PathDstInTree,FileNameOrg);
|
||||
|
@ -8551,12 +8565,10 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
}
|
||||
}
|
||||
else // Empty filename
|
||||
Str_Copy (Gbl.Message,Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_UPLOAD_FILE_You_must_specify_the_file_NO_HTML);
|
||||
}
|
||||
else // I do not have permission to create files here
|
||||
Str_Copy (Gbl.Message,Txt_UPLOAD_FILE_Forbidden_NO_HTML,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_UPLOAD_FILE_Forbidden_NO_HTML);
|
||||
|
||||
return UploadSucessful;
|
||||
}
|
||||
|
@ -8602,7 +8614,8 @@ void Brw_RecLinkFileBrowser (void)
|
|||
Name given by me: intel-architectures.pdf
|
||||
File in swad: intel-architectures.pdf.url
|
||||
*/
|
||||
Str_Copy (URLWithoutEndingSlash,Gbl.FileBrowser.NewFilFolLnkName,PATH_MAX);
|
||||
Str_Copy (URLWithoutEndingSlash,Gbl.FileBrowser.NewFilFolLnkName,
|
||||
PATH_MAX);
|
||||
else
|
||||
/*
|
||||
Gbl.FileBrowser.NewFilFolLnkName is empty
|
||||
|
@ -8611,7 +8624,8 @@ void Brw_RecLinkFileBrowser (void)
|
|||
URL: http://www.intel.es/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-manual-325462.pdf
|
||||
File in swad: 64-ia-32-architectures-software-developer-manual-325462.pdf.url
|
||||
*/
|
||||
Str_Copy (URLWithoutEndingSlash,URL,PATH_MAX);
|
||||
Str_Copy (URLWithoutEndingSlash,URL,
|
||||
PATH_MAX);
|
||||
|
||||
/* Remove possible final '/' from URL */
|
||||
if (URLWithoutEndingSlash[LengthURL - 1] == '/')
|
||||
|
@ -9968,7 +9982,8 @@ void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata)
|
|||
FileMetadata->FileType = (Brw_FileType_t) UnsignedNum;
|
||||
|
||||
/* Get path (row[6]) */
|
||||
Str_Copy (FileMetadata->FullPathInTree,row[6],PATH_MAX);
|
||||
Str_Copy (FileMetadata->FullPathInTree,row[6],
|
||||
PATH_MAX);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata->FullPathInTree,
|
||||
FileMetadata->PathInTreeUntilFilFolLnk,
|
||||
FileMetadata->FilFolLnkName);
|
||||
|
@ -10097,7 +10112,8 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
FileMetadata->FileType = (Brw_FileType_t) UnsignedNum;
|
||||
|
||||
/* Get path (row[6]) */
|
||||
Str_Copy (FileMetadata->FullPathInTree,row[6],PATH_MAX);
|
||||
Str_Copy (FileMetadata->FullPathInTree,row[6],
|
||||
PATH_MAX);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata->FullPathInTree,
|
||||
FileMetadata->PathInTreeUntilFilFolLnk,
|
||||
FileMetadata->FilFolLnkName);
|
||||
|
@ -11158,7 +11174,8 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],cha
|
|||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
|
||||
/***** Copy file name into summary string *****/
|
||||
Str_Copy (SummaryStr,FileMetadata.FilFolLnkName,Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,FileMetadata.FilFolLnkName,
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
|
|
73
swad_forum.c
73
swad_forum.c
|
@ -265,7 +265,7 @@ static unsigned For_NumPstsInThrWithPstCod (long PstCod,long *ThrCod);
|
|||
static long For_InsertForumThread (For_ForumType_t ForumType,long FirstPstCod);
|
||||
static void For_RemoveThreadOnly (long ThrCod);
|
||||
static void For_RemoveThreadAndItsPsts (long ThrCod);
|
||||
static void For_GetThrSubject (long ThrCod,char *Subject,size_t MaxSize);
|
||||
static void For_GetThrSubject (long ThrCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1]);
|
||||
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod);
|
||||
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod);
|
||||
static long For_GetLastPstCod (long ThrCod);
|
||||
|
@ -276,16 +276,18 @@ static unsigned For_GetNumOfWritersInThr (long ThrCod);
|
|||
static unsigned For_GetNumPstsInThr (long ThrCod);
|
||||
static unsigned For_GetNumMyPstInThr (long ThrCod);
|
||||
static time_t For_GetThrReadTime (long ThrCod);
|
||||
static void For_ShowThreadPosts (long ThrCod,char *LastSubject);
|
||||
static void For_ShowThreadPosts (long ThrCod,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1]);
|
||||
|
||||
static void For_PutIconsForums (void);
|
||||
|
||||
static void For_WriteNumPsts (unsigned NumPsts);
|
||||
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,
|
||||
bool LastPst,char *LastSubject,
|
||||
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||
bool NewPst,bool ICanModerateForum);
|
||||
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||
char *Subject,char *Content,struct Image *Image);
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||
struct Image *Image);
|
||||
static void For_WriteNumberOfPosts (For_ForumType_t ForumType,long UsrCod);
|
||||
|
||||
static void For_PutParamWhichForum (void);
|
||||
|
@ -661,7 +663,7 @@ static void For_RemoveThreadAndItsPsts (long ThrCod)
|
|||
/********************* Get the thread subject from a thread ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_GetThrSubject (long ThrCod,char *Subject,size_t MaxSize)
|
||||
static void For_GetThrSubject (long ThrCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1])
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -676,7 +678,8 @@ static void For_GetThrSubject (long ThrCod,char *Subject,size_t MaxSize)
|
|||
|
||||
/***** Write the subject of the thread *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Subject,row[0],MaxSize);
|
||||
Str_Copy (Subject,row[0],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
Str_LimitLengthHTMLStr (Subject,20);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -942,7 +945,7 @@ void For_RemoveUsrFromReadThrs (long UsrCod)
|
|||
/****************************** Show forum posts *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
||||
static void For_ShowThreadPosts (long ThrCod,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1])
|
||||
{
|
||||
extern const char *Hlp_SOCIAL_Forums;
|
||||
extern const char *Txt_Thread;
|
||||
|
@ -954,7 +957,8 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
|||
char Query[1024];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRow,NumRows;
|
||||
unsigned long NumRow;
|
||||
unsigned long NumRows;
|
||||
unsigned NumPst = 0; // Initialized to avoid warning
|
||||
unsigned NumPsts;
|
||||
time_t ReadTimeUTC; // Read time of thread for the current user
|
||||
|
@ -1158,7 +1162,7 @@ static void For_WriteNumPsts (unsigned NumPsts)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,
|
||||
bool LastPst,char *LastSubject,
|
||||
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||
bool NewPst,bool ICanModerateForum)
|
||||
{
|
||||
extern const char *Txt_unread_MESSAGE;
|
||||
|
@ -1193,7 +1197,8 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
|
||||
if (Enabled)
|
||||
/* Return this subject as last subject */
|
||||
Str_Copy (LastSubject,Subject,Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (LastSubject,Subject,
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
|
||||
/***** Put an icon with post status *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -1319,7 +1324,8 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
"<td class=\"MSG_TXT LEFT_TOP\">");
|
||||
if (Enabled)
|
||||
{
|
||||
Str_Copy (Content,OriginalContent,Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,OriginalContent,
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
Msg_WriteMsgContent (Content,Cns_MAX_BYTES_LONG_TEXT,true,false);
|
||||
|
||||
/***** Show image *****/
|
||||
|
@ -1342,7 +1348,9 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
/*****************************************************************************/
|
||||
|
||||
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||
char *Subject, char *Content,struct Image *Image)
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||
struct Image *Image)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -1370,10 +1378,12 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
|||
*CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
|
||||
|
||||
/****** Get subject (row[2]) *****/
|
||||
Str_Copy (Subject,row[2],Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (Subject,row[2],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
|
||||
/****** Get location (row[3]) *****/
|
||||
Str_Copy (Content,row[3],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,row[3],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
|
||||
/****** Get image name (row[4]), title (row[5]) and URL (row[6]) *****/
|
||||
Img_GetImageNameTitleAndURLFromRow (row[4],row[5],row[6],Image);
|
||||
|
@ -1412,7 +1422,8 @@ void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Copy subject *****/
|
||||
Str_Copy (SummaryStr,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
|
@ -1424,7 +1435,11 @@ void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||
|
||||
Str_Copy (*ContentStr,row[1],Length);
|
||||
if (Length)
|
||||
Str_Copy (*ContentStr,row[1],
|
||||
Length);
|
||||
else
|
||||
**ContentStr = '\0';
|
||||
}
|
||||
}
|
||||
mysql_free_result (mysql_res);
|
||||
|
@ -2191,7 +2206,8 @@ void For_SetForumName (For_ForumType_t ForumType,
|
|||
switch (ForumType)
|
||||
{
|
||||
case For_FORUM_COURSE_USRS:
|
||||
Str_Copy (ForumName,Crs->ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||
Str_Copy (ForumName,Crs->ShrtName,
|
||||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM_COURSE_TCHS:
|
||||
sprintf (ForumName,"%s%s",Crs->ShrtName,
|
||||
|
@ -2199,7 +2215,8 @@ void For_SetForumName (For_ForumType_t ForumType,
|
|||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_DEGREE_USRS:
|
||||
Str_Copy (ForumName,Deg->ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||
Str_Copy (ForumName,Deg->ShrtName,
|
||||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM_DEGREE_TCHS:
|
||||
sprintf (ForumName,"%s%s",Deg->ShrtName,
|
||||
|
@ -2207,7 +2224,8 @@ void For_SetForumName (For_ForumType_t ForumType,
|
|||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_CENTRE_USRS:
|
||||
Str_Copy (ForumName,Ctr->ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||
Str_Copy (ForumName,Ctr->ShrtName,
|
||||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM_CENTRE_TCHS:
|
||||
sprintf (ForumName,"%s%s",Ctr->ShrtName,
|
||||
|
@ -2215,7 +2233,8 @@ void For_SetForumName (For_ForumType_t ForumType,
|
|||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_INSTIT_USRS:
|
||||
Str_Copy (ForumName,Ins->ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||
Str_Copy (ForumName,Ins->ShrtName,
|
||||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM_INSTIT_TCHS:
|
||||
sprintf (ForumName,"%s%s",Ins->ShrtName,
|
||||
|
@ -2235,7 +2254,8 @@ void For_SetForumName (For_ForumType_t ForumType,
|
|||
Txt_only_teachers_NO_HTML[Language]);
|
||||
break;
|
||||
case For_FORUM_SWAD_USRS:
|
||||
Str_Copy (ForumName,Cfg_PLATFORM_SHORT_NAME,For_MAX_BYTES_FORUM_NAME);
|
||||
Str_Copy (ForumName,Cfg_PLATFORM_SHORT_NAME,
|
||||
For_MAX_BYTES_FORUM_NAME);
|
||||
break;
|
||||
case For_FORUM_SWAD_TCHS:
|
||||
sprintf (ForumName,"%s%s",Cfg_PLATFORM_SHORT_NAME,
|
||||
|
@ -3597,7 +3617,8 @@ void For_GetThrData (struct ForumThread *Thr)
|
|||
Thr->WriteTime[For_LAST_MSG ] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||
|
||||
/***** Get the subject of this thread (row[6]) *****/
|
||||
Str_Copy (Thr->Subject,row[6],Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (Thr->Subject,row[6],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
if (!Thr->Subject[0])
|
||||
sprintf (Thr->Subject,"[%s]",Txt_no_subject);
|
||||
|
||||
|
@ -4139,7 +4160,7 @@ void For_ReqDelThr (void)
|
|||
ThrCod = For_GetParamThrCod ();
|
||||
|
||||
/***** Get subject of thread to delete *****/
|
||||
For_GetThrSubject (ThrCod,Subject,Cns_MAX_BYTES_SUBJECT);
|
||||
For_GetThrSubject (ThrCod,Subject);
|
||||
|
||||
/***** Request confirmation to remove the thread *****/
|
||||
if (Subject[0])
|
||||
|
@ -4179,7 +4200,7 @@ void For_DelThr (void)
|
|||
ThrCod = For_GetParamThrCod ();
|
||||
|
||||
/***** Get subject of thread to delete *****/
|
||||
For_GetThrSubject (ThrCod,Subject,Cns_MAX_BYTES_SUBJECT);
|
||||
For_GetThrSubject (ThrCod,Subject);
|
||||
|
||||
/***** Remove the thread and all its posts *****/
|
||||
For_RemoveThreadAndItsPsts (ThrCod);
|
||||
|
@ -4222,7 +4243,7 @@ void For_CutThr (void)
|
|||
ThrCod = For_GetParamThrCod ();
|
||||
|
||||
/***** Get subject of thread to cut *****/
|
||||
For_GetThrSubject (ThrCod,Subject,Cns_MAX_BYTES_SUBJECT);
|
||||
For_GetThrSubject (ThrCod,Subject);
|
||||
|
||||
/***** Mark the thread as cut *****/
|
||||
For_InsertThrInClipboard (ThrCod);
|
||||
|
@ -4262,7 +4283,7 @@ void For_PasteThr (void)
|
|||
ThrCod = For_GetParamThrCod ();
|
||||
|
||||
/***** Get subject of thread to paste *****/
|
||||
For_GetThrSubject (ThrCod,Subject,Cns_MAX_BYTES_SUBJECT);
|
||||
For_GetThrSubject (ThrCod,Subject);
|
||||
|
||||
/***** Paste (move) the thread to current forum *****/
|
||||
if (For_CheckIfThrBelongsToForum (ThrCod,Gbl.Forum.ForumType))
|
||||
|
|
15
swad_group.c
15
swad_group.c
|
@ -2498,7 +2498,8 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
Lay_ShowErrorAndExit ("Wrong code of group.");
|
||||
|
||||
/* Get group name (row[1]) */
|
||||
Str_Copy (Grp->GrpName,row[1],Grp_MAX_LENGTH_GROUP_NAME);
|
||||
Str_Copy (Grp->GrpName,row[1],
|
||||
Grp_MAX_LENGTH_GROUP_NAME);
|
||||
|
||||
/* Get max number of students of group (row[2]) and number of current students */
|
||||
Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[2]);
|
||||
|
@ -2626,7 +2627,8 @@ static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp)
|
|||
|
||||
/***** Get some data of group type *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (GrpTyp->GrpTypName,row[0],Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
Str_Copy (GrpTyp->GrpTypName,row[0],
|
||||
Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
GrpTyp->MandatoryEnrollment = (row[1][0] == 'Y');
|
||||
GrpTyp->MultipleEnrollment = (row[2][0] == 'Y');
|
||||
GrpTyp->MustBeOpened = (row[3][0] == 'Y');
|
||||
|
@ -2712,13 +2714,15 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
|
|||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
||||
|
||||
/* Get the name of the group type (row[2]) */
|
||||
Str_Copy (GrpDat->GrpTypName,row[2],Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
Str_Copy (GrpDat->GrpTypName,row[2],
|
||||
Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
|
||||
/* Get whether a student may be in one or multiple groups (row[3]) */
|
||||
GrpDat->MultipleEnrollment = (row[3][0] == 'Y');
|
||||
|
||||
/* Get the name of the group (row[4]) */
|
||||
Str_Copy (GrpDat->GrpName,row[4],Grp_MAX_LENGTH_GROUP_NAME);
|
||||
Str_Copy (GrpDat->GrpName,row[4],
|
||||
Grp_MAX_LENGTH_GROUP_NAME);
|
||||
|
||||
/* Get maximum number of students (row[5]) */
|
||||
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[5]);
|
||||
|
@ -4089,7 +4093,8 @@ void Grp_RenameGroup (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Gbl.CurrentCrs.Grps.GrpName,NewNameGrp,Grp_MAX_LENGTH_GROUP_NAME);
|
||||
Str_Copy (Gbl.CurrentCrs.Grps.GrpName,NewNameGrp,
|
||||
Grp_MAX_LENGTH_GROUP_NAME);
|
||||
Grp_ReqEditGroups ();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Hie_MAX_LENGTH_LOCATION_SHORT_NAME 32
|
||||
#define Hie_MAX_LENGTH_LOCATION_SHORT_NAME_SPEC_CHAR (Hie_MAX_LENGTH_LOCATION_SHORT_NAME * Str_MAX_LENGTH_SPEC_CHAR_HTML)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -312,7 +312,8 @@ void Hld_GetListHolidays (void)
|
|||
Hld->PlcCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get the full name of the place (row[2]) */
|
||||
Str_Copy (Hld->PlaceFullName,row[2],Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Str_Copy (Hld->PlaceFullName,row[2],
|
||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
|
||||
/* Get type (row[3]) */
|
||||
Hld->HldTyp = Hld_GetTypeOfHoliday (row[3]);
|
||||
|
@ -336,7 +337,8 @@ void Hld_GetListHolidays (void)
|
|||
}
|
||||
|
||||
/* Get the name of the holiday/non school period (row[6]) */
|
||||
Str_Copy (Hld->Name,row[6],Hld_MAX_LENGTH_HOLIDAY_NAME);
|
||||
Str_Copy (Hld->Name,row[6],
|
||||
Hld_MAX_LENGTH_HOLIDAY_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,7 +404,8 @@ static void Hld_GetDataOfHolidayByCod (struct Holiday *Hld)
|
|||
Hld->PlcCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get the full name of the place (row[1]) */
|
||||
Str_Copy (Hld->PlaceFullName,row[1],Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Str_Copy (Hld->PlaceFullName,row[1],
|
||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
|
||||
/* Get type (row[2]) */
|
||||
Hld->HldTyp = Hld_GetTypeOfHoliday (row[2]);
|
||||
|
@ -426,7 +429,8 @@ static void Hld_GetDataOfHolidayByCod (struct Holiday *Hld)
|
|||
}
|
||||
|
||||
/* Get the name of the holiday/non school period (row[5]) */
|
||||
Str_Copy (Hld->Name,row[5],Hld_MAX_LENGTH_HOLIDAY_NAME);
|
||||
Str_Copy (Hld->Name,row[5],
|
||||
Hld_MAX_LENGTH_HOLIDAY_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -694,7 +698,8 @@ void Hld_ChangeHolidayPlace (void)
|
|||
|
||||
/***** Show the form again *****/
|
||||
Hld->PlcCod = NewPlace.PlcCod;
|
||||
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Str_Copy (Hld->PlaceFullName,NewPlace.FullName,
|
||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Hld_EditHolidays ();
|
||||
}
|
||||
|
||||
|
@ -889,7 +894,8 @@ void Hld_RenameHoliday (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Hld->Name,NewHldName,Hld_MAX_LENGTH_HOLIDAY_NAME);
|
||||
Str_Copy (Hld->Name,NewHldName,
|
||||
Hld_MAX_LENGTH_HOLIDAY_NAME);
|
||||
Hld_EditHolidays ();
|
||||
}
|
||||
|
||||
|
|
27
swad_image.c
27
swad_image.c
|
@ -143,7 +143,8 @@ void Img_GetImageNameTitleAndURLFromRow (const char *Name,
|
|||
size_t Length;
|
||||
|
||||
/***** Copy image name to struct *****/
|
||||
Str_Copy (Image->Name,Name,Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Str_Copy (Image->Name,Name,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/***** Set status of image file *****/
|
||||
Image->Status = Image->Name[0] ? Img_NAME_STORED_IN_DB :
|
||||
|
@ -163,7 +164,8 @@ void Img_GetImageNameTitleAndURLFromRow (const char *Name,
|
|||
|
||||
if ((Image->Title = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for image title.");
|
||||
Str_Copy (Image->Title,Title,Length);
|
||||
Str_Copy (Image->Title,Title,
|
||||
Length);
|
||||
}
|
||||
|
||||
/***** Copy image URL to struct *****/
|
||||
|
@ -179,7 +181,8 @@ void Img_GetImageNameTitleAndURLFromRow (const char *Name,
|
|||
|
||||
if ((Image->URL = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for image URL.");
|
||||
Str_Copy (Image->URL,URL,Length);
|
||||
Str_Copy (Image->URL,URL,
|
||||
Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +320,8 @@ void Img_GetImageFromForm (int NumImgInForm,struct Image *Image,
|
|||
Img_FreeImageTitle (Image);
|
||||
if ((Image->Title = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for image title.");
|
||||
Str_Copy (Image->Title,Title,Length);
|
||||
Str_Copy (Image->Title,Title,
|
||||
Length);
|
||||
}
|
||||
|
||||
/***** By last, get image URL from form *****/
|
||||
|
@ -331,7 +335,8 @@ void Img_GetImageFromForm (int NumImgInForm,struct Image *Image,
|
|||
Img_FreeImageURL (Image);
|
||||
if ((Image->URL = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for image URL.");
|
||||
Str_Copy (Image->URL,URL,Length);
|
||||
Str_Copy (Image->URL,URL,
|
||||
Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,10 +350,14 @@ void Img_SetParamNames (struct ParamUploadImg *ParamUploadImg,int NumImgInForm)
|
|||
{
|
||||
if (NumImgInForm < 0) // One unique image in form ==> no suffix needed
|
||||
{
|
||||
Str_Copy (ParamUploadImg->Action,"ImgAct",Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->File ,"ImgFil",Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->Title ,"ImgTit",Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->URL ,"ImgURL",Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->Action,"ImgAct",
|
||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->File ,"ImgFil",
|
||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->Title ,"ImgTit",
|
||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
Str_Copy (ParamUploadImg->URL ,"ImgURL",
|
||||
Img_MAX_LENGTH_PARAM_UPLOAD_IMG);
|
||||
}
|
||||
else // Several images in form ==> add suffix
|
||||
{
|
||||
|
|
34
swad_info.c
34
swad_info.c
|
@ -320,8 +320,8 @@ static bool Inf_CheckIfInfoAvailable (Inf_InfoSrc_t InfoSrc);
|
|||
static Inf_InfoType_t Inf_AsignInfoType (void);
|
||||
static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD);
|
||||
static void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||
char *InfoTxtHTML,char *InfoTxtMD,
|
||||
size_t MaxLength);
|
||||
char InfoTxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||
char InfoTxtMD[Cns_MAX_BYTES_LONG_TEXT + 1]);
|
||||
|
||||
static bool Inf_CheckPlainTxt (long CrsCod,Inf_InfoType_t InfoType);
|
||||
static bool Inf_CheckAndShowPlainTxt (void);
|
||||
|
@ -1692,8 +1692,8 @@ static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||
char *InfoTxtHTML,char *InfoTxtMD,
|
||||
size_t MaxLength)
|
||||
char InfoTxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||
char InfoTxtMD[Cns_MAX_BYTES_LONG_TEXT + 1])
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -1715,11 +1715,13 @@ static void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
|||
|
||||
/* Get text in HTML format (not rigorous) */
|
||||
if (InfoTxtHTML)
|
||||
Str_Copy (InfoTxtHTML,row[0],MaxLength);
|
||||
Str_Copy (InfoTxtHTML,row[0],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
|
||||
/* Get text in Markdown format */
|
||||
if (InfoTxtMD)
|
||||
Str_Copy (InfoTxtMD,row[1],MaxLength);
|
||||
Str_Copy (InfoTxtMD,row[1],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1746,7 +1748,7 @@ static bool Inf_CheckPlainTxt (long CrsCod,Inf_InfoType_t InfoType)
|
|||
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1];
|
||||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (CrsCod,InfoType,TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||
Inf_GetInfoTxtFromDB (CrsCod,InfoType,TxtHTML,NULL);
|
||||
|
||||
return (TxtHTML[0] != '\0');
|
||||
}
|
||||
|
@ -1776,7 +1778,7 @@ static bool Inf_CheckAndShowPlainTxt (void)
|
|||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,
|
||||
TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||
TxtHTML,NULL);
|
||||
|
||||
if (TxtHTML[0])
|
||||
{
|
||||
|
@ -1822,7 +1824,7 @@ static bool Inf_CheckRichTxt (long CrsCod,Inf_InfoType_t InfoType)
|
|||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (CrsCod,InfoType,
|
||||
TxtHTML,TxtMD,Cns_MAX_BYTES_LONG_TEXT);
|
||||
TxtHTML,TxtMD);
|
||||
|
||||
return (TxtMD[0] != '\0');
|
||||
}
|
||||
|
@ -1860,7 +1862,7 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,
|
||||
TxtHTML,TxtMD,Cns_MAX_BYTES_LONG_TEXT);
|
||||
TxtHTML,TxtMD);
|
||||
|
||||
if (TxtMD[0])
|
||||
{
|
||||
|
@ -1961,7 +1963,7 @@ int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer)
|
|||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,
|
||||
TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||
TxtHTML,NULL);
|
||||
|
||||
if (TxtHTML[0])
|
||||
{
|
||||
|
@ -2062,7 +2064,7 @@ void Inf_EditPlainTxtInfo (void)
|
|||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,
|
||||
TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||
TxtHTML,NULL);
|
||||
|
||||
/***** Edition area *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
|
||||
|
@ -2113,7 +2115,7 @@ void Inf_EditRichTxtInfo (void)
|
|||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,
|
||||
TxtHTML,NULL,Cns_MAX_BYTES_LONG_TEXT);
|
||||
TxtHTML,NULL);
|
||||
|
||||
/***** Edition area *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
|
||||
|
@ -2144,7 +2146,8 @@ void Inf_RecAndChangePlainTxtInfo (void)
|
|||
/***** Get text with course information from form *****/
|
||||
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,
|
||||
Cns_MAX_BYTES_LONG_TEXT,NULL);
|
||||
Str_Copy (Txt_MarkdownFormat,Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Txt_MarkdownFormat,Txt_HTMLFormat,
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_HTML,
|
||||
Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store in HTML format (not rigorous)
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_MARKDOWN,
|
||||
|
@ -2179,7 +2182,8 @@ void Inf_RecAndChangeRichTxtInfo (void)
|
|||
/***** Get text with course information from form *****/
|
||||
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,
|
||||
Cns_MAX_BYTES_LONG_TEXT,NULL);
|
||||
Str_Copy (Txt_MarkdownFormat,Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Txt_MarkdownFormat,Txt_HTMLFormat,
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_HTML,
|
||||
Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store in HTML format (not rigorous)
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_MARKDOWN,
|
||||
|
|
|
@ -1028,13 +1028,16 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData)
|
|||
Ins->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
||||
/* Get the short name of the institution (row[4]) */
|
||||
Str_Copy (Ins->ShrtName,row[4],Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
||||
Str_Copy (Ins->ShrtName,row[4],
|
||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the institution (row[5]) */
|
||||
Str_Copy (Ins->FullName,row[5],Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
Str_Copy (Ins->FullName,row[5],
|
||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
|
||||
/* Get the URL of the institution (row[6]) */
|
||||
Str_Copy (Ins->WWW,row[6],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ins->WWW,row[6],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get extra data */
|
||||
switch (GetExtraData)
|
||||
|
@ -1122,13 +1125,16 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins,
|
|||
Ins->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
||||
/* Get the short name of the institution (row[3]) */
|
||||
Str_Copy (Ins->ShrtName,row[3],Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
||||
Str_Copy (Ins->ShrtName,row[3],
|
||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the institution (row[4]) */
|
||||
Str_Copy (Ins->FullName,row[4],Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
Str_Copy (Ins->FullName,row[4],
|
||||
Ins_MAX_LENGTH_INSTIT_FULL_NAME);
|
||||
|
||||
/* Get the URL of the institution (row[5]) */
|
||||
Str_Copy (Ins->WWW,row[5],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Ins->WWW,row[5],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get extra data */
|
||||
if (GetExtraData == Ins_GET_EXTRA_DATA)
|
||||
|
@ -1178,7 +1184,8 @@ void Ins_GetShortNameOfInstitutionByCod (struct Instit *Ins)
|
|||
/***** Get the short name of this institution *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
Str_Copy (Ins->ShrtName,row[0],Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
||||
Str_Copy (Ins->ShrtName,row[0],
|
||||
Ins_MAX_LENGTH_INSTIT_SHRT_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -1270,7 +1277,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
/************************* List all the institutions *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Ins_MAX_LENGTH_WWW_ON_SCREEN 10
|
||||
#define Ins_MAX_LENGTH_WWW_ON_SCREEN 15
|
||||
|
||||
static void Ins_ListInstitutionsForEdition (void)
|
||||
{
|
||||
|
@ -1279,7 +1286,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
extern const char *Txt_INSTITUTION_STATUS[Ins_NUM_STATUS_TXT];
|
||||
unsigned NumIns;
|
||||
struct Instit *Ins;
|
||||
char WWW[Ins_MAX_LENGTH_WWW_ON_SCREEN+1];
|
||||
char WWW[Cns_MAX_LENGTH_WWW + 1];
|
||||
struct UsrData UsrDat;
|
||||
bool ICanEdit;
|
||||
Ins_StatusTxt_t StatusTxt;
|
||||
|
@ -1387,12 +1394,14 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (WWW,Ins->WWW,Ins_MAX_LENGTH_WWW_ON_SCREEN);
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\" class=\"DAT\" title=\"%s\">%s",
|
||||
Str_Copy (WWW,Ins->WWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Str_LimitLengthHTMLStr (WWW,Ins_MAX_LENGTH_WWW_ON_SCREEN);
|
||||
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\""
|
||||
" class=\"DAT\" title=\"%s\">"
|
||||
"%s"
|
||||
"</a>",
|
||||
Ins->WWW,Ins->WWW,WWW);
|
||||
if (strlen (Ins->WWW) > Ins_MAX_LENGTH_WWW_ON_SCREEN)
|
||||
fprintf (Gbl.F.Out,"…");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
|
@ -1853,7 +1862,8 @@ 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);
|
||||
Str_Copy (Ins->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
@ -1884,7 +1894,8 @@ 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);
|
||||
Str_Copy (Gbl.CurrentIns.Ins.WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_The_new_web_address_is_X,NewWWW);
|
||||
|
|
24
swad_link.c
24
swad_link.c
|
@ -232,13 +232,16 @@ void Lnk_GetListLinks (void)
|
|||
Lay_ShowErrorAndExit ("Wrong code of institutional link.");
|
||||
|
||||
/* Get the short name of the link (row[1]) */
|
||||
Str_Copy (Lnk->ShrtName,row[1],Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
||||
Str_Copy (Lnk->ShrtName,row[1],
|
||||
Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the link (row[2]) */
|
||||
Str_Copy (Lnk->FullName,row[2],Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
||||
Str_Copy (Lnk->FullName,row[2],
|
||||
Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
||||
|
||||
/* Get the URL of the link (row[3]) */
|
||||
Str_Copy (Lnk->WWW,row[3],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Lnk->WWW,row[3],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -277,13 +280,16 @@ void Lnk_GetDataOfLinkByCod (struct Link *Lnk)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get the short name of the link (row[0]) */
|
||||
Str_Copy (Lnk->ShrtName,row[0],Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
||||
Str_Copy (Lnk->ShrtName,row[0],
|
||||
Lnk_MAX_LENGTH_LINK_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the link (row[1]) */
|
||||
Str_Copy (Lnk->FullName,row[1],Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
||||
Str_Copy (Lnk->FullName,row[1],
|
||||
Lnk_MAX_LENGTH_LINK_FULL_NAME);
|
||||
|
||||
/* Get the URL of the link (row[2]) */
|
||||
Str_Copy (Lnk->WWW,row[2],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Lnk->WWW,row[2],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -545,7 +551,8 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (CurrentLnkName,NewLnkName,MaxLength);
|
||||
Str_Copy (CurrentLnkName,NewLnkName,
|
||||
MaxLength);
|
||||
Lnk_EditLinks ();
|
||||
}
|
||||
|
||||
|
@ -602,7 +609,8 @@ void Lnk_ChangeLinkWWW (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_web_address_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Lnk->WWW,NewWWW,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Lnk->WWW,NewWWW,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Lnk_EditLinks ();
|
||||
}
|
||||
|
||||
|
|
46
swad_mail.c
46
swad_mail.c
|
@ -67,6 +67,7 @@ extern struct Globals Gbl;
|
|||
static void Mai_GetParamMaiOrderType (void);
|
||||
static void Mai_PutIconToEditMailDomains (void);
|
||||
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
||||
static void Mai_GetMailBox (const char *Email,char MailBox[Usr_MAX_BYTES_USR_EMAIL + 1]);
|
||||
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char *MailDomain);
|
||||
|
||||
static void Mai_ListMailDomainsForEdition (void);
|
||||
|
@ -288,10 +289,12 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
|
|||
Lay_ShowErrorAndExit ("Wrong code of mail domain.");
|
||||
|
||||
/* Get the mail domain (row[1]) */
|
||||
Str_Copy (Mai->Domain,row[1],Mai_MAX_LENGTH_MAIL_DOMAIN);
|
||||
Str_Copy (Mai->Domain,row[1],
|
||||
Mai_MAX_LENGTH_MAIL_DOMAIN);
|
||||
|
||||
/* Get the mail domain info (row[2]) */
|
||||
Str_Copy (Mai->Info,row[2],Mai_MAX_LENGTH_MAIL_INFO);
|
||||
Str_Copy (Mai->Info,row[2],
|
||||
Mai_MAX_LENGTH_MAIL_INFO);
|
||||
|
||||
/* Get number of users (row[3]) */
|
||||
if (sscanf (row[3],"%u",&(Mai->NumUsrs)) != 1)
|
||||
|
@ -323,10 +326,30 @@ bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** Check #2: if my mail domain allowed? *****/
|
||||
Str_GetMailBox (UsrDat->Email,MailDomain,Usr_MAX_BYTES_USR_EMAIL);
|
||||
Mai_GetMailBox (UsrDat->Email,MailDomain);
|
||||
return Mai_CheckIfMailDomainIsAllowedForNotif (MailDomain);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get mailbox from email address ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Mai_GetMailBox (const char *Email,char MailBox[Usr_MAX_BYTES_USR_EMAIL + 1])
|
||||
{
|
||||
const char *Ptr;
|
||||
|
||||
MailBox[0] = '\0'; // Return empty mailbox on error
|
||||
|
||||
if ((Ptr = strchr (Email,(int) '@'))) // Find first '@' in address
|
||||
if (Ptr != Email) // '@' is not the first character in Email
|
||||
{
|
||||
Ptr++; // Skip '@'
|
||||
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
|
||||
Str_Copy (MailBox,Ptr,
|
||||
Usr_MAX_BYTES_USR_EMAIL);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Check if a mail domain is allowed for notifications ************/
|
||||
/*****************************************************************************/
|
||||
|
@ -392,10 +415,12 @@ void Mai_GetDataOfMailDomainByCod (struct Mail *Mai)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get the short name of the mail (row[0]) */
|
||||
Str_Copy (Mai->Domain,row[0],Mai_MAX_LENGTH_MAIL_DOMAIN);
|
||||
Str_Copy (Mai->Domain,row[0],
|
||||
Mai_MAX_LENGTH_MAIL_DOMAIN);
|
||||
|
||||
/* Get the full name of the mail (row[1]) */
|
||||
Str_Copy (Mai->Info,row[1],Mai_MAX_LENGTH_MAIL_INFO);
|
||||
Str_Copy (Mai->Info,row[1],
|
||||
Mai_MAX_LENGTH_MAIL_INFO);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -649,7 +674,8 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (CurrentMaiName,NewMaiName,MaxLength);
|
||||
Str_Copy (CurrentMaiName,NewMaiName,
|
||||
MaxLength);
|
||||
Mai_EditMailDomains ();
|
||||
}
|
||||
|
||||
|
@ -966,7 +992,7 @@ bool Mai_CheckIfEmailIsValid (const char *Email)
|
|||
bool ArrobaFound = false;
|
||||
|
||||
/***** An email address must have a number of characters
|
||||
5 <= Length <= Mai_MAX_BYTES_USR_EMAIL *****/
|
||||
5 <= Length <= Usr_MAX_BYTES_USR_EMAIL *****/
|
||||
if (Length < 5 ||
|
||||
Length > Usr_MAX_BYTES_USR_EMAIL)
|
||||
return false;
|
||||
|
@ -1029,7 +1055,8 @@ bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat)
|
|||
{
|
||||
/* Get email */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (UsrDat->Email,row[0],Usr_MAX_BYTES_USR_EMAIL);
|
||||
Str_Copy (UsrDat->Email,row[0],
|
||||
Usr_MAX_BYTES_USR_EMAIL);
|
||||
UsrDat->EmailConfirmed = (row[1][0] == 'Y');
|
||||
Found = true;
|
||||
}
|
||||
|
@ -1677,7 +1704,8 @@ void Mai_ConfirmEmail (void)
|
|||
UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get user's email */
|
||||
Str_Copy (Email,row[1],Usr_MAX_BYTES_USR_EMAIL);
|
||||
Str_Copy (Email,row[1],
|
||||
Usr_MAX_BYTES_USR_EMAIL);
|
||||
|
||||
KeyIsCorrect = true;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,14 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_user.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Mai_MAX_LENGTH_MAIL_DOMAIN 255
|
||||
#define Mai_MAX_LENGTH_MAIL_INFO 255
|
||||
#define Mai_MAX_LENGTH_MAIL_DOMAIN (128 - 1)
|
||||
#define Mai_MAX_LENGTH_MAIL_INFO (128 - 1)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
27
swad_mark.c
27
swad_mark.c
|
@ -323,8 +323,7 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
|
|||
// Only one table is allowed
|
||||
if (Str_FindStrInFile (FileAllMarks,"<table",Str_NO_SKIP_HTML_COMMENTS))
|
||||
{
|
||||
Str_Copy (Gbl.Message,Txt_There_are_more_than_one_table_in_the_file_of_marks,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_There_are_more_than_one_table_in_the_file_of_marks);
|
||||
FileIsCorrect = false;
|
||||
}
|
||||
else
|
||||
|
@ -385,8 +384,7 @@ bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks)
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (Gbl.Message,Txt_Table_not_found_in_the_file_of_marks,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_Table_not_found_in_the_file_of_marks);
|
||||
FileIsCorrect = false;
|
||||
}
|
||||
|
||||
|
@ -458,8 +456,7 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
|
|||
/***** Open HTML file with the table of marks *****/
|
||||
if (!(FileAllMarks = fopen (PathFileAllMarks,"rb")))
|
||||
{ // Can't open the file with the table of marks
|
||||
Str_Copy (Gbl.Message,"Can not open file of marks.", // TODO: Need translation!
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s","Can not open file of marks."); // TODO: Need translation!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -779,11 +776,13 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
||||
|
||||
/* Path (row[2]) */
|
||||
Str_Copy (FullPathInTreeFromDBMarksTable,row[2],PATH_MAX);
|
||||
Str_Copy (FullPathInTreeFromDBMarksTable,row[2],
|
||||
PATH_MAX);
|
||||
Str_SplitFullPathIntoPathAndFileName (FullPathInTreeFromDBMarksTable,
|
||||
PathUntilFileName,
|
||||
FileName);
|
||||
Str_Copy (SummaryStr,FileName,NAME_MAX);
|
||||
Str_Copy (SummaryStr,FileName,
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
|
@ -834,7 +833,8 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
if ((*ContentStr = (char *) malloc (Length + 1)))
|
||||
{
|
||||
/* 9 starting chars */
|
||||
Str_Copy (*ContentStr,"<![CDATA[",9);
|
||||
Str_Copy (*ContentStr,"<![CDATA[",
|
||||
9);
|
||||
|
||||
/* Content */
|
||||
Ptr = (*ContentStr) + 9;
|
||||
|
@ -848,7 +848,8 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
}
|
||||
|
||||
/* 3 ending chars */
|
||||
Str_Copy (Ptr,"]]>",3);
|
||||
Str_Copy (Ptr,"]]>",
|
||||
3);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -860,8 +861,7 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (Gbl.Message,"Can not open file with user's marks!", // TODO: Need translation!
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s","Can not open file with user's marks!"); // TODO: Need translation!
|
||||
if ((*ContentStr = (char *) malloc (9+strlen (Gbl.Message)+3+1)))
|
||||
sprintf (*ContentStr,"<![CDATA[%s]]>",Gbl.Message);
|
||||
}
|
||||
|
@ -869,8 +869,7 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
}
|
||||
else
|
||||
{
|
||||
Str_Copy (Gbl.Message,"User's IDs not found!", // TODO: Need translation!
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s","User's IDs not found!"); // TODO: Need translation!
|
||||
if ((*ContentStr = (char *) malloc (9+strlen (Gbl.Message)+3+1)))
|
||||
sprintf (*ContentStr,"<![CDATA[%s]]>",Gbl.Message);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ extern struct Globals Gbl;
|
|||
/**************************** Internal prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Msg_PutFormMsgUsrs (char *Content);
|
||||
static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]);
|
||||
|
||||
static void Msg_ShowSentOrReceivedMessages (void);
|
||||
static unsigned long Msg_GetNumUsrsBannedByMe (void);
|
||||
|
@ -100,7 +100,7 @@ static void Msg_PutLinkToShowMorePotentialRecipients (void);
|
|||
static void Msg_PutParamsShowMorePotentialRecipients (void);
|
||||
static void Msg_ShowOneUniqueRecipient (void);
|
||||
static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void);
|
||||
static void Msg_WriteFormSubjectAndContentMsgToUsrs (char *Content);
|
||||
static void Msg_WriteFormSubjectAndContentMsgToUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]);
|
||||
static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs);
|
||||
|
||||
static void Msg_MakeFilterFromToSubquery (char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY + 1]);
|
||||
|
@ -125,8 +125,11 @@ static bool Msg_CheckIfReceivedMsgIsDeletedForAllItsRecipients (long MsgCod);
|
|||
static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromToSubquery);
|
||||
|
||||
static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
||||
time_t *CreatTimeUTC,char *Subject,bool *Deleted);
|
||||
static void Msg_GetMsgContent (long MsgCod,char *Content,struct Image *Image);
|
||||
time_t *CreatTimeUTC,
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||
bool *Deleted);
|
||||
static void Msg_GetMsgContent (long MsgCod,char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||
struct Image *Image);
|
||||
|
||||
static void Msg_WriteSentOrReceivedMsgSubject (long MsgCod,const char *Subject,bool Open,bool Expanded);
|
||||
static void Msg_WriteFormToReply (long MsgCod,long CrsCod,
|
||||
|
@ -162,7 +165,7 @@ void Msg_FormMsgUsrs (void)
|
|||
/***************** Put a form to write a new message to users ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Msg_PutFormMsgUsrs (char *Content)
|
||||
static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
|
||||
{
|
||||
extern const char *Hlp_MESSAGES_Write;
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
|
@ -472,7 +475,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
|
|||
/****** Write form fields with subject and content of a message to users *****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Msg_WriteFormSubjectAndContentMsgToUsrs (char *Content)
|
||||
static void Msg_WriteFormSubjectAndContentMsgToUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
extern const char *Txt_MSG_Subject;
|
||||
|
@ -518,10 +521,12 @@ static void Msg_WriteFormSubjectAndContentMsgToUsrs (char *Content)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get subject */
|
||||
Str_Copy (Gbl.Msg.Subject,row[0],Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (Gbl.Msg.Subject,row[0],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
|
||||
/* Get content */
|
||||
Str_Copy (Content,row[1],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,row[1],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -598,7 +603,7 @@ static void Msg_WriteFormSubjectAndContentMsgToUsrs (char *Content)
|
|||
|
||||
void Msg_PutHiddenParamAnotherRecipient (const struct UsrData *UsrDat)
|
||||
{
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
|
||||
sprintf (NicknameWithArroba,"@%s",UsrDat->Nickname);
|
||||
Par_PutHiddenParamString ("OtherRecipients",NicknameWithArroba);
|
||||
|
@ -2651,7 +2656,9 @@ static void Msg_GetParamOnlyUnreadMsgs (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
||||
time_t *CreatTimeUTC,char *Subject,bool *Deleted)
|
||||
time_t *CreatTimeUTC,
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||
bool *Deleted)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -2703,7 +2710,7 @@ static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
|||
/************************ Get the subject of a message ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Msg_GetMsgSubject (long MsgCod,char *Subject)
|
||||
void Msg_GetMsgSubject (long MsgCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1])
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -2717,7 +2724,8 @@ void Msg_GetMsgSubject (long MsgCod,char *Subject)
|
|||
{
|
||||
/***** Get subject *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Subject,row[0],Cns_MAX_BYTES_SUBJECT);
|
||||
Str_Copy (Subject,row[0],
|
||||
Cns_MAX_BYTES_SUBJECT);
|
||||
}
|
||||
else
|
||||
Subject[0] = '\0';
|
||||
|
@ -2730,7 +2738,8 @@ void Msg_GetMsgSubject (long MsgCod,char *Subject)
|
|||
/*************** Get content and optional image of a message *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Msg_GetMsgContent (long MsgCod,char *Content,struct Image *Image)
|
||||
static void Msg_GetMsgContent (long MsgCod,char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||
struct Image *Image)
|
||||
{
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -2751,7 +2760,8 @@ static void Msg_GetMsgContent (long MsgCod,char *Content,struct Image *Image)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/****** Get content (row[0]) *****/
|
||||
Str_Copy (Content,row[0],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,row[0],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
|
||||
/****** Get image name (row[1]), title (row[2]) and URL (row[3]) *****/
|
||||
Img_GetImageNameTitleAndURLFromRow (row[1],row[2],row[3],Image);
|
||||
|
@ -3027,7 +3037,8 @@ void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Copy subject *****/
|
||||
Str_Copy (SummaryStr,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
|
@ -3037,7 +3048,8 @@ void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
Length = strlen (row[1]);
|
||||
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||
Str_Copy (*ContentStr,row[1],Length);
|
||||
Str_Copy (*ContentStr,row[1],
|
||||
Length);
|
||||
}
|
||||
}
|
||||
mysql_free_result (mysql_res);
|
||||
|
|
|
@ -93,7 +93,7 @@ void Msg_PutHiddenParamsMsgsFilters (void);
|
|||
void Msg_GetDistinctCoursesInMyMessages (void);
|
||||
void Msg_ShowFormSelectCourseSentOrRecMsgs (void);
|
||||
void Msg_ShowFormToFilterMsgs (void);
|
||||
void Msg_GetMsgSubject (long MsgCod,char *Subject);
|
||||
void Msg_GetMsgSubject (long MsgCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1]);
|
||||
void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
||||
char **ContentStr,long MsgCod,
|
||||
unsigned MaxChars,bool GetContent);
|
||||
|
|
|
@ -78,6 +78,8 @@ typedef enum
|
|||
Net_YOUTUBE,
|
||||
} Net_WebsAndSocialNetworks_t;
|
||||
|
||||
#define Net_MAX_LENGTH_NETWORK_NAME 32
|
||||
|
||||
const char *Net_WebsAndSocialNetworksDB[Net_NUM_WEBS_AND_SOCIAL_NETWORKS] =
|
||||
{
|
||||
"www", // Net_WWW
|
||||
|
@ -225,7 +227,8 @@ void Net_ShowWebsAndSocialNets (const struct UsrData *UsrDat)
|
|||
{
|
||||
/* Get URL */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (URL,row[0],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (URL,row[0],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Show the web / social network */
|
||||
Net_ShowAWebOrSocialNet (URL,
|
||||
|
@ -315,7 +318,8 @@ void Net_ShowFormMyWebsAndSocialNets (void)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get URL */
|
||||
Str_Copy (URL,row[0],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (URL,row[0],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
else
|
||||
URL[0] = '\0';
|
||||
|
@ -438,9 +442,10 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumRows,NumRow;
|
||||
unsigned NumRows;
|
||||
unsigned NumRow;
|
||||
Net_WebsAndSocialNetworks_t Web;
|
||||
char WebStr[32];
|
||||
char NetName[Net_MAX_LENGTH_NETWORK_NAME + 1];
|
||||
unsigned NumUsrsTotalInPlatform;
|
||||
unsigned NumUsrs;
|
||||
|
||||
|
@ -551,11 +556,12 @@ void Net_ShowWebAndSocialNetworksStats (void)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get web / social network (row[0]) */
|
||||
Str_Copy (WebStr,row[0],sizeof (WebStr) - 1);
|
||||
Str_Copy (NetName,row[0],
|
||||
Net_MAX_LENGTH_NETWORK_NAME);
|
||||
for (Web = (Net_WebsAndSocialNetworks_t) 0;
|
||||
Web < Net_NUM_WEBS_AND_SOCIAL_NETWORKS;
|
||||
Web++)
|
||||
if (!strcmp (Net_WebsAndSocialNetworksDB[Web],WebStr))
|
||||
if (!strcmp (Net_WebsAndSocialNetworksDB[Web],NetName))
|
||||
break;
|
||||
if (Web < Net_NUM_WEBS_AND_SOCIAL_NETWORKS)
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ static void Nck_RemoveNicknameFromDB (const char *Nickname);
|
|||
|
||||
bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba)
|
||||
{
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
unsigned Length;
|
||||
const char *Ptr;
|
||||
|
||||
|
@ -74,7 +74,7 @@ bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba)
|
|||
|
||||
/***** Make a copy of nickname *****/
|
||||
Str_Copy (NicknameWithoutArroba,NicknameWithArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
Str_RemoveLeadingArrobas (NicknameWithoutArroba);
|
||||
Length = strlen (NicknameWithoutArroba);
|
||||
|
||||
|
@ -101,7 +101,8 @@ bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba)
|
|||
/************* Get nickname of a user from his/her user's code ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,char *Nickname)
|
||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||
char Nickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1])
|
||||
{
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -116,12 +117,13 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,char *Nickname)
|
|||
{
|
||||
/* Get nickname */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Nickname,row[0],Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Str_Copy (Nickname,row[0],
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
Found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Nickname = '\0';
|
||||
Nickname[0] = '\0';
|
||||
Found = false;
|
||||
}
|
||||
|
||||
|
@ -139,7 +141,7 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,char *Nickname)
|
|||
|
||||
long Nck_GetUsrCodFromNickname (const char *Nickname)
|
||||
{
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA + 1];
|
||||
char NicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -150,7 +152,7 @@ long Nck_GetUsrCodFromNickname (const char *Nickname)
|
|||
{
|
||||
/***** Make a copy without possible starting arrobas *****/
|
||||
Str_Copy (NicknameWithoutArroba,Nickname,
|
||||
Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
Str_RemoveLeadingArrobas (NicknameWithoutArroba);
|
||||
|
||||
/***** Get user's code from database *****/
|
||||
|
@ -195,7 +197,7 @@ void Nck_ShowFormChangeUsrNickname (void)
|
|||
MYSQL_ROW row;
|
||||
unsigned NumNicks;
|
||||
unsigned NumNick;
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
|
||||
/***** Get my nicknames *****/
|
||||
sprintf (Query,"SELECT Nickname FROM usr_nicknames"
|
||||
|
@ -352,17 +354,17 @@ void Nck_UpdateNick (void)
|
|||
extern const char *Txt_Your_nickname_X_has_been_registered_successfully;
|
||||
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
|
||||
char Query[1024];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
bool Error = false;
|
||||
|
||||
/***** Get new nickname from form *****/
|
||||
Par_GetParToText ("NewNick",NewNicknameWithArroba,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Par_GetParToText ("NewNick",NewNicknameWithArroba,Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
if (Nck_CheckIfNickWithArrobaIsValid (NewNicknameWithArroba)) // If new nickname is valid
|
||||
{
|
||||
/***** Remove arrobas at the beginning *****/
|
||||
Str_Copy (NewNicknameWithoutArroba,NewNicknameWithArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
Str_RemoveLeadingArrobas (NewNicknameWithoutArroba);
|
||||
|
||||
/***** Check if new nickname exists in database *****/
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
|
||||
#define Nck_MIN_LENGTH_NICKNAME_WITHOUT_ARROBA 3
|
||||
#define Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA 16
|
||||
#define Nck_MAX_BYTES_NICKNAME_WITH_ARROBA 127 // Used for variables that store the characters typed in a form
|
||||
|
||||
#define Nck_MAX_BYTES_LIST_NICKS ((Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+2)*Cfg_MAX_USRS_IN_LIST)
|
||||
#define Nck_MAX_BYTES_NICKNAME_FROM_FORM (128 - 1) // For variables that store characters typed in a form
|
||||
|
||||
#define Nck_MAX_BYTES_LIST_NICKS ((Nck_MAX_BYTES_NICKNAME_FROM_FORM+2)*Cfg_MAX_USRS_IN_LIST)
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
|
@ -44,7 +45,8 @@
|
|||
|
||||
bool Nck_CheckIfNickWithArrobaIsValid (const char *NicknameWithArroba);
|
||||
|
||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,char *Nickname);
|
||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||
char Nickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 1]);
|
||||
long Nck_GetUsrCodFromNickname (const char *Nickname);
|
||||
void Nck_ShowFormChangeUsrNickname (void);
|
||||
|
||||
|
|
|
@ -411,7 +411,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
|
|||
UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
||||
/* Get the content (row[3]) and insert links */
|
||||
Str_Copy (Content,row[3],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Content,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,
|
||||
Not_MaxCharsURLOnScreen[TypeNoticesListing]);
|
||||
if (TypeNoticesListing == Not_LIST_BRIEF_NOTICES)
|
||||
|
@ -555,7 +556,8 @@ static void Not_GetDataAndShowNotice (long NotCod)
|
|||
UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get the content (row[2]) and insert links*/
|
||||
Str_Copy (Content,row[2],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Content,row[2],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,
|
||||
Not_MaxCharsURLOnScreen[Not_LIST_FULL_NOTICES]);
|
||||
|
||||
|
@ -767,7 +769,8 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Copy summary *****/
|
||||
Str_Copy (SummaryStr,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
|
@ -777,7 +780,8 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
Length = strlen (row[0]);
|
||||
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||
Str_Copy (*ContentStr,row[0],Length);
|
||||
Str_Copy (*ContentStr,row[0],
|
||||
Length);
|
||||
}
|
||||
}
|
||||
mysql_free_result (mysql_res);
|
||||
|
|
|
@ -80,7 +80,8 @@ bool Par_GetQueryString (void)
|
|||
char UnsignedLongStr[10 + 1];
|
||||
unsigned long UnsignedLong;
|
||||
|
||||
Str_Copy (Method,getenv ("REQUEST_METHOD"),Par_MAX_LENGTH_METHOD);
|
||||
Str_Copy (Method,getenv ("REQUEST_METHOD"),
|
||||
Par_MAX_LENGTH_METHOD);
|
||||
|
||||
if (!strcmp (Method,"GET"))
|
||||
{
|
||||
|
@ -105,7 +106,8 @@ bool Par_GetQueryString (void)
|
|||
/* Get content length */
|
||||
if (getenv ("CONTENT_LENGTH"))
|
||||
{
|
||||
Str_Copy (UnsignedLongStr,getenv ("CONTENT_LENGTH"),10);
|
||||
Str_Copy (UnsignedLongStr,getenv ("CONTENT_LENGTH"),
|
||||
10);
|
||||
if (sscanf (UnsignedLongStr,"%lu",&UnsignedLong) != 1)
|
||||
return false;
|
||||
Gbl.Params.ContentLength = (size_t) UnsignedLong;
|
||||
|
@ -119,7 +121,8 @@ bool Par_GetQueryString (void)
|
|||
if (getenv ("CONTENT_TYPE") == NULL)
|
||||
return false;
|
||||
|
||||
Str_Copy (ContentType,getenv ("CONTENT_TYPE"),Par_MAX_LENGTH_CONTENT_TYPE);
|
||||
Str_Copy (ContentType,getenv ("CONTENT_TYPE"),
|
||||
Par_MAX_LENGTH_CONTENT_TYPE);
|
||||
|
||||
if (!strncmp (ContentType,"multipart/form-data",strlen ("multipart/form-data")))
|
||||
{
|
||||
|
@ -581,7 +584,7 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
|
|||
{
|
||||
case Act_CONT_NORM:
|
||||
if (PtrDst)
|
||||
Str_Copy (PtrDst,&Gbl.Params.QueryString[Param->Value.Start],
|
||||
strncpy (PtrDst,&Gbl.Params.QueryString[Param->Value.Start],
|
||||
Param->Value.Length);
|
||||
break;
|
||||
case Act_CONT_DATA:
|
||||
|
@ -650,7 +653,7 @@ void Par_GetMainParameters (void)
|
|||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
char UnsignedStr[10+1];
|
||||
unsigned UnsignedNum;
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
char LongStr[1+10+1];
|
||||
|
||||
/***** Reset codes of country, institution, centre, degree and course *****/
|
||||
|
@ -677,7 +680,7 @@ void Par_GetMainParameters (void)
|
|||
/***** Get another user's nickname, if exists
|
||||
(this nickname is used to go to another user's profile,
|
||||
not to get the logged user) *****/
|
||||
if (Par_GetParToText ("usr",Nickname,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA))
|
||||
if (Par_GetParToText ("usr",Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM))
|
||||
{
|
||||
if (Nickname[0])
|
||||
{
|
||||
|
@ -693,7 +696,7 @@ void Par_GetMainParameters (void)
|
|||
Gbl.Action.Act = ActSeePubPrf; // Set default action if no other is specified
|
||||
}
|
||||
}
|
||||
else if (Par_GetParToText ("agd",Nickname,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA))
|
||||
else if (Par_GetParToText ("agd",Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM))
|
||||
{
|
||||
if (Nickname[0])
|
||||
{
|
||||
|
|
|
@ -179,8 +179,7 @@ void Pwd_ActChgMyPwd1 (void)
|
|||
/***** Check if I have written twice the same password *****/
|
||||
if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
|
||||
// Passwords don't match
|
||||
Str_Copy (Gbl.Message,Txt_You_have_not_written_twice_the_same_new_password,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_You_have_not_written_twice_the_same_new_password);
|
||||
else
|
||||
{
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,
|
||||
|
@ -192,15 +191,13 @@ void Pwd_ActChgMyPwd1 (void)
|
|||
Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64);
|
||||
Ses_UpdateSessionDataInDB ();
|
||||
Enr_UpdateUsrData (&Gbl.Usrs.Me.UsrDat);
|
||||
Str_Copy (Gbl.Message,Txt_Your_password_has_been_changed_successfully,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_Your_password_has_been_changed_successfully);
|
||||
Gbl.Usrs.Error = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Str_Copy (Gbl.Message,Txt_You_have_not_entered_your_password_correctly,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_You_have_not_entered_your_password_correctly);
|
||||
}
|
||||
|
||||
void Pwd_ActChgMyPwd2 (void)
|
||||
|
@ -501,8 +498,7 @@ void Pwd_UpdateOtherPwd1 (void)
|
|||
|
||||
if (strcmp (NewPlainPassword[0],NewPlainPassword[1]))
|
||||
// Paswords don't match
|
||||
Str_Copy (Gbl.Message,Txt_You_have_not_written_twice_the_same_new_password,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_You_have_not_written_twice_the_same_new_password);
|
||||
else
|
||||
{
|
||||
Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,
|
||||
|
@ -522,12 +518,10 @@ void Pwd_UpdateOtherPwd1 (void)
|
|||
}
|
||||
}
|
||||
else
|
||||
Str_Copy (Gbl.Message,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else // User not found
|
||||
Str_Copy (Gbl.Message,Txt_User_not_found_or_you_do_not_have_permission_,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
void Pwd_UpdateOtherPwd2 (void)
|
||||
|
@ -563,8 +557,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
|
|||
/***** Check if password is found in user's ID, first name or surnames of anybody *****/
|
||||
if (Pwd_CheckIfPasswdIsUsrIDorName (PlainPassword)) // PlainPassword is a user's ID, name or surname
|
||||
{
|
||||
Str_Copy (Gbl.Message,Txt_The_password_is_too_trivial_,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_The_password_is_too_trivial_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -572,8 +565,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
|
|||
if (Pwd_GetNumOtherUsrsWhoUseThisPassword (EncryptedPassword,UsrCod) >
|
||||
Pwd_MAX_OTHER_USERS_USING_THE_SAME_PASSWORD)
|
||||
{
|
||||
Str_Copy (Gbl.Message,Txt_The_password_is_too_trivial_,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_The_password_is_too_trivial_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -650,8 +642,7 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
|
|||
/***** Check spaces in password *****/
|
||||
if (strchr (PlainPassword,(int) ' ') != NULL) // PlainPassword with spaces
|
||||
{
|
||||
Str_Copy (Gbl.Message,Txt_The_password_can_not_contain_spaces,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_The_password_can_not_contain_spaces);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -663,8 +654,7 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
|
|||
ItsANumber = false;
|
||||
if (ItsANumber)
|
||||
{
|
||||
Str_Copy (Gbl.Message,Txt_The_password_can_not_consist_only_of_digits,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s",Txt_The_password_can_not_consist_only_of_digits);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
12
swad_photo.c
12
swad_photo.c
|
@ -1157,14 +1157,17 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
|||
}
|
||||
|
||||
/***** Hidden div to pass user's name to Javascript *****/
|
||||
Str_Copy (FullName,UsrDat->FullName,Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_Copy (FullName,UsrDat->FullName,
|
||||
Usr_MAX_BYTES_FULL_NAME);
|
||||
if (PutZoomCode)
|
||||
{
|
||||
Str_Copy (ShortName,UsrDat->FirstName,Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_Copy (ShortName,UsrDat->FirstName,
|
||||
Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_LimitLengthHTMLStr (ShortName,23);
|
||||
Surnames[0] = '\0';
|
||||
if (UsrDat->Surname1[0])
|
||||
Str_Copy (Surnames,UsrDat->Surname1,Usr_MAX_BYTES_SURNAMES);
|
||||
Str_Copy (Surnames,UsrDat->Surname1,
|
||||
Usr_MAX_BYTES_SURNAMES);
|
||||
if (UsrDat->Surname2[0])
|
||||
{
|
||||
Str_Concat (Surnames," ",Usr_MAX_BYTES_SURNAMES);
|
||||
|
@ -2372,7 +2375,8 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
|
|||
Pho_ComputePhotoSize (NumStds,NumStdsWithPhoto,&PhotoWidth,&PhotoHeight);
|
||||
|
||||
/***** Make a copy of the degree short name *****/
|
||||
Str_Copy (CopyOfDegShortName,Deg->ShrtName,Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
Str_Copy (CopyOfDegShortName,Deg->ShrtName,
|
||||
Deg_MAX_LENGTH_DEGREE_SHRT_NAME);
|
||||
Str_LimitLengthHTMLStr (CopyOfDegShortName,
|
||||
SeeOrPrint == Pho_DEGREES_SEE ? 10 :
|
||||
15);
|
||||
|
|
21
swad_place.c
21
swad_place.c
|
@ -302,10 +302,12 @@ void Plc_GetListPlaces (void)
|
|||
Lay_ShowErrorAndExit ("Wrong code of place.");
|
||||
|
||||
/* Get the short name of the place (row[1]) */
|
||||
Str_Copy (Plc->ShrtName,row[1],Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
||||
Str_Copy (Plc->ShrtName,row[1],
|
||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the place (row[2]) */
|
||||
Str_Copy (Plc->FullName,row[2],Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Str_Copy (Plc->FullName,row[2],
|
||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
|
||||
/* Get number of centres in this place (row[3]) */
|
||||
if (sscanf (row[3],"%u",&Plc->NumCtrs) != 1)
|
||||
|
@ -347,8 +349,10 @@ void Plc_GetDataOfPlaceByCod (struct Place *Plc)
|
|||
}
|
||||
else if (Plc->PlcCod == 0)
|
||||
{
|
||||
Str_Copy (Plc->ShrtName,Txt_Another_place,Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
||||
Str_Copy (Plc->FullName,Txt_Another_place,Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Str_Copy (Plc->ShrtName,Txt_Another_place,
|
||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
||||
Str_Copy (Plc->FullName,Txt_Another_place,
|
||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
}
|
||||
else if (Plc->PlcCod > 0)
|
||||
{
|
||||
|
@ -377,10 +381,12 @@ void Plc_GetDataOfPlaceByCod (struct Place *Plc)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get the short name of the place (row[0]) */
|
||||
Str_Copy (Plc->ShrtName,row[0],Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
||||
Str_Copy (Plc->ShrtName,row[0],
|
||||
Plc_MAX_LENGTH_PLACE_SHRT_NAME);
|
||||
|
||||
/* Get the full name of the place (row[1]) */
|
||||
Str_Copy (Plc->FullName,row[1],Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
Str_Copy (Plc->FullName,row[1],
|
||||
Plc_MAX_LENGTH_PLACE_FULL_NAME);
|
||||
|
||||
/* Get number of centres in this place (row[2]) */
|
||||
if (sscanf (row[2],"%u",&Plc->NumCtrs) != 1)
|
||||
|
@ -651,7 +657,8 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (CurrentPlcName,NewPlcName,MaxLength);
|
||||
Str_Copy (CurrentPlcName,NewPlcName,
|
||||
MaxLength);
|
||||
Plc_EditPlaces ();
|
||||
}
|
||||
|
||||
|
|
|
@ -227,22 +227,28 @@ static void Plg_GetListPlugins (void)
|
|||
Lay_ShowErrorAndExit ("Wrong code of plugin.");
|
||||
|
||||
/* Get the name of the plugin (row[1]) */
|
||||
Str_Copy (Plg->Name,row[1],Plg_MAX_LENGTH_PLUGIN_NAME);
|
||||
Str_Copy (Plg->Name,row[1],
|
||||
Plg_MAX_LENGTH_PLUGIN_NAME);
|
||||
|
||||
/* Get the description of the plugin (row[2]) */
|
||||
Str_Copy (Plg->Description,row[2],Plg_MAX_LENGTH_PLUGIN_DESCRIPTION);
|
||||
Str_Copy (Plg->Description,row[2],
|
||||
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION);
|
||||
|
||||
/* Get the logo of the plugin (row[3]) */
|
||||
Str_Copy (Plg->Logo,row[3],Plg_MAX_LENGTH_PLUGIN_LOGO);
|
||||
Str_Copy (Plg->Logo,row[3],
|
||||
Plg_MAX_LENGTH_PLUGIN_LOGO);
|
||||
|
||||
/* Get the application key of the plugin (row[4]) */
|
||||
Str_Copy (Plg->AppKey,row[4],Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
Str_Copy (Plg->AppKey,row[4],
|
||||
Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
|
||||
/* Get the URL of the plugin (row[5]) */
|
||||
Str_Copy (Plg->URL,row[5],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Plg->URL,row[5],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get the IP of the plugin (row[6]) */
|
||||
Str_Copy (Plg->IP,row[6],Cns_MAX_LENGTH_IP);
|
||||
Str_Copy (Plg->IP,row[6],
|
||||
Cns_MAX_LENGTH_IP);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -288,22 +294,28 @@ bool Plg_GetDataOfPluginByCod (struct Plugin *Plg)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get the name of the plugin (row[0]) */
|
||||
Str_Copy (Plg->Name,row[0],Plg_MAX_LENGTH_PLUGIN_NAME);
|
||||
Str_Copy (Plg->Name,row[0],
|
||||
Plg_MAX_LENGTH_PLUGIN_NAME);
|
||||
|
||||
/* Get the description of the plugin (row[1]) */
|
||||
Str_Copy (Plg->Description,row[1],Plg_MAX_LENGTH_PLUGIN_DESCRIPTION);
|
||||
Str_Copy (Plg->Description,row[1],
|
||||
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION);
|
||||
|
||||
/* Get the logo of the plugin (row[2]) */
|
||||
Str_Copy (Plg->Logo,row[2],Plg_MAX_LENGTH_PLUGIN_LOGO);
|
||||
Str_Copy (Plg->Logo,row[2],
|
||||
Plg_MAX_LENGTH_PLUGIN_LOGO);
|
||||
|
||||
/* Get the application key of the plugin (row[3]) */
|
||||
Str_Copy (Plg->AppKey,row[3],Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
Str_Copy (Plg->AppKey,row[3],
|
||||
Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
|
||||
/* Get the URL of the plugin (row[4]) */
|
||||
Str_Copy (Plg->URL,row[4],Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Plg->URL,row[4],
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
/* Get the IP of the plugin (row[5]) */
|
||||
Str_Copy (Plg->IP,row[5],Cns_MAX_LENGTH_IP);
|
||||
Str_Copy (Plg->IP,row[5],
|
||||
Cns_MAX_LENGTH_IP);
|
||||
}
|
||||
else
|
||||
PluginFound = false;
|
||||
|
@ -569,7 +581,8 @@ void Plg_RenamePlugin (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->Name,NewPlgName,Plg_MAX_LENGTH_PLUGIN_NAME);
|
||||
Str_Copy (Plg->Name,NewPlgName,
|
||||
Plg_MAX_LENGTH_PLUGIN_NAME);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
@ -629,7 +642,8 @@ void Plg_ChangePlgDescription (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->Description,NewDescription,Plg_MAX_LENGTH_PLUGIN_DESCRIPTION);
|
||||
Str_Copy (Plg->Description,NewDescription,
|
||||
Plg_MAX_LENGTH_PLUGIN_DESCRIPTION);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
@ -672,7 +686,8 @@ void Plg_ChangePlgLogo (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_logo_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->Logo,NewLogo,Plg_MAX_LENGTH_PLUGIN_LOGO);
|
||||
Str_Copy (Plg->Logo,NewLogo,
|
||||
Plg_MAX_LENGTH_PLUGIN_LOGO);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
@ -715,7 +730,8 @@ void Plg_ChangePlgAppKey (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_logo_empty); // TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->AppKey,NewAppKey,Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
Str_Copy (Plg->AppKey,NewAppKey,
|
||||
Plg_MAX_LENGTH_PLUGIN_APP_KEY);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
@ -758,7 +774,8 @@ void Plg_ChangePlgURL (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_URL_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->URL,NewURL,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (Plg->URL,NewURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
@ -801,7 +818,8 @@ void Plg_ChangePlgIP (void)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_You_can_not_leave_the_IP_address_empty);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Plg->IP,NewIP,Cns_MAX_LENGTH_IP);
|
||||
Str_Copy (Plg->IP,NewIP,
|
||||
Cns_MAX_LENGTH_IP);
|
||||
Plg_EditPlugins ();
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickna
|
|||
"</label>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Nickname,
|
||||
Nck_MAX_BYTES_NICKNAME_WITH_ARROBA,
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM,
|
||||
DefaultNickname);
|
||||
|
||||
/***** Send button and end frame *****/
|
||||
|
|
|
@ -624,7 +624,10 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
|
|||
char Message_part2[512];
|
||||
|
||||
/***** Get from the database the name of the field *****/
|
||||
Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,Gbl.CurrentCrs.Records.Field.Name,&Gbl.CurrentCrs.Records.Field.NumLines,&Gbl.CurrentCrs.Records.Field.Visibility);
|
||||
Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,
|
||||
Gbl.CurrentCrs.Records.Field.Name,
|
||||
&Gbl.CurrentCrs.Records.Field.NumLines,
|
||||
&Gbl.CurrentCrs.Records.Field.Visibility);
|
||||
|
||||
/***** Write mensaje to ask confirmation of deletion *****/
|
||||
sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_X,
|
||||
|
@ -704,7 +707,8 @@ static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_LENGTH_NAME_FIELD
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Name of the field */
|
||||
Str_Copy (Name,row[0],Rec_MAX_LENGTH_NAME_FIELD);
|
||||
Str_Copy (Name,row[0],
|
||||
Rec_MAX_LENGTH_NAME_FIELD);
|
||||
|
||||
/* Number of lines of the field (row[1]) */
|
||||
*NumLines = Rec_ConvertToNumLinesField (row[1]);
|
||||
|
@ -1723,7 +1727,8 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
{
|
||||
if (ThisFieldHasText)
|
||||
{
|
||||
Str_Copy (Text,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Text,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Text,Cns_MAX_BYTES_TEXT,false);
|
||||
fprintf (Gbl.F.Out,"%s",Text);
|
||||
|
@ -2577,17 +2582,20 @@ static void Rec_ShowFullName (struct UsrData *UsrDat)
|
|||
fprintf (Gbl.F.Out,"<td class=\"REC_C2_MID REC_NAME LEFT_TOP\">");
|
||||
|
||||
/***** First name *****/
|
||||
Str_Copy (Name,UsrDat->FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Name,UsrDat->FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_LimitLengthHTMLStr (Name,20);
|
||||
fprintf (Gbl.F.Out,"%s<br />",Name);
|
||||
|
||||
/***** Surname 1 *****/
|
||||
Str_Copy (Name,UsrDat->Surname1,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Name,UsrDat->Surname1,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_LimitLengthHTMLStr (Name,20);
|
||||
fprintf (Gbl.F.Out,"%s<br />",Name);
|
||||
|
||||
/***** Surname 2 *****/
|
||||
Str_Copy (Name,UsrDat->Surname2,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Name,UsrDat->Surname2,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_LimitLengthHTMLStr (Name,20);
|
||||
fprintf (Gbl.F.Out,"%s",Name);
|
||||
|
||||
|
@ -2601,7 +2609,7 @@ static void Rec_ShowFullName (struct UsrData *UsrDat)
|
|||
static void Rec_ShowNickname (struct UsrData *UsrDat,bool PutFormLinks)
|
||||
{
|
||||
extern const char *Txt_View_public_profile;
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"REC_C2_MID REC_NAME LEFT_BOTTOM\">"
|
||||
|
|
|
@ -355,6 +355,7 @@ void Sch_PutFormToSearchInPageTopHeading (void)
|
|||
ActionSearch = ActSysSch;
|
||||
Gbl.Scope.Default = Sco_SCOPE_SYS;
|
||||
}
|
||||
|
||||
Act_FormStart (ActionSearch);
|
||||
Sco_GetScope ("ScopeSch");
|
||||
Sco_PutParamScope ("ScopeSch",Gbl.Scope.Current);
|
||||
|
|
|
@ -80,7 +80,8 @@ void Ses_GetNumSessions (void)
|
|||
void Ses_CreateSession (void)
|
||||
{
|
||||
/***** Create a unique name for the session *****/
|
||||
Str_Copy (Gbl.Session.Id,Gbl.UniqueNameEncrypted,Ses_LENGTH_SESSION_ID);
|
||||
Str_Copy (Gbl.Session.Id,Gbl.UniqueNameEncrypted,
|
||||
Ses_LENGTH_SESSION_ID);
|
||||
|
||||
/***** Check that session is not open *****/
|
||||
if (Ses_CheckIfSessionExists (Gbl.Session.Id))
|
||||
|
@ -315,7 +316,8 @@ bool Ses_GetSessionData (void)
|
|||
Gbl.Search.WhatToSearch = (Sch_WhatToSearch_t) UnsignedNum;
|
||||
|
||||
/* Get search string (row[9]) */
|
||||
Str_Copy (Gbl.Search.Str,row[9],Sch_MAX_LENGTH_STRING_TO_FIND);
|
||||
Str_Copy (Gbl.Search.Str,row[9],
|
||||
Sch_MAX_LENGTH_STRING_TO_FIND);
|
||||
}
|
||||
|
||||
Result = true;
|
||||
|
@ -428,8 +430,11 @@ unsigned Ses_GetHiddenParFromDB (Act_Action_t Action,const char *ParamName,char
|
|||
{
|
||||
/***** Get the value del parameter *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (ParamValue,row[0],MaxBytes);
|
||||
|
||||
ParameterIsTooBig = (strlen (row[0]) > MaxBytes);
|
||||
if (!ParameterIsTooBig)
|
||||
Str_Copy (ParamValue,row[0],
|
||||
MaxBytes);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
|
|
@ -1493,7 +1493,8 @@ static void Soc_GetAndWriteSocialPost (long PstCod)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/****** Get content (row[0]) *****/
|
||||
Str_Copy (Content,row[0],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,row[0],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
|
||||
/****** Get image name (row[1]), title (row[2]) and URL (row[3]) *****/
|
||||
Img_GetImageNameTitleAndURLFromRow (row[1],row[2],row[3],&Image);
|
||||
|
@ -1982,7 +1983,8 @@ static void Soc_PutFormToWriteNewPost (void)
|
|||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_NOTE_RIGHT_CONTAINER\">");
|
||||
|
||||
/* Write author's full name and nickname */
|
||||
Str_Copy (FullName,Gbl.Usrs.Me.UsrDat.FullName,Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_Copy (FullName,Gbl.Usrs.Me.UsrDat.FullName,
|
||||
Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_LimitLengthHTMLStr (FullName,16);
|
||||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_RIGHT_AUTHOR\">"
|
||||
"<span class=\"DAT_N_BOLD\">%s</span>"
|
||||
|
@ -4561,7 +4563,8 @@ static void Soc_GetDataOfSocialCommentFromRow (MYSQL_ROW row,struct SocialCommen
|
|||
SocCom->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[3]);
|
||||
|
||||
/***** Get content (row[4]) *****/
|
||||
Str_Copy (SocCom->Content,row[4],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (SocCom->Content,row[4],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
|
||||
/***** Get number of times this comment has been favourited *****/
|
||||
SocCom->NumFavs = Soc_GetNumTimesACommHasBeenFav (SocCom);
|
||||
|
@ -4701,7 +4704,8 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/****** Get content (row[0]) *****/
|
||||
Str_Copy (Content,row[0],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,row[0],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -4713,14 +4717,16 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
Length = strlen (Content);
|
||||
if ((*ContentStr = (char *) malloc (Length + 1)) != NULL)
|
||||
{
|
||||
Str_Copy (*ContentStr,Content,Length);
|
||||
Str_Copy (*ContentStr,Content,
|
||||
Length);
|
||||
ContentCopied = true;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Copy summary string *****/
|
||||
Str_LimitLengthHTMLStr (Content,MaxChars);
|
||||
Str_Copy (SummaryStr,Content,Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,Content,
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
else
|
||||
Soc_GetNoteSummary (&SocNot,SummaryStr,Soc_MAX_BYTES_SUMMARY);
|
||||
|
@ -4737,7 +4743,8 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/****** Get content (row[0]) *****/
|
||||
Str_Copy (Content,row[0],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Str_Copy (Content,row[0],
|
||||
Cns_MAX_BYTES_LONG_TEXT);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -4749,14 +4756,16 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
Length = strlen (Content);
|
||||
if ((*ContentStr = (char *) malloc (Length + 1)) != NULL)
|
||||
{
|
||||
Str_Copy (*ContentStr,Content,Length);
|
||||
Str_Copy (*ContentStr,Content,
|
||||
Length);
|
||||
ContentCopied = true;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Copy summary string *****/
|
||||
Str_LimitLengthHTMLStr (Content,MaxChars);
|
||||
Str_Copy (SummaryStr,Content,Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,Content,
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4824,7 +4833,8 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
|
|||
if (IsNickname)
|
||||
{
|
||||
/* Copy nickname */
|
||||
Str_Copy (UsrDat.Nickname,Nickname.PtrStart,Nickname.Length);
|
||||
Str_Copy (UsrDat.Nickname,Nickname.PtrStart,
|
||||
Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA);
|
||||
|
||||
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.Nickname)) > 0)
|
||||
if (UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // It's not me
|
||||
|
|
|
@ -255,7 +255,8 @@ The IP address of the remote host making the request.
|
|||
void Sta_GetRemoteAddr (void)
|
||||
{
|
||||
if (getenv ("REMOTE_ADDR"))
|
||||
Str_Copy (Gbl.IP,getenv ("REMOTE_ADDR"),Cns_MAX_LENGTH_IP);
|
||||
Str_Copy (Gbl.IP,getenv ("REMOTE_ADDR"),
|
||||
Cns_MAX_LENGTH_IP);
|
||||
else
|
||||
Gbl.IP[0] = '\0';
|
||||
}
|
||||
|
@ -983,7 +984,8 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
|
|||
switch (Gbl.Stat.CountType)
|
||||
{
|
||||
case Sta_TOTAL_CLICKS:
|
||||
Str_Copy (StrQueryCountType,"COUNT(*)",Sta_MAX_LENGTH_COUNT_TYPE);
|
||||
Str_Copy (StrQueryCountType,"COUNT(*)",
|
||||
Sta_MAX_LENGTH_COUNT_TYPE);
|
||||
break;
|
||||
case Sta_DISTINCT_USRS:
|
||||
sprintf (StrQueryCountType,"COUNT(DISTINCT(%s.UsrCod))",LogTable);
|
||||
|
@ -5451,10 +5453,14 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
|
|||
|
||||
if (SizeOfFileZones.NumCrss == -1)
|
||||
{
|
||||
Str_Copy (StrNumCrss ,"-",10);
|
||||
Str_Copy (StrNumFoldersPerCrs,"-",10);
|
||||
Str_Copy (StrNumFilesPerCrs ,"-",10);
|
||||
Str_Copy (FileSizePerCrsStr ,"-",Fil_MAX_BYTES_FILE_SIZE_STRING);
|
||||
Str_Copy (StrNumCrss,"-",
|
||||
10);
|
||||
Str_Copy (StrNumFoldersPerCrs,"-",
|
||||
10);
|
||||
Str_Copy (StrNumFilesPerCrs,"-",
|
||||
10);
|
||||
Str_Copy (FileSizePerCrsStr,"-",
|
||||
Fil_MAX_BYTES_FILE_SIZE_STRING);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5474,16 +5480,21 @@ static void Sta_WriteRowStatsFileBrowsers (Brw_FileBrowser_t FileZone,const char
|
|||
}
|
||||
|
||||
if (SizeOfFileZones.NumGrps == -1)
|
||||
Str_Copy (StrNumGrps,"-",10);
|
||||
Str_Copy (StrNumGrps,"-",
|
||||
10);
|
||||
else
|
||||
sprintf (StrNumGrps,"%d",SizeOfFileZones.NumGrps);
|
||||
|
||||
if (SizeOfFileZones.NumUsrs == -1)
|
||||
{
|
||||
Str_Copy (StrNumUsrs ,"-",10);
|
||||
Str_Copy (StrNumFoldersPerUsr,"-",10);
|
||||
Str_Copy (StrNumFilesPerUsr ,"-",10);
|
||||
Str_Copy (FileSizePerUsrStr ,"-",Fil_MAX_BYTES_FILE_SIZE_STRING);
|
||||
Str_Copy (StrNumUsrs,"-",
|
||||
10);
|
||||
Str_Copy (StrNumFoldersPerUsr,"-",
|
||||
10);
|
||||
Str_Copy (StrNumFilesPerUsr,"-",
|
||||
10);
|
||||
Str_Copy (FileSizePerUsrStr,"-",
|
||||
Fil_MAX_BYTES_FILE_SIZE_STRING);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
105
swad_string.c
105
swad_string.c
|
@ -104,7 +104,7 @@ action="https://localhost/swad/es" method="post">
|
|||
|
||||
#define MAX_LINKS 1000
|
||||
|
||||
#define MAX_BYTES_LIMITED_URL 1024 // Max. number of bytes of the URL shown on screen
|
||||
#define MAX_BYTES_LIMITED_URL (1024 - 1) // Max. number of bytes of the URL shown on screen
|
||||
|
||||
void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen)
|
||||
{
|
||||
|
@ -232,8 +232,6 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
/* Initialize anchors for this link */
|
||||
Links[NumLinks].Anchor1Nick = NULL;
|
||||
Links[NumLinks].Anchor2Nick = NULL;
|
||||
Links[NumLinks].Anchor1NickLength = 0;
|
||||
Links[NumLinks].Anchor2NickLength = 0;
|
||||
|
||||
/* Calculate length of this URL */
|
||||
Links[NumLinks].NumActualBytes = (size_t) (Links[NumLinks].PtrEnd + 1 - Links[NumLinks].PtrStart);
|
||||
|
@ -244,7 +242,8 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
/* Make a copy of this URL */
|
||||
NumBytesToCopy = (Links[NumLinks].NumActualBytes < MAX_BYTES_LIMITED_URL) ? Links[NumLinks].NumActualBytes :
|
||||
MAX_BYTES_LIMITED_URL;
|
||||
Str_Copy (LimitedURL,Links[NumLinks].PtrStart,NumBytesToCopy);
|
||||
strncpy (LimitedURL,Links[NumLinks].PtrStart,NumBytesToCopy);
|
||||
LimitedURL[NumBytesToCopy] = '\0';
|
||||
|
||||
/* Limit the number of characters on screen of the copy, and calculate its length in bytes */
|
||||
LengthVisibleLink = Str_LimitLengthHTMLStr (LimitedURL,MaxCharsURLOnScreen);
|
||||
|
@ -316,7 +315,7 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
Anchor1NickLength = strlen (Anchor1Nick);
|
||||
if ((Links[NumLinks].Anchor1Nick = (char *) malloc (Anchor1NickLength+1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to insert link.");
|
||||
Str_Copy (Links[NumLinks].Anchor1Nick,Anchor1Nick,Anchor1NickLength);
|
||||
strcpy (Links[NumLinks].Anchor1Nick,Anchor1Nick);
|
||||
Links[NumLinks].Anchor1NickLength = Anchor1NickLength;
|
||||
|
||||
/* Store second part of anchor */
|
||||
|
@ -329,7 +328,7 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
Anchor2NickLength = strlen (Anchor2Nick);
|
||||
if ((Links[NumLinks].Anchor2Nick = (char *) malloc (Anchor2NickLength+1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to insert link.");
|
||||
Str_Copy (Links[NumLinks].Anchor2Nick,Anchor2Nick,Anchor2NickLength);
|
||||
strcpy (Links[NumLinks].Anchor2Nick,Anchor2Nick);
|
||||
Links[NumLinks].Anchor2NickLength = Anchor2NickLength;
|
||||
|
||||
AnchorNickTotalLength = Anchor1NickLength + Anchor2NickLength + Anchor3NickLength;
|
||||
|
@ -407,7 +406,8 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
|||
/* Make a copy of this URL */
|
||||
NumBytesToCopy = (Links[NumLink].NumActualBytes < MAX_BYTES_LIMITED_URL) ? Links[NumLink].NumActualBytes :
|
||||
MAX_BYTES_LIMITED_URL;
|
||||
Str_Copy (LimitedURL,Links[NumLink].PtrStart,NumBytesToCopy);
|
||||
strncpy (LimitedURL,Links[NumLink].PtrStart,NumBytesToCopy);
|
||||
LimitedURL[NumBytesToCopy] = '\0';
|
||||
|
||||
/* Limit the length of the copy */
|
||||
NumBytesToShow = Str_LimitLengthHTMLStr (LimitedURL,MaxCharsURLOnScreen);
|
||||
|
@ -985,7 +985,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
|||
if (ChangeTo != Str_DONT_CHANGE)
|
||||
{
|
||||
/***** Allocate memory for a destination string where to do the changes *****/
|
||||
if ((StrDst = (char *) malloc (MaxLengthStr)) == NULL)
|
||||
if ((StrDst = (char *) malloc (MaxLengthStr + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to change the format of a string.");
|
||||
|
||||
/***** Make the change *****/
|
||||
|
@ -1366,7 +1366,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
|||
Lay_ShowErrorAndExit ("Space allocated to string is full.");
|
||||
|
||||
/* Copy to appropiate place the special character string */
|
||||
Str_Copy (PtrDst,StrSpecialChar,LengthSpecStrDst);
|
||||
strncpy (PtrDst,StrSpecialChar,LengthSpecStrDst);
|
||||
|
||||
/* Increment pointer to character after ';' */
|
||||
PtrSrc += LengthSpecStrSrc;
|
||||
|
@ -1388,9 +1388,11 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
|
|||
LengthStrDst++;
|
||||
}
|
||||
}
|
||||
StrDst[LengthStrDst] = '\0';
|
||||
|
||||
/***** Copy destination string with changes to source string *****/
|
||||
Str_Copy (Str,StrDst,LengthStrDst); // Str <-- StrDst
|
||||
strncpy (Str,StrDst,LengthStrDst); // Str <-- StrDst
|
||||
Str[LengthStrDst] = '\0';
|
||||
|
||||
/***** Free memory used for the destination string *****/
|
||||
free ((void *) StrDst);
|
||||
|
@ -2384,12 +2386,10 @@ size_t Str_GetLengthRootFileName (const char *FileName)
|
|||
/************** Get the name of a file from a complete path ******************/
|
||||
/*****************************************************************************/
|
||||
// Split a full path in path (without ending '/' ) and a file name
|
||||
// PathWithoutFileName must have space for at least PATH_MAX+1 bytes
|
||||
// FileName must have space for at least NAME_MAX+1 bytes
|
||||
|
||||
void Str_SplitFullPathIntoPathAndFileName (const char *FullPath,
|
||||
char *PathWithoutFileName,
|
||||
char *FileName)
|
||||
void Str_SplitFullPathIntoPathAndFileName (const char FullPath[PATH_MAX + 1],
|
||||
char PathWithoutFileName[PATH_MAX + 1],
|
||||
char FileName[NAME_MAX + 1])
|
||||
{
|
||||
const char *PtrFileName;
|
||||
size_t LengthUntilFileName;
|
||||
|
@ -2405,14 +2405,17 @@ void Str_SplitFullPathIntoPathAndFileName (const char *FullPath,
|
|||
/***** Get PathWithoutFileName *****/
|
||||
LengthUntilFileName = (size_t) (PtrFileName - FullPath); // Last slash included
|
||||
if (LengthUntilFileName > 1)
|
||||
{
|
||||
Str_Copy (PathWithoutFileName,FullPath,
|
||||
LengthUntilFileName > PATH_MAX ? PATH_MAX :
|
||||
LengthUntilFileName - 1); // Do not copy ending slash
|
||||
PATH_MAX);
|
||||
PathWithoutFileName[LengthUntilFileName - 1] = '\0'; // Do not copy ending slash
|
||||
}
|
||||
else
|
||||
PathWithoutFileName[0] = '\0';
|
||||
|
||||
/***** Get FileName *****/
|
||||
Str_Copy (FileName,PtrFileName,NAME_MAX);
|
||||
Str_Copy (FileName,PtrFileName,
|
||||
NAME_MAX);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2751,10 +2754,9 @@ bool Str_ConvertFilFolLnkNameToValid (char *FileName)
|
|||
FileName);
|
||||
}
|
||||
else // FileName is empty
|
||||
Str_Copy (Gbl.Message,
|
||||
sprintf (Gbl.Message,"%s",
|
||||
Gbl.FileBrowser.UploadingWithDropzone ? Txt_UPLOAD_FILE_Invalid_name_NO_HTML :
|
||||
Txt_UPLOAD_FILE_Invalid_name,
|
||||
Lay_MAX_BYTES_ALERT);
|
||||
Txt_UPLOAD_FILE_Invalid_name);
|
||||
|
||||
return FileNameIsOK;
|
||||
}
|
||||
|
@ -2827,40 +2829,53 @@ void Str_CreateRandomAlphanumStr (char *Str,size_t Length)
|
|||
Str[Length] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Get mailbox from email address ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Str_GetMailBox (const char *Email,char *MailBox,size_t MaxLength)
|
||||
{
|
||||
const char *Ptr;
|
||||
|
||||
MailBox[0] = '\0'; // Return empty mailbox on error
|
||||
|
||||
if ((Ptr = strchr (Email,(int) '@'))) // Find first '@' in address
|
||||
if (Ptr != Email) // '@' is not the first character in Email
|
||||
{
|
||||
Ptr++; // Skip '@'
|
||||
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
|
||||
Str_Copy (MailBox,Ptr,MaxLength);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Safe string copy *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Str_Copy (char *Dst,const char *Src,size_t MaxLength)
|
||||
void Str_Copy (char *Dst,const char *Src,size_t DstSize)
|
||||
{
|
||||
strncpy (Dst,Src,MaxLength);
|
||||
Dst[MaxLength] = '\0';
|
||||
size_t LengthSrc = strlen (Src);
|
||||
|
||||
if (DstSize < LengthSrc)
|
||||
{
|
||||
sprintf (Gbl.Message,"Trying to copy %lu chars into a %lu-chars buffer.",
|
||||
LengthSrc,DstSize);
|
||||
Lay_ShowErrorAndExit (Gbl.Message);
|
||||
}
|
||||
|
||||
// strncpy (Dst,Src,MaxLength);
|
||||
// Dst[MaxLength] = '\0';
|
||||
strcpy (Dst,Src);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Safe string concatenation ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Str_Concat (char *Dst,const char *Src,size_t MaxLength)
|
||||
void Str_Concat (char *Dst,const char *Src,size_t DstSize)
|
||||
{
|
||||
strncat (Dst,Src,MaxLength - strlen (Dst));
|
||||
size_t LengthDst;
|
||||
size_t LengthSrc;
|
||||
size_t FreeSpace;
|
||||
|
||||
LengthDst = strlen (Dst);
|
||||
if (LengthDst > DstSize)
|
||||
{
|
||||
sprintf (Gbl.Message,"%lu-chars buffer has %lu chars!",
|
||||
DstSize,LengthSrc);
|
||||
Lay_ShowErrorAndExit (Gbl.Message);
|
||||
}
|
||||
|
||||
FreeSpace = DstSize - LengthDst;
|
||||
LengthSrc = strlen (Src);
|
||||
if (FreeSpace < LengthSrc)
|
||||
{
|
||||
sprintf (Gbl.Message,"Trying to concatenate %lu chars to a %lu-chars buffer with free space for only %lu chars!",
|
||||
LengthSrc,DstSize,FreeSpace);
|
||||
Lay_ShowErrorAndExit (Gbl.Message);
|
||||
}
|
||||
|
||||
// strncat (Dst,Src,FreeSpace);
|
||||
strcat (Dst,Src);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
/********************************* Headers **********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <limits.h> // For NAME_MAX and PATH_MAX
|
||||
#include <stdbool.h> // For boolean type
|
||||
#include <stdio.h> // For FILE
|
||||
|
||||
|
@ -102,8 +103,9 @@ void Str_ReplaceSeveralSpacesForOne (char *Str);
|
|||
void Str_CopyStrChangingSpaces (const char *StringWithSpaces,char *StringWithoutSpaces,unsigned MaxLength);
|
||||
long Str_ConvertStrCodToLongCod (const char *Str);
|
||||
size_t Str_GetLengthRootFileName (const char *FileName);
|
||||
void Str_SplitFullPathIntoPathAndFileName (const char *FullPath,
|
||||
char *PathWithoutFileName,char *FileName);
|
||||
void Str_SplitFullPathIntoPathAndFileName (const char FullPath[PATH_MAX + 1],
|
||||
char PathWithoutFileName[PATH_MAX + 1],
|
||||
char FileName[NAME_MAX + 1]);
|
||||
bool Str_FileIs (const char *FileName,const char *Extension);
|
||||
bool Str_FileIsHTML (const char *FileName);
|
||||
bool Str_Path1BeginsByPath2 (const char *Path1,const char *Path2);
|
||||
|
@ -117,9 +119,8 @@ bool Str_ConvertFilFolLnkNameToValid (char *FileName);
|
|||
void Str_ConvertToValidFileName (char *Str);
|
||||
|
||||
void Str_CreateRandomAlphanumStr (char *Str,size_t Length);
|
||||
void Str_GetMailBox (const char *Email,char *MailBox,size_t MaxLength);
|
||||
|
||||
void Str_Copy (char *Dst,const char *Src,size_t MaxLength);
|
||||
void Str_Concat (char *Dst,const char *Src,size_t MaxLength);
|
||||
void Str_Copy (char *Dst,const char *Src,size_t DstSize);
|
||||
void Str_Concat (char *Dst,const char *Src,size_t DstSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -131,7 +131,8 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Survey *Svy);
|
|||
static bool Svy_CheckIfICanDoThisSurveyBasedOnGrps (long SvyCod);
|
||||
|
||||
static unsigned Svy_GetNumQstsSvy (long SvyCod);
|
||||
static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,char *Txt);
|
||||
static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
static void Svy_InitQst (struct SurveyQuestion *SvyQst);
|
||||
static void Svy_PutParamQstCod (long QstCod);
|
||||
static long Svy_GetParamQstCod (void);
|
||||
|
@ -690,8 +691,10 @@ static void Svy_WriteAuthor (struct Survey *Svy)
|
|||
"PHOTO15x20",Pho_ZOOM,false);
|
||||
|
||||
/***** Write name *****/
|
||||
Str_Copy (FirstName,UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Surnames,UsrDat.Surname1,Usr_MAX_BYTES_SURNAMES);
|
||||
Str_Copy (FirstName,UsrDat.FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (Surnames,UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_SURNAMES);
|
||||
if (UsrDat.Surname2[0])
|
||||
{
|
||||
Str_Concat (Surnames," ",Usr_MAX_BYTES_SURNAMES);
|
||||
|
@ -1247,7 +1250,8 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
|
|||
Svy->Status.Open = (row[8][0] == '1');
|
||||
|
||||
/* Get the title of the survey (row[9]) */
|
||||
Str_Copy (Svy->Title,row[9],Svy_MAX_LENGTH_SURVEY_TITLE);
|
||||
Str_Copy (Svy->Title,row[9],
|
||||
Svy_MAX_LENGTH_SURVEY_TITLE);
|
||||
|
||||
/* Get number of questions and number of users who have already answer this survey */
|
||||
Svy->NumQsts = Svy_GetNumQstsSvy (Svy->SvyCod);
|
||||
|
@ -1427,7 +1431,8 @@ static void Svy_GetSurveyTxtFromDB (long SvyCod,char Txt[Cns_MAX_BYTES_TEXT + 1]
|
|||
{
|
||||
/* Get info text */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Txt,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Txt,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
else
|
||||
Txt[0] = '\0';
|
||||
|
@ -1467,7 +1472,8 @@ void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Get summary *****/
|
||||
Str_Copy (SummaryStr,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (SummaryStr,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
|
@ -1477,7 +1483,8 @@ void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
|
|||
Length = strlen (row[1]);
|
||||
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||
Str_Copy (*ContentStr,row[1],Length);
|
||||
Str_Copy (*ContentStr,row[1],
|
||||
Length);
|
||||
}
|
||||
}
|
||||
mysql_free_result (mysql_res);
|
||||
|
@ -2608,7 +2615,8 @@ void Svy_RequestEditQuestion (void)
|
|||
/******************* Show form to edit one survey question *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,char *Txt)
|
||||
static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
extern const char *Hlp_STATS_Surveys_questions;
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
|
@ -2647,7 +2655,8 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch
|
|||
SvyQst->AnswerType = Svy_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||
|
||||
/* Get the stem of the question from the database (row[2]) */
|
||||
Str_Copy (Txt,row[2],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Txt,row[2],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -2665,7 +2674,8 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch
|
|||
if (!Svy_AllocateTextChoiceAnswer (SvyQst,NumAns))
|
||||
Lay_ShowErrorAndExit (Gbl.Message);
|
||||
|
||||
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],Svy_MAX_BYTES_ANSWER);
|
||||
Str_Copy (SvyQst->AnsChoice[NumAns].Text,row[2],
|
||||
Svy_MAX_BYTES_ANSWER);
|
||||
}
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -3381,7 +3391,8 @@ static void Svy_WriteQstStem (const char *Stem)
|
|||
Length = strlen (Stem) * Str_MAX_LENGTH_SPEC_CHAR_HTML;
|
||||
if ((HeadingRigorousHTML = malloc (Length + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store stem of question.");
|
||||
Str_Copy (HeadingRigorousHTML,Stem,Length);
|
||||
Str_Copy (HeadingRigorousHTML,Stem,
|
||||
Length);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
HeadingRigorousHTML,Length,false);
|
||||
|
||||
|
@ -3426,7 +3437,8 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *Sv
|
|||
AnsLength = strlen (row[2]);
|
||||
if ((Answer = malloc (AnsLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store answer.");
|
||||
Str_Copy (Answer,row[2],AnsLength);
|
||||
Str_Copy (Answer,row[2],
|
||||
AnsLength);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Answer,AnsLength,false);
|
||||
|
||||
|
|
37
swad_test.c
37
swad_test.c
|
@ -218,7 +218,8 @@ static void Tst_GetParamNumQst (void);
|
|||
static bool Tst_GetCreateXMLFromForm (void);
|
||||
static int Tst_CountNumTagsInList (void);
|
||||
static int Tst_CountNumAnswerTypesInList (void);
|
||||
static void Tst_PutFormEditOneQst (char *Stem,char *Feedback);
|
||||
static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||
char Feedback[Cns_MAX_BYTES_TEXT + 1]);
|
||||
static void Tst_PutFloatInputField (const char *Label,const char *Field,
|
||||
double Value);
|
||||
static void Tst_PutTFInputField (const char *Label,char Value);
|
||||
|
@ -229,7 +230,8 @@ static void Tst_FreeTextChoiceAnswer (unsigned NumOpt);
|
|||
static void Tst_InitImagesOfQuestion (void);
|
||||
static void Tst_FreeImagesOfQuestion (void);
|
||||
|
||||
static void Tst_GetQstDataFromDB (char *Stem,char *Feedback);
|
||||
static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||
char Feedback[Cns_MAX_BYTES_TEXT + 1]);
|
||||
static void Tst_GetImageFromDB (int NumOpt,struct Image *Image);
|
||||
|
||||
static Tst_AnswerType_t Tst_ConvertFromUnsignedStrToAnsTyp (const char *UnsignedStr);
|
||||
|
@ -1025,7 +1027,8 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem)
|
|||
StemLength = strlen (Stem) * Str_MAX_LENGTH_SPEC_CHAR_HTML;
|
||||
if ((StemRigorousHTML = malloc (StemLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store stem of question.");
|
||||
Str_Copy (StemRigorousHTML,Stem,StemLength);
|
||||
Str_Copy (StemRigorousHTML,Stem,
|
||||
StemLength);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
StemRigorousHTML,StemLength,false);
|
||||
|
||||
|
@ -1154,7 +1157,8 @@ void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback)
|
|||
FeedbackLength = strlen (Feedback) * Str_MAX_LENGTH_SPEC_CHAR_HTML;
|
||||
if ((FeedbackRigorousHTML = malloc (FeedbackLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store stem of question.");
|
||||
Str_Copy (FeedbackRigorousHTML,Feedback,FeedbackLength);
|
||||
Str_Copy (FeedbackRigorousHTML,Feedback,
|
||||
FeedbackLength);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
FeedbackRigorousHTML,FeedbackLength,false);
|
||||
|
||||
|
@ -3055,7 +3059,8 @@ static void Tst_WriteAnswersOfAQstEdit (long QstCod)
|
|||
LengthAnswer = strlen (row[1]) * Str_MAX_LENGTH_SPEC_CHAR_HTML;
|
||||
if ((Answer = malloc (LengthAnswer + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store answer.");
|
||||
Str_Copy (Answer,row[1],LengthAnswer);
|
||||
Str_Copy (Answer,row[1],
|
||||
LengthAnswer);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Answer,LengthAnswer,false);
|
||||
|
||||
|
@ -3068,7 +3073,8 @@ static void Tst_WriteAnswersOfAQstEdit (long QstCod)
|
|||
LengthFeedback = strlen (row[2]) * Str_MAX_LENGTH_SPEC_CHAR_HTML;
|
||||
if ((Feedback = malloc (LengthFeedback + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store feedback.");
|
||||
Str_Copy (Feedback,row[2],LengthFeedback);
|
||||
Str_Copy (Feedback,row[2],
|
||||
LengthFeedback);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Feedback,LengthFeedback,false);
|
||||
}
|
||||
|
@ -4453,7 +4459,8 @@ void Tst_ShowFormEditOneQst (void)
|
|||
// 2. By clicking "Edit" icon in a listing of existing questions
|
||||
// 3. From the action associated to reception of a question, on error in the parameters received from the form
|
||||
|
||||
static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
||||
static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||
char Feedback[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
extern const char *Hlp_ASSESSMENT_Tests;
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
|
@ -5038,7 +5045,8 @@ static void Tst_FreeImagesOfQuestion (void)
|
|||
/****************** Get data of a question from database *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Tst_GetQstDataFromDB (char *Stem,char *Feedback)
|
||||
static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||
char Feedback[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -5073,13 +5081,15 @@ static void Tst_GetQstDataFromDB (char *Stem,char *Feedback)
|
|||
Gbl.Test.Shuffle = (row[1][0] == 'Y');
|
||||
|
||||
/* Get the stem of the question from the database (row[2]) */
|
||||
Str_Copy (Stem,row[2],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Stem,row[2],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Get the feedback of the question from the database (row[3]) */
|
||||
Feedback[0] = '\0';
|
||||
if (row[3])
|
||||
if (row[3][0])
|
||||
Str_Copy (Feedback,row[3],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Feedback,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Get the image name, title and URL of the question
|
||||
from the database (row[4], row[5], row[6]) */
|
||||
|
@ -5095,7 +5105,8 @@ static void Tst_GetQstDataFromDB (char *Stem,char *Feedback)
|
|||
NumRow++)
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Gbl.Test.Tags.Txt[NumRow],row[0],Tst_MAX_BYTES_TAG);
|
||||
Str_Copy (Gbl.Test.Tags.Txt[NumRow],row[0],
|
||||
Tst_MAX_BYTES_TAG);
|
||||
}
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
|
@ -5755,13 +5766,13 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
if ((TagCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
{
|
||||
Str_Copy (Gbl.Message,"Wrong code of tag.",Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s","Wrong code of tag.");
|
||||
Error = true;
|
||||
}
|
||||
}
|
||||
else if (NumRows > 1)
|
||||
{
|
||||
Str_Copy (Gbl.Message,"Duplicated tag.",Lay_MAX_BYTES_ALERT);
|
||||
sprintf (Gbl.Message,"%s","Duplicated tag.");
|
||||
Error = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -571,7 +571,8 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
|
|||
if (TagElem->Content)
|
||||
{
|
||||
Str_Copy (Gbl.Test.Tags.Txt[Gbl.Test.Tags.Num],
|
||||
TagElem->Content,Tst_MAX_BYTES_TAG);
|
||||
TagElem->Content,
|
||||
Tst_MAX_BYTES_TAG);
|
||||
Gbl.Test.Tags.Num++;
|
||||
}
|
||||
}
|
||||
|
@ -587,7 +588,8 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
|
|||
if (StemElem->Content)
|
||||
{
|
||||
/* Convert stem from text to HTML (in database stem is stored in HTML) */
|
||||
Str_Copy (Stem,StemElem->Content,Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Stem,StemElem->Content,
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
|
||||
Stem,Cns_MAX_BYTES_TEXT,true);
|
||||
|
||||
|
@ -843,7 +845,8 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
|
|||
if (!strcmp (LowerUpperElem->TagName,"lower"))
|
||||
{
|
||||
if (LowerUpperElem->Content)
|
||||
Str_Copy (Gbl.Test.Answer.Options[0].Text,LowerUpperElem->Content,
|
||||
Str_Copy (Gbl.Test.Answer.Options[0].Text,
|
||||
LowerUpperElem->Content,
|
||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||
break; // Only first element "lower"
|
||||
}
|
||||
|
@ -853,7 +856,8 @@ static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem)
|
|||
if (!strcmp (LowerUpperElem->TagName,"upper"))
|
||||
{
|
||||
if (LowerUpperElem->Content)
|
||||
Str_Copy (Gbl.Test.Answer.Options[1].Text,LowerUpperElem->Content,
|
||||
Str_Copy (Gbl.Test.Answer.Options[1].Text,
|
||||
LowerUpperElem->Content,
|
||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||
break; // Only first element "upper"
|
||||
}
|
||||
|
|
|
@ -743,12 +743,14 @@ static void TT_CreatTimeTableFromDB (long UsrCod)
|
|||
(Gbl.TimeTable.Type == TT_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[7]) :
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
Str_Copy (TimeTable[Day][Hour].Columns[FirstFreeColumn].Group,
|
||||
row[5],TT_MAX_BYTES_GROUP);
|
||||
row[5],
|
||||
TT_MAX_BYTES_GROUP);
|
||||
TimeTable[Day][Hour].Columns[FirstFreeColumn].GrpCod = GrpCod;
|
||||
// no break;
|
||||
case TT_TUTOR_TIMETABLE:
|
||||
Str_Copy (TimeTable[Day][Hour].Columns[FirstFreeColumn].Place,
|
||||
row[3],TT_MAX_BYTES_PLACE);
|
||||
row[3],
|
||||
TT_MAX_BYTES_PLACE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -798,9 +800,11 @@ static void TT_ModifTimeTable (void)
|
|||
TimeTable[Gbl.TimeTable.Day][Gbl.TimeTable.Hour].Columns[Gbl.TimeTable.Column].ClassType = Gbl.TimeTable.ClassType;
|
||||
TimeTable[Gbl.TimeTable.Day][Gbl.TimeTable.Hour].Columns[Gbl.TimeTable.Column].Duration = Gbl.TimeTable.Duration;
|
||||
Str_Copy (TimeTable[Gbl.TimeTable.Day][Gbl.TimeTable.Hour].Columns[Gbl.TimeTable.Column].Group,
|
||||
Gbl.TimeTable.Group,TT_MAX_BYTES_GROUP);
|
||||
Gbl.TimeTable.Group,
|
||||
TT_MAX_BYTES_GROUP);
|
||||
Str_Copy (TimeTable[Gbl.TimeTable.Day][Gbl.TimeTable.Hour].Columns[Gbl.TimeTable.Column].Place,
|
||||
Gbl.TimeTable.Place,TT_MAX_BYTES_PLACE);
|
||||
Gbl.TimeTable.Place,
|
||||
TT_MAX_BYTES_PLACE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
80
swad_user.c
80
swad_user.c
|
@ -485,7 +485,8 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get encrypted password */
|
||||
Str_Copy (UsrDat->Password,row[1],Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64);
|
||||
Str_Copy (UsrDat->Password,row[1],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64);
|
||||
|
||||
/* Get roles */
|
||||
UsrDat->RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
|
||||
|
@ -497,9 +498,12 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
Rol_VISITOR; // User belongs to some courses
|
||||
|
||||
/* Get name */
|
||||
Str_Copy (UsrDat->Surname1 ,row[2],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2 ,row[3],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->FirstName,row[4],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname1,row[2],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2,row[3],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->FirstName,row[4],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
/* Get sex */
|
||||
UsrDat->Sex = Usr_GetSexFromStr (row[5]);
|
||||
|
@ -544,7 +548,8 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
UsrDat->Prefs.FirstDayOfWeek = UnsignedNum;
|
||||
|
||||
/* Get rest of data */
|
||||
Str_Copy (UsrDat->Photo,row[10],Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Str_Copy (UsrDat->Photo,row[10],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[11]);
|
||||
UsrDat->ProfileVisibility = Pri_GetVisibilityFromStr (row[12]);
|
||||
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[13]);
|
||||
|
@ -553,14 +558,21 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
|
||||
UsrDat->Tch.DptCod = Str_ConvertStrCodToLongCod (row[16]);
|
||||
UsrDat->Tch.CtrCod = Str_ConvertStrCodToLongCod (row[17]);
|
||||
Str_Copy (UsrDat->Tch.Office ,row[18],Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->Tch.OfficePhone,row[19],Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->Tch.Office,row[18],
|
||||
Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->Tch.OfficePhone,row[19],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
|
||||
Str_Copy (UsrDat->LocalAddress ,row[20],Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->LocalPhone ,row[21],Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->FamilyAddress,row[22],Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->FamilyPhone ,row[23],Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->OriginPlace ,row[24],Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->LocalAddress,row[20],
|
||||
Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->LocalPhone,row[21],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->FamilyAddress,row[22],
|
||||
Cns_MAX_BYTES_STRING);
|
||||
Str_Copy (UsrDat->FamilyPhone,row[23],
|
||||
Usr_MAX_BYTES_PHONE);
|
||||
Str_Copy (UsrDat->OriginPlace,row[24],
|
||||
Cns_MAX_BYTES_STRING);
|
||||
|
||||
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[25]);
|
||||
|
||||
|
@ -618,7 +630,8 @@ static void Usr_GetUsrCommentsFromString (char *Str,struct UsrData *UsrDat)
|
|||
/***** Check that memory for comments is allocated *****/
|
||||
if (UsrDat->Comments)
|
||||
/***** Copy comments from Str to Comments *****/
|
||||
Str_Copy (UsrDat->Comments,Str,Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (UsrDat->Comments,Str,
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -704,7 +717,8 @@ static Usr_Sex_t Usr_GetSexFromStr (const char *Str)
|
|||
|
||||
void Usr_BuildFullName (struct UsrData *UsrDat)
|
||||
{
|
||||
Str_Copy (UsrDat->FullName,UsrDat->FirstName,Usr_MAX_BYTES_FULL_NAME);
|
||||
Str_Copy (UsrDat->FullName,UsrDat->FirstName,
|
||||
Usr_MAX_BYTES_FULL_NAME);
|
||||
if (UsrDat->Surname1[0])
|
||||
{
|
||||
Str_Concat (UsrDat->FullName," ",Usr_MAX_BYTES_FULL_NAME);
|
||||
|
@ -727,10 +741,12 @@ void Usr_RestrictLengthAndWriteName (const struct UsrData *UsrDat,unsigned MaxCh
|
|||
char Surnames[Usr_MAX_BYTES_SURNAMES + 1];
|
||||
|
||||
/***** Restrict length of firstname and surnames *****/
|
||||
Str_Copy (FirstName,UsrDat->FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (FirstName,UsrDat->FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_LimitLengthHTMLStr (FirstName,MaxChars);
|
||||
|
||||
Str_Copy (Surnames,UsrDat->Surname1,Usr_MAX_BYTES_SURNAMES);
|
||||
Str_Copy (Surnames,UsrDat->Surname1,
|
||||
Usr_MAX_BYTES_SURNAMES);
|
||||
if (UsrDat->Surname2[0])
|
||||
{
|
||||
Str_Concat (Surnames," ",Usr_MAX_BYTES_SURNAMES);
|
||||
|
@ -1996,7 +2012,8 @@ void Usr_CreateBirthdayStrDB (const struct UsrData *UsrDat,
|
|||
if (UsrDat->Birthday.Year == 0 ||
|
||||
UsrDat->Birthday.Month == 0 ||
|
||||
UsrDat->Birthday.Day == 0)
|
||||
Str_Copy (BirthdayStrDB,"NULL",Usr_BIRTHDAY_STR_DB_LENGTH);
|
||||
Str_Copy (BirthdayStrDB,"NULL",
|
||||
Usr_BIRTHDAY_STR_DB_LENGTH);
|
||||
else
|
||||
sprintf (BirthdayStrDB,"'%04u-%02u-%02u'",
|
||||
UsrDat->Birthday.Year,
|
||||
|
@ -2105,7 +2122,8 @@ void Usr_WriteLoggedUsrHead (void)
|
|||
/* Name */
|
||||
if (Gbl.Usrs.Me.UsrDat.FullName[0])
|
||||
{
|
||||
Str_Copy (UsrName,Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrName,Gbl.Usrs.Me.UsrDat.FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_LimitLengthHTMLStr (UsrName,12);
|
||||
fprintf (Gbl.F.Out,"%s",UsrName);
|
||||
}
|
||||
|
@ -2976,7 +2994,8 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
|
|||
/***** Checkbox to select user *****/
|
||||
// Two colors are used alternatively to better distinguish the rows
|
||||
if (UsrIsTheMsgSender)
|
||||
Str_Copy (BgColor,"LIGHT_GREEN",Usr_MAX_LENGTH_BG_COLOR);
|
||||
Str_Copy (BgColor,"LIGHT_GREEN",
|
||||
Usr_MAX_LENGTH_BG_COLOR);
|
||||
else
|
||||
sprintf (BgColor,"COLOR%u",Gbl.RowEvenOdd);
|
||||
|
||||
|
@ -3247,7 +3266,8 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
|
|||
if (Rec_GetFieldFromCrsRecord (UsrDat->UsrCod,Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res))
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Text,row[0],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (Text,row[0],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Text,Cns_MAX_BYTES_TEXT,false); // Se convierte of HTML a HTML respetuoso
|
||||
}
|
||||
|
@ -4676,13 +4696,16 @@ static void Usr_GetListUsrsFromQuery (const char *Query,Rol_Role_t Role,Sco_Scop
|
|||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get user's surname 1 (row[2]) */
|
||||
Str_Copy (UsrInList->Surname1 ,row[2],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrInList->Surname1,row[2],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
/* Get user's surname 2 (row[3]) */
|
||||
Str_Copy (UsrInList->Surname2 ,row[3],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrInList->Surname2,row[3],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
/* Get user's first name (row[4]) */
|
||||
Str_Copy (UsrInList->FirstName,row[4],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrInList->FirstName,row[4],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
/* Get user's sex (row[5]) */
|
||||
UsrInList->Sex = Usr_GetSexFromStr (row[5]);
|
||||
|
@ -4787,9 +4810,12 @@ 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);
|
||||
Str_Copy (UsrDat->Surname1 ,UsrInList->Surname1 ,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2 ,UsrInList->Surname2 ,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->FirstName,UsrInList->FirstName,Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname1,UsrInList->Surname1,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2,UsrInList->Surname2,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->FirstName,UsrInList->FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
UsrDat->Sex = UsrInList->Sex;
|
||||
Str_Copy (UsrDat->Photo,UsrInList->Photo,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
@ -5128,7 +5154,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
|||
{
|
||||
if (strlen (UsrDat.EncryptedUsrCod) < Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS)
|
||||
Str_Copy (Gbl.Usrs.Select.All,UsrDat.EncryptedUsrCod,
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64); // Add first user
|
||||
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); // Add first user
|
||||
}
|
||||
else // Not first user in list
|
||||
{
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#define Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 12
|
||||
#define Usr_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 60
|
||||
|
||||
#define Usr_MAX_BYTES_USR_EMAIL (128-1)
|
||||
#define Usr_MAX_LENGTH_USR_LOGIN (128 - 1) // @nick, email or ID
|
||||
#define Usr_MAX_BYTES_USR_LOGIN (128 - 1)
|
||||
|
||||
|
@ -66,6 +65,8 @@
|
|||
// Surname1 +' '+ Surname2 + ','+' ' + FirstName
|
||||
// Surname1 +' '+ Surname2 + '<br />' + FirstName
|
||||
|
||||
#define Usr_MAX_BYTES_USR_EMAIL (128 - 1)
|
||||
|
||||
#define Usr_BIRTHDAY_STR_DB_LENGTH (4+1+2+1+2) // "'%04u-%02u-%02u'"
|
||||
|
||||
#define Usr_MAX_LENGTH_PHONE 16
|
||||
|
|
|
@ -214,7 +214,7 @@ static int Svc_GetCurrentDegCodFromCurrentCrsCod (void);
|
|||
static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod);
|
||||
|
||||
static int Svc_CheckParamsNewAccount (char *NewNicknameWithArroba, // Input
|
||||
char *NewNicknameWithoutArroba, // Output
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1], // Output
|
||||
char *NewEmail, // Input-output
|
||||
char *NewPlainPassword, // Input
|
||||
char *NewEncryptedPassword); // Output
|
||||
|
@ -553,12 +553,16 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get user's name */
|
||||
Str_Copy (UsrDat->Surname1 ,row[0],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2 ,row[1],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->FirstName,row[2],Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname1,row[0],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->Surname2,row[1],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (UsrDat->FirstName,row[2],
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
/* Get user's photo */
|
||||
Str_Copy (UsrDat->Photo,row[3],Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
Str_Copy (UsrDat->Photo,row[3],
|
||||
Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64);
|
||||
|
||||
/* Get user's brithday */
|
||||
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[4]);
|
||||
|
@ -637,7 +641,7 @@ int swad__createAccount (struct soap *soap,
|
|||
char *userNickname,char *userEmail,char *userPassword,char *appKey, // input
|
||||
struct swad__createAccountOutput *createAccountOut) // output
|
||||
{
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||
char NewEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||
int Result;
|
||||
int ReturnCode;
|
||||
|
@ -690,7 +694,8 @@ int swad__createAccount (struct soap *soap,
|
|||
if (Mai_UpdateEmailInDB (&Gbl.Usrs.Me.UsrDat,userEmail))
|
||||
{
|
||||
/* Email updated sucessfully */
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,userEmail,Usr_MAX_BYTES_USR_EMAIL);
|
||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,userEmail,
|
||||
Usr_MAX_BYTES_USR_EMAIL);
|
||||
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
|
||||
}
|
||||
|
||||
|
@ -708,7 +713,7 @@ int swad__createAccount (struct soap *soap,
|
|||
// Return false on error
|
||||
//char *userNickname,char *userEmail,char *userID,char *userPassword
|
||||
static int Svc_CheckParamsNewAccount (char *NewNicknameWithArroba, // Input
|
||||
char *NewNicknameWithoutArroba, // Output
|
||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1], // Output
|
||||
char *NewEmail, // Input-output
|
||||
char *NewPlainPassword, // Input
|
||||
char *NewEncryptedPassword) // Output
|
||||
|
@ -718,7 +723,7 @@ static int Svc_CheckParamsNewAccount (char *NewNicknameWithArroba, // Input
|
|||
/***** Step 1/3: Check new nickname *****/
|
||||
/* Make a copy without possible starting arrobas */
|
||||
Str_Copy (NewNicknameWithoutArroba,NewNicknameWithArroba,
|
||||
Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
if (Nck_CheckIfNickWithArrobaIsValid (NewNicknameWithArroba)) // If new nickname is valid
|
||||
{
|
||||
/***** Remove arrobas at the beginning *****/
|
||||
|
@ -802,7 +807,8 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
return ReturnCode;
|
||||
|
||||
/***** Check if user's email, @nickname or ID are valid *****/
|
||||
Str_Copy (UsrIDNickOrEmail,userID,Usr_MAX_BYTES_USR_LOGIN);
|
||||
Str_Copy (UsrIDNickOrEmail,userID,
|
||||
Usr_MAX_BYTES_USR_LOGIN);
|
||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||
{
|
||||
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
||||
|
@ -877,20 +883,26 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
|||
|
||||
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
||||
Str_Copy (loginByUserPasswordKeyOut->userID,
|
||||
Gbl.Usrs.Me.UsrDat.IDs.List[0].ID,ID_MAX_LENGTH_USR_ID); // TODO: What user's ID?
|
||||
Gbl.Usrs.Me.UsrDat.IDs.List[0].ID, // TODO: What user's ID?
|
||||
ID_MAX_LENGTH_USR_ID);
|
||||
|
||||
Str_Copy (loginByUserPasswordKeyOut->userSurname1,
|
||||
Gbl.Usrs.Me.UsrDat.Surname1,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (loginByUserPasswordKeyOut->userSurname2,
|
||||
Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Me.UsrDat.Surname2,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (loginByUserPasswordKeyOut->userFirstname,
|
||||
Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Me.UsrDat.FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
Str_Copy (loginByUserPasswordKeyOut->userBirthday,
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
|
||||
Dat_LENGTH_YYYYMMDD);
|
||||
|
||||
loginByUserPasswordKeyOut->userRole = Svc_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB];
|
||||
|
||||
|
@ -1028,17 +1040,22 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
ID_MAX_LENGTH_USR_ID);
|
||||
|
||||
Str_Copy (loginBySessionKeyOut->userSurname1,
|
||||
Gbl.Usrs.Me.UsrDat.Surname1,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (loginBySessionKeyOut->userSurname2,
|
||||
Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Me.UsrDat.Surname2,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
Str_Copy (loginBySessionKeyOut->userFirstname,
|
||||
Gbl.Usrs.Me.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Me.UsrDat.FirstName,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
Str_Copy (loginBySessionKeyOut->userBirthday,
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
|
||||
Dat_LENGTH_YYYYMMDD);
|
||||
|
||||
loginBySessionKeyOut->userRole = Svc_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB];
|
||||
|
||||
|
@ -1080,7 +1097,8 @@ int swad__getNewPassword (struct soap *soap,
|
|||
return ReturnCode;
|
||||
|
||||
/***** Check if user's email, @nickname or ID are valid *****/
|
||||
Str_Copy (UsrIDNickOrEmail,userID,Usr_MAX_BYTES_USR_LOGIN);
|
||||
Str_Copy (UsrIDNickOrEmail,userID,
|
||||
Usr_MAX_BYTES_USR_LOGIN);
|
||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||
{
|
||||
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
||||
|
@ -1208,13 +1226,13 @@ int swad__getCourses (struct soap *soap,
|
|||
|
||||
/* Get course short name (row[1]) */
|
||||
getCoursesOut->coursesArray.__ptr[NumRow].courseShortName = (char *) soap_malloc (Gbl.soap,Crs_MAX_LENGTH_COURSE_SHRT_NAME + 1);
|
||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseShortName,
|
||||
row[1],Crs_MAX_LENGTH_COURSE_SHRT_NAME);
|
||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseShortName,row[1],
|
||||
Crs_MAX_LENGTH_COURSE_SHRT_NAME);
|
||||
|
||||
/* Get course full name (row[2]) */
|
||||
getCoursesOut->coursesArray.__ptr[NumRow].courseFullName = (char *) soap_malloc (Gbl.soap,Crs_MAX_LENGTH_COURSE_FULL_NAME + 1);
|
||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseFullName,
|
||||
row[2],Crs_MAX_LENGTH_COURSE_FULL_NAME);
|
||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseFullName,row[2],
|
||||
Crs_MAX_LENGTH_COURSE_FULL_NAME);
|
||||
|
||||
/* Get role (row[3]) */
|
||||
if (sscanf (row[3],"%u",&Role) != 1) // Role in this course
|
||||
|
@ -1311,7 +1329,8 @@ int swad__getCourseInfo (struct soap *soap,
|
|||
Inf_GetAndCheckInfoSrcFromDB (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Info.Type,&InfoSrc,&MustBeRead);
|
||||
Length = strlen (NamesInWSForInfoSrc[InfoSrc]);
|
||||
getCourseInfo->infoSrc = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc],Length);
|
||||
Str_Copy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc],
|
||||
Length);
|
||||
|
||||
/***** Set paths *****/
|
||||
Hie_InitHierarchy ();
|
||||
|
@ -1495,7 +1514,8 @@ int swad__findUsers (struct soap *soap,
|
|||
Role = Svc_SvcRole_to_RolRole[userRole];
|
||||
|
||||
/***** Query users beloging to course or group from database *****/
|
||||
Str_Copy (Gbl.Search.Str,filter,Sch_MAX_LENGTH_STRING_TO_FIND);
|
||||
Str_Copy (Gbl.Search.Str,filter,
|
||||
Sch_MAX_LENGTH_STRING_TO_FIND);
|
||||
|
||||
if (Gbl.Search.Str[0]) // Search some users
|
||||
{
|
||||
|
@ -1670,8 +1690,8 @@ int swad__getGroupTypes (struct soap *soap,
|
|||
|
||||
/* Get group type name (row[1]) */
|
||||
getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName = (char *) soap_malloc (Gbl.soap,Grp_MAX_LENGTH_GROUP_TYPE_NAME + 1);
|
||||
Str_Copy (getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName,
|
||||
row[1],Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
Str_Copy (getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName,row[1],
|
||||
Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
|
||||
/* Get whether enrollment is mandatory ('Y') or voluntary ('N') (row[2]) */
|
||||
getGroupTypesOut->groupTypesArray.__ptr[NumRow].mandatory = (row[2][0] == 'Y') ? 1 :
|
||||
|
@ -1781,8 +1801,8 @@ int swad__getGroups (struct soap *soap,
|
|||
|
||||
/* Get group type name (row[1]) */
|
||||
getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName = (char *) soap_malloc (Gbl.soap,Grp_MAX_LENGTH_GROUP_TYPE_NAME + 1);
|
||||
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,
|
||||
row[1],Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,row[1],
|
||||
Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
|
||||
/* Get group code (row[2]) */
|
||||
GrpCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
@ -1790,8 +1810,8 @@ int swad__getGroups (struct soap *soap,
|
|||
|
||||
/* Get group name (row[3]) */
|
||||
getGroupsOut->groupsArray.__ptr[NumRow].groupName = (char *) soap_malloc (Gbl.soap,Grp_MAX_LENGTH_GROUP_NAME + 1);
|
||||
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupName,
|
||||
row[3],Grp_MAX_LENGTH_GROUP_NAME);
|
||||
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupName,row[3],
|
||||
Grp_MAX_LENGTH_GROUP_NAME);
|
||||
|
||||
/* Get max number of students of group (row[4]) and number of current students */
|
||||
MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[4]);
|
||||
|
@ -1942,8 +1962,8 @@ int swad__sendMyGroups (struct soap *soap,
|
|||
|
||||
/* Get group type name (row[1]) */
|
||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName = (char *) soap_malloc (Gbl.soap,Grp_MAX_LENGTH_GROUP_TYPE_NAME + 1);
|
||||
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,
|
||||
row[1],Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,row[1],
|
||||
Grp_MAX_LENGTH_GROUP_TYPE_NAME);
|
||||
|
||||
/* Get group code (row[2]) */
|
||||
GrpCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
@ -1951,8 +1971,8 @@ int swad__sendMyGroups (struct soap *soap,
|
|||
|
||||
/* Get group name (row[3]) */
|
||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName = (char *) soap_malloc (Gbl.soap,Grp_MAX_LENGTH_GROUP_NAME + 1);
|
||||
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName,
|
||||
row[3],Grp_MAX_LENGTH_GROUP_NAME);
|
||||
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName,row[3],
|
||||
Grp_MAX_LENGTH_GROUP_NAME);
|
||||
|
||||
/* Get max number of students of group (row[4]) and number of current students */
|
||||
MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[4]);
|
||||
|
@ -1998,7 +2018,8 @@ static void Svc_CopyUsrData (struct swad__user *Usr,struct UsrData *UsrDat,bool
|
|||
/* Copy user's nickname */
|
||||
Length = strlen (UsrDat->Nickname);
|
||||
Usr->userNickname = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (Usr->userNickname,UsrDat->Nickname,Length);
|
||||
Str_Copy (Usr->userNickname,UsrDat->Nickname,
|
||||
Length);
|
||||
|
||||
/* Copy user's first ID */
|
||||
if (UsrIDIsVisible && UsrDat->IDs.List)
|
||||
|
@ -2007,28 +2028,33 @@ static void Svc_CopyUsrData (struct swad__user *Usr,struct UsrData *UsrDat,bool
|
|||
FirstID = "********";
|
||||
Length = strlen (FirstID);
|
||||
Usr->userID = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (Usr->userID,FirstID,Length);
|
||||
Str_Copy (Usr->userID,FirstID,
|
||||
Length);
|
||||
|
||||
/* Copy user's surname1 */
|
||||
Length = strlen (UsrDat->Surname1);
|
||||
Usr->userSurname1 = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (Usr->userSurname1,UsrDat->Surname1,Length);
|
||||
Str_Copy (Usr->userSurname1,UsrDat->Surname1,
|
||||
Length);
|
||||
|
||||
/* Copy user's surname2 */
|
||||
Length = strlen (UsrDat->Surname2);
|
||||
Usr->userSurname2 = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (Usr->userSurname2,UsrDat->Surname2,Length);
|
||||
Str_Copy (Usr->userSurname2,UsrDat->Surname2,
|
||||
Length);
|
||||
|
||||
/* Copy user's first name */
|
||||
Length = strlen (UsrDat->FirstName);
|
||||
Usr->userFirstname = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (Usr->userFirstname,UsrDat->FirstName,Length);
|
||||
Str_Copy (Usr->userFirstname,UsrDat->FirstName,
|
||||
Length);
|
||||
|
||||
/* User's photo URL */
|
||||
Pho_BuildLinkToPhoto (UsrDat,PhotoURL);
|
||||
Length = strlen (PhotoURL);
|
||||
Usr->userPhoto = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (Usr->userPhoto,PhotoURL,Length);
|
||||
Str_Copy (Usr->userPhoto,PhotoURL,
|
||||
Length);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -2123,23 +2149,27 @@ int swad__getAttendanceEvents (struct soap *soap,
|
|||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1 = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1,
|
||||
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
||||
Gbl.Usrs.Other.UsrDat.Surname1,
|
||||
Length);
|
||||
|
||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname2 = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname2,
|
||||
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
||||
Gbl.Usrs.Other.UsrDat.Surname2,
|
||||
Length);
|
||||
|
||||
Length = strlen (Gbl.Usrs.Other.UsrDat.FirstName);
|
||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userFirstname = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userFirstname,
|
||||
Gbl.Usrs.Other.UsrDat.FirstName,Length);
|
||||
Gbl.Usrs.Other.UsrDat.FirstName,
|
||||
Length);
|
||||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||
Length = strlen (PhotoURL);
|
||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userPhoto = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userPhoto,
|
||||
PhotoURL,Length);
|
||||
PhotoURL,
|
||||
Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2168,14 +2198,14 @@ int swad__getAttendanceEvents (struct soap *soap,
|
|||
/* Get title of the event (row[6]) */
|
||||
Length = strlen (row[6]);
|
||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title,
|
||||
row[6],Length);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title,row[6],
|
||||
Length);
|
||||
|
||||
/* Get Txt (row[7]) */
|
||||
Length = strlen (row[7]);
|
||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text,
|
||||
row[7],Length);
|
||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text,row[7],
|
||||
Length);
|
||||
|
||||
/* Get list of groups for this attendance event */
|
||||
Svc_GetListGrpsInAttendanceEventFromDB (AttCod,&(getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].groups));
|
||||
|
@ -2323,7 +2353,8 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
|||
return soap_receiver_fault (Gbl.soap,
|
||||
"Request forbidden",
|
||||
"Title of attendance event is empty");
|
||||
Str_Copy (Att.Title,title,Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
Str_Copy (Att.Title,title,
|
||||
Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
|
||||
|
||||
/* Create a list of groups selected */
|
||||
Svc_GetLstGrpsSel (groups);
|
||||
|
@ -2566,14 +2597,16 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
Length = strlen (Gbl.Usrs.Other.UsrDat.Nickname);
|
||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userNickname = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userNickname,
|
||||
Gbl.Usrs.Other.UsrDat.Nickname,Length);
|
||||
Gbl.Usrs.Other.UsrDat.Nickname,
|
||||
Length);
|
||||
|
||||
if (Gbl.Usrs.Other.UsrDat.IDs.Num)
|
||||
{
|
||||
Length = strlen (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID); // TODO: What user's ID?
|
||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userID,
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,Length);
|
||||
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,
|
||||
Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2584,23 +2617,27 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname1 = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname1,
|
||||
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
||||
Gbl.Usrs.Other.UsrDat.Surname1,
|
||||
Length);
|
||||
|
||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname2 = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname2,
|
||||
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
||||
Gbl.Usrs.Other.UsrDat.Surname2,
|
||||
Length);
|
||||
|
||||
Length = strlen (Gbl.Usrs.Other.UsrDat.FirstName);
|
||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userFirstname = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userFirstname,
|
||||
Gbl.Usrs.Other.UsrDat.FirstName,Length);
|
||||
Gbl.Usrs.Other.UsrDat.FirstName,
|
||||
Length);
|
||||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||
Length = strlen (PhotoURL);
|
||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userPhoto = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userPhoto,
|
||||
PhotoURL,Length);
|
||||
PhotoURL,
|
||||
Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2835,7 +2872,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
NotifyEvent = Ntf_GetNotifyEventFromDB ((const char *) row[1]);
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType = (char *) soap_malloc (Gbl.soap,Ntf_MAX_LENGTH_NOTIFY_EVENT + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType,
|
||||
Ntf_WSNotifyEvents[NotifyEvent],Ntf_MAX_LENGTH_NOTIFY_EVENT);
|
||||
Ntf_WSNotifyEvents[NotifyEvent],
|
||||
Ntf_MAX_LENGTH_NOTIFY_EVENT);
|
||||
|
||||
/* Get time of the event (row[2]) */
|
||||
EventTime = 0L;
|
||||
|
@ -2859,20 +2897,24 @@ int swad__getNotifications (struct soap *soap,
|
|||
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1,
|
||||
Gbl.Usrs.Other.UsrDat.Surname1 ,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Other.UsrDat.Surname1,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2 = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2,
|
||||
Gbl.Usrs.Other.UsrDat.Surname2 ,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Other.UsrDat.Surname2,
|
||||
Usr_MAX_BYTES_NAME);
|
||||
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname = (char *) soap_malloc (Gbl.soap,Usr_MAX_BYTES_NAME + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname,
|
||||
Gbl.Usrs.Other.UsrDat.FirstName,Usr_MAX_BYTES_NAME);
|
||||
Gbl.Usrs.Other.UsrDat.FirstName,
|
||||
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);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto,
|
||||
PhotoURL,Cns_MAX_LENGTH_WWW);
|
||||
PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2927,8 +2969,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
|
||||
Txt_Institution,Ins.ShrtName);
|
||||
else
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,
|
||||
"-",Ntf_MAX_LENGTH_NOTIFY_LOCATION);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"-",
|
||||
Ntf_MAX_LENGTH_NOTIFY_LOCATION);
|
||||
|
||||
/* Get status (row[9]) */
|
||||
if (sscanf (row[9],"%u",&Status) != 1)
|
||||
|
@ -2944,7 +2986,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
Length = strlen (SummaryStr);
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].summary = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].summary,
|
||||
SummaryStr,Length);
|
||||
SummaryStr,
|
||||
Length);
|
||||
|
||||
if (ContentStr == NULL)
|
||||
{
|
||||
|
@ -2956,7 +2999,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
Length = strlen (ContentStr);
|
||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].content = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].content,
|
||||
ContentStr,Length);
|
||||
ContentStr,
|
||||
Length);
|
||||
|
||||
/* Free memory used by content string */
|
||||
free ((void *) ContentStr);
|
||||
|
@ -3097,7 +3141,7 @@ int swad__sendMessage (struct soap *soap,
|
|||
{
|
||||
int ReturnCode;
|
||||
long ReplyUsrCod = -1L;
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1];
|
||||
char Nickname[Nck_MAX_BYTES_NICKNAME_FROM_FORM+1];
|
||||
char Query[Svc_MAX_LENGTH_QUERY_RECIPIENTS + 1];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -3195,7 +3239,7 @@ int swad__sendMessage (struct soap *soap,
|
|||
while (*Ptr)
|
||||
{
|
||||
/* Find next string in text until comma (leading and trailing spaces are removed) */
|
||||
Str_GetNextStringUntilComma (&Ptr,Nickname,Nck_MAX_BYTES_NICKNAME_WITH_ARROBA);
|
||||
Str_GetNextStringUntilComma (&Ptr,Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
||||
|
||||
/* Check if string is a valid nickname */
|
||||
if (Nck_CheckIfNickWithArrobaIsValid (Nickname)) // String is a nickname?
|
||||
|
@ -3749,7 +3793,8 @@ static int Svc_GetTstQuestions (long CrsCod,long BeginTime,struct swad__getTests
|
|||
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||
getTestsOut->questionsArray.__ptr[NumRow].answerType = (char *) soap_malloc (Gbl.soap,Tst_MAX_LENGTH_ANSWER_TYPE + 1);
|
||||
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].answerType,
|
||||
Tst_StrAnswerTypesXML[AnswerType],Tst_MAX_LENGTH_ANSWER_TYPE);
|
||||
Tst_StrAnswerTypesXML[AnswerType],
|
||||
Tst_MAX_LENGTH_ANSWER_TYPE);
|
||||
|
||||
/* Get shuffle (row[2]) */
|
||||
getTestsOut->questionsArray.__ptr[NumRow].shuffle = (row[2][0] == 'Y') ? 1 :
|
||||
|
@ -3842,13 +3887,13 @@ static int Svc_GetTstAnswers (long CrsCod,long BeginTime,struct swad__getTestsOu
|
|||
|
||||
/* Get answer (row[3]) */
|
||||
getTestsOut->answersArray.__ptr[NumRow].answerText = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_TEXT + 1);
|
||||
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerText,
|
||||
row[3],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerText,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Get feedback (row[4]) */
|
||||
getTestsOut->answersArray.__ptr[NumRow].answerFeedback = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_TEXT + 1);
|
||||
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerFeedback,
|
||||
row[4],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerFeedback,row[4],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4077,7 +4122,8 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||
getTrivialQuestionOut->question.answerType = (char *) soap_malloc (Gbl.soap,Tst_MAX_LENGTH_ANSWER_TYPE + 1);
|
||||
Str_Copy (getTrivialQuestionOut->question.answerType,
|
||||
Tst_StrAnswerTypesXML[AnswerType],Tst_MAX_LENGTH_ANSWER_TYPE);
|
||||
Tst_StrAnswerTypesXML[AnswerType],
|
||||
Tst_MAX_LENGTH_ANSWER_TYPE);
|
||||
|
||||
/* Get shuffle (row[2]) */
|
||||
getTrivialQuestionOut->question.shuffle = (row[2][0] == 'Y') ? 1 :
|
||||
|
@ -4157,13 +4203,13 @@ int swad__getTrivialQuestion (struct soap *soap,
|
|||
|
||||
/* Get answer (row[3]) */
|
||||
getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_TEXT + 1);
|
||||
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText,
|
||||
row[3],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText,row[3],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/* Get feedback (row[4]) */
|
||||
getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback = (char *) soap_malloc (Gbl.soap,Cns_MAX_BYTES_TEXT + 1);
|
||||
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback,
|
||||
row[4],Cns_MAX_BYTES_TEXT);
|
||||
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback,row[4],
|
||||
Cns_MAX_BYTES_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4589,9 +4635,11 @@ int swad__getFile (struct soap *soap,
|
|||
URL);
|
||||
|
||||
/***** Copy data into output structure *****/
|
||||
Str_Copy (getFileOut->fileName,FileMetadata.FilFolLnkName,NAME_MAX);
|
||||
Str_Copy (getFileOut->fileName,FileMetadata.FilFolLnkName,
|
||||
NAME_MAX);
|
||||
|
||||
Str_Copy (getFileOut->URL,URL,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (getFileOut->URL,URL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
|
||||
getFileOut->size = (int) FileMetadata.Size;
|
||||
|
||||
|
@ -4609,7 +4657,8 @@ int swad__getFile (struct soap *soap,
|
|||
Usr_MAX_BYTES_FULL_NAME);
|
||||
|
||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||
Str_Copy (getFileOut->publisherPhoto,PhotoURL,Cns_MAX_LENGTH_WWW);
|
||||
Str_Copy (getFileOut->publisherPhoto,PhotoURL,
|
||||
Cns_MAX_LENGTH_WWW);
|
||||
}
|
||||
|
||||
return SOAP_OK;
|
||||
|
@ -4697,7 +4746,8 @@ int swad__getMarks (struct soap *soap,
|
|||
{
|
||||
Length = strlen (ContentStr);
|
||||
getMarksOut->content = (char *) soap_malloc (Gbl.soap,Length + 1);
|
||||
Str_Copy (getMarksOut->content,ContentStr,Length);
|
||||
Str_Copy (getMarksOut->content,ContentStr,
|
||||
Length);
|
||||
free ((void *) ContentStr);
|
||||
ContentStr = NULL;
|
||||
}
|
||||
|
|
12
swad_xml.c
12
swad_xml.c
|
@ -180,7 +180,8 @@ static void XML_GetElement (struct XMLElement *ParentElem)
|
|||
{
|
||||
if ((ParentElem->Content = malloc (ContentLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory.");
|
||||
Str_Copy (ParentElem->Content,StartContent,ContentLength);
|
||||
strncpy (ParentElem->Content,StartContent,ContentLength);
|
||||
ParentElem->Content[ContentLength] = '\0';
|
||||
ParentElem->ContentLength = ContentLength;
|
||||
}
|
||||
|
||||
|
@ -216,7 +217,8 @@ static void XML_GetElement (struct XMLElement *ParentElem)
|
|||
ChildElem->TagNameLength = strcspn (Gbl.XMLPtr,">/ \t");
|
||||
if ((ChildElem->TagName = malloc (ChildElem->TagNameLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory.");
|
||||
Str_Copy (ChildElem->TagName,Gbl.XMLPtr,ChildElem->TagNameLength);
|
||||
strncpy (ChildElem->TagName,Gbl.XMLPtr,ChildElem->TagNameLength);
|
||||
ChildElem->TagName[ChildElem->TagNameLength] = '\0';
|
||||
Gbl.XMLPtr += ChildElem->TagNameLength;
|
||||
|
||||
/*
|
||||
|
@ -335,7 +337,8 @@ static void XML_GetAttributes (struct XMLElement *Elem)
|
|||
Attribute->AttributeNameLength = strcspn (Gbl.XMLPtr,"=");
|
||||
if ((Attribute->AttributeName = malloc (Attribute->AttributeNameLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory.");
|
||||
Str_Copy (Attribute->AttributeName,Gbl.XMLPtr,Attribute->AttributeNameLength);
|
||||
strncpy (Attribute->AttributeName,Gbl.XMLPtr,Attribute->AttributeNameLength);
|
||||
Attribute->AttributeName[Attribute->AttributeNameLength] = '\0';
|
||||
Gbl.XMLPtr += Attribute->AttributeNameLength;
|
||||
/* End of attribute name:
|
||||
<parent><child attribute1="value" attribute2="value">...</child>...</parent>
|
||||
|
@ -364,7 +367,8 @@ static void XML_GetAttributes (struct XMLElement *Elem)
|
|||
|
||||
if ((Attribute->Content = malloc (Attribute->ContentLength + 1)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory.");
|
||||
Str_Copy (Attribute->Content,Gbl.XMLPtr,Attribute->ContentLength);
|
||||
strncpy (Attribute->Content,Gbl.XMLPtr,Attribute->ContentLength);
|
||||
Attribute->Content[Attribute->ContentLength] = '\0';
|
||||
Gbl.XMLPtr += Attribute->ContentLength;
|
||||
|
||||
Gbl.XMLPtr++;
|
||||
|
|
|
@ -272,7 +272,8 @@ static void ZIP_CreateTmpDirForCompression (void)
|
|||
Fil_RemoveOldTmpFiles (PathZipPriv,Cfg_TIME_TO_DELETE_BROWSER_ZIP_FILES,false);
|
||||
|
||||
/***** Create a new temporary directory *****/
|
||||
Str_Copy (Gbl.FileBrowser.ZIP.TmpDir,Gbl.UniqueNameEncrypted,NAME_MAX);
|
||||
Str_Copy (Gbl.FileBrowser.ZIP.TmpDir,Gbl.UniqueNameEncrypted,
|
||||
NAME_MAX);
|
||||
sprintf (PathDirTmp,"%s/%s",PathZipPriv,Gbl.FileBrowser.ZIP.TmpDir);
|
||||
if (mkdir (PathDirTmp,(mode_t) 0xFFF))
|
||||
Lay_ShowErrorAndExit ("Can not create temporary folder for compression.");
|
||||
|
@ -298,7 +299,8 @@ static void ZIP_CreateDirCompressionUsr (struct UsrData *UsrDat)
|
|||
with a name that identifies the owner
|
||||
of the assignments and works *****/
|
||||
/* Create link name for this user */
|
||||
Str_Copy (FullNameAndUsrID,UsrDat->Surname1,ZIP_MAX_LENGTH_FULL_NAME_AND_ID);
|
||||
Str_Copy (FullNameAndUsrID,UsrDat->Surname1,
|
||||
ZIP_MAX_LENGTH_FULL_NAME_AND_ID);
|
||||
if (UsrDat->Surname1[0] &&
|
||||
UsrDat->Surname2[0])
|
||||
Str_Concat (FullNameAndUsrID,"_",ZIP_MAX_LENGTH_FULL_NAME_AND_ID); // Separation between surname 1 and surname 2
|
||||
|
@ -602,7 +604,8 @@ static void ZIP_ShowLinkToDownloadZIP (const char *FileName,const char *URL,
|
|||
char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1];
|
||||
|
||||
/***** Limit length of the name of the file *****/
|
||||
Str_Copy (FileNameShort,FileName,NAME_MAX);
|
||||
Str_Copy (FileNameShort,FileName,
|
||||
NAME_MAX);
|
||||
Str_LimitLengthHTMLStr (FileNameShort,50);
|
||||
|
||||
/***** Start frame *****/
|
||||
|
|
Loading…
Reference in New Issue