mirror of https://github.com/acanas/swad-core.git
Version 16.155.21
This commit is contained in:
parent
2745f891ed
commit
5bd5fb1b59
|
@ -924,7 +924,8 @@ static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed
|
||||||
/***** Update my nickname in database *****/
|
/***** Update my nickname in database *****/
|
||||||
sprintf (Query,"INSERT INTO usr_IDs"
|
sprintf (Query,"INSERT INTO usr_IDs"
|
||||||
" (UsrCod,UsrID,CreatTime,Confirmed)"
|
" (UsrCod,UsrID,CreatTime,Confirmed)"
|
||||||
" VALUES ('%ld','%s',NOW(),'%c')",
|
" VALUES"
|
||||||
|
" ('%ld','%s',NOW(),'%c')",
|
||||||
UsrCod,NewID,
|
UsrCod,NewID,
|
||||||
Confirmed ? 'Y' :
|
Confirmed ? 'Y' :
|
||||||
'N');
|
'N');
|
||||||
|
|
|
@ -377,7 +377,8 @@ void MFU_UpdateMFUActions (void)
|
||||||
/***** Update score for the current action *****/
|
/***** Update score for the current action *****/
|
||||||
sprintf (Query,"REPLACE INTO actions_MFU"
|
sprintf (Query,"REPLACE INTO actions_MFU"
|
||||||
" (UsrCod,ActCod,Score,LastClick)"
|
" (UsrCod,ActCod,Score,LastClick)"
|
||||||
" VALUES ('%ld','%ld','%f',NOW())",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%f',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod,
|
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod,
|
||||||
Score);
|
Score);
|
||||||
|
|
|
@ -375,7 +375,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWith
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
Txt_Email,
|
Txt_Email,
|
||||||
Cns_MAX_CHARS_EMAIL,
|
Cns_MAX_CHARS_EMAIL_ADDRESS,
|
||||||
Txt_HELP_email,
|
Txt_HELP_email,
|
||||||
NewEmail);
|
NewEmail);
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ static void Acc_PrintAccountSeparator (void)
|
||||||
bool Acc_CreateMyNewAccountAndLogIn (void)
|
bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||||
{
|
{
|
||||||
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNicknameWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
||||||
char NewEmail[Cns_MAX_BYTES_EMAIL + 1];
|
char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
char NewEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
char NewEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||||
|
|
||||||
if (Acc_GetParamsNewAccount (NewNicknameWithoutArroba,NewEmail,NewEncryptedPassword))
|
if (Acc_GetParamsNewAccount (NewNicknameWithoutArroba,NewEmail,NewEncryptedPassword))
|
||||||
|
@ -578,7 +578,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||||
{
|
{
|
||||||
/* Email updated sucessfully */
|
/* Email updated sucessfully */
|
||||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,NewEmail,
|
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,NewEmail,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
|
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ static bool Acc_GetParamsNewAccount (char NewNicknameWithoutArroba[Nck_MAX_BYTES
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Step 2/3: Get new email from form *****/
|
/***** Step 2/3: Get new email from form *****/
|
||||||
Par_GetParToText ("NewEmail",NewEmail,Cns_MAX_BYTES_EMAIL);
|
Par_GetParToText ("NewEmail",NewEmail,Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
if (Mai_CheckIfEmailIsValid (NewEmail)) // New email is valid
|
if (Mai_CheckIfEmailIsValid (NewEmail)) // New email is valid
|
||||||
{
|
{
|
||||||
|
@ -717,12 +717,14 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
|
||||||
/***** Insert new user in database *****/
|
/***** Insert new user in database *****/
|
||||||
/* Insert user's data */
|
/* Insert user's data */
|
||||||
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB);
|
Usr_CreateBirthdayStrDB (UsrDat,BirthdayStrDB);
|
||||||
sprintf (Query,"INSERT INTO usr_data (EncryptedUsrCod,Password,Surname1,Surname2,FirstName,Sex,"
|
sprintf (Query,"INSERT INTO usr_data"
|
||||||
|
" (EncryptedUsrCod,Password,Surname1,Surname2,FirstName,Sex,"
|
||||||
"Theme,IconSet,Language,FirstDayOfWeek,PhotoVisibility,ProfileVisibility,"
|
"Theme,IconSet,Language,FirstDayOfWeek,PhotoVisibility,ProfileVisibility,"
|
||||||
"CtyCod,"
|
"CtyCod,"
|
||||||
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
|
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
|
||||||
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
|
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
|
||||||
" VALUES ('%s','%s','%s','%s','%s','%s',"
|
" VALUES"
|
||||||
|
" ('%s','%s','%s','%s','%s','%s',"
|
||||||
"'%s','%s','%s','%u','%s','%s',"
|
"'%s','%s','%s','%u','%s','%s',"
|
||||||
"'%ld',"
|
"'%ld',"
|
||||||
"'%s','%s','%s','%s','%s',%s,'%s',"
|
"'%s','%s','%s','%s','%s',%s,'%s',"
|
||||||
|
@ -754,8 +756,10 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
|
||||||
NumID++)
|
NumID++)
|
||||||
{
|
{
|
||||||
Str_ConvertToUpperText (UsrDat->IDs.List[NumID].ID);
|
Str_ConvertToUpperText (UsrDat->IDs.List[NumID].ID);
|
||||||
sprintf (Query,"INSERT INTO usr_IDs (UsrCod,UsrID,CreatTime,Confirmed)"
|
sprintf (Query,"INSERT INTO usr_IDs"
|
||||||
" VALUES ('%ld','%s',NOW(),'%c')",
|
" (UsrCod,UsrID,CreatTime,Confirmed)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s',NOW(),'%c')",
|
||||||
UsrDat->UsrCod,
|
UsrDat->UsrCod,
|
||||||
UsrDat->IDs.List[NumID].ID,
|
UsrDat->IDs.List[NumID].ID,
|
||||||
UsrDat->IDs.List[NumID].Confirmed ? 'Y' :
|
UsrDat->IDs.List[NumID].Confirmed ? 'Y' :
|
||||||
|
|
|
@ -512,8 +512,10 @@ static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const cha
|
||||||
char Query[128 + Cns_MAX_BYTES_SUBJECT + Cns_MAX_BYTES_TEXT];
|
char Query[128 + Cns_MAX_BYTES_SUBJECT + Cns_MAX_BYTES_TEXT];
|
||||||
|
|
||||||
/***** Select announcements not seen *****/
|
/***** Select announcements not seen *****/
|
||||||
sprintf (Query,"INSERT INTO announcements (Roles,Subject,Content)"
|
sprintf (Query,"INSERT INTO announcements"
|
||||||
" VALUES ('%u','%s','%s')",
|
" (Roles,Subject,Content)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%u','%s','%s')",
|
||||||
Roles,Subject,Content);
|
Roles,Subject,Content);
|
||||||
DB_QueryINSERT (Query,"can not create announcement");
|
DB_QueryINSERT (Query,"can not create announcement");
|
||||||
}
|
}
|
||||||
|
@ -599,7 +601,10 @@ void Ann_MarkAnnouncementAsSeen (void)
|
||||||
AnnCod = Ann_GetParamAnnCod ();
|
AnnCod = Ann_GetParamAnnCod ();
|
||||||
|
|
||||||
/***** Mark announcement as seen *****/
|
/***** Mark announcement as seen *****/
|
||||||
sprintf (Query,"REPLACE INTO ann_seen (AnnCod,UsrCod) VALUES ('%ld','%ld')",
|
sprintf (Query,"REPLACE INTO ann_seen"
|
||||||
|
" (AnnCod,UsrCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
AnnCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
AnnCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryREPLACE (Query,"can not mark announcement as seen");
|
DB_QueryREPLACE (Query,"can not mark announcement as seen");
|
||||||
|
|
||||||
|
|
|
@ -1561,8 +1561,10 @@ static void Asg_CreateGrps (long AsgCod)
|
||||||
NumGrpSel++)
|
NumGrpSel++)
|
||||||
{
|
{
|
||||||
/* Create group */
|
/* Create group */
|
||||||
sprintf (Query,"INSERT INTO asg_grp (AsgCod,GrpCod)"
|
sprintf (Query,"INSERT INTO asg_grp"
|
||||||
" VALUES ('%ld','%ld')",
|
" (AsgCod,GrpCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
AsgCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
AsgCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||||
DB_QueryINSERT (Query,"can not associate a group to an assignment");
|
DB_QueryINSERT (Query,"can not associate a group to an assignment");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1333,9 +1333,9 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
|
||||||
sprintf (Query,"INSERT INTO att_events"
|
sprintf (Query,"INSERT INTO att_events"
|
||||||
" (CrsCod,Hidden,UsrCod,"
|
" (CrsCod,Hidden,UsrCod,"
|
||||||
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
|
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
|
||||||
" VALUES ('%ld','%c','%ld',"
|
" VALUES"
|
||||||
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
" ('%ld','%c','%ld',"
|
||||||
"'%c','%s','%s')",
|
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),'%c','%s','%s')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Att->Hidden ? 'Y' :
|
Att->Hidden ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
|
@ -1476,8 +1476,10 @@ static void Att_CreateGrps (long AttCod)
|
||||||
NumGrpSel++)
|
NumGrpSel++)
|
||||||
{
|
{
|
||||||
/* Create group */
|
/* Create group */
|
||||||
sprintf (Query,"INSERT INTO att_grp (AttCod,GrpCod)"
|
sprintf (Query,"INSERT INTO att_grp"
|
||||||
" VALUES ('%ld','%ld')",
|
" (AttCod,GrpCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
AttCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
AttCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||||
DB_QueryINSERT (Query,"can not associate a group to an attendance event");
|
DB_QueryINSERT (Query,"can not associate a group to an attendance event");
|
||||||
}
|
}
|
||||||
|
@ -2548,7 +2550,8 @@ static void Att_RegUsrInAttEventChangingComments (long AttCod,long UsrCod,bool P
|
||||||
/***** Register user as assistant to an event in database *****/
|
/***** Register user as assistant to an event in database *****/
|
||||||
sprintf (Query,"REPLACE INTO att_usr"
|
sprintf (Query,"REPLACE INTO att_usr"
|
||||||
" (AttCod,UsrCod,Present,CommentStd,CommentTch)"
|
" (AttCod,UsrCod,Present,CommentStd,CommentTch)"
|
||||||
" VALUES ('%ld','%ld','%c','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%c','%s','%s')",
|
||||||
AttCod,UsrCod,
|
AttCod,UsrCod,
|
||||||
Present ? 'Y' :
|
Present ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
|
|
|
@ -911,8 +911,10 @@ static void Ban_CreateBanner (struct Banner *Ban)
|
||||||
char Query[256 + Ban_MAX_BYTES_SHRT_NAME + Ban_MAX_BYTES_FULL_NAME + Ban_MAX_BYTES_IMAGE + Cns_MAX_BYTES_WWW];
|
char Query[256 + Ban_MAX_BYTES_SHRT_NAME + Ban_MAX_BYTES_FULL_NAME + Ban_MAX_BYTES_IMAGE + Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new banner *****/
|
/***** Create a new banner *****/
|
||||||
sprintf (Query,"INSERT INTO banners (Hidden,ShortName,FullName,Img,WWW)"
|
sprintf (Query,"INSERT INTO banners"
|
||||||
" VALUES ('N','%s','%s','%s','%s')",
|
" (Hidden,ShortName,FullName,Img,WWW)"
|
||||||
|
" VALUES"
|
||||||
|
" ('N','%s','%s','%s','%s')",
|
||||||
Ban->ShrtName,Ban->FullName,Ban->Img,Ban->WWW);
|
Ban->ShrtName,Ban->FullName,Ban->Img,Ban->WWW);
|
||||||
DB_QueryINSERT (Query,"can not create banner");
|
DB_QueryINSERT (Query,"can not create banner");
|
||||||
|
|
||||||
|
|
|
@ -2749,9 +2749,11 @@ static void Ctr_CreateCentre (struct Centre *Ctr,unsigned Status)
|
||||||
Cns_MAX_BYTES_WWW];
|
Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new centre *****/
|
/***** Create a new centre *****/
|
||||||
sprintf (Query,"INSERT INTO centres (InsCod,PlcCod,Status,RequesterUsrCod,"
|
sprintf (Query,"INSERT INTO centres"
|
||||||
|
" (InsCod,PlcCod,Status,RequesterUsrCod,"
|
||||||
"ShortName,FullName,WWW,PhotoAttribution)"
|
"ShortName,FullName,WWW,PhotoAttribution)"
|
||||||
" VALUES ('%ld','%ld','%u','%ld',"
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u','%ld',"
|
||||||
"'%s','%s','%s','')",
|
"'%s','%s','%s','')",
|
||||||
Ctr->InsCod,Ctr->PlcCod,
|
Ctr->InsCod,Ctr->PlcCod,
|
||||||
Status,
|
Status,
|
||||||
|
|
|
@ -207,14 +207,18 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.155.20 (2017-03-13)"
|
#define Log_PLATFORM_VERSION "SWAD 16.155.21 (2017-03-13)"
|
||||||
#define CSS_FILE "swad16.147.css"
|
#define CSS_FILE "swad16.147.css"
|
||||||
#define JS_FILE "swad16.144.js"
|
#define JS_FILE "swad16.144.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
Version 16.155.20:Mar 13, 2017 Adjusting size of database fields. (? lines)
|
Version 16.155.21:Mar 13, 2017 Adjusting size of database fields. (216948 lines)
|
||||||
|
1 change necessary in database.
|
||||||
|
ALTER TABLE pending_emails CHANGE COLUMN E_mail E_mail VARCHAR(255) COLLATE latin1_general_ci NOT NULL;
|
||||||
|
|
||||||
|
Version 16.155.20:Mar 13, 2017 Adjusting size of database fields. (216944 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
ALTER TABLE msg_content_deleted CHANGE COLUMN ImageTitle ImageTitle VARCHAR(2047) NOT NULL DEFAULT '';
|
ALTER TABLE msg_content_deleted CHANGE COLUMN ImageTitle ImageTitle VARCHAR(2047) NOT NULL DEFAULT '';
|
||||||
|
|
||||||
|
|
|
@ -627,7 +627,8 @@ void Con_UpdateMeInConnectedList (void)
|
||||||
The role which is stored is the role of the last click *****/
|
The role which is stored is the role of the last click *****/
|
||||||
sprintf (Query,"REPLACE INTO connected"
|
sprintf (Query,"REPLACE INTO connected"
|
||||||
" (UsrCod,RoleInLastCrs,LastCrsCod,LastTime)"
|
" (UsrCod,RoleInLastCrs,LastCrsCod,LastTime)"
|
||||||
" VALUES ('%ld','%u','%ld',NOW())",
|
" VALUES"
|
||||||
|
" ('%ld','%u','%ld',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
(unsigned) Gbl.Usrs.Me.LoggedRole,
|
(unsigned) Gbl.Usrs.Me.LoggedRole,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
#define Cns_MAX_CHARS_DATE (4 + 1 + 2 + 1 + 2)
|
#define Cns_MAX_CHARS_DATE (4 + 1 + 2 + 1 + 2)
|
||||||
#define Cns_MAX_BYTES_DATE Cns_MAX_CHARS_DATE
|
#define Cns_MAX_BYTES_DATE Cns_MAX_CHARS_DATE
|
||||||
|
|
||||||
#define Cns_MAX_CHARS_EMAIL (256 - 1) // 255
|
#define Cns_MAX_CHARS_EMAIL_ADDRESS (256 - 1) // 255
|
||||||
#define Cns_MAX_BYTES_EMAIL Cns_MAX_CHARS_EMAIL // 255
|
#define Cns_MAX_BYTES_EMAIL_ADDRESS Cns_MAX_CHARS_EMAIL_ADDRESS // 255
|
||||||
|
|
||||||
#define Cns_MAX_CHARS_SUBJECT (256 - 1) // 255
|
#define Cns_MAX_CHARS_SUBJECT (256 - 1) // 255
|
||||||
#define Cns_MAX_BYTES_SUBJECT ((Cns_MAX_CHARS_SUBJECT + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 4095
|
#define Cns_MAX_BYTES_SUBJECT ((Cns_MAX_CHARS_SUBJECT + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 4095
|
||||||
|
|
|
@ -2219,8 +2219,10 @@ static void Cty_CreateCountry (struct Country *Cty)
|
||||||
Str_Concat (SubQueryWWW2,"'",
|
Str_Concat (SubQueryWWW2,"'",
|
||||||
Cty_MAX_BYTES_SUBQUERY_CTYS_WWW);
|
Cty_MAX_BYTES_SUBQUERY_CTYS_WWW);
|
||||||
}
|
}
|
||||||
sprintf (Query,"INSERT INTO countries (CtyCod,Alpha2%s%s)"
|
sprintf (Query,"INSERT INTO countries"
|
||||||
" VALUES ('%03ld','%s'%s%s)",
|
" (CtyCod,Alpha2%s%s)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%03ld','%s'%s%s)",
|
||||||
SubQueryNam1,SubQueryWWW1,
|
SubQueryNam1,SubQueryWWW1,
|
||||||
Cty->CtyCod,Cty->Alpha2,SubQueryNam2,SubQueryWWW2);
|
Cty->CtyCod,Cty->Alpha2,SubQueryNam2,SubQueryWWW2);
|
||||||
DB_QueryINSERT (Query,"can not create country");
|
DB_QueryINSERT (Query,"can not create country");
|
||||||
|
|
|
@ -1942,9 +1942,10 @@ static void Crs_CreateCourse (struct Course *Crs,unsigned Status)
|
||||||
Hie_MAX_BYTES_FULL_NAME];
|
Hie_MAX_BYTES_FULL_NAME];
|
||||||
|
|
||||||
/***** Insert new course into pending requests *****/
|
/***** Insert new course into pending requests *****/
|
||||||
sprintf (Query,"INSERT INTO courses (DegCod,Year,InsCrsCod,"
|
sprintf (Query,"INSERT INTO courses"
|
||||||
"Status,RequesterUsrCod,ShortName,FullName)"
|
" (DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName)"
|
||||||
" VALUES ('%ld','%u','%s','%u','%ld','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%u','%s','%u','%ld','%s','%s')",
|
||||||
Crs->DegCod,Crs->Year,
|
Crs->DegCod,Crs->Year,
|
||||||
Crs->InstitutionalCrsCod,
|
Crs->InstitutionalCrsCod,
|
||||||
Status,
|
Status,
|
||||||
|
@ -3286,8 +3287,10 @@ void Crs_UpdateCrsLast (void)
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT)
|
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT)
|
||||||
{
|
{
|
||||||
/***** Update my last access to current course *****/
|
/***** Update my last access to current course *****/
|
||||||
sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)"
|
sprintf (Query,"REPLACE INTO crs_last"
|
||||||
" VALUES ('%ld',NOW())",
|
" (CrsCod,LastTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld',NOW())",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
DB_QueryUPDATE (Query,"can not update last access to current course");
|
DB_QueryUPDATE (Query,"can not update last access to current course");
|
||||||
}
|
}
|
||||||
|
|
160
swad_database.c
160
swad_database.c
|
@ -1507,7 +1507,7 @@ mysql> DESCRIBE mail_domains;
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS mail_domains ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS mail_domains ("
|
||||||
"MaiCod INT NOT NULL AUTO_INCREMENT,"
|
"MaiCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"Domain VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_EMAIL
|
"Domain VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_EMAIL_ADDRESS
|
||||||
"Info VARCHAR(2047) NOT NULL," // Mai_MAX_BYTES_MAIL_INFO
|
"Info VARCHAR(2047) NOT NULL," // Mai_MAX_BYTES_MAIL_INFO
|
||||||
"UNIQUE INDEX(MaiCod),"
|
"UNIQUE INDEX(MaiCod),"
|
||||||
"UNIQUE INDEX(Domain))");
|
"UNIQUE INDEX(Domain))");
|
||||||
|
@ -1612,15 +1612,15 @@ mysql> DESCRIBE msg_rcv;
|
||||||
6 rows in set (0.00 sec)
|
6 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_rcv ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_rcv ("
|
||||||
"MsgCod INT NOT NULL,"
|
"MsgCod INT NOT NULL,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"Notified ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Notified ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"Replied ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Replied ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"Expanded ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Expanded ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"UNIQUE INDEX (UsrCod,MsgCod),"
|
"UNIQUE INDEX (UsrCod,MsgCod),"
|
||||||
"INDEX(MsgCod),"
|
"INDEX(MsgCod),"
|
||||||
"INDEX(Notified))");
|
"INDEX(Notified))");
|
||||||
|
|
||||||
/***** Table msg_rcv_deleted *****/
|
/***** Table msg_rcv_deleted *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1637,14 +1637,14 @@ mysql> DESCRIBE msg_rcv_deleted;
|
||||||
5 rows in set (0.00 sec)
|
5 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_rcv_deleted ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_rcv_deleted ("
|
||||||
"MsgCod INT NOT NULL,"
|
"MsgCod INT NOT NULL,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"Notified ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Notified ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"Replied ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Replied ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"UNIQUE INDEX(UsrCod,MsgCod),"
|
"UNIQUE INDEX(UsrCod,MsgCod),"
|
||||||
"INDEX(MsgCod),"
|
"INDEX(MsgCod),"
|
||||||
"INDEX(Notified))");
|
"INDEX(Notified))");
|
||||||
|
|
||||||
/***** Table msg_snt *****/
|
/***** Table msg_snt *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1661,14 +1661,14 @@ mysql> DESCRIBE msg_snt;
|
||||||
5 rows in set (0.00 sec)
|
5 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_snt ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_snt ("
|
||||||
"MsgCod INT NOT NULL,"
|
"MsgCod INT NOT NULL,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"Expanded ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Expanded ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"CreatTime DATETIME NOT NULL,"
|
"CreatTime DATETIME NOT NULL,"
|
||||||
"UNIQUE INDEX(MsgCod),"
|
"UNIQUE INDEX(MsgCod),"
|
||||||
"INDEX(CrsCod),"
|
"INDEX(CrsCod),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table msg_snt_deleted *****/
|
/***** Table msg_snt_deleted *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1684,13 +1684,13 @@ mysql> DESCRIBE msg_snt_deleted;
|
||||||
4 rows in set (0.00 sec)
|
4 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_snt_deleted ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS msg_snt_deleted ("
|
||||||
"MsgCod INT NOT NULL,"
|
"MsgCod INT NOT NULL,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"CreatTime DATETIME NOT NULL,"
|
"CreatTime DATETIME NOT NULL,"
|
||||||
"UNIQUE INDEX(MsgCod),"
|
"UNIQUE INDEX(MsgCod),"
|
||||||
"INDEX(CrsCod),"
|
"INDEX(CrsCod),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table notices *****/
|
/***** Table notices *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1709,18 +1709,18 @@ mysql> DESCRIBE notices;
|
||||||
7 rows in set (0.00 sec)
|
7 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS notices ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS notices ("
|
||||||
"NotCod INT NOT NULL AUTO_INCREMENT,"
|
"NotCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"CreatTime DATETIME NOT NULL,"
|
"CreatTime DATETIME NOT NULL,"
|
||||||
"Content TEXT NOT NULL,"
|
"Content TEXT NOT NULL,"
|
||||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||||
"NumNotif INT NOT NULL DEFAULT 0,"
|
"NumNotif INT NOT NULL DEFAULT 0,"
|
||||||
"UNIQUE INDEX(NotCod),"
|
"UNIQUE INDEX(NotCod),"
|
||||||
"INDEX(CrsCod,Status),"
|
"INDEX(CrsCod,Status),"
|
||||||
"INDEX(UsrCod),"
|
"INDEX(UsrCod),"
|
||||||
"INDEX(CreatTime),"
|
"INDEX(CreatTime),"
|
||||||
"INDEX(Status))");
|
"INDEX(Status))");
|
||||||
|
|
||||||
/***** Table notices_deleted *****/
|
/***** Table notices_deleted *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1738,16 +1738,16 @@ mysql> DESCRIBE notices_deleted;
|
||||||
6 rows in set (0.01 sec)
|
6 rows in set (0.01 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS notices_deleted ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS notices_deleted ("
|
||||||
"NotCod INT NOT NULL,"
|
"NotCod INT NOT NULL,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"CreatTime DATETIME NOT NULL,"
|
"CreatTime DATETIME NOT NULL,"
|
||||||
"Content TEXT NOT NULL,"
|
"Content TEXT NOT NULL,"
|
||||||
"NumNotif INT NOT NULL DEFAULT 0,"
|
"NumNotif INT NOT NULL DEFAULT 0,"
|
||||||
"UNIQUE INDEX(NotCod),"
|
"UNIQUE INDEX(NotCod),"
|
||||||
"INDEX(CrsCod),"
|
"INDEX(CrsCod),"
|
||||||
"INDEX(UsrCod),"
|
"INDEX(UsrCod),"
|
||||||
"INDEX(CreatTime))");
|
"INDEX(CreatTime))");
|
||||||
|
|
||||||
/***** Table notif *****/
|
/***** Table notif *****/
|
||||||
/*
|
/*
|
||||||
|
@ -1771,43 +1771,43 @@ mysql> DESCRIBE notif;
|
||||||
*/
|
*/
|
||||||
// TODO: Change NtfCod and LogCod from INT to BIGINT in database tables.
|
// TODO: Change NtfCod and LogCod from INT to BIGINT in database tables.
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS notif ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS notif ("
|
||||||
"NtfCod INT NOT NULL AUTO_INCREMENT,"
|
"NtfCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"NotifyEvent TINYINT NOT NULL,"
|
"NotifyEvent TINYINT NOT NULL,"
|
||||||
"ToUsrCod INT NOT NULL,"
|
"ToUsrCod INT NOT NULL,"
|
||||||
"FromUsrCod INT NOT NULL,"
|
"FromUsrCod INT NOT NULL,"
|
||||||
"InsCod INT NOT NULL DEFAULT -1,"
|
"InsCod INT NOT NULL DEFAULT -1,"
|
||||||
"CtrCod INT NOT NULL DEFAULT -1,"
|
"CtrCod INT NOT NULL DEFAULT -1,"
|
||||||
"DegCod INT NOT NULL DEFAULT -1,"
|
"DegCod INT NOT NULL DEFAULT -1,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"Cod INT NOT NULL DEFAULT -1,"
|
"Cod INT NOT NULL DEFAULT -1,"
|
||||||
"TimeNotif DATETIME NOT NULL,"
|
"TimeNotif DATETIME NOT NULL,"
|
||||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||||
"UNIQUE INDEX(NtfCod),"
|
"UNIQUE INDEX(NtfCod),"
|
||||||
"INDEX(NotifyEvent),"
|
"INDEX(NotifyEvent),"
|
||||||
"INDEX(ToUsrCod),"
|
"INDEX(ToUsrCod),"
|
||||||
"INDEX(CrsCod),"
|
"INDEX(CrsCod),"
|
||||||
"INDEX(TimeNotif))");
|
"INDEX(TimeNotif))");
|
||||||
|
|
||||||
/***** Table pending_emails *****/
|
/***** Table pending_emails *****/
|
||||||
/*
|
/*
|
||||||
MariaDB [swad]> DESCRIBE pending_emails;
|
mysql> DESCRIBE pending_emails;
|
||||||
+-------------+--------------+------+-----+---------+-------+
|
+-------------+--------------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+-------------+--------------+------+-----+---------+-------+
|
+-------------+--------------+------+-----+---------+-------+
|
||||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||||
| E_mail | varchar(127) | NO | | NULL | |
|
| E_mail | varchar(255) | NO | | NULL | |
|
||||||
| MailKey | char(43) | NO | PRI | NULL | |
|
| MailKey | char(43) | NO | PRI | NULL | |
|
||||||
| DateAndTime | datetime | NO | | NULL | |
|
| DateAndTime | datetime | NO | | NULL | |
|
||||||
+-------------+--------------+------+-----+---------+-------+
|
+-------------+--------------+------+-----+---------+-------+
|
||||||
4 rows in set (0.00 sec)
|
4 rows in set (0,00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS pending_emails ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS pending_emails ("
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"E_mail VARCHAR(127) COLLATE latin1_general_ci NOT NULL,"
|
"E_mail VARCHAR(255) COLLATE latin1_general_ci NOT NULL," // Cns_MAX_CHARS_EMAIL_ADDRESS
|
||||||
"MailKey CHAR(43) COLLATE latin1_bin NOT NULL,"
|
"MailKey CHAR(43) COLLATE latin1_bin NOT NULL," // Mai_LENGTH_EMAIL_CONFIRM_KEY
|
||||||
"DateAndTime DATETIME NOT NULL,"
|
"DateAndTime DATETIME NOT NULL,"
|
||||||
"INDEX(UsrCod),"
|
"INDEX(UsrCod),"
|
||||||
"UNIQUE INDEX(MailKey))");
|
"UNIQUE INDEX(MailKey))");
|
||||||
|
|
||||||
/***** Table pending_passwd *****/
|
/***** Table pending_passwd *****/
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1171,10 +1171,10 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status)
|
||||||
Cns_MAX_BYTES_WWW];
|
Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new degree *****/
|
/***** Create a new degree *****/
|
||||||
sprintf (Query,"INSERT INTO degrees (CtrCod,DegTypCod,Status,"
|
sprintf (Query,"INSERT INTO degrees"
|
||||||
"RequesterUsrCod,ShortName,FullName,WWW)"
|
" (CtrCod,DegTypCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
|
||||||
" VALUES ('%ld','%ld','%u',"
|
" VALUES"
|
||||||
"'%ld','%s','%s','%s')",
|
" ('%ld','%ld','%u','%ld','%s','%s','%s')",
|
||||||
Deg->CtrCod,Deg->DegTypCod,Status,
|
Deg->CtrCod,Deg->DegTypCod,Status,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,Deg->ShrtName,Deg->FullName,Deg->WWW);
|
Gbl.Usrs.Me.UsrDat.UsrCod,Deg->ShrtName,Deg->FullName,Deg->WWW);
|
||||||
Deg->DegCod = DB_QueryINSERTandReturnCode (Query,"can not create a new degree");
|
Deg->DegCod = DB_QueryINSERTandReturnCode (Query,"can not create a new degree");
|
||||||
|
|
|
@ -1089,8 +1089,10 @@ static void Dpt_CreateDepartment (struct Department *Dpt)
|
||||||
Cns_MAX_BYTES_WWW];
|
Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new department *****/
|
/***** Create a new department *****/
|
||||||
sprintf (Query,"INSERT INTO departments (InsCod,ShortName,FullName,WWW)"
|
sprintf (Query,"INSERT INTO departments"
|
||||||
" VALUES ('%ld','%s','%s','%s')",
|
" (InsCod,ShortName,FullName,WWW)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s','%s','%s')",
|
||||||
Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW);
|
Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW);
|
||||||
DB_QueryINSERT (Query,"can not create a new department");
|
DB_QueryINSERT (Query,"can not create a new department");
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,10 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
|
||||||
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
||||||
{
|
{
|
||||||
/***** Insert possible duplicate into database *****/
|
/***** Insert possible duplicate into database *****/
|
||||||
sprintf (Query,"REPLACE INTO usr_duplicated (UsrCod,InformerCod,InformTime)"
|
sprintf (Query,"REPLACE INTO usr_duplicated"
|
||||||
" VALUES ('%ld','%ld',NOW())",
|
" (UsrCod,InformerCod,InformTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW())",
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod,
|
Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not report duplicate");
|
DB_QueryINSERT (Query,"can not report duplicate");
|
||||||
|
|
|
@ -243,11 +243,15 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Register user in current course in database *****/
|
/***** Register user in current course in database *****/
|
||||||
sprintf (Query,"INSERT INTO crs_usr (CrsCod,UsrCod,Role,Accepted,"
|
sprintf (Query,"INSERT INTO crs_usr"
|
||||||
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod,NumAccTst,LastAccTst,NumQstsLastTst,"
|
" (CrsCod,UsrCod,Role,Accepted,"
|
||||||
|
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod,"
|
||||||
|
"NumAccTst,LastAccTst,NumQstsLastTst,"
|
||||||
"UsrListType,ColsClassPhoto,ListWithPhotos)"
|
"UsrListType,ColsClassPhoto,ListWithPhotos)"
|
||||||
" VALUES ('%ld','%ld','%u','%c',"
|
" VALUES"
|
||||||
"'-1','-1','-1','0',FROM_UNIXTIME('%ld'),'0',"
|
" ('%ld','%ld','%u','%c',"
|
||||||
|
"'-1','-1','-1',"
|
||||||
|
"'0',FROM_UNIXTIME('%ld'),'0',"
|
||||||
"'%s','%u','%c')",
|
"'%s','%u','%c')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole,
|
Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole,
|
||||||
KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' :
|
KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' :
|
||||||
|
@ -330,7 +334,7 @@ void Enr_WriteFormToReqAnotherUsrID (Act_Action_t NextAction)
|
||||||
"</label>",
|
"</label>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
Txt_nick_email_or_ID,
|
Txt_nick_email_or_ID,
|
||||||
Cns_MAX_CHARS_EMAIL);
|
Cns_MAX_CHARS_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/***** Send button*****/
|
/***** Send button*****/
|
||||||
Lay_PutConfirmButton (Txt_Continue);
|
Lay_PutConfirmButton (Txt_Continue);
|
||||||
|
@ -1421,7 +1425,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
||||||
|
|
||||||
/* Find next string in text */
|
/* Find next string in text */
|
||||||
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
|
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/* Reset default list of users' codes */
|
/* Reset default list of users' codes */
|
||||||
ListUsrCods.NumUsrs = 0;
|
ListUsrCods.NumUsrs = 0;
|
||||||
|
@ -1544,7 +1548,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
||||||
|
|
||||||
/* Find next string in text */
|
/* Find next string in text */
|
||||||
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
|
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/* Reset default list of users' codes */
|
/* Reset default list of users' codes */
|
||||||
ListUsrCods.NumUsrs = 0;
|
ListUsrCods.NumUsrs = 0;
|
||||||
|
@ -1917,8 +1921,10 @@ void Enr_SignUpInCrs (void)
|
||||||
}
|
}
|
||||||
else // No request in database for this user in this course
|
else // No request in database for this user in this course
|
||||||
{
|
{
|
||||||
sprintf (Query,"INSERT INTO crs_usr_requests (CrsCod,UsrCod,Role,RequestTime)"
|
sprintf (Query,"INSERT INTO crs_usr_requests"
|
||||||
" VALUES ('%ld','%ld','%u',NOW())",
|
" (CrsCod,UsrCod,Role,RequestTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u',NOW())",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
(unsigned) RoleFromForm);
|
(unsigned) RoleFromForm);
|
||||||
|
@ -3265,8 +3271,10 @@ static void Enr_RegisterAdmin (struct UsrData *UsrDat,Sco_Scope_t Scope,long Cod
|
||||||
else // User was not administrator of current institution/centre/degree
|
else // User was not administrator of current institution/centre/degree
|
||||||
{
|
{
|
||||||
/***** Insert or replace administrator in current institution/centre/degree *****/
|
/***** Insert or replace administrator in current institution/centre/degree *****/
|
||||||
sprintf (Query,"REPLACE INTO admin (UsrCod,Scope,Cod)"
|
sprintf (Query,"REPLACE INTO admin"
|
||||||
" VALUES ('%ld','%s','%ld')",
|
" (UsrCod,Scope,Cod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s','%ld')",
|
||||||
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
|
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
|
||||||
DB_QueryREPLACE (Query,"can not create administrator");
|
DB_QueryREPLACE (Query,"can not create administrator");
|
||||||
|
|
||||||
|
|
|
@ -4089,9 +4089,11 @@ static void Brw_StoreSizeOfFileTreeInDB (void)
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Update size of the file browser in database *****/
|
/***** Update size of the file browser in database *****/
|
||||||
sprintf (Query,"REPLACE INTO file_browser_size (FileBrowser,Cod,ZoneUsrCod,"
|
sprintf (Query,"REPLACE INTO file_browser_size"
|
||||||
|
" (FileBrowser,Cod,ZoneUsrCod,"
|
||||||
"NumLevels,NumFolders,NumFiles,TotalSize)"
|
"NumLevels,NumFolders,NumFiles,TotalSize)"
|
||||||
" VALUES ('%u','%ld','%ld',"
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld',"
|
||||||
"'%u','%lu','%lu','%llu')",
|
"'%u','%lu','%lu','%llu')",
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],Cod,ZoneUsrCod,
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],Cod,ZoneUsrCod,
|
||||||
Gbl.FileBrowser.Size.NumLevls,
|
Gbl.FileBrowser.Size.NumLevls,
|
||||||
|
@ -4885,8 +4887,10 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
/***** Update date of my last access to file browser in this course *****/
|
/***** Update date of my last access to file browser in this course *****/
|
||||||
sprintf (Query,"REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick)"
|
sprintf (Query,"REPLACE INTO file_browser_last"
|
||||||
" VALUES ('%ld','%u','%ld',NOW())",
|
" (UsrCod,FileBrowser,Cod,LastClick)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%u','%ld',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
(unsigned) Brw_FileBrowserForDB_file_browser_last[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_file_browser_last[Gbl.FileBrowser.Type],
|
||||||
Cod);
|
Cod);
|
||||||
|
@ -6801,12 +6805,10 @@ static void Brw_AddPathToClipboards (void)
|
||||||
char Query[512 + PATH_MAX];
|
char Query[512 + PATH_MAX];
|
||||||
|
|
||||||
/***** Add path to clipboards *****/
|
/***** Add path to clipboards *****/
|
||||||
sprintf (Query,"INSERT INTO clipboard (UsrCod,FileBrowser,"
|
sprintf (Query,"INSERT INTO clipboard"
|
||||||
"Cod,WorksUsrCod,"
|
" (UsrCod,FileBrowser,Cod,WorksUsrCod,FileType,Path)"
|
||||||
"FileType,Path)"
|
" VALUES"
|
||||||
" VALUES ('%ld','%u',"
|
" ('%ld','%u','%ld','%ld','%u','%s')",
|
||||||
"'%ld','%ld',"
|
|
||||||
"'%u','%s')",
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Gbl.FileBrowser.Type,
|
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Gbl.FileBrowser.Type,
|
||||||
Cod,WorksUsrCod,
|
Cod,WorksUsrCod,
|
||||||
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree);
|
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree);
|
||||||
|
@ -6956,7 +6958,8 @@ static void Brw_InsertFolderInExpandedFolders (const char Path[PATH_MAX + 1])
|
||||||
// Path must be stored with final '/'
|
// Path must be stored with final '/'
|
||||||
sprintf (Query,"INSERT INTO expanded_folders"
|
sprintf (Query,"INSERT INTO expanded_folders"
|
||||||
" (UsrCod,FileBrowser,Cod,WorksUsrCod,Path,ClickTime)"
|
" (UsrCod,FileBrowser,Cod,WorksUsrCod,Path,ClickTime)"
|
||||||
" VALUES ('%ld','%u','%ld','%ld','%s/',NOW())",
|
" VALUES"
|
||||||
|
" ('%ld','%u','%ld','%ld','%s/',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
(unsigned) Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type],
|
||||||
Cod,WorksUsrCod,
|
Cod,WorksUsrCod,
|
||||||
|
@ -10441,7 +10444,8 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
|
||||||
/* Insert number of views in database */
|
/* Insert number of views in database */
|
||||||
sprintf (Query,"INSERT INTO file_view"
|
sprintf (Query,"INSERT INTO file_view"
|
||||||
" (FilCod,UsrCod,NumViews)"
|
" (FilCod,UsrCod,NumViews)"
|
||||||
" VALUES ('%ld','%ld','1')",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','1')",
|
||||||
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not insert number of views of a file");
|
DB_QueryINSERT (Query,"can not insert number of views of a file");
|
||||||
}
|
}
|
||||||
|
@ -10697,9 +10701,11 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
||||||
char Query[512 + PATH_MAX];
|
char Query[512 + PATH_MAX];
|
||||||
|
|
||||||
/***** Add path to the database *****/
|
/***** Add path to the database *****/
|
||||||
sprintf (Query,"INSERT INTO files (FileBrowser,Cod,ZoneUsrCod,"
|
sprintf (Query,"INSERT INTO files"
|
||||||
|
" (FileBrowser,Cod,ZoneUsrCod,"
|
||||||
"PublisherUsrCod,FileType,Path,Hidden,Public,License)"
|
"PublisherUsrCod,FileType,Path,Hidden,Public,License)"
|
||||||
" VALUES ('%u','%ld','%ld',"
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld',"
|
||||||
"'%ld','%u','%s','N','%c','%u')",
|
"'%ld','%u','%s','N','%c','%u')",
|
||||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||||
Cod,ZoneUsrCod,
|
Cod,ZoneUsrCod,
|
||||||
|
|
|
@ -1012,7 +1012,8 @@ void Fol_FollowUsr1 (void)
|
||||||
/***** Follow user in database *****/
|
/***** Follow user in database *****/
|
||||||
sprintf (Query,"REPLACE INTO usr_follow"
|
sprintf (Query,"REPLACE INTO usr_follow"
|
||||||
" (FollowerCod,FollowedCod,FollowTime)"
|
" (FollowerCod,FollowedCod,FollowTime)"
|
||||||
" VALUES ('%ld','%ld',NOW())",
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
DB_QueryREPLACE (Query,"can not follow user");
|
DB_QueryREPLACE (Query,"can not follow user");
|
||||||
|
|
33
swad_forum.c
33
swad_forum.c
|
@ -448,7 +448,8 @@ static void For_InsertPstIntoBannedPstTable (long PstCod)
|
||||||
/***** Remove post from banned posts table *****/
|
/***** Remove post from banned posts table *****/
|
||||||
sprintf (Query,"REPLACE INTO forum_disabled_post"
|
sprintf (Query,"REPLACE INTO forum_disabled_post"
|
||||||
" (PstCod,UsrCod,DisableTime)"
|
" (PstCod,UsrCod,DisableTime)"
|
||||||
" VALUES ('%ld','%ld',NOW())",
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW())",
|
||||||
PstCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
PstCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryREPLACE (Query,"can not ban a post of a forum");
|
DB_QueryREPLACE (Query,"can not ban a post of a forum");
|
||||||
}
|
}
|
||||||
|
@ -483,7 +484,8 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
||||||
sprintf (Query,"INSERT INTO forum_post"
|
sprintf (Query,"INSERT INTO forum_post"
|
||||||
" (ThrCod,UsrCod,CreatTime,ModifTime,NumNotif,"
|
" (ThrCod,UsrCod,CreatTime,ModifTime,NumNotif,"
|
||||||
"Subject,Content,ImageName,ImageTitle,ImageURL)"
|
"Subject,Content,ImageName,ImageTitle,ImageURL)"
|
||||||
" VALUES ('%ld','%ld',NOW(),NOW(),'0',"
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW(),NOW(),'0',"
|
||||||
"'%s','%s','%s','%s','%s')",
|
"'%s','%s','%s','%s','%s')",
|
||||||
ThrCod,UsrCod,
|
ThrCod,UsrCod,
|
||||||
Subject,Content,
|
Subject,Content,
|
||||||
|
@ -581,35 +583,40 @@ static long For_InsertForumThread (For_ForumType_t ForumType,long FirstPstCod)
|
||||||
case For_FORUM_SWAD_TCHS:
|
case For_FORUM_SWAD_TCHS:
|
||||||
sprintf (Query,"INSERT INTO forum_thread"
|
sprintf (Query,"INSERT INTO forum_thread"
|
||||||
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
||||||
" VALUES ('%u','-1','%ld','%ld')",
|
" VALUES"
|
||||||
|
" ('%u','-1','%ld','%ld')",
|
||||||
(unsigned) ForumType,FirstPstCod,FirstPstCod);
|
(unsigned) ForumType,FirstPstCod,FirstPstCod);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_INSTIT_USRS:
|
case For_FORUM_INSTIT_USRS:
|
||||||
case For_FORUM_INSTIT_TCHS:
|
case For_FORUM_INSTIT_TCHS:
|
||||||
sprintf (Query,"INSERT INTO forum_thread"
|
sprintf (Query,"INSERT INTO forum_thread"
|
||||||
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
||||||
" VALUES ('%u','%ld','%ld','%ld')",
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld','%ld')",
|
||||||
(unsigned) ForumType,Gbl.Forum.Ins.InsCod,FirstPstCod,FirstPstCod);
|
(unsigned) ForumType,Gbl.Forum.Ins.InsCod,FirstPstCod,FirstPstCod);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_CENTRE_USRS:
|
case For_FORUM_CENTRE_USRS:
|
||||||
case For_FORUM_CENTRE_TCHS:
|
case For_FORUM_CENTRE_TCHS:
|
||||||
sprintf (Query,"INSERT INTO forum_thread"
|
sprintf (Query,"INSERT INTO forum_thread"
|
||||||
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
||||||
" VALUES ('%u','%ld','%ld','%ld')",
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld','%ld')",
|
||||||
(unsigned) ForumType,Gbl.Forum.Ctr.CtrCod,FirstPstCod,FirstPstCod);
|
(unsigned) ForumType,Gbl.Forum.Ctr.CtrCod,FirstPstCod,FirstPstCod);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_DEGREE_USRS:
|
case For_FORUM_DEGREE_USRS:
|
||||||
case For_FORUM_DEGREE_TCHS:
|
case For_FORUM_DEGREE_TCHS:
|
||||||
sprintf (Query,"INSERT INTO forum_thread"
|
sprintf (Query,"INSERT INTO forum_thread"
|
||||||
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
||||||
" VALUES ('%u','%ld','%ld','%ld')",
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld','%ld')",
|
||||||
(unsigned) ForumType,Gbl.Forum.Deg.DegCod,FirstPstCod,FirstPstCod);
|
(unsigned) ForumType,Gbl.Forum.Deg.DegCod,FirstPstCod,FirstPstCod);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_COURSE_USRS:
|
case For_FORUM_COURSE_USRS:
|
||||||
case For_FORUM_COURSE_TCHS:
|
case For_FORUM_COURSE_TCHS:
|
||||||
sprintf (Query,"INSERT INTO forum_thread"
|
sprintf (Query,"INSERT INTO forum_thread"
|
||||||
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
" (ForumType,Location,FirstPstCod,LastPstCod)"
|
||||||
" VALUES ('%u','%ld','%ld','%ld')",
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld','%ld')",
|
||||||
(unsigned) ForumType,Gbl.Forum.Crs.CrsCod,FirstPstCod,FirstPstCod);
|
(unsigned) ForumType,Gbl.Forum.Crs.CrsCod,FirstPstCod,FirstPstCod);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -789,8 +796,10 @@ static void For_UpdateThrReadTime (long ThrCod,time_t ReadTimeUTC)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Insert or replace pair ThrCod-UsrCod in forum_thr_read *****/
|
/***** Insert or replace pair ThrCod-UsrCod in forum_thr_read *****/
|
||||||
sprintf (Query,"REPLACE INTO forum_thr_read (ThrCod,UsrCod,ReadTime)"
|
sprintf (Query,"REPLACE INTO forum_thr_read"
|
||||||
" VALUES ('%ld','%ld',FROM_UNIXTIME('%ld'))",
|
" (ThrCod,UsrCod,ReadTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld',FROM_UNIXTIME('%ld'))",
|
||||||
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,(long) ReadTimeUTC);
|
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,(long) ReadTimeUTC);
|
||||||
DB_QueryREPLACE (Query,"can not update the status of reading of a thread of a forum");
|
DB_QueryREPLACE (Query,"can not update the status of reading of a thread of a forum");
|
||||||
}
|
}
|
||||||
|
@ -4433,8 +4442,10 @@ void For_InsertThrInClipboard (long ThrCod)
|
||||||
For_RemoveExpiredThrsClipboards ();
|
For_RemoveExpiredThrsClipboards ();
|
||||||
|
|
||||||
/***** Add thread to my clipboard *****/
|
/***** Add thread to my clipboard *****/
|
||||||
sprintf (Query,"REPLACE INTO forum_thr_clip (ThrCod,UsrCod)"
|
sprintf (Query,"REPLACE INTO forum_thr_clip"
|
||||||
" VALUES ('%ld','%ld')",
|
" (ThrCod,UsrCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryREPLACE (Query,"can not add thread to clipboard");
|
DB_QueryREPLACE (Query,"can not add thread to clipboard");
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ struct Globals
|
||||||
Rol_Role_t LoggedRoleBeforeCloseSession;
|
Rol_Role_t LoggedRoleBeforeCloseSession;
|
||||||
Rol_Role_t MaxRole;
|
Rol_Role_t MaxRole;
|
||||||
bool RoleHasChanged; // Set when I have changed my role
|
bool RoleHasChanged; // Set when I have changed my role
|
||||||
char UsrIdLogin[Cns_MAX_BYTES_EMAIL + 1]; // String to store the ID, nickname or email entered in the user's login
|
char UsrIdLogin[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // String to store the ID, nickname or email entered in the user's login
|
||||||
char LoginPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
char LoginPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||||
char LoginEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
char LoginEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||||
char PendingPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
char PendingPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
|
||||||
|
|
15
swad_group.c
15
swad_group.c
|
@ -1066,8 +1066,10 @@ static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Register in group *****/
|
/***** Register in group *****/
|
||||||
sprintf (Query,"INSERT INTO crs_grp_usr (GrpCod,UsrCod)"
|
sprintf (Query,"INSERT INTO crs_grp_usr"
|
||||||
" VALUES ('%ld','%ld')",
|
" (GrpCod,UsrCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
GrpCod,UsrDat->UsrCod);
|
GrpCod,UsrDat->UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not add a user to a group");
|
DB_QueryINSERT (Query,"can not add a user to a group");
|
||||||
}
|
}
|
||||||
|
@ -3266,7 +3268,8 @@ static void Grp_CreateGroupType (void)
|
||||||
/***** Create a new group type *****/
|
/***** Create a new group type *****/
|
||||||
sprintf (Query,"INSERT INTO crs_grp_types"
|
sprintf (Query,"INSERT INTO crs_grp_types"
|
||||||
" (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)"
|
" (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)"
|
||||||
" VALUES ('%ld','%s','%c','%c','%c',FROM_UNIXTIME('%ld'))",
|
" VALUES"
|
||||||
|
" ('%ld','%s','%c','%c','%c',FROM_UNIXTIME('%ld'))",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,
|
Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment ? 'Y' :
|
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
|
@ -3293,8 +3296,10 @@ static void Grp_CreateGroup (void)
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
|
|
||||||
/***** Create a new group *****/
|
/***** Create a new group *****/
|
||||||
sprintf (Query,"INSERT INTO crs_grp (GrpTypCod,GrpName,MaxStudents,Open,FileZones)"
|
sprintf (Query,"INSERT INTO crs_grp"
|
||||||
" VALUES ('%ld','%s','%u','N','N')",
|
" (GrpTypCod,GrpName,MaxStudents,Open,FileZones)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s','%u','N','N')",
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,
|
||||||
Gbl.CurrentCrs.Grps.GrpName,
|
Gbl.CurrentCrs.Grps.GrpName,
|
||||||
Gbl.CurrentCrs.Grps.MaxStudents);
|
Gbl.CurrentCrs.Grps.MaxStudents);
|
||||||
|
|
|
@ -1127,7 +1127,8 @@ static void Hld_CreateHoliday (struct Holiday *Hld)
|
||||||
/***** Create a new holiday or no school period *****/
|
/***** Create a new holiday or no school period *****/
|
||||||
sprintf (Query,"INSERT INTO holidays"
|
sprintf (Query,"INSERT INTO holidays"
|
||||||
" (InsCod,PlcCod,HldTyp,StartDate,EndDate,Name)"
|
" (InsCod,PlcCod,HldTyp,StartDate,EndDate,Name)"
|
||||||
" VALUES ('%ld','%ld','%u','%04u%02u%02u','%04u%02u%02u','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u','%04u%02u%02u','%04u%02u%02u','%s')",
|
||||||
Gbl.CurrentIns.Ins.InsCod,Hld->PlcCod,(unsigned) Hld->HldTyp,
|
Gbl.CurrentIns.Ins.InsCod,Hld->PlcCod,(unsigned) Hld->HldTyp,
|
||||||
Hld->StartDate.Year,
|
Hld->StartDate.Year,
|
||||||
Hld->StartDate.Month,
|
Hld->StartDate.Month,
|
||||||
|
|
15
swad_info.c
15
swad_info.c
|
@ -709,8 +709,10 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
||||||
if (IHaveRead)
|
if (IHaveRead)
|
||||||
{
|
{
|
||||||
/***** Insert I have read course information *****/
|
/***** Insert I have read course information *****/
|
||||||
sprintf (Query,"REPLACE INTO crs_info_read (UsrCod,CrsCod,InfoType)"
|
sprintf (Query,"REPLACE INTO crs_info_read"
|
||||||
" VALUES ('%ld','%ld','%s')",
|
" (UsrCod,CrsCod,InfoType)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%s')",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type]);
|
||||||
|
@ -1480,8 +1482,10 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
|
||||||
}
|
}
|
||||||
else // Info is not stored in database, so insert it
|
else // Info is not stored in database, so insert it
|
||||||
{
|
{
|
||||||
sprintf (Query,"INSERT INTO crs_info_src (CrsCod,InfoType,InfoSrc,MustBeRead)"
|
sprintf (Query,"INSERT INTO crs_info_src"
|
||||||
" VALUES ('%ld','%s','%s','N')",
|
" (CrsCod,InfoType,InfoSrc,MustBeRead)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s','%s','N')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
|
||||||
Inf_NamesInDBForInfoSrc[InfoSrc]);
|
Inf_NamesInDBForInfoSrc[InfoSrc]);
|
||||||
|
@ -1668,7 +1672,8 @@ static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD)
|
||||||
/***** Insert or replace info source for a specific type of course information *****/
|
/***** Insert or replace info source for a specific type of course information *****/
|
||||||
sprintf (Query,"REPLACE INTO crs_info_txt"
|
sprintf (Query,"REPLACE INTO crs_info_txt"
|
||||||
" (CrsCod,InfoType,InfoTxtHTML,InfoTxtMD)"
|
" (CrsCod,InfoType,InfoTxtHTML,InfoTxtMD)"
|
||||||
" VALUES ('%ld','%s','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%s','%s','%s')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
|
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
|
||||||
InfoTxtHTML,InfoTxtMD);
|
InfoTxtHTML,InfoTxtMD);
|
||||||
|
|
|
@ -2401,10 +2401,10 @@ static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status)
|
||||||
Cns_MAX_BYTES_WWW];
|
Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new institution *****/
|
/***** Create a new institution *****/
|
||||||
sprintf (Query,"INSERT INTO institutions (CtyCod,Status,RequesterUsrCod,"
|
sprintf (Query,"INSERT INTO institutions"
|
||||||
"ShortName,FullName,WWW)"
|
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
|
||||||
" VALUES ('%ld','%u','%ld',"
|
" VALUES"
|
||||||
"'%s','%s','%s')",
|
" ('%ld','%u','%ld','%s','%s','%s')",
|
||||||
Ins->CtyCod,
|
Ins->CtyCod,
|
||||||
Status,
|
Status,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
|
|
@ -784,8 +784,10 @@ static void Lnk_CreateLink (struct Link *Lnk)
|
||||||
Cns_MAX_BYTES_WWW];
|
Cns_MAX_BYTES_WWW];
|
||||||
|
|
||||||
/***** Create a new link *****/
|
/***** Create a new link *****/
|
||||||
sprintf (Query,"INSERT INTO links (ShortName,FullName,WWW)"
|
sprintf (Query,"INSERT INTO links"
|
||||||
" VALUES ('%s','%s','%s')",
|
" (ShortName,FullName,WWW)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%s','%s')",
|
||||||
Lnk->ShrtName,Lnk->FullName,Lnk->WWW);
|
Lnk->ShrtName,Lnk->FullName,Lnk->WWW);
|
||||||
DB_QueryINSERT (Query,"can not create institutional link");
|
DB_QueryINSERT (Query,"can not create institutional link");
|
||||||
|
|
||||||
|
|
92
swad_mail.c
92
swad_mail.c
|
@ -67,8 +67,8 @@ extern struct Globals Gbl;
|
||||||
static void Mai_GetParamMaiOrder (void);
|
static void Mai_GetParamMaiOrder (void);
|
||||||
static void Mai_PutIconToEditMailDomains (void);
|
static void Mai_PutIconToEditMailDomains (void);
|
||||||
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
||||||
static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_EMAIL + 1]);
|
static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||||
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Cns_MAX_BYTES_EMAIL + 1]);
|
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||||
|
|
||||||
static void Mai_ListMailDomainsForEdition (void);
|
static void Mai_ListMailDomainsForEdition (void);
|
||||||
static void Mai_PutParamMaiCod (long MaiCod);
|
static void Mai_PutParamMaiCod (long MaiCod);
|
||||||
|
@ -82,9 +82,9 @@ static void Mai_PutHeadMailDomains (void);
|
||||||
static void Mai_CreateMailDomain (struct Mail *Mai);
|
static void Mai_CreateMailDomain (struct Mail *Mai);
|
||||||
|
|
||||||
static void Mai_RemoveEmail (struct UsrData *UsrDat);
|
static void Mai_RemoveEmail (struct UsrData *UsrDat);
|
||||||
static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL + 1]);
|
static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||||
static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe);
|
static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe);
|
||||||
static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL + 1],
|
static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1],
|
||||||
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1]);
|
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1]);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -291,7 +291,7 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
|
||||||
|
|
||||||
/* Get the mail domain (row[1]) */
|
/* Get the mail domain (row[1]) */
|
||||||
Str_Copy (Mai->Domain,row[1],
|
Str_Copy (Mai->Domain,row[1],
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/* Get the mail domain info (row[2]) */
|
/* Get the mail domain info (row[2]) */
|
||||||
Str_Copy (Mai->Info,row[2],
|
Str_Copy (Mai->Info,row[2],
|
||||||
|
@ -320,7 +320,7 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
|
||||||
|
|
||||||
bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
char MailDomain[Cns_MAX_BYTES_EMAIL + 1];
|
char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
|
|
||||||
/***** Check #1: is my email address confirmed? *****/
|
/***** Check #1: is my email address confirmed? *****/
|
||||||
if (!UsrDat->EmailConfirmed)
|
if (!UsrDat->EmailConfirmed)
|
||||||
|
@ -335,7 +335,7 @@ bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
|
||||||
/********************** Get mailbox from email address ***********************/
|
/********************** Get mailbox from email address ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_EMAIL + 1])
|
static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_E
|
||||||
Ptr++; // Skip '@'
|
Ptr++; // Skip '@'
|
||||||
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
|
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
|
||||||
Str_Copy (MailDomain,Ptr,
|
Str_Copy (MailDomain,Ptr,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,9 +355,9 @@ static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_E
|
||||||
/************ Check if a mail domain is allowed for notifications ************/
|
/************ Check if a mail domain is allowed for notifications ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Cns_MAX_BYTES_EMAIL + 1])
|
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
char Query[128 + Cns_MAX_BYTES_EMAIL];
|
char Query[128 + Cns_MAX_BYTES_EMAIL_ADDRESS];
|
||||||
|
|
||||||
/***** Get number of mail_domains with a name from database *****/
|
/***** Get number of mail_domains with a name from database *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM mail_domains WHERE Domain='%s'",
|
sprintf (Query,"SELECT COUNT(*) FROM mail_domains WHERE Domain='%s'",
|
||||||
|
@ -417,7 +417,7 @@ void Mai_GetDataOfMailDomainByCod (struct Mail *Mai)
|
||||||
|
|
||||||
/* Get the short name of the mail (row[0]) */
|
/* Get the short name of the mail (row[0]) */
|
||||||
Str_Copy (Mai->Domain,row[0],
|
Str_Copy (Mai->Domain,row[0],
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/* Get the full name of the mail (row[1]) */
|
/* Get the full name of the mail (row[1]) */
|
||||||
Str_Copy (Mai->Info,row[1],
|
Str_Copy (Mai->Info,row[1],
|
||||||
|
@ -490,7 +490,7 @@ static void Mai_ListMailDomainsForEdition (void)
|
||||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Domain\""
|
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"Domain\""
|
||||||
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
Cns_MAX_CHARS_EMAIL,Mai->Domain,
|
Cns_MAX_CHARS_EMAIL_ADDRESS,Mai->Domain,
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
@ -609,7 +609,7 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||||
case Cns_SHRT_NAME:
|
case Cns_SHRT_NAME:
|
||||||
ParamName = "Domain";
|
ParamName = "Domain";
|
||||||
FieldName = "Domain";
|
FieldName = "Domain";
|
||||||
MaxBytes = Cns_MAX_BYTES_EMAIL;
|
MaxBytes = Cns_MAX_BYTES_EMAIL_ADDRESS;
|
||||||
CurrentMaiName = Mai->Domain;
|
CurrentMaiName = Mai->Domain;
|
||||||
break;
|
break;
|
||||||
case Cns_FULL_NAME:
|
case Cns_FULL_NAME:
|
||||||
|
@ -744,7 +744,7 @@ static void Mai_PutFormToCreateMailDomain (void)
|
||||||
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
" size=\"15\" maxlength=\"%u\" value=\"%s\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</td>",
|
"</td>",
|
||||||
Cns_MAX_CHARS_EMAIL,Mai->Domain);
|
Cns_MAX_CHARS_EMAIL_ADDRESS,Mai->Domain);
|
||||||
|
|
||||||
/***** Mail domain info *****/
|
/***** Mail domain info *****/
|
||||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||||
|
@ -808,7 +808,7 @@ void Mai_RecFormNewMailDomain (void)
|
||||||
|
|
||||||
/***** Get parameters from form *****/
|
/***** Get parameters from form *****/
|
||||||
/* Get mail short name */
|
/* Get mail short name */
|
||||||
Par_GetParToText ("Domain",Mai->Domain,Cns_MAX_BYTES_EMAIL);
|
Par_GetParToText ("Domain",Mai->Domain,Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/* Get mail full name */
|
/* Get mail full name */
|
||||||
Par_GetParToText ("Info",Mai->Info,Mai_MAX_BYTES_MAIL_INFO);
|
Par_GetParToText ("Info",Mai->Info,Mai_MAX_BYTES_MAIL_INFO);
|
||||||
|
@ -846,11 +846,14 @@ static void Mai_CreateMailDomain (struct Mail *Mai)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Created_new_email_domain_X;
|
extern const char *Txt_Created_new_email_domain_X;
|
||||||
char Query[128 +
|
char Query[128 +
|
||||||
Cns_MAX_BYTES_EMAIL +
|
Cns_MAX_BYTES_EMAIL_ADDRESS +
|
||||||
Mai_MAX_BYTES_MAIL_INFO];
|
Mai_MAX_BYTES_MAIL_INFO];
|
||||||
|
|
||||||
/***** Create a new mail *****/
|
/***** Create a new mail *****/
|
||||||
sprintf (Query,"INSERT INTO mail_domains (Domain,Info) VALUES ('%s','%s')",
|
sprintf (Query,"INSERT INTO mail_domains"
|
||||||
|
" (Domain,Info)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%s')",
|
||||||
Mai->Domain,Mai->Info);
|
Mai->Domain,Mai->Info);
|
||||||
DB_QueryINSERT (Query,"can not create mail domain");
|
DB_QueryINSERT (Query,"can not create mail domain");
|
||||||
|
|
||||||
|
@ -1007,9 +1010,9 @@ bool Mai_CheckIfEmailIsValid (const char *Email)
|
||||||
bool ArrobaFound = false;
|
bool ArrobaFound = false;
|
||||||
|
|
||||||
/***** An email address must have a number of characters
|
/***** An email address must have a number of characters
|
||||||
5 <= Length <= Cns_MAX_BYTES_EMAIL *****/
|
5 <= Length <= Cns_MAX_BYTES_EMAIL_ADDRESS *****/
|
||||||
if (Length < 5 ||
|
if (Length < 5 ||
|
||||||
Length > Cns_MAX_BYTES_EMAIL)
|
Length > Cns_MAX_BYTES_EMAIL_ADDRESS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** An email address can have digits, letters, '.', '-' and '_';
|
/***** An email address can have digits, letters, '.', '-' and '_';
|
||||||
|
@ -1071,7 +1074,7 @@ bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat)
|
||||||
/* Get email */
|
/* Get email */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
Str_Copy (UsrDat->Email,row[0],
|
Str_Copy (UsrDat->Email,row[0],
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
UsrDat->EmailConfirmed = (row[1][0] == 'Y');
|
UsrDat->EmailConfirmed = (row[1][0] == 'Y');
|
||||||
Found = true;
|
Found = true;
|
||||||
}
|
}
|
||||||
|
@ -1087,9 +1090,9 @@ bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Returns -1L if email not found
|
// Returns -1L if email not found
|
||||||
|
|
||||||
long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL + 1])
|
long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
char Query[512 + Cns_MAX_BYTES_EMAIL];
|
char Query[512 + Cns_MAX_BYTES_EMAIL_ADDRESS];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
|
@ -1328,7 +1331,7 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
|
||||||
"<input type=\"email\" id=\"NewEmail\" name=\"NewEmail\""
|
"<input type=\"email\" id=\"NewEmail\" name=\"NewEmail\""
|
||||||
" size=\"18\" maxlength=\"%u\" value=\"%s\" />"
|
" size=\"18\" maxlength=\"%u\" value=\"%s\" />"
|
||||||
"</div>",
|
"</div>",
|
||||||
Cns_MAX_CHARS_EMAIL,
|
Cns_MAX_CHARS_EMAIL_ADDRESS,
|
||||||
Gbl.Usrs.Me.UsrDat.Email);
|
Gbl.Usrs.Me.UsrDat.Email);
|
||||||
Lay_PutCreateButtonInline (NumEmails ? Txt_Change_email : // User already has an email address
|
Lay_PutCreateButtonInline (NumEmails ? Txt_Change_email : // User already has an email address
|
||||||
Txt_Save); // User has no email address yet
|
Txt_Save); // User has no email address yet
|
||||||
|
@ -1379,12 +1382,12 @@ static void Mai_RemoveEmail (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Email_X_removed;
|
extern const char *Txt_Email_X_removed;
|
||||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||||
char Email[Cns_MAX_BYTES_EMAIL + 1];
|
char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
|
|
||||||
if (Usr_ICanEditOtherUsr (UsrDat))
|
if (Usr_ICanEditOtherUsr (UsrDat))
|
||||||
{
|
{
|
||||||
/***** Get new email from form *****/
|
/***** Get new email from form *****/
|
||||||
Par_GetParToText ("Email",Email,Cns_MAX_BYTES_EMAIL);
|
Par_GetParToText ("Email",Email,Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
/***** Remove one of user's old email addresses *****/
|
/***** Remove one of user's old email addresses *****/
|
||||||
Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email);
|
Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email);
|
||||||
|
@ -1404,9 +1407,9 @@ static void Mai_RemoveEmail (struct UsrData *UsrDat)
|
||||||
/*************** Remove an old email address from database *******************/
|
/*************** Remove an old email address from database *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL + 1])
|
static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
char Query[256 + Cns_MAX_BYTES_EMAIL];
|
char Query[256 + Cns_MAX_BYTES_EMAIL_ADDRESS];
|
||||||
|
|
||||||
/***** Remove an old email address *****/
|
/***** Remove an old email address *****/
|
||||||
sprintf (Query,"DELETE FROM usr_emails"
|
sprintf (Query,"DELETE FROM usr_emails"
|
||||||
|
@ -1461,12 +1464,12 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
|
||||||
extern const char *Txt_The_email_address_X_had_been_registered_by_another_user;
|
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;
|
extern const char *Txt_The_email_address_entered_X_is_not_valid;
|
||||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||||
char NewEmail[Cns_MAX_BYTES_EMAIL + 1];
|
char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
|
|
||||||
if (Usr_ICanEditOtherUsr (UsrDat))
|
if (Usr_ICanEditOtherUsr (UsrDat))
|
||||||
{
|
{
|
||||||
/***** Get new email from form *****/
|
/***** Get new email from form *****/
|
||||||
Par_GetParToText ("NewEmail",NewEmail,Cns_MAX_BYTES_EMAIL);
|
Par_GetParToText ("NewEmail",NewEmail,Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
if (Mai_CheckIfEmailIsValid (NewEmail)) // New email is valid
|
if (Mai_CheckIfEmailIsValid (NewEmail)) // New email is valid
|
||||||
{
|
{
|
||||||
|
@ -1520,9 +1523,9 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
|
||||||
// Return true if email is successfully updated
|
// Return true if email is successfully updated
|
||||||
// Return false if email can not be updated beacuse it is registered by another user
|
// Return false if email can not be updated beacuse it is registered by another user
|
||||||
|
|
||||||
bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL + 1])
|
bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
char Query[256 + Cns_MAX_BYTES_EMAIL];
|
char Query[256 + Cns_MAX_BYTES_EMAIL_ADDRESS];
|
||||||
|
|
||||||
/***** Check if the new email matches any of the confirmed emails of other users *****/
|
/***** Check if the new email matches any of the confirmed emails of other users *****/
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM usr_emails"
|
sprintf (Query,"SELECT COUNT(*) FROM usr_emails"
|
||||||
|
@ -1546,7 +1549,9 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
|
||||||
|
|
||||||
/***** Update email in database *****/
|
/***** Update email in database *****/
|
||||||
sprintf (Query,"REPLACE INTO usr_emails"
|
sprintf (Query,"REPLACE INTO usr_emails"
|
||||||
" (UsrCod,E_mail,CreatTime) VALUES ('%ld','%s',NOW())",
|
" (UsrCod,E_mail,CreatTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s',NOW())",
|
||||||
UsrDat->UsrCod,NewEmail);
|
UsrDat->UsrCod,NewEmail);
|
||||||
DB_QueryREPLACE (Query,"can not update email");
|
DB_QueryREPLACE (Query,"can not update email");
|
||||||
|
|
||||||
|
@ -1667,11 +1672,11 @@ void Mai_ShowMsgConfirmEmailHasBeenSent (void)
|
||||||
/************************* Insert mail hey in database ***********************/
|
/************************* Insert mail hey in database ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL + 1],
|
static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1],
|
||||||
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1])
|
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1])
|
||||||
{
|
{
|
||||||
char Query[256 +
|
char Query[256 +
|
||||||
Cns_MAX_BYTES_EMAIL +
|
Cns_MAX_BYTES_EMAIL_ADDRESS +
|
||||||
Mai_LENGTH_EMAIL_CONFIRM_KEY];
|
Mai_LENGTH_EMAIL_CONFIRM_KEY];
|
||||||
|
|
||||||
/***** Remove expired pending emails from database *****/
|
/***** Remove expired pending emails from database *****/
|
||||||
|
@ -1681,8 +1686,10 @@ static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL + 1],
|
||||||
DB_QueryDELETE (Query,"can not remove old pending mail keys");
|
DB_QueryDELETE (Query,"can not remove old pending mail keys");
|
||||||
|
|
||||||
/***** Insert mail key in database *****/
|
/***** Insert mail key in database *****/
|
||||||
sprintf (Query,"INSERT INTO pending_emails (UsrCod,E_mail,MailKey,DateAndTime)"
|
sprintf (Query,"INSERT INTO pending_emails"
|
||||||
" VALUES ('%ld','%s','%s',NOW())",
|
" (UsrCod,E_mail,MailKey,DateAndTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s','%s',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Email,
|
Email,
|
||||||
MailKey);
|
MailKey);
|
||||||
|
@ -1700,13 +1707,13 @@ void Mai_ConfirmEmail (void)
|
||||||
extern const char *Txt_The_email_address_has_not_been_confirmed;
|
extern const char *Txt_The_email_address_has_not_been_confirmed;
|
||||||
extern const char *Txt_Failed_email_confirmation_key;
|
extern const char *Txt_Failed_email_confirmation_key;
|
||||||
char Query[256 +
|
char Query[256 +
|
||||||
Cns_MAX_BYTES_EMAIL +
|
Cns_MAX_BYTES_EMAIL_ADDRESS +
|
||||||
Mai_LENGTH_EMAIL_CONFIRM_KEY];
|
Mai_LENGTH_EMAIL_CONFIRM_KEY];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1];
|
char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1];
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
char Email[Cns_MAX_BYTES_EMAIL + 1];
|
char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
bool KeyIsCorrect = false;
|
bool KeyIsCorrect = false;
|
||||||
bool Confirmed;
|
bool Confirmed;
|
||||||
|
|
||||||
|
@ -1715,7 +1722,8 @@ void Mai_ConfirmEmail (void)
|
||||||
|
|
||||||
/***** Get user's code and email from key *****/
|
/***** Get user's code and email from key *****/
|
||||||
sprintf (Query,"SELECT UsrCod,E_mail FROM pending_emails"
|
sprintf (Query,"SELECT UsrCod,E_mail FROM pending_emails"
|
||||||
" WHERE MailKey='%s'",MailKey);
|
" WHERE MailKey='%s'",
|
||||||
|
MailKey);
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's code and email from key"))
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's code and email from key"))
|
||||||
{
|
{
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -1725,7 +1733,7 @@ void Mai_ConfirmEmail (void)
|
||||||
|
|
||||||
/* Get user's email */
|
/* Get user's email */
|
||||||
Str_Copy (Email,row[1],
|
Str_Copy (Email,row[1],
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
KeyIsCorrect = true;
|
KeyIsCorrect = true;
|
||||||
}
|
}
|
||||||
|
@ -1736,8 +1744,8 @@ void Mai_ConfirmEmail (void)
|
||||||
if (KeyIsCorrect)
|
if (KeyIsCorrect)
|
||||||
{
|
{
|
||||||
/***** Delete this key *****/
|
/***** Delete this key *****/
|
||||||
sprintf (Query,"DELETE FROM pending_emails"
|
sprintf (Query,"DELETE FROM pending_emails WHERE MailKey='%s'",
|
||||||
" WHERE MailKey='%s'",MailKey);
|
MailKey);
|
||||||
DB_QueryDELETE (Query,"can not remove an email key");
|
DB_QueryDELETE (Query,"can not remove an email key");
|
||||||
|
|
||||||
/***** Check user's code and email
|
/***** Check user's code and email
|
||||||
|
|
|
@ -48,7 +48,7 @@ typedef enum
|
||||||
struct Mail
|
struct Mail
|
||||||
{
|
{
|
||||||
long MaiCod;
|
long MaiCod;
|
||||||
char Domain[Cns_MAX_BYTES_EMAIL + 1];
|
char Domain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
char Info[Mai_MAX_BYTES_MAIL_INFO + 1];
|
char Info[Mai_MAX_BYTES_MAIL_INFO + 1];
|
||||||
unsigned NumUsrs;
|
unsigned NumUsrs;
|
||||||
};
|
};
|
||||||
|
@ -75,7 +75,7 @@ void Mai_ListEmails (void); // Creates an email message to students
|
||||||
|
|
||||||
bool Mai_CheckIfEmailIsValid (const char *Email);
|
bool Mai_CheckIfEmailIsValid (const char *Email);
|
||||||
bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat);
|
bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat);
|
||||||
long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL + 1]);
|
long Mai_GetUsrCodFromEmail (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||||
|
|
||||||
void Mai_PutLinkToChangeOtherUsrEmails (void);
|
void Mai_PutLinkToChangeOtherUsrEmails (void);
|
||||||
void Mai_ShowFormOthEmail (void);
|
void Mai_ShowFormOthEmail (void);
|
||||||
|
@ -84,7 +84,7 @@ void Mai_RemoveMyUsrEmail (void);
|
||||||
void Mai_RemoveOtherUsrEmail (void);
|
void Mai_RemoveOtherUsrEmail (void);
|
||||||
void May_NewMyUsrEmail (void);
|
void May_NewMyUsrEmail (void);
|
||||||
void Mai_NewOtherUsrEmail (void);
|
void Mai_NewOtherUsrEmail (void);
|
||||||
bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL + 1]);
|
bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||||
|
|
||||||
void Mai_PutButtonToCheckEmailAddress (void);
|
void Mai_PutButtonToCheckEmailAddress (void);
|
||||||
bool Mai_SendMailMsgToConfirmEmail (void);
|
bool Mai_SendMailMsgToConfirmEmail (void);
|
||||||
|
|
|
@ -88,8 +88,10 @@ void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Add file of marks to the database *****/
|
/***** Add file of marks to the database *****/
|
||||||
sprintf (Query,"INSERT INTO marks_properties (FilCod,%s,%s)"
|
sprintf (Query,"INSERT INTO marks_properties"
|
||||||
" VALUES ('%ld','%u','%u')",
|
" (FilCod,%s,%s)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%u','%u')",
|
||||||
Mrk_HeadOrFootStr[Brw_HEADER],
|
Mrk_HeadOrFootStr[Brw_HEADER],
|
||||||
Mrk_HeadOrFootStr[Brw_FOOTER],
|
Mrk_HeadOrFootStr[Brw_FOOTER],
|
||||||
FilCod,
|
FilCod,
|
||||||
|
|
|
@ -1301,7 +1301,8 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
||||||
/***** Insert message subject and content in the database *****/
|
/***** Insert message subject and content in the database *****/
|
||||||
sprintf (Query,"INSERT INTO msg_content"
|
sprintf (Query,"INSERT INTO msg_content"
|
||||||
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
|
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
|
||||||
" VALUES ('%s','%s','%s','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%s','%s','%s','%s','%s')",
|
||||||
Subject,Content,
|
Subject,Content,
|
||||||
Image->Name,
|
Image->Name,
|
||||||
Image->Title ? Image->Title : "",
|
Image->Title ? Image->Title : "",
|
||||||
|
@ -1309,8 +1310,10 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
||||||
MsgCod = DB_QueryINSERTandReturnCode (Query,"can not create message");
|
MsgCod = DB_QueryINSERTandReturnCode (Query,"can not create message");
|
||||||
|
|
||||||
/***** Insert message in sent messages *****/
|
/***** Insert message in sent messages *****/
|
||||||
sprintf (Query,"INSERT INTO msg_snt (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
|
sprintf (Query,"INSERT INTO msg_snt"
|
||||||
" VALUES ('%ld','%ld','%ld','N',NOW())",
|
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%ld','N',NOW())",
|
||||||
MsgCod,
|
MsgCod,
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -1379,7 +1382,8 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
|
||||||
|
|
||||||
/***** Move messages from msg_rcv to msg_rcv_deleted *****/
|
/***** Move messages from msg_rcv to msg_rcv_deleted *****/
|
||||||
/* Insert messages into msg_rcv_deleted */
|
/* Insert messages into msg_rcv_deleted */
|
||||||
sprintf (Query,"INSERT IGNORE INTO msg_rcv_deleted (MsgCod,UsrCod,Notified,Open,Replied)"
|
sprintf (Query,"INSERT IGNORE INTO msg_rcv_deleted"
|
||||||
|
" (MsgCod,UsrCod,Notified,Open,Replied)"
|
||||||
" SELECT MsgCod,UsrCod,Notified,Open,Replied FROM msg_rcv WHERE UsrCod='%ld'",
|
" SELECT MsgCod,UsrCod,Notified,Open,Replied FROM msg_rcv WHERE UsrCod='%ld'",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not remove received messages");
|
DB_QueryINSERT (Query,"can not remove received messages");
|
||||||
|
@ -1390,8 +1394,10 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
|
||||||
|
|
||||||
/***** Move message from msg_snt to msg_snt_deleted *****/
|
/***** Move message from msg_snt to msg_snt_deleted *****/
|
||||||
/* Insert message into msg_snt_deleted */
|
/* Insert message into msg_snt_deleted */
|
||||||
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted (MsgCod,CrsCod,UsrCod,CreatTime)"
|
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted"
|
||||||
" SELECT MsgCod,CrsCod,UsrCod,CreatTime FROM msg_snt WHERE UsrCod='%ld'",
|
" (MsgCod,CrsCod,UsrCod,CreatTime)"
|
||||||
|
" SELECT MsgCod,CrsCod,UsrCod,CreatTime"
|
||||||
|
" FROM msg_snt WHERE UsrCod='%ld'",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not remove sent messages");
|
DB_QueryINSERT (Query,"can not remove sent messages");
|
||||||
|
|
||||||
|
@ -1411,7 +1417,8 @@ static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEm
|
||||||
/***** Insert message received in the database *****/
|
/***** Insert message received in the database *****/
|
||||||
sprintf (Query,"INSERT INTO msg_rcv"
|
sprintf (Query,"INSERT INTO msg_rcv"
|
||||||
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
|
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
|
||||||
" VALUES ('%ld','%ld','%c','N','N','N')",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%c','N','N','N')",
|
||||||
MsgCod,UsrCod,
|
MsgCod,UsrCod,
|
||||||
NotifyByEmail ? 'Y' :
|
NotifyByEmail ? 'Y' :
|
||||||
'N');
|
'N');
|
||||||
|
@ -1442,7 +1449,8 @@ static void Msg_MoveReceivedMsgToDeleted (long MsgCod,long UsrCod)
|
||||||
|
|
||||||
/***** Move message from msg_rcv to msg_rcv_deleted *****/
|
/***** Move message from msg_rcv to msg_rcv_deleted *****/
|
||||||
/* Insert message into msg_rcv_deleted */
|
/* Insert message into msg_rcv_deleted */
|
||||||
sprintf (Query,"INSERT IGNORE INTO msg_rcv_deleted (MsgCod,UsrCod,Notified,Open,Replied)"
|
sprintf (Query,"INSERT IGNORE INTO msg_rcv_deleted"
|
||||||
|
" (MsgCod,UsrCod,Notified,Open,Replied)"
|
||||||
" SELECT MsgCod,UsrCod,Notified,Open,Replied"
|
" SELECT MsgCod,UsrCod,Notified,Open,Replied"
|
||||||
" FROM msg_rcv WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
" FROM msg_rcv WHERE MsgCod='%ld' AND UsrCod='%ld'",
|
||||||
MsgCod,UsrCod);
|
MsgCod,UsrCod);
|
||||||
|
@ -1472,7 +1480,8 @@ static void Msg_MoveSentMsgToDeleted (long MsgCod)
|
||||||
|
|
||||||
/***** Move message from msg_snt to msg_snt_deleted *****/
|
/***** Move message from msg_snt to msg_snt_deleted *****/
|
||||||
/* Insert message into msg_snt_deleted */
|
/* Insert message into msg_snt_deleted */
|
||||||
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted (MsgCod,CrsCod,UsrCod,CreatTime)"
|
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted"
|
||||||
|
" (MsgCod,CrsCod,UsrCod,CreatTime)"
|
||||||
" SELECT MsgCod,CrsCod,UsrCod,CreatTime"
|
" SELECT MsgCod,CrsCod,UsrCod,CreatTime"
|
||||||
" FROM msg_snt WHERE MsgCod='%ld'",
|
" FROM msg_snt WHERE MsgCod='%ld'",
|
||||||
MsgCod);
|
MsgCod);
|
||||||
|
@ -1522,7 +1531,8 @@ void Msg_MoveUnusedMsgsContentToDeleted (void)
|
||||||
|
|
||||||
/***** Move messages from msg_content to msg_content_deleted *****/
|
/***** Move messages from msg_content to msg_content_deleted *****/
|
||||||
/* Insert message content into msg_content_deleted */
|
/* Insert message content into msg_content_deleted */
|
||||||
sprintf (Query,"INSERT IGNORE INTO msg_content_deleted (MsgCod,Subject,Content)"
|
sprintf (Query,"INSERT IGNORE INTO msg_content_deleted"
|
||||||
|
" (MsgCod,Subject,Content)"
|
||||||
" SELECT MsgCod,Subject,Content FROM msg_content"
|
" SELECT MsgCod,Subject,Content FROM msg_content"
|
||||||
" WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)"
|
" WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)"
|
||||||
" AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)");
|
" AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)");
|
||||||
|
@ -3638,8 +3648,10 @@ void Msg_BanSenderWhenShowingMsgs (void)
|
||||||
Lay_ShowErrorAndExit ("Sender does not exist.");
|
Lay_ShowErrorAndExit ("Sender does not exist.");
|
||||||
|
|
||||||
/***** Insert pair (sender's code - my code) in table of banned senders if not inserted *****/
|
/***** Insert pair (sender's code - my code) in table of banned senders if not inserted *****/
|
||||||
sprintf (Query,"REPLACE INTO msg_banned (FromUsrCod,ToUsrCod)"
|
sprintf (Query,"REPLACE INTO msg_banned"
|
||||||
" VALUES ('%ld','%ld')",
|
" (FromUsrCod,ToUsrCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryREPLACE (Query,"can not ban sender");
|
DB_QueryREPLACE (Query,"can not ban sender");
|
||||||
|
|
||||||
|
|
|
@ -409,8 +409,10 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
|
||||||
if (URL[0])
|
if (URL[0])
|
||||||
{
|
{
|
||||||
/***** Insert or replace web / social network *****/
|
/***** Insert or replace web / social network *****/
|
||||||
sprintf (Query,"REPLACE INTO usr_webs (UsrCod,Web,URL)"
|
sprintf (Query,"REPLACE INTO usr_webs"
|
||||||
" VALUES ('%ld','%s','%s')",
|
" (UsrCod,Web,URL)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s','%s')",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Net_WebsAndSocialNetworksDB[Web],
|
Net_WebsAndSocialNetworksDB[Web],
|
||||||
URL);
|
URL);
|
||||||
|
|
|
@ -432,7 +432,9 @@ void Nck_UpdateMyNick (const char *NewNickname)
|
||||||
|
|
||||||
/***** Update my nickname in database *****/
|
/***** Update my nickname in database *****/
|
||||||
sprintf (Query,"REPLACE INTO usr_nicknames"
|
sprintf (Query,"REPLACE INTO usr_nicknames"
|
||||||
" (UsrCod,Nickname,CreatTime) VALUES ('%ld','%s',NOW())",
|
" (UsrCod,Nickname,CreatTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,NewNickname);
|
Gbl.Usrs.Me.UsrDat.UsrCod,NewNickname);
|
||||||
DB_QueryREPLACE (Query,"can not update your nickname");
|
DB_QueryREPLACE (Query,"can not update your nickname");
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,9 +163,12 @@ static long Not_InsertNoticeInDB (const char *Content)
|
||||||
char Query[256 + Cns_MAX_BYTES_TEXT];
|
char Query[256 + Cns_MAX_BYTES_TEXT];
|
||||||
|
|
||||||
/***** Insert notice in the database *****/
|
/***** Insert notice in the database *****/
|
||||||
sprintf (Query,"INSERT INTO notices (CrsCod,UsrCod,CreatTime,Content,Status)"
|
sprintf (Query,"INSERT INTO notices"
|
||||||
" VALUES ('%ld','%ld',NOW(),'%s','%u')",
|
" (CrsCod,UsrCod,CreatTime,Content,Status)"
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,Content,(unsigned) Not_ACTIVE_NOTICE);
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW(),'%s','%u')",
|
||||||
|
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
Content,(unsigned) Not_ACTIVE_NOTICE);
|
||||||
return DB_QueryINSERTandReturnCode (Query,"can not create notice");
|
return DB_QueryINSERTandReturnCode (Query,"can not create notice");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +302,8 @@ void Not_RemoveNotice (void)
|
||||||
|
|
||||||
/***** Remove notice *****/
|
/***** Remove notice *****/
|
||||||
/* Copy notice to table of deleted notices */
|
/* Copy notice to table of deleted notices */
|
||||||
sprintf (Query,"INSERT IGNORE INTO notices_deleted (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
|
sprintf (Query,"INSERT IGNORE INTO notices_deleted"
|
||||||
|
" (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
|
||||||
" SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif"
|
" SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif"
|
||||||
" FROM notices"
|
" FROM notices"
|
||||||
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
" WHERE NotCod='%ld' AND CrsCod='%ld'",
|
||||||
|
|
|
@ -1434,15 +1434,14 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Store notify event *****/
|
/***** Store notify event *****/
|
||||||
sprintf (Query,"INSERT INTO notif (NotifyEvent,ToUsrCod,FromUsrCod,"
|
sprintf (Query,"INSERT INTO notif"
|
||||||
"InsCod,CtrCod,DegCod,CrsCod,"
|
" (NotifyEvent,ToUsrCod,FromUsrCod,"
|
||||||
"Cod,TimeNotif,Status)"
|
"InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
|
||||||
" VALUES ('%u','%ld','%ld',"
|
" VALUES"
|
||||||
"'%ld','%ld','%ld','%ld',"
|
" ('%u','%ld','%ld',"
|
||||||
"'%ld',NOW(),'%u')",
|
"'%ld','%ld','%ld','%ld','%ld',NOW(),'%u')",
|
||||||
(unsigned) NotifyEvent,UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) NotifyEvent,UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
InsCod,CtrCod,DegCod,CrsCod,
|
InsCod,CtrCod,DegCod,CrsCod,Cod,(unsigned) Status);
|
||||||
Cod,(unsigned) Status);
|
|
||||||
DB_QueryINSERT (Query,"can not create new notification event");
|
DB_QueryINSERT (Query,"can not create new notification event");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1830,8 +1829,10 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
|
||||||
Ntf_GetNumNotifSent (DegCod,CrsCod,NotifyEvent,&CurrentNumEvents,&CurrentNumMails);
|
Ntf_GetNumNotifSent (DegCod,CrsCod,NotifyEvent,&CurrentNumEvents,&CurrentNumMails);
|
||||||
|
|
||||||
/***** Update number of users notified *****/
|
/***** Update number of users notified *****/
|
||||||
sprintf (Query,"REPLACE INTO sta_notif (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
|
sprintf (Query,"REPLACE INTO sta_notif"
|
||||||
" VALUES ('%ld','%ld','%u','%u','%u')",
|
" (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u','%u','%u')",
|
||||||
DegCod,CrsCod,(unsigned) NotifyEvent,
|
DegCod,CrsCod,(unsigned) NotifyEvent,
|
||||||
CurrentNumEvents + NumEvents,
|
CurrentNumEvents + NumEvents,
|
||||||
CurrentNumMails + NumMails);
|
CurrentNumMails + NumMails);
|
||||||
|
|
|
@ -261,7 +261,7 @@ void Pwd_ShowFormSendNewPwd (void)
|
||||||
" size=\"8\" maxlength=\"%u\" value=\"%s\" />"
|
" size=\"8\" maxlength=\"%u\" value=\"%s\" />"
|
||||||
"</label>",
|
"</label>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],Txt_nick_email_or_ID,
|
The_ClassForm[Gbl.Prefs.Theme],Txt_nick_email_or_ID,
|
||||||
Cns_MAX_CHARS_EMAIL,Gbl.Usrs.Me.UsrIdLogin);
|
Cns_MAX_CHARS_EMAIL_ADDRESS,Gbl.Usrs.Me.UsrIdLogin);
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Get_a_new_password);
|
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Get_a_new_password);
|
||||||
|
@ -469,8 +469,10 @@ void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD +
|
||||||
DB_QueryDELETE (Query,"can not remove expired pending passwords");
|
DB_QueryDELETE (Query,"can not remove expired pending passwords");
|
||||||
|
|
||||||
/***** Update my current password in database *****/
|
/***** Update my current password in database *****/
|
||||||
sprintf (Query,"REPLACE INTO pending_passwd (UsrCod,PendingPassword,DateAndTime)"
|
sprintf (Query,"REPLACE INTO pending_passwd"
|
||||||
" VALUES ('%ld','%s',NOW())",
|
" (UsrCod,PendingPassword,DateAndTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%s',NOW())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PendingPassword);
|
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PendingPassword);
|
||||||
DB_QueryREPLACE (Query,"can not create pending password");
|
DB_QueryREPLACE (Query,"can not create pending password");
|
||||||
}
|
}
|
||||||
|
|
|
@ -905,7 +905,10 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
||||||
else // The user does not exist ==> add him/her
|
else // The user does not exist ==> add him/her
|
||||||
{
|
{
|
||||||
/* Add the user, with one access */
|
/* Add the user, with one access */
|
||||||
sprintf (Query,"INSERT INTO clicks_without_photo (UsrCod,NumClicks) VALUES ('%ld',1)",
|
sprintf (Query,"INSERT INTO clicks_without_photo"
|
||||||
|
" (UsrCod,NumClicks)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld',1)",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not create number of clicks without photo");
|
DB_QueryINSERT (Query,"can not create number of clicks without photo");
|
||||||
NumClicks = 1;
|
NumClicks = 1;
|
||||||
|
@ -2287,7 +2290,8 @@ static void Pho_UpdateDegStats (long DegCod,Usr_Sex_t Sex,unsigned NumStds,unsig
|
||||||
|
|
||||||
sprintf (Query,"REPLACE INTO sta_degrees"
|
sprintf (Query,"REPLACE INTO sta_degrees"
|
||||||
" (DegCod,Sex,NumStds,NumStdsWithPhoto,TimeAvgPhoto,TimeToComputeAvgPhoto)"
|
" (DegCod,Sex,NumStds,NumStdsWithPhoto,TimeAvgPhoto,TimeToComputeAvgPhoto)"
|
||||||
" VALUES ('%ld','%s','%u','%u',NOW(),'%ld')",
|
" VALUES"
|
||||||
|
" ('%ld','%s','%u','%u',NOW(),'%ld')",
|
||||||
DegCod,Usr_StringsSexDB[Sex],NumStds,NumStdsWithPhoto,TimeToComputeAvgPhotoInMicroseconds);
|
DegCod,Usr_StringsSexDB[Sex],NumStds,NumStdsWithPhoto,TimeToComputeAvgPhotoInMicroseconds);
|
||||||
DB_QueryREPLACE (Query,"can not save stats of a degree");
|
DB_QueryREPLACE (Query,"can not save stats of a degree");
|
||||||
}
|
}
|
||||||
|
|
|
@ -849,7 +849,8 @@ static void Plc_CreatePlace (struct Place *Plc)
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
|
|
||||||
/***** Create a new place *****/
|
/***** Create a new place *****/
|
||||||
sprintf (Query,"INSERT INTO places (InsCod,ShortName,FullName)"
|
sprintf (Query,"INSERT INTO places"
|
||||||
|
" (InsCod,ShortName,FullName)"
|
||||||
" VALUES ('%ld','%s','%s')",
|
" VALUES ('%ld','%s','%s')",
|
||||||
Gbl.CurrentIns.Ins.InsCod,Plc->ShrtName,Plc->FullName);
|
Gbl.CurrentIns.Ins.InsCod,Plc->ShrtName,Plc->FullName);
|
||||||
DB_QueryINSERT (Query,"can not create place");
|
DB_QueryINSERT (Query,"can not create place");
|
||||||
|
|
|
@ -1048,8 +1048,10 @@ static void Plg_CreatePlugin (struct Plugin *Plg)
|
||||||
Cns_MAX_BYTES_IP];
|
Cns_MAX_BYTES_IP];
|
||||||
|
|
||||||
/***** Create a new plugin *****/
|
/***** Create a new plugin *****/
|
||||||
sprintf (Query,"INSERT INTO plugins (Name,Description,Logo,AppKey,URL,IP)"
|
sprintf (Query,"INSERT INTO plugins"
|
||||||
" VALUES ('%s','%s','%s','%s','%s','%s')",
|
" (Name,Description,Logo,AppKey,URL,IP)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%s','%s','%s','%s','%s')",
|
||||||
Plg->Name,Plg->Description,Plg->Logo,Plg->AppKey,Plg->URL,Plg->IP);
|
Plg->Name,Plg->Description,Plg->Logo,Plg->AppKey,Plg->URL,Plg->IP);
|
||||||
DB_QueryINSERT (Query,"can not create plugin");
|
DB_QueryINSERT (Query,"can not create plugin");
|
||||||
|
|
||||||
|
|
|
@ -189,8 +189,10 @@ void Pre_SetPrefsFromIP (void)
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Update preferences from current IP in database *****/
|
/***** Update preferences from current IP in database *****/
|
||||||
sprintf (Query,"REPLACE INTO IP_prefs (IP,UsrCod,LastChange,FirstDayOfWeek,Theme,IconSet,Menu,SideCols)"
|
sprintf (Query,"REPLACE INTO IP_prefs"
|
||||||
" VALUES ('%s','%ld',NOW(),'%u','%s','%s','%u','%u')",
|
" (IP,UsrCod,LastChange,FirstDayOfWeek,Theme,IconSet,Menu,SideCols)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%ld',NOW(),'%u','%s','%s','%u','%u')",
|
||||||
Gbl.IP,Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.IP,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Prefs.FirstDayOfWeek,
|
Gbl.Prefs.FirstDayOfWeek,
|
||||||
The_ThemeId[Gbl.Prefs.Theme],
|
The_ThemeId[Gbl.Prefs.Theme],
|
||||||
|
|
|
@ -1076,8 +1076,9 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
|
||||||
|
|
||||||
/***** Create user's figures *****/
|
/***** Create user's figures *****/
|
||||||
sprintf (Query,"INSERT INTO usr_figures"
|
sprintf (Query,"INSERT INTO usr_figures"
|
||||||
"(UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
|
" (UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
|
||||||
" VALUES ('%ld',%s,'%ld','%ld','%ld','%ld')",
|
" VALUES"
|
||||||
|
" ('%ld',%s,'%ld','%ld','%ld','%ld')",
|
||||||
UsrCod,
|
UsrCod,
|
||||||
SubQueryFirstClickTime,
|
SubQueryFirstClickTime,
|
||||||
UsrFigures->NumClicks, // -1L ==> unknown number of clicks
|
UsrFigures->NumClicks, // -1L ==> unknown number of clicks
|
||||||
|
|
|
@ -552,7 +552,8 @@ void Rec_CreateRecordField (void)
|
||||||
/***** Create the new field *****/
|
/***** Create the new field *****/
|
||||||
sprintf (Query,"INSERT INTO crs_record_fields"
|
sprintf (Query,"INSERT INTO crs_record_fields"
|
||||||
" (CrsCod,FieldName,NumLines,Visibility)"
|
" (CrsCod,FieldName,NumLines,Visibility)"
|
||||||
" VALUES ('%ld','%s','%u','%u')",
|
" VALUES"
|
||||||
|
" ('%ld','%s','%u','%u')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.CurrentCrs.Records.Field.Name,
|
Gbl.CurrentCrs.Records.Field.Name,
|
||||||
Gbl.CurrentCrs.Records.Field.NumLines,
|
Gbl.CurrentCrs.Records.Field.NumLines,
|
||||||
|
@ -1834,8 +1835,10 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
||||||
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
|
||||||
{
|
{
|
||||||
/***** Insert text field of record course *****/
|
/***** Insert text field of record course *****/
|
||||||
sprintf (Query,"INSERT INTO crs_records (FieldCod,UsrCod,Txt)"
|
sprintf (Query,"INSERT INTO crs_records"
|
||||||
" VALUES ('%ld','%ld','%s')",
|
" (FieldCod,UsrCod,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%s')",
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,
|
||||||
UsrCod,
|
UsrCod,
|
||||||
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text);
|
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text);
|
||||||
|
|
|
@ -160,9 +160,11 @@ void Ses_InsertSessionInDB (void)
|
||||||
if (Gbl.Search.WhatToSearch == Sch_SEARCH_UNKNOWN)
|
if (Gbl.Search.WhatToSearch == Sch_SEARCH_UNKNOWN)
|
||||||
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
|
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
|
||||||
|
|
||||||
sprintf (Query,"INSERT INTO sessions (SessionId,UsrCod,Password,Role,"
|
sprintf (Query,"INSERT INTO sessions"
|
||||||
|
" (SessionId,UsrCod,Password,Role,"
|
||||||
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)"
|
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)"
|
||||||
" VALUES ('%s','%ld','%s','%u',"
|
" VALUES"
|
||||||
|
" ('%s','%ld','%s','%u',"
|
||||||
"'%ld','%ld','%ld','%ld','%ld',NOW(),NOW(),'%u')",
|
"'%ld','%ld','%ld','%ld','%ld',NOW(),NOW(),'%u')",
|
||||||
Gbl.Session.Id,
|
Gbl.Session.Id,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
@ -358,7 +360,8 @@ void Ses_InsertHiddenParInDB (Act_Action_t Action,const char *ParamName,const ch
|
||||||
/***** Insert parameter in the database *****/
|
/***** Insert parameter in the database *****/
|
||||||
sprintf (Query,"INSERT INTO hidden_params"
|
sprintf (Query,"INSERT INTO hidden_params"
|
||||||
" (SessionId,Action,ParamName,ParamValue)"
|
" (SessionId,Action,ParamName,ParamValue)"
|
||||||
" VALUES ('%s','%d','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%s','%d','%s','%s')",
|
||||||
Gbl.Session.Id,(int) Action,ParamName,ParamValue);
|
Gbl.Session.Id,(int) Action,ParamName,ParamValue);
|
||||||
DB_QueryINSERT (Query,"can not create hidden parameter");
|
DB_QueryINSERT (Query,"can not create hidden parameter");
|
||||||
Gbl.HiddenParamsInsertedIntoDB = true;
|
Gbl.HiddenParamsInsertedIntoDB = true;
|
||||||
|
|
|
@ -1942,7 +1942,8 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct Soci
|
||||||
/***** Store social note *****/
|
/***** Store social note *****/
|
||||||
sprintf (Query,"INSERT INTO social_notes"
|
sprintf (Query,"INSERT INTO social_notes"
|
||||||
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
||||||
" VALUES ('%u','%ld','%ld','%ld','N',NOW())",
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld','%ld','N',NOW())",
|
||||||
(unsigned) NoteType,Cod,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod);
|
(unsigned) NoteType,Cod,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod);
|
||||||
SocPub->NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
|
SocPub->NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
|
||||||
|
|
||||||
|
@ -2304,8 +2305,10 @@ static long Soc_ReceiveSocialPost (void)
|
||||||
|
|
||||||
/***** Publish *****/
|
/***** Publish *****/
|
||||||
/* Insert post content in the database */
|
/* Insert post content in the database */
|
||||||
sprintf (Query,"INSERT INTO social_posts (Content,ImageName,ImageTitle,ImageURL)"
|
sprintf (Query,"INSERT INTO social_posts"
|
||||||
" VALUES ('%s','%s','%s','%s')",
|
" (Content,ImageName,ImageTitle,ImageURL)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%s','%s','%s')",
|
||||||
Content,
|
Content,
|
||||||
Image.Name,
|
Image.Name,
|
||||||
(Image.Name[0] && // Save image title only if image attached
|
(Image.Name[0] && // Save image title only if image attached
|
||||||
|
@ -3012,7 +3015,8 @@ static long Soc_ReceiveComment (void)
|
||||||
/* Insert comment content in the database */
|
/* Insert comment content in the database */
|
||||||
sprintf (Query,"INSERT INTO social_comments"
|
sprintf (Query,"INSERT INTO social_comments"
|
||||||
" (PubCod,Content,ImageName,ImageTitle,ImageURL)"
|
" (PubCod,Content,ImageName,ImageTitle,ImageURL)"
|
||||||
" VALUES ('%ld','%s','%s','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%s','%s','%s','%s')",
|
||||||
SocPub.PubCod,
|
SocPub.PubCod,
|
||||||
Content,
|
Content,
|
||||||
Image.Name,
|
Image.Name,
|
||||||
|
@ -3182,7 +3186,9 @@ static long Soc_FavSocialNote (void)
|
||||||
{
|
{
|
||||||
/***** Mark as favourite in database *****/
|
/***** Mark as favourite in database *****/
|
||||||
sprintf (Query,"INSERT IGNORE INTO social_notes_fav"
|
sprintf (Query,"INSERT IGNORE INTO social_notes_fav"
|
||||||
" (NotCod,UsrCod,TimeFav) VALUES ('%ld','%ld',NOW())",
|
" (NotCod,UsrCod,TimeFav)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW())",
|
||||||
SocNot.NotCod,
|
SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not favourite social note");
|
DB_QueryINSERT (Query,"can not favourite social note");
|
||||||
|
@ -3268,7 +3274,9 @@ static long Soc_FavSocialComment (void)
|
||||||
{
|
{
|
||||||
/***** Mark as favourite in database *****/
|
/***** Mark as favourite in database *****/
|
||||||
sprintf (Query,"INSERT IGNORE INTO social_comments_fav"
|
sprintf (Query,"INSERT IGNORE INTO social_comments_fav"
|
||||||
" (PubCod,UsrCod,TimeFav) VALUES ('%ld','%ld',NOW())",
|
" (PubCod,UsrCod,TimeFav)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW())",
|
||||||
SocCom.PubCod,
|
SocCom.PubCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not favourite social comment");
|
DB_QueryINSERT (Query,"can not favourite social comment");
|
||||||
|
@ -4722,7 +4730,8 @@ static void Soc_AddNotesJustRetrievedToTimelineThisSession (void)
|
||||||
{
|
{
|
||||||
char Query[256 + Ses_LENGTH_SESSION_ID];
|
char Query[256 + Ses_LENGTH_SESSION_ID];
|
||||||
|
|
||||||
sprintf (Query,"INSERT IGNORE INTO social_timelines (SessionId,NotCod)"
|
sprintf (Query,"INSERT IGNORE INTO social_timelines"
|
||||||
|
" (SessionId,NotCod)"
|
||||||
" SELECT DISTINCTROW '%s',NotCod FROM not_codes",
|
" SELECT DISTINCTROW '%s',NotCod FROM not_codes",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
DB_QueryINSERT (Query,"can not insert social notes in timeline");
|
DB_QueryINSERT (Query,"can not insert social notes in timeline");
|
||||||
|
|
|
@ -333,8 +333,10 @@ void Sta_LogAccess (const char *Comments)
|
||||||
if (Comments)
|
if (Comments)
|
||||||
{
|
{
|
||||||
/* Log comments */
|
/* Log comments */
|
||||||
sprintf (Query,"INSERT INTO log_comments (LogCod,Comments)"
|
sprintf (Query,"INSERT INTO log_comments"
|
||||||
" VALUES ('%ld','",
|
" (LogCod,Comments)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','",
|
||||||
LogCod);
|
LogCod);
|
||||||
Str_AddStrToQuery (Query,Comments,sizeof (Query));
|
Str_AddStrToQuery (Query,Comments,sizeof (Query));
|
||||||
Str_Concat (Query,"')",
|
Str_Concat (Query,"')",
|
||||||
|
@ -352,8 +354,10 @@ void Sta_LogAccess (const char *Comments)
|
||||||
if (Gbl.Search.LogSearch && Gbl.Search.Str[0])
|
if (Gbl.Search.LogSearch && Gbl.Search.Str[0])
|
||||||
{
|
{
|
||||||
/* Log search string */
|
/* Log search string */
|
||||||
sprintf (Query,"INSERT INTO log_search (LogCod,SearchStr)"
|
sprintf (Query,"INSERT INTO log_search"
|
||||||
" VALUES ('%ld','",
|
" (LogCod,SearchStr)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','",
|
||||||
LogCod);
|
LogCod);
|
||||||
Str_AddStrToQuery (Query,Gbl.Search.Str,sizeof (Query));
|
Str_AddStrToQuery (Query,Gbl.Search.Str,sizeof (Query));
|
||||||
Str_Concat (Query,"')",
|
Str_Concat (Query,"')",
|
||||||
|
@ -371,8 +375,10 @@ void Sta_LogAccess (const char *Comments)
|
||||||
if (Gbl.WebService.IsWebService)
|
if (Gbl.WebService.IsWebService)
|
||||||
{
|
{
|
||||||
/* Log web service plugin and function */
|
/* Log web service plugin and function */
|
||||||
sprintf (Query,"INSERT INTO log_ws (LogCod,PlgCod,FunCod)"
|
sprintf (Query,"INSERT INTO log_ws"
|
||||||
" VALUES ('%ld','%ld','%u')",
|
" (LogCod,PlgCod,FunCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u')",
|
||||||
LogCod,Gbl.WebService.PlgCod,(unsigned) Gbl.WebService.Function);
|
LogCod,Gbl.WebService.PlgCod,(unsigned) Gbl.WebService.Function);
|
||||||
|
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
|
@ -381,8 +387,10 @@ void Sta_LogAccess (const char *Comments)
|
||||||
else if (Gbl.Banners.BanCodClicked > 0)
|
else if (Gbl.Banners.BanCodClicked > 0)
|
||||||
{
|
{
|
||||||
/* Log banner clicked */
|
/* Log banner clicked */
|
||||||
sprintf (Query,"INSERT INTO log_banners (LogCod,BanCod)"
|
sprintf (Query,"INSERT INTO log_banners"
|
||||||
" VALUES ('%ld','%ld')",
|
" (LogCod,BanCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
LogCod,Gbl.Banners.BanCodClicked);
|
LogCod,Gbl.Banners.BanCodClicked);
|
||||||
DB_QueryINSERT (Query,"can not log banner clicked");
|
DB_QueryINSERT (Query,"can not log banner clicked");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2219,7 +2219,8 @@ static void Svy_CreateSurvey (struct Survey *Svy,const char *Txt)
|
||||||
/***** Create a new survey *****/
|
/***** Create a new survey *****/
|
||||||
sprintf (Query,"INSERT INTO surveys"
|
sprintf (Query,"INSERT INTO surveys"
|
||||||
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
|
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
|
||||||
" VALUES ('%s','%ld','N','%u','%ld',"
|
" VALUES"
|
||||||
|
" ('%s','%ld','N','%u','%ld',"
|
||||||
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||||
"'%s','%s')",
|
"'%s','%s')",
|
||||||
Sco_ScopeDB[Svy->Scope],Svy->Cod,
|
Sco_ScopeDB[Svy->Scope],Svy->Cod,
|
||||||
|
@ -2368,7 +2369,10 @@ static void Svy_CreateGrps (long SvyCod)
|
||||||
NumGrpSel++)
|
NumGrpSel++)
|
||||||
{
|
{
|
||||||
/* Create group */
|
/* Create group */
|
||||||
sprintf (Query,"INSERT INTO svy_grp (SvyCod,GrpCod) VALUES ('%ld','%ld')",
|
sprintf (Query,"INSERT INTO svy_grp"
|
||||||
|
" (SvyCod,GrpCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
SvyCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
SvyCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||||
DB_QueryINSERT (Query,"can not associate a group to a survey");
|
DB_QueryINSERT (Query,"can not associate a group to a survey");
|
||||||
}
|
}
|
||||||
|
@ -2996,8 +3000,10 @@ void Svy_ReceiveQst (void)
|
||||||
SvyQst.QstInd = Svy_GetNextQuestionIndexInSvy (SvyCod);
|
SvyQst.QstInd = Svy_GetNextQuestionIndexInSvy (SvyCod);
|
||||||
|
|
||||||
/* Insert question in the table of questions */
|
/* Insert question in the table of questions */
|
||||||
sprintf (Query,"INSERT INTO svy_questions (SvyCod,QstInd,AnsType,Stem)"
|
sprintf (Query,"INSERT INTO svy_questions"
|
||||||
" VALUES ('%ld','%u','%s','%s')",
|
" (SvyCod,QstInd,AnsType,Stem)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%u','%s','%s')",
|
||||||
SvyCod,SvyQst.QstInd,Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
|
SvyCod,SvyQst.QstInd,Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
|
||||||
SvyQst.QstCod = DB_QueryINSERTandReturnCode (Query,"can not create question");
|
SvyQst.QstCod = DB_QueryINSERTandReturnCode (Query,"can not create question");
|
||||||
}
|
}
|
||||||
|
@ -3038,8 +3044,10 @@ void Svy_ReceiveQst (void)
|
||||||
if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty
|
if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty
|
||||||
{
|
{
|
||||||
/* Create answer into database */
|
/* Create answer into database */
|
||||||
sprintf (Query,"INSERT INTO svy_answers (QstCod,AnsInd,NumUsrs,Answer)"
|
sprintf (Query,"INSERT INTO svy_answers"
|
||||||
" VALUES ('%ld','%u','0','%s')",
|
" (QstCod,AnsInd,NumUsrs,Answer)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%u','0','%s')",
|
||||||
SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text);
|
SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text);
|
||||||
DB_QueryINSERT (Query,"can not create answer");
|
DB_QueryINSERT (Query,"can not create answer");
|
||||||
}
|
}
|
||||||
|
@ -3702,8 +3710,10 @@ static void Svy_RegisterIHaveAnsweredSvy (long SvyCod)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
sprintf (Query,"INSERT INTO svy_users (SvyCod,UsrCod)"
|
sprintf (Query,"INSERT INTO svy_users"
|
||||||
" VALUES ('%ld','%ld')",
|
" (SvyCod,UsrCod)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld')",
|
||||||
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not register that you have answered the survey");
|
DB_QueryINSERT (Query,"can not register that you have answered the survey");
|
||||||
}
|
}
|
||||||
|
|
38
swad_test.c
38
swad_test.c
|
@ -699,7 +699,10 @@ static void Tst_SetTstStatus (unsigned NumTst,Tst_Status_t TstStatus)
|
||||||
DB_QueryDELETE (Query,"can not remove old status of tests");
|
DB_QueryDELETE (Query,"can not remove old status of tests");
|
||||||
|
|
||||||
/***** Update database *****/
|
/***** Update database *****/
|
||||||
sprintf (Query,"REPLACE INTO tst_status (SessionId,CrsCod,NumTst,Status) VALUES ('%s','%ld','%u','%u')",
|
sprintf (Query,"REPLACE INTO tst_status"
|
||||||
|
" (SessionId,CrsCod,NumTst,Status)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%ld','%u','%u')",
|
||||||
Gbl.Session.Id,Gbl.CurrentCrs.Crs.CrsCod,NumTst,(unsigned) TstStatus);
|
Gbl.Session.Id,Gbl.CurrentCrs.Crs.CrsCod,NumTst,(unsigned) TstStatus);
|
||||||
DB_QueryREPLACE (Query,"can not update status of test");
|
DB_QueryREPLACE (Query,"can not update status of test");
|
||||||
}
|
}
|
||||||
|
@ -2147,7 +2150,8 @@ void Tst_ReceiveConfigTst (void)
|
||||||
/***** Update database *****/
|
/***** Update database *****/
|
||||||
sprintf (Query,"REPLACE INTO tst_config"
|
sprintf (Query,"REPLACE INTO tst_config"
|
||||||
" (CrsCod,Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Feedback)"
|
" (CrsCod,Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Feedback)"
|
||||||
" VALUES ('%ld','%s','%u','%u','%u','%lu','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%s','%u','%u','%u','%lu','%s')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Tst_PluggableDB[Gbl.Test.Config.Pluggable],
|
Tst_PluggableDB[Gbl.Test.Config.Pluggable],
|
||||||
Gbl.Test.Config.Min,Gbl.Test.Config.Def,Gbl.Test.Config.Max,
|
Gbl.Test.Config.Min,Gbl.Test.Config.Def,Gbl.Test.Config.Max,
|
||||||
|
@ -5783,8 +5787,10 @@ static long Tst_CreateNewTag (long CrsCod,const char *TagTxt)
|
||||||
char Query[256 + Tst_MAX_BYTES_TAG];
|
char Query[256 + Tst_MAX_BYTES_TAG];
|
||||||
|
|
||||||
/***** Insert new tag into tst_tags table *****/
|
/***** Insert new tag into tst_tags table *****/
|
||||||
sprintf (Query,"INSERT INTO tst_tags (CrsCod,ChangeTime,TagTxt,TagHidden)"
|
sprintf (Query,"INSERT INTO tst_tags"
|
||||||
" VALUES ('%ld',NOW(),'%s','N')",
|
" (CrsCod,ChangeTime,TagTxt,TagHidden)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld',NOW(),'%s','N')",
|
||||||
CrsCod,TagTxt);
|
CrsCod,TagTxt);
|
||||||
return DB_QueryINSERTandReturnCode (Query,"can not create new tag");
|
return DB_QueryINSERTandReturnCode (Query,"can not create new tag");
|
||||||
}
|
}
|
||||||
|
@ -6026,7 +6032,8 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
||||||
" (CrsCod,EditTime,AnsType,Shuffle,"
|
" (CrsCod,EditTime,AnsType,Shuffle,"
|
||||||
"Stem,Feedback,ImageName,ImageTitle,ImageURL,"
|
"Stem,Feedback,ImageName,ImageTitle,ImageURL,"
|
||||||
"NumHits,Score)"
|
"NumHits,Score)"
|
||||||
" VALUES ('%ld',NOW(),'%s','%c',"
|
" VALUES"
|
||||||
|
" ('%ld',NOW(),'%s','%c',"
|
||||||
"'%s','%s','%s','%s','%s',"
|
"'%s','%s','%s','%s','%s',"
|
||||||
"'0','0')",
|
"'0','0')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
|
@ -6100,8 +6107,10 @@ static void Tst_InsertTagsIntoDB (void)
|
||||||
TagCod = Tst_CreateNewTag (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.Tags.Txt[NumTag]);
|
TagCod = Tst_CreateNewTag (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.Tags.Txt[NumTag]);
|
||||||
|
|
||||||
/***** Insert tag in tst_question_tags *****/
|
/***** Insert tag in tst_question_tags *****/
|
||||||
sprintf (Query,"INSERT INTO tst_question_tags (QstCod,TagCod,TagInd)"
|
sprintf (Query,"INSERT INTO tst_question_tags"
|
||||||
" VALUES ('%ld','%ld','%u')",
|
" (QstCod,TagCod,TagInd)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u')",
|
||||||
Gbl.Test.QstCod,TagCod,TagIdx);
|
Gbl.Test.QstCod,TagCod,TagIdx);
|
||||||
DB_QueryINSERT (Query,"can not create tag");
|
DB_QueryINSERT (Query,"can not create tag");
|
||||||
|
|
||||||
|
@ -6130,7 +6139,8 @@ static void Tst_InsertAnswersIntoDB (void)
|
||||||
sprintf (Query,"INSERT INTO tst_answers"
|
sprintf (Query,"INSERT INTO tst_answers"
|
||||||
" (QstCod,AnsInd,Answer,Feedback,"
|
" (QstCod,AnsInd,Answer,Feedback,"
|
||||||
"ImageName,ImageTitle,ImageURL,Correct)"
|
"ImageName,ImageTitle,ImageURL,Correct)"
|
||||||
" VALUES (%ld,0,'%ld','','','','','Y')",
|
" VALUES"
|
||||||
|
" (%ld,0,'%ld','','','','','Y')",
|
||||||
Gbl.Test.QstCod,
|
Gbl.Test.QstCod,
|
||||||
Gbl.Test.Answer.Integer);
|
Gbl.Test.Answer.Integer);
|
||||||
DB_QueryINSERT (Query,"can not create answer");
|
DB_QueryINSERT (Query,"can not create answer");
|
||||||
|
@ -6144,7 +6154,8 @@ static void Tst_InsertAnswersIntoDB (void)
|
||||||
sprintf (Query,"INSERT INTO tst_answers"
|
sprintf (Query,"INSERT INTO tst_answers"
|
||||||
" (QstCod,AnsInd,Answer,Feedback,"
|
" (QstCod,AnsInd,Answer,Feedback,"
|
||||||
"ImageName,ImageTitle,ImageURL,Correct)"
|
"ImageName,ImageTitle,ImageURL,Correct)"
|
||||||
" VALUES (%ld,%u,'%lg','','','','','Y')",
|
" VALUES"
|
||||||
|
" (%ld,%u,'%lg','','','','','Y')",
|
||||||
Gbl.Test.QstCod,i,
|
Gbl.Test.QstCod,i,
|
||||||
Gbl.Test.Answer.FloatingPoint[i]);
|
Gbl.Test.Answer.FloatingPoint[i]);
|
||||||
DB_QueryINSERT (Query,"can not create answer");
|
DB_QueryINSERT (Query,"can not create answer");
|
||||||
|
@ -6155,7 +6166,8 @@ static void Tst_InsertAnswersIntoDB (void)
|
||||||
sprintf (Query,"INSERT INTO tst_answers"
|
sprintf (Query,"INSERT INTO tst_answers"
|
||||||
" (QstCod,AnsInd,Answer,Feedback,"
|
" (QstCod,AnsInd,Answer,Feedback,"
|
||||||
"ImageName,ImageTitle,ImageURL,Correct)"
|
"ImageName,ImageTitle,ImageURL,Correct)"
|
||||||
" VALUES (%ld,0,'%c','','','','','Y')",
|
" VALUES"
|
||||||
|
" (%ld,0,'%c','','','','','Y')",
|
||||||
Gbl.Test.QstCod,
|
Gbl.Test.QstCod,
|
||||||
Gbl.Test.Answer.TF);
|
Gbl.Test.Answer.TF);
|
||||||
DB_QueryINSERT (Query,"can not create answer");
|
DB_QueryINSERT (Query,"can not create answer");
|
||||||
|
@ -7018,7 +7030,8 @@ static long Tst_CreateTestResultInDB (void)
|
||||||
/***** Insert new test result into table *****/
|
/***** Insert new test result into table *****/
|
||||||
sprintf (Query,"INSERT INTO tst_exams"
|
sprintf (Query,"INSERT INTO tst_exams"
|
||||||
" (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)"
|
" (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)"
|
||||||
" VALUES ('%ld','%ld','%c',NOW(),'%u')",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%c',NOW(),'%u')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Test.AllowTeachers ? 'Y' :
|
Gbl.Test.AllowTeachers ? 'Y' :
|
||||||
|
@ -7884,7 +7897,8 @@ static void Tst_StoreOneTestResultQstInDB (long TstCod,long QstCod,unsigned NumQ
|
||||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||||
sprintf (Query,"INSERT INTO tst_exam_questions"
|
sprintf (Query,"INSERT INTO tst_exam_questions"
|
||||||
" (TstCod,QstCod,QstInd,Score,Indexes,Answers)"
|
" (TstCod,QstCod,QstInd,Score,Indexes,Answers)"
|
||||||
" VALUES ('%ld','%ld','%u','%lf','%s','%s')",
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%u','%lf','%s','%s')",
|
||||||
TstCod,QstCod,
|
TstCod,QstCod,
|
||||||
NumQst, // 0, 1, 2, 3...
|
NumQst, // 0, 1, 2, 3...
|
||||||
Score,
|
Score,
|
||||||
|
|
|
@ -476,8 +476,10 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
|
||||||
if (TimeTable[Day][Hour].Columns[Column].HourType == TT_FIRST_HOUR &&
|
if (TimeTable[Day][Hour].Columns[Column].HourType == TT_FIRST_HOUR &&
|
||||||
TimeTable[Day][Hour].Columns[Column].Duration > 0)
|
TimeTable[Day][Hour].Columns[Column].Duration > 0)
|
||||||
{
|
{
|
||||||
sprintf (Query,"INSERT INTO timetable_crs (CrsCod,GrpCod,Day,Hour,Duration,ClassType,Place,GroupName)"
|
sprintf (Query,"INSERT INTO timetable_crs"
|
||||||
" VALUES ('%ld','%ld','%c','%u','%d','%s','%s','%s')",
|
" (CrsCod,GrpCod,Day,Hour,Duration,ClassType,Place,GroupName)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%c','%u','%d','%s','%s','%s')",
|
||||||
CrsCod,
|
CrsCod,
|
||||||
TimeTable[Day][Hour].Columns[Column].GrpCod,
|
TimeTable[Day][Hour].Columns[Column].GrpCod,
|
||||||
TimeTableCharsDays[Day],
|
TimeTableCharsDays[Day],
|
||||||
|
@ -516,8 +518,10 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
|
||||||
if (TimeTable[Day][Hour].Columns[Column].HourType == TT_FIRST_HOUR &&
|
if (TimeTable[Day][Hour].Columns[Column].HourType == TT_FIRST_HOUR &&
|
||||||
TimeTable[Day][Hour].Columns[Column].Duration > 0)
|
TimeTable[Day][Hour].Columns[Column].Duration > 0)
|
||||||
{
|
{
|
||||||
sprintf (Query,"INSERT INTO timetable_tut (UsrCod,Day,Hour,Duration,Place)"
|
sprintf (Query,"INSERT INTO timetable_tut"
|
||||||
" VALUES ('%ld','%c','%u','%d','%s')",
|
" (UsrCod,Day,Hour,Duration,Place)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%c','%u','%d','%s')",
|
||||||
UsrCod,TimeTableCharsDays[Day],Hour,
|
UsrCod,TimeTableCharsDays[Day],Hour,
|
||||||
TimeTable[Day][Hour].Columns[Column].Duration,
|
TimeTable[Day][Hour].Columns[Column].Duration,
|
||||||
TimeTable[Day][Hour].Columns[Column].Place);
|
TimeTable[Day][Hour].Columns[Column].Place);
|
||||||
|
|
15
swad_user.c
15
swad_user.c
|
@ -2054,7 +2054,7 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) ())
|
||||||
Gbl.Prefs.IconsURL,
|
Gbl.Prefs.IconsURL,
|
||||||
Txt_User[Usr_SEX_UNKNOWN],
|
Txt_User[Usr_SEX_UNKNOWN],
|
||||||
Txt_User[Usr_SEX_UNKNOWN],
|
Txt_User[Usr_SEX_UNKNOWN],
|
||||||
Cns_MAX_CHARS_EMAIL,
|
Cns_MAX_CHARS_EMAIL_ADDRESS,
|
||||||
Txt_nick_email_or_ID,
|
Txt_nick_email_or_ID,
|
||||||
Gbl.Usrs.Me.UsrIdLogin);
|
Gbl.Usrs.Me.UsrIdLogin);
|
||||||
|
|
||||||
|
@ -2195,7 +2195,10 @@ static void Usr_InsertMyBirthday (void)
|
||||||
DB_QueryDELETE (Query,"can not delete old birthdays");
|
DB_QueryDELETE (Query,"can not delete old birthdays");
|
||||||
|
|
||||||
/***** Insert new birthday *****/
|
/***** Insert new birthday *****/
|
||||||
sprintf (Query,"INSERT INTO birthdays_today (UsrCod,Today) VALUES ('%ld',CURDATE())",
|
sprintf (Query,"INSERT INTO birthdays_today"
|
||||||
|
" (UsrCod,Today)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld',CURDATE())",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
DB_QueryINSERT (Query,"can not insert birthday");
|
DB_QueryINSERT (Query,"can not insert birthday");
|
||||||
}
|
}
|
||||||
|
@ -2299,7 +2302,7 @@ void Usr_PutFormLogOut (void)
|
||||||
|
|
||||||
void Usr_GetParamUsrIdLogin (void)
|
void Usr_GetParamUsrIdLogin (void)
|
||||||
{
|
{
|
||||||
Par_GetParToText ("UsrId",Gbl.Usrs.Me.UsrIdLogin,Cns_MAX_BYTES_EMAIL);
|
Par_GetParToText ("UsrId",Gbl.Usrs.Me.UsrIdLogin,Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
// Users' IDs are always stored internally without leading zeros
|
// Users' IDs are always stored internally without leading zeros
|
||||||
Str_RemoveLeadingZeros (Gbl.Usrs.Me.UsrIdLogin);
|
Str_RemoveLeadingZeros (Gbl.Usrs.Me.UsrIdLogin);
|
||||||
}
|
}
|
||||||
|
@ -2313,7 +2316,7 @@ static void Usr_GetParamOtherUsrIDNickOrEMail (void)
|
||||||
/***** Get parameter with the plain user's ID, @nick or email of another user *****/
|
/***** Get parameter with the plain user's ID, @nick or email of another user *****/
|
||||||
Par_GetParToText ("OtherUsrIDNickOrEMail",
|
Par_GetParToText ("OtherUsrIDNickOrEMail",
|
||||||
Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail,
|
Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
|
|
||||||
// If it's a user's ID (if does not contain '@')
|
// If it's a user's ID (if does not contain '@')
|
||||||
if (strchr (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail,(int) '@') != NULL) // '@' not found
|
if (strchr (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail,(int) '@') != NULL) // '@' not found
|
||||||
|
@ -3589,7 +3592,7 @@ static void Usr_WriteMainUsrDataExceptUsrID (struct UsrData *UsrDat,
|
||||||
static void Usr_WriteEmail (struct UsrData *UsrDat,const char *BgColor)
|
static void Usr_WriteEmail (struct UsrData *UsrDat,const char *BgColor)
|
||||||
{
|
{
|
||||||
bool ShowEmail;
|
bool ShowEmail;
|
||||||
char MailLink[7 + Cns_MAX_BYTES_EMAIL + 1]; // mailto:mail_address
|
char MailLink[7 + Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // mailto:mail_address
|
||||||
|
|
||||||
if (UsrDat->Email[0])
|
if (UsrDat->Email[0])
|
||||||
{
|
{
|
||||||
|
@ -5206,7 +5209,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
||||||
size_t LengthSelectedUsrsCods;
|
size_t LengthSelectedUsrsCods;
|
||||||
size_t LengthUsrCod;
|
size_t LengthUsrCod;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1];
|
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
struct ListUsrCods ListUsrCods;
|
struct ListUsrCods ListUsrCods;
|
||||||
bool Error = false;
|
bool Error = false;
|
||||||
|
|
|
@ -118,7 +118,7 @@ struct UsrData
|
||||||
{
|
{
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
char EncryptedUsrCod [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
char EncryptedUsrCod [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
|
||||||
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1]; // String to store the ID, nickname or email
|
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // String to store the ID, nickname or email
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct ListIDs *List;
|
struct ListIDs *List;
|
||||||
|
@ -136,7 +136,7 @@ struct UsrData
|
||||||
char FirstName [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
char FirstName [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
|
||||||
char FullName [Usr_MAX_BYTES_FULL_NAME + 1];
|
char FullName [Usr_MAX_BYTES_FULL_NAME + 1];
|
||||||
Usr_Sex_t Sex;
|
Usr_Sex_t Sex;
|
||||||
char Email [Cns_MAX_BYTES_EMAIL + 1];
|
char Email [Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
bool EmailConfirmed;
|
bool EmailConfirmed;
|
||||||
char Photo [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo
|
char Photo [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo
|
||||||
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
|
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
|
||||||
|
|
|
@ -465,8 +465,10 @@ static int Svc_GenerateNewWSKey (long UsrCod,
|
||||||
"Generated key already existed in database");
|
"Generated key already existed in database");
|
||||||
|
|
||||||
/***** Insert key into database *****/
|
/***** Insert key into database *****/
|
||||||
sprintf (Query,"INSERT INTO ws_keys (WSKey,UsrCod,PlgCod,LastTime)"
|
sprintf (Query,"INSERT INTO ws_keys"
|
||||||
" VALUES ('%s','%ld','%ld',NOW())",
|
" (WSKey,UsrCod,PlgCod,LastTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%s','%ld','%ld',NOW())",
|
||||||
WSKey,UsrCod,Gbl.WebService.PlgCod);
|
WSKey,UsrCod,Gbl.WebService.PlgCod);
|
||||||
DB_QueryINSERT (Query,"can not insert new key");
|
DB_QueryINSERT (Query,"can not insert new key");
|
||||||
|
|
||||||
|
@ -695,7 +697,7 @@ int swad__createAccount (struct soap *soap,
|
||||||
{
|
{
|
||||||
/* Email updated sucessfully */
|
/* Email updated sucessfully */
|
||||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,userEmail,
|
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,userEmail,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
|
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +769,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
char *userID,char *userPassword,char *appKey, // input
|
char *userID,char *userPassword,char *appKey, // input
|
||||||
struct swad__loginByUserPasswordKeyOutput *loginByUserPasswordKeyOut) // output
|
struct swad__loginByUserPasswordKeyOutput *loginByUserPasswordKeyOut) // output
|
||||||
{
|
{
|
||||||
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1];
|
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
int ReturnCode;
|
int ReturnCode;
|
||||||
char Query[512];
|
char Query[512];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -808,7 +810,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
|
|
||||||
/***** Check if user's email, @nickname or ID are valid *****/
|
/***** Check if user's email, @nickname or ID are valid *****/
|
||||||
Str_Copy (UsrIDNickOrEmail,userID,
|
Str_Copy (UsrIDNickOrEmail,userID,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
||||||
|
@ -1078,7 +1080,7 @@ int swad__getNewPassword (struct soap *soap,
|
||||||
struct swad__getNewPasswordOutput *getNewPasswordOut) // output
|
struct swad__getNewPasswordOutput *getNewPasswordOut) // output
|
||||||
{
|
{
|
||||||
int ReturnCode;
|
int ReturnCode;
|
||||||
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1];
|
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
char Query[512];
|
char Query[512];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -1098,7 +1100,7 @@ int swad__getNewPassword (struct soap *soap,
|
||||||
|
|
||||||
/***** Check if user's email, @nickname or ID are valid *****/
|
/***** Check if user's email, @nickname or ID are valid *****/
|
||||||
Str_Copy (UsrIDNickOrEmail,userID,
|
Str_Copy (UsrIDNickOrEmail,userID,
|
||||||
Cns_MAX_BYTES_EMAIL);
|
Cns_MAX_BYTES_EMAIL_ADDRESS);
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
||||||
|
@ -3355,15 +3357,18 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
||||||
/* Build query */
|
/* Build query */
|
||||||
sprintf (Query,"INSERT INTO msg_content"
|
sprintf (Query,"INSERT INTO msg_content"
|
||||||
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
|
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
|
||||||
" VALUES ('%s','%s','','','')",
|
" VALUES"
|
||||||
|
" ('%s','%s','','','')",
|
||||||
Subject,Content);
|
Subject,Content);
|
||||||
|
|
||||||
/* Get the code of the inserted item */
|
/* Get the code of the inserted item */
|
||||||
NewMsgCod = DB_QueryINSERTandReturnCode (Query,"can not create message");
|
NewMsgCod = DB_QueryINSERTandReturnCode (Query,"can not create message");
|
||||||
|
|
||||||
/***** Insert message in sent messages *****/
|
/***** Insert message in sent messages *****/
|
||||||
sprintf (Query,"INSERT INTO msg_snt (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
|
sprintf (Query,"INSERT INTO msg_snt"
|
||||||
" VALUES ('%ld','-1','%ld','N',NOW())",
|
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','-1','%ld','N',NOW())",
|
||||||
NewMsgCod,SenderUsrCod);
|
NewMsgCod,SenderUsrCod);
|
||||||
DB_QueryINSERT (Query,"can not create message");
|
DB_QueryINSERT (Query,"can not create message");
|
||||||
|
|
||||||
|
@ -3371,8 +3376,10 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Insert message received in the database *****/
|
/***** Insert message received in the database *****/
|
||||||
sprintf (Query,"INSERT INTO msg_rcv (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
|
sprintf (Query,"INSERT INTO msg_rcv"
|
||||||
" VALUES ('%ld','%ld','%c','N','N','N')",
|
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld','%c','N','N','N')",
|
||||||
NewMsgCod,RecipientUsrCod,
|
NewMsgCod,RecipientUsrCod,
|
||||||
NotifyByEmail ? 'Y' :
|
NotifyByEmail ? 'Y' :
|
||||||
'N');
|
'N');
|
||||||
|
@ -3380,8 +3387,10 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
|
||||||
|
|
||||||
/***** Create notification for this recipient.
|
/***** Create notification for this recipient.
|
||||||
If this recipient wants to receive notifications by email, activate the sending of a notification *****/
|
If this recipient wants to receive notifications by email, activate the sending of a notification *****/
|
||||||
sprintf (Query,"INSERT INTO notif (NotifyEvent,ToUsrCod,FromUsrCod,InsCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
|
sprintf (Query,"INSERT INTO notif"
|
||||||
" VALUES ('%u','%ld','%ld','-1','-1','-1','%ld',NOW(),'%u')",
|
" (NotifyEvent,ToUsrCod,FromUsrCod,InsCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%u','%ld','%ld','-1','-1','-1','%ld',NOW(),'%u')",
|
||||||
(unsigned) Ntf_EVENT_MESSAGE,
|
(unsigned) Ntf_EVENT_MESSAGE,
|
||||||
RecipientUsrCod,
|
RecipientUsrCod,
|
||||||
SenderUsrCod,
|
SenderUsrCod,
|
||||||
|
@ -3452,8 +3461,10 @@ int swad__sendNotice (struct soap *soap,
|
||||||
|
|
||||||
/***** Insert notice in the database *****/
|
/***** Insert notice in the database *****/
|
||||||
/* Build query */
|
/* Build query */
|
||||||
sprintf (Query,"INSERT INTO notices (CrsCod,UsrCod,CreatTime,Content,Status)"
|
sprintf (Query,"INSERT INTO notices"
|
||||||
" VALUES ('%ld','%ld',NOW(),'%s','%u')",
|
" (CrsCod,UsrCod,CreatTime,Content,Status)"
|
||||||
|
" VALUES"
|
||||||
|
" ('%ld','%ld',NOW(),'%s','%u')",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
body,(unsigned) Not_ACTIVE_NOTICE);
|
body,(unsigned) Not_ACTIVE_NOTICE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue