Version 16.155.21

This commit is contained in:
Antonio Cañas Vargas 2017-03-13 13:17:53 +01:00
parent 2745f891ed
commit 5bd5fb1b59
51 changed files with 518 additions and 337 deletions

View File

@ -924,7 +924,8 @@ static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed
/***** Update my nickname in database *****/
sprintf (Query,"INSERT INTO usr_IDs"
" (UsrCod,UsrID,CreatTime,Confirmed)"
" VALUES ('%ld','%s',NOW(),'%c')",
" VALUES"
" ('%ld','%s',NOW(),'%c')",
UsrCod,NewID,
Confirmed ? 'Y' :
'N');

View File

@ -377,7 +377,8 @@ void MFU_UpdateMFUActions (void)
/***** Update score for the current action *****/
sprintf (Query,"REPLACE INTO actions_MFU"
" (UsrCod,ActCod,Score,LastClick)"
" VALUES ('%ld','%ld','%f',NOW())",
" VALUES"
" ('%ld','%ld','%f',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod,
Score);

View File

@ -375,7 +375,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWith
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Email,
Cns_MAX_CHARS_EMAIL,
Cns_MAX_CHARS_EMAIL_ADDRESS,
Txt_HELP_email,
NewEmail);
@ -551,7 +551,7 @@ static void Acc_PrintAccountSeparator (void)
bool Acc_CreateMyNewAccountAndLogIn (void)
{
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];
if (Acc_GetParamsNewAccount (NewNicknameWithoutArroba,NewEmail,NewEncryptedPassword))
@ -578,7 +578,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
{
/* Email updated sucessfully */
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,NewEmail,
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
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 *****/
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
{
@ -717,12 +717,14 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
/***** Insert new user in database *****/
/* Insert user's data */
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,"
"CtyCod,"
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
" VALUES ('%s','%s','%s','%s','%s','%s',"
" VALUES"
" ('%s','%s','%s','%s','%s','%s',"
"'%s','%s','%s','%u','%s','%s',"
"'%ld',"
"'%s','%s','%s','%s','%s',%s,'%s',"
@ -754,8 +756,10 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
NumID++)
{
Str_ConvertToUpperText (UsrDat->IDs.List[NumID].ID);
sprintf (Query,"INSERT INTO usr_IDs (UsrCod,UsrID,CreatTime,Confirmed)"
" VALUES ('%ld','%s',NOW(),'%c')",
sprintf (Query,"INSERT INTO usr_IDs"
" (UsrCod,UsrID,CreatTime,Confirmed)"
" VALUES"
" ('%ld','%s',NOW(),'%c')",
UsrDat->UsrCod,
UsrDat->IDs.List[NumID].ID,
UsrDat->IDs.List[NumID].Confirmed ? 'Y' :

View File

@ -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];
/***** Select announcements not seen *****/
sprintf (Query,"INSERT INTO announcements (Roles,Subject,Content)"
" VALUES ('%u','%s','%s')",
sprintf (Query,"INSERT INTO announcements"
" (Roles,Subject,Content)"
" VALUES"
" ('%u','%s','%s')",
Roles,Subject,Content);
DB_QueryINSERT (Query,"can not create announcement");
}
@ -599,7 +601,10 @@ void Ann_MarkAnnouncementAsSeen (void)
AnnCod = Ann_GetParamAnnCod ();
/***** 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);
DB_QueryREPLACE (Query,"can not mark announcement as seen");

View File

@ -1561,8 +1561,10 @@ static void Asg_CreateGrps (long AsgCod)
NumGrpSel++)
{
/* Create group */
sprintf (Query,"INSERT INTO asg_grp (AsgCod,GrpCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO asg_grp"
" (AsgCod,GrpCod)"
" VALUES"
" ('%ld','%ld')",
AsgCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
DB_QueryINSERT (Query,"can not associate a group to an assignment");
}

View File

@ -1333,9 +1333,9 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
sprintf (Query,"INSERT INTO att_events"
" (CrsCod,Hidden,UsrCod,"
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
" VALUES ('%ld','%c','%ld',"
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
"'%c','%s','%s')",
" VALUES"
" ('%ld','%c','%ld',"
"FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),'%c','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Att->Hidden ? 'Y' :
'N',
@ -1476,8 +1476,10 @@ static void Att_CreateGrps (long AttCod)
NumGrpSel++)
{
/* Create group */
sprintf (Query,"INSERT INTO att_grp (AttCod,GrpCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO att_grp"
" (AttCod,GrpCod)"
" VALUES"
" ('%ld','%ld')",
AttCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
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 *****/
sprintf (Query,"REPLACE INTO att_usr"
" (AttCod,UsrCod,Present,CommentStd,CommentTch)"
" VALUES ('%ld','%ld','%c','%s','%s')",
" VALUES"
" ('%ld','%ld','%c','%s','%s')",
AttCod,UsrCod,
Present ? 'Y' :
'N',

View File

@ -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];
/***** Create a new banner *****/
sprintf (Query,"INSERT INTO banners (Hidden,ShortName,FullName,Img,WWW)"
" VALUES ('N','%s','%s','%s','%s')",
sprintf (Query,"INSERT INTO banners"
" (Hidden,ShortName,FullName,Img,WWW)"
" VALUES"
" ('N','%s','%s','%s','%s')",
Ban->ShrtName,Ban->FullName,Ban->Img,Ban->WWW);
DB_QueryINSERT (Query,"can not create banner");

View File

@ -2749,9 +2749,11 @@ static void Ctr_CreateCentre (struct Centre *Ctr,unsigned Status)
Cns_MAX_BYTES_WWW];
/***** 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)"
" VALUES ('%ld','%ld','%u','%ld',"
" VALUES"
" ('%ld','%ld','%u','%ld',"
"'%s','%s','%s','')",
Ctr->InsCod,Ctr->PlcCod,
Status,

View File

@ -207,14 +207,18 @@
/****************************** 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 JS_FILE "swad16.144.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.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:
ALTER TABLE msg_content_deleted CHANGE COLUMN ImageTitle ImageTitle VARCHAR(2047) NOT NULL DEFAULT '';

View File

@ -627,7 +627,8 @@ void Con_UpdateMeInConnectedList (void)
The role which is stored is the role of the last click *****/
sprintf (Query,"REPLACE INTO connected"
" (UsrCod,RoleInLastCrs,LastCrsCod,LastTime)"
" VALUES ('%ld','%u','%ld',NOW())",
" VALUES"
" ('%ld','%u','%ld',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Gbl.Usrs.Me.LoggedRole,
Gbl.CurrentCrs.Crs.CrsCod);

View File

@ -45,8 +45,8 @@
#define Cns_MAX_CHARS_DATE (4 + 1 + 2 + 1 + 2)
#define Cns_MAX_BYTES_DATE Cns_MAX_CHARS_DATE
#define Cns_MAX_CHARS_EMAIL (256 - 1) // 255
#define Cns_MAX_BYTES_EMAIL Cns_MAX_CHARS_EMAIL // 255
#define Cns_MAX_CHARS_EMAIL_ADDRESS (256 - 1) // 255
#define Cns_MAX_BYTES_EMAIL_ADDRESS Cns_MAX_CHARS_EMAIL_ADDRESS // 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

View File

@ -2219,8 +2219,10 @@ static void Cty_CreateCountry (struct Country *Cty)
Str_Concat (SubQueryWWW2,"'",
Cty_MAX_BYTES_SUBQUERY_CTYS_WWW);
}
sprintf (Query,"INSERT INTO countries (CtyCod,Alpha2%s%s)"
" VALUES ('%03ld','%s'%s%s)",
sprintf (Query,"INSERT INTO countries"
" (CtyCod,Alpha2%s%s)"
" VALUES"
" ('%03ld','%s'%s%s)",
SubQueryNam1,SubQueryWWW1,
Cty->CtyCod,Cty->Alpha2,SubQueryNam2,SubQueryWWW2);
DB_QueryINSERT (Query,"can not create country");

View File

@ -1942,9 +1942,10 @@ static void Crs_CreateCourse (struct Course *Crs,unsigned Status)
Hie_MAX_BYTES_FULL_NAME];
/***** Insert new course into pending requests *****/
sprintf (Query,"INSERT INTO courses (DegCod,Year,InsCrsCod,"
"Status,RequesterUsrCod,ShortName,FullName)"
" VALUES ('%ld','%u','%s','%u','%ld','%s','%s')",
sprintf (Query,"INSERT INTO courses"
" (DegCod,Year,InsCrsCod,Status,RequesterUsrCod,ShortName,FullName)"
" VALUES"
" ('%ld','%u','%s','%u','%ld','%s','%s')",
Crs->DegCod,Crs->Year,
Crs->InstitutionalCrsCod,
Status,
@ -3286,8 +3287,10 @@ void Crs_UpdateCrsLast (void)
Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT)
{
/***** Update my last access to current course *****/
sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)"
" VALUES ('%ld',NOW())",
sprintf (Query,"REPLACE INTO crs_last"
" (CrsCod,LastTime)"
" VALUES"
" ('%ld',NOW())",
Gbl.CurrentCrs.Crs.CrsCod);
DB_QueryUPDATE (Query,"can not update last access to current course");
}

View File

@ -1507,7 +1507,7 @@ mysql> DESCRIBE mail_domains;
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS mail_domains ("
"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
"UNIQUE INDEX(MaiCod),"
"UNIQUE INDEX(Domain))");
@ -1790,21 +1790,21 @@ mysql> DESCRIBE notif;
/***** Table pending_emails *****/
/*
MariaDB [swad]> DESCRIBE pending_emails;
mysql> DESCRIBE pending_emails;
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| UsrCod | int(11) | NO | MUL | NULL | |
| E_mail | varchar(127) | NO | | NULL | |
| E_mail | varchar(255) | NO | | NULL | |
| MailKey | char(43) | NO | PRI | 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 ("
"UsrCod INT NOT NULL,"
"E_mail VARCHAR(127) COLLATE latin1_general_ci NOT NULL,"
"MailKey CHAR(43) COLLATE latin1_bin 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," // Mai_LENGTH_EMAIL_CONFIRM_KEY
"DateAndTime DATETIME NOT NULL,"
"INDEX(UsrCod),"
"UNIQUE INDEX(MailKey))");

View File

@ -1171,10 +1171,10 @@ static void Deg_CreateDegree (struct Degree *Deg,unsigned Status)
Cns_MAX_BYTES_WWW];
/***** Create a new degree *****/
sprintf (Query,"INSERT INTO degrees (CtrCod,DegTypCod,Status,"
"RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES ('%ld','%ld','%u',"
"'%ld','%s','%s','%s')",
sprintf (Query,"INSERT INTO degrees"
" (CtrCod,DegTypCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES"
" ('%ld','%ld','%u','%ld','%s','%s','%s')",
Deg->CtrCod,Deg->DegTypCod,Status,
Gbl.Usrs.Me.UsrDat.UsrCod,Deg->ShrtName,Deg->FullName,Deg->WWW);
Deg->DegCod = DB_QueryINSERTandReturnCode (Query,"can not create a new degree");

View File

@ -1089,8 +1089,10 @@ static void Dpt_CreateDepartment (struct Department *Dpt)
Cns_MAX_BYTES_WWW];
/***** Create a new department *****/
sprintf (Query,"INSERT INTO departments (InsCod,ShortName,FullName,WWW)"
" VALUES ('%ld','%s','%s','%s')",
sprintf (Query,"INSERT INTO departments"
" (InsCod,ShortName,FullName,WWW)"
" VALUES"
" ('%ld','%s','%s','%s')",
Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW);
DB_QueryINSERT (Query,"can not create a new department");

View File

@ -88,8 +88,10 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
{
/***** Insert possible duplicate into database *****/
sprintf (Query,"REPLACE INTO usr_duplicated (UsrCod,InformerCod,InformTime)"
" VALUES ('%ld','%ld',NOW())",
sprintf (Query,"REPLACE INTO usr_duplicated"
" (UsrCod,InformerCod,InformTime)"
" VALUES"
" ('%ld','%ld',NOW())",
Gbl.Usrs.Other.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryINSERT (Query,"can not report duplicate");

View File

@ -243,11 +243,15 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
}
/***** Register user in current course in database *****/
sprintf (Query,"INSERT INTO crs_usr (CrsCod,UsrCod,Role,Accepted,"
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod,NumAccTst,LastAccTst,NumQstsLastTst,"
sprintf (Query,"INSERT INTO crs_usr"
" (CrsCod,UsrCod,Role,Accepted,"
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod,"
"NumAccTst,LastAccTst,NumQstsLastTst,"
"UsrListType,ColsClassPhoto,ListWithPhotos)"
" VALUES ('%ld','%ld','%u','%c',"
"'-1','-1','-1','0',FROM_UNIXTIME('%ld'),'0',"
" VALUES"
" ('%ld','%ld','%u','%c',"
"'-1','-1','-1',"
"'0',FROM_UNIXTIME('%ld'),'0',"
"'%s','%u','%c')",
Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole,
KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' :
@ -330,7 +334,7 @@ void Enr_WriteFormToReqAnotherUsrID (Act_Action_t NextAction)
"</label>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_nick_email_or_ID,
Cns_MAX_CHARS_EMAIL);
Cns_MAX_CHARS_EMAIL_ADDRESS);
/***** Send button*****/
Lay_PutConfirmButton (Txt_Continue);
@ -1421,7 +1425,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
/* Find next string in text */
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
/* Reset default list of users' codes */
ListUsrCods.NumUsrs = 0;
@ -1544,7 +1548,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
/* Find next string in text */
Str_GetNextStringUntilSeparator (&Ptr,UsrDat.UsrIDNickOrEmail,
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
/* Reset default list of users' codes */
ListUsrCods.NumUsrs = 0;
@ -1917,8 +1921,10 @@ void Enr_SignUpInCrs (void)
}
else // No request in database for this user in this course
{
sprintf (Query,"INSERT INTO crs_usr_requests (CrsCod,UsrCod,Role,RequestTime)"
" VALUES ('%ld','%ld','%u',NOW())",
sprintf (Query,"INSERT INTO crs_usr_requests"
" (CrsCod,UsrCod,Role,RequestTime)"
" VALUES"
" ('%ld','%ld','%u',NOW())",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(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
{
/***** Insert or replace administrator in current institution/centre/degree *****/
sprintf (Query,"REPLACE INTO admin (UsrCod,Scope,Cod)"
" VALUES ('%ld','%s','%ld')",
sprintf (Query,"REPLACE INTO admin"
" (UsrCod,Scope,Cod)"
" VALUES"
" ('%ld','%s','%ld')",
UsrDat->UsrCod,Sco_ScopeDB[Scope],Cod);
DB_QueryREPLACE (Query,"can not create administrator");

View File

@ -4089,9 +4089,11 @@ static void Brw_StoreSizeOfFileTreeInDB (void)
char Query[512];
/***** 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)"
" VALUES ('%u','%ld','%ld',"
" VALUES"
" ('%u','%ld','%ld',"
"'%u','%lu','%lu','%llu')",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],Cod,ZoneUsrCod,
Gbl.FileBrowser.Size.NumLevls,
@ -4885,8 +4887,10 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
DB_FreeMySQLResult (&mysql_res);
/***** Update date of my last access to file browser in this course *****/
sprintf (Query,"REPLACE INTO file_browser_last (UsrCod,FileBrowser,Cod,LastClick)"
" VALUES ('%ld','%u','%ld',NOW())",
sprintf (Query,"REPLACE INTO file_browser_last"
" (UsrCod,FileBrowser,Cod,LastClick)"
" VALUES"
" ('%ld','%u','%ld',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Brw_FileBrowserForDB_file_browser_last[Gbl.FileBrowser.Type],
Cod);
@ -6801,12 +6805,10 @@ static void Brw_AddPathToClipboards (void)
char Query[512 + PATH_MAX];
/***** Add path to clipboards *****/
sprintf (Query,"INSERT INTO clipboard (UsrCod,FileBrowser,"
"Cod,WorksUsrCod,"
"FileType,Path)"
" VALUES ('%ld','%u',"
"'%ld','%ld',"
"'%u','%s')",
sprintf (Query,"INSERT INTO clipboard"
" (UsrCod,FileBrowser,Cod,WorksUsrCod,FileType,Path)"
" VALUES"
" ('%ld','%u','%ld','%ld','%u','%s')",
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Gbl.FileBrowser.Type,
Cod,WorksUsrCod,
(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 '/'
sprintf (Query,"INSERT INTO expanded_folders"
" (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,
(unsigned) Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type],
Cod,WorksUsrCod,
@ -10441,7 +10444,8 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
/* Insert number of views in database */
sprintf (Query,"INSERT INTO file_view"
" (FilCod,UsrCod,NumViews)"
" VALUES ('%ld','%ld','1')",
" VALUES"
" ('%ld','%ld','1')",
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
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];
/***** 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)"
" VALUES ('%u','%ld','%ld',"
" VALUES"
" ('%u','%ld','%ld',"
"'%ld','%u','%s','N','%c','%u')",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod,

View File

@ -1012,7 +1012,8 @@ void Fol_FollowUsr1 (void)
/***** Follow user in database *****/
sprintf (Query,"REPLACE INTO usr_follow"
" (FollowerCod,FollowedCod,FollowTime)"
" VALUES ('%ld','%ld',NOW())",
" VALUES"
" ('%ld','%ld',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Other.UsrDat.UsrCod);
DB_QueryREPLACE (Query,"can not follow user");

View File

@ -448,7 +448,8 @@ static void For_InsertPstIntoBannedPstTable (long PstCod)
/***** Remove post from banned posts table *****/
sprintf (Query,"REPLACE INTO forum_disabled_post"
" (PstCod,UsrCod,DisableTime)"
" VALUES ('%ld','%ld',NOW())",
" VALUES"
" ('%ld','%ld',NOW())",
PstCod,Gbl.Usrs.Me.UsrDat.UsrCod);
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"
" (ThrCod,UsrCod,CreatTime,ModifTime,NumNotif,"
"Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES ('%ld','%ld',NOW(),NOW(),'0',"
" VALUES"
" ('%ld','%ld',NOW(),NOW(),'0',"
"'%s','%s','%s','%s','%s')",
ThrCod,UsrCod,
Subject,Content,
@ -581,35 +583,40 @@ static long For_InsertForumThread (For_ForumType_t ForumType,long FirstPstCod)
case For_FORUM_SWAD_TCHS:
sprintf (Query,"INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES ('%u','-1','%ld','%ld')",
" VALUES"
" ('%u','-1','%ld','%ld')",
(unsigned) ForumType,FirstPstCod,FirstPstCod);
break;
case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS:
sprintf (Query,"INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES ('%u','%ld','%ld','%ld')",
" VALUES"
" ('%u','%ld','%ld','%ld')",
(unsigned) ForumType,Gbl.Forum.Ins.InsCod,FirstPstCod,FirstPstCod);
break;
case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS:
sprintf (Query,"INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES ('%u','%ld','%ld','%ld')",
" VALUES"
" ('%u','%ld','%ld','%ld')",
(unsigned) ForumType,Gbl.Forum.Ctr.CtrCod,FirstPstCod,FirstPstCod);
break;
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
sprintf (Query,"INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES ('%u','%ld','%ld','%ld')",
" VALUES"
" ('%u','%ld','%ld','%ld')",
(unsigned) ForumType,Gbl.Forum.Deg.DegCod,FirstPstCod,FirstPstCod);
break;
case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS:
sprintf (Query,"INSERT INTO forum_thread"
" (ForumType,Location,FirstPstCod,LastPstCod)"
" VALUES ('%u','%ld','%ld','%ld')",
" VALUES"
" ('%u','%ld','%ld','%ld')",
(unsigned) ForumType,Gbl.Forum.Crs.CrsCod,FirstPstCod,FirstPstCod);
break;
}
@ -789,8 +796,10 @@ static void For_UpdateThrReadTime (long ThrCod,time_t ReadTimeUTC)
char Query[256];
/***** Insert or replace pair ThrCod-UsrCod in forum_thr_read *****/
sprintf (Query,"REPLACE INTO forum_thr_read (ThrCod,UsrCod,ReadTime)"
" VALUES ('%ld','%ld',FROM_UNIXTIME('%ld'))",
sprintf (Query,"REPLACE INTO forum_thr_read"
" (ThrCod,UsrCod,ReadTime)"
" VALUES"
" ('%ld','%ld',FROM_UNIXTIME('%ld'))",
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,(long) ReadTimeUTC);
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 ();
/***** Add thread to my clipboard *****/
sprintf (Query,"REPLACE INTO forum_thr_clip (ThrCod,UsrCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"REPLACE INTO forum_thr_clip"
" (ThrCod,UsrCod)"
" VALUES"
" ('%ld','%ld')",
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryREPLACE (Query,"can not add thread to clipboard");
}

View File

@ -293,7 +293,7 @@ struct Globals
Rol_Role_t LoggedRoleBeforeCloseSession;
Rol_Role_t MaxRole;
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 LoginEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
char PendingPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];

View File

@ -1066,8 +1066,10 @@ static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
char Query[256];
/***** Register in group *****/
sprintf (Query,"INSERT INTO crs_grp_usr (GrpCod,UsrCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO crs_grp_usr"
" (GrpCod,UsrCod)"
" VALUES"
" ('%ld','%ld')",
GrpCod,UsrDat->UsrCod);
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 *****/
sprintf (Query,"INSERT INTO crs_grp_types"
" (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.Grps.GrpTyp.MandatoryEnrollment ? 'Y' :
'N',
@ -3293,8 +3296,10 @@ static void Grp_CreateGroup (void)
char Query[1024];
/***** Create a new group *****/
sprintf (Query,"INSERT INTO crs_grp (GrpTypCod,GrpName,MaxStudents,Open,FileZones)"
" VALUES ('%ld','%s','%u','N','N')",
sprintf (Query,"INSERT INTO crs_grp"
" (GrpTypCod,GrpName,MaxStudents,Open,FileZones)"
" VALUES"
" ('%ld','%s','%u','N','N')",
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,
Gbl.CurrentCrs.Grps.GrpName,
Gbl.CurrentCrs.Grps.MaxStudents);

View File

@ -1127,7 +1127,8 @@ static void Hld_CreateHoliday (struct Holiday *Hld)
/***** Create a new holiday or no school period *****/
sprintf (Query,"INSERT INTO holidays"
" (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,
Hld->StartDate.Year,
Hld->StartDate.Month,

View File

@ -709,8 +709,10 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
if (IHaveRead)
{
/***** Insert I have read course information *****/
sprintf (Query,"REPLACE INTO crs_info_read (UsrCod,CrsCod,InfoType)"
" VALUES ('%ld','%ld','%s')",
sprintf (Query,"REPLACE INTO crs_info_read"
" (UsrCod,CrsCod,InfoType)"
" VALUES"
" ('%ld','%ld','%s')",
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.CurrentCrs.Crs.CrsCod,
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
{
sprintf (Query,"INSERT INTO crs_info_src (CrsCod,InfoType,InfoSrc,MustBeRead)"
" VALUES ('%ld','%s','%s','N')",
sprintf (Query,"INSERT INTO crs_info_src"
" (CrsCod,InfoType,InfoSrc,MustBeRead)"
" VALUES"
" ('%ld','%s','%s','N')",
Gbl.CurrentCrs.Crs.CrsCod,
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
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 *****/
sprintf (Query,"REPLACE INTO crs_info_txt"
" (CrsCod,InfoType,InfoTxtHTML,InfoTxtMD)"
" VALUES ('%ld','%s','%s','%s')",
" VALUES"
" ('%ld','%s','%s','%s')",
Gbl.CurrentCrs.Crs.CrsCod,
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
InfoTxtHTML,InfoTxtMD);

View File

@ -2401,10 +2401,10 @@ static void Ins_CreateInstitution (struct Instit *Ins,unsigned Status)
Cns_MAX_BYTES_WWW];
/***** Create a new institution *****/
sprintf (Query,"INSERT INTO institutions (CtyCod,Status,RequesterUsrCod,"
"ShortName,FullName,WWW)"
" VALUES ('%ld','%u','%ld',"
"'%s','%s','%s')",
sprintf (Query,"INSERT INTO institutions"
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES"
" ('%ld','%u','%ld','%s','%s','%s')",
Ins->CtyCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,

View File

@ -784,8 +784,10 @@ static void Lnk_CreateLink (struct Link *Lnk)
Cns_MAX_BYTES_WWW];
/***** Create a new link *****/
sprintf (Query,"INSERT INTO links (ShortName,FullName,WWW)"
" VALUES ('%s','%s','%s')",
sprintf (Query,"INSERT INTO links"
" (ShortName,FullName,WWW)"
" VALUES"
" ('%s','%s','%s')",
Lnk->ShrtName,Lnk->FullName,Lnk->WWW);
DB_QueryINSERT (Query,"can not create institutional link");

View File

@ -67,8 +67,8 @@ extern struct Globals Gbl;
static void Mai_GetParamMaiOrder (void);
static void Mai_PutIconToEditMailDomains (void);
static void Mai_GetListMailDomainsAllowedForNotif (void);
static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_EMAIL + 1]);
static bool Mai_CheckIfMailDomainIsAllowedForNotif (const 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_ADDRESS + 1]);
static void Mai_ListMailDomainsForEdition (void);
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_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_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]);
/*****************************************************************************/
@ -291,7 +291,7 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
/* Get the mail 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]) */
Str_Copy (Mai->Info,row[2],
@ -320,7 +320,7 @@ static void Mai_GetListMailDomainsAllowedForNotif (void)
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? *****/
if (!UsrDat->EmailConfirmed)
@ -335,7 +335,7 @@ bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct UsrData *UsrDat)
/********************** 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;
@ -347,7 +347,7 @@ static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_E
Ptr++; // Skip '@'
if (strchr (Ptr,(int) '@') == NULL) // No more '@' found
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 ************/
/*****************************************************************************/
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 *****/
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]) */
Str_Copy (Mai->Domain,row[0],
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
/* Get the full name of the mail (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\""
" size=\"15\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_EMAIL,Mai->Domain,
Cns_MAX_CHARS_EMAIL_ADDRESS,Mai->Domain,
Gbl.Form.Id);
Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>");
@ -609,7 +609,7 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
case Cns_SHRT_NAME:
ParamName = "Domain";
FieldName = "Domain";
MaxBytes = Cns_MAX_BYTES_EMAIL;
MaxBytes = Cns_MAX_BYTES_EMAIL_ADDRESS;
CurrentMaiName = Mai->Domain;
break;
case Cns_FULL_NAME:
@ -744,7 +744,7 @@ static void Mai_PutFormToCreateMailDomain (void)
" size=\"15\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />"
"</td>",
Cns_MAX_CHARS_EMAIL,Mai->Domain);
Cns_MAX_CHARS_EMAIL_ADDRESS,Mai->Domain);
/***** Mail domain info *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
@ -808,7 +808,7 @@ void Mai_RecFormNewMailDomain (void)
/***** Get parameters from form *****/
/* 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 */
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;
char Query[128 +
Cns_MAX_BYTES_EMAIL +
Cns_MAX_BYTES_EMAIL_ADDRESS +
Mai_MAX_BYTES_MAIL_INFO];
/***** 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);
DB_QueryINSERT (Query,"can not create mail domain");
@ -1007,9 +1010,9 @@ bool Mai_CheckIfEmailIsValid (const char *Email)
bool ArrobaFound = false;
/***** 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 ||
Length > Cns_MAX_BYTES_EMAIL)
Length > Cns_MAX_BYTES_EMAIL_ADDRESS)
return false;
/***** An email address can have digits, letters, '.', '-' and '_';
@ -1071,7 +1074,7 @@ bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat)
/* Get email */
row = mysql_fetch_row (mysql_res);
Str_Copy (UsrDat->Email,row[0],
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
UsrDat->EmailConfirmed = (row[1][0] == 'Y');
Found = true;
}
@ -1087,9 +1090,9 @@ bool Mai_GetEmailFromUsrCod (struct UsrData *UsrDat)
/*****************************************************************************/
// 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_ROW row;
unsigned NumUsrs;
@ -1328,7 +1331,7 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
"<input type=\"email\" id=\"NewEmail\" name=\"NewEmail\""
" size=\"18\" maxlength=\"%u\" value=\"%s\" />"
"</div>",
Cns_MAX_CHARS_EMAIL,
Cns_MAX_CHARS_EMAIL_ADDRESS,
Gbl.Usrs.Me.UsrDat.Email);
Lay_PutCreateButtonInline (NumEmails ? Txt_Change_email : // User already has an email address
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_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))
{
/***** 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 *****/
Mai_RemoveEmailFromDB (UsrDat->UsrCod,Email);
@ -1404,9 +1407,9 @@ static void Mai_RemoveEmail (struct UsrData *UsrDat)
/*************** 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 *****/
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_entered_X_is_not_valid;
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))
{
/***** 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
{
@ -1520,9 +1523,9 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
// Return true if email is successfully updated
// 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 *****/
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 *****/
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);
DB_QueryREPLACE (Query,"can not update email");
@ -1667,11 +1672,11 @@ void Mai_ShowMsgConfirmEmailHasBeenSent (void)
/************************* 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])
{
char Query[256 +
Cns_MAX_BYTES_EMAIL +
Cns_MAX_BYTES_EMAIL_ADDRESS +
Mai_LENGTH_EMAIL_CONFIRM_KEY];
/***** 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");
/***** Insert mail key in database *****/
sprintf (Query,"INSERT INTO pending_emails (UsrCod,E_mail,MailKey,DateAndTime)"
" VALUES ('%ld','%s','%s',NOW())",
sprintf (Query,"INSERT INTO pending_emails"
" (UsrCod,E_mail,MailKey,DateAndTime)"
" VALUES"
" ('%ld','%s','%s',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,
Email,
MailKey);
@ -1700,13 +1707,13 @@ void Mai_ConfirmEmail (void)
extern const char *Txt_The_email_address_has_not_been_confirmed;
extern const char *Txt_Failed_email_confirmation_key;
char Query[256 +
Cns_MAX_BYTES_EMAIL +
Cns_MAX_BYTES_EMAIL_ADDRESS +
Mai_LENGTH_EMAIL_CONFIRM_KEY];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1];
long UsrCod;
char Email[Cns_MAX_BYTES_EMAIL + 1];
char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
bool KeyIsCorrect = false;
bool Confirmed;
@ -1715,7 +1722,8 @@ void Mai_ConfirmEmail (void)
/***** Get user's code and email from key *****/
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"))
{
row = mysql_fetch_row (mysql_res);
@ -1725,7 +1733,7 @@ void Mai_ConfirmEmail (void)
/* Get user's email */
Str_Copy (Email,row[1],
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
KeyIsCorrect = true;
}
@ -1736,8 +1744,8 @@ void Mai_ConfirmEmail (void)
if (KeyIsCorrect)
{
/***** Delete this key *****/
sprintf (Query,"DELETE FROM pending_emails"
" WHERE MailKey='%s'",MailKey);
sprintf (Query,"DELETE FROM pending_emails WHERE MailKey='%s'",
MailKey);
DB_QueryDELETE (Query,"can not remove an email key");
/***** Check user's code and email

View File

@ -48,7 +48,7 @@ typedef enum
struct Mail
{
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];
unsigned NumUsrs;
};
@ -75,7 +75,7 @@ void Mai_ListEmails (void); // Creates an email message to students
bool Mai_CheckIfEmailIsValid (const char *Email);
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_ShowFormOthEmail (void);
@ -84,7 +84,7 @@ void Mai_RemoveMyUsrEmail (void);
void Mai_RemoveOtherUsrEmail (void);
void May_NewMyUsrEmail (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);
bool Mai_SendMailMsgToConfirmEmail (void);

View File

@ -88,8 +88,10 @@ void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks)
char Query[256];
/***** Add file of marks to the database *****/
sprintf (Query,"INSERT INTO marks_properties (FilCod,%s,%s)"
" VALUES ('%ld','%u','%u')",
sprintf (Query,"INSERT INTO marks_properties"
" (FilCod,%s,%s)"
" VALUES"
" ('%ld','%u','%u')",
Mrk_HeadOrFootStr[Brw_HEADER],
Mrk_HeadOrFootStr[Brw_FOOTER],
FilCod,

View File

@ -1301,7 +1301,8 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
/***** Insert message subject and content in the database *****/
sprintf (Query,"INSERT INTO msg_content"
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES ('%s','%s','%s','%s','%s')",
" VALUES"
" ('%s','%s','%s','%s','%s')",
Subject,Content,
Image->Name,
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");
/***** Insert message in sent messages *****/
sprintf (Query,"INSERT INTO msg_snt (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" VALUES ('%ld','%ld','%ld','N',NOW())",
sprintf (Query,"INSERT INTO msg_snt"
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" VALUES"
" ('%ld','%ld','%ld','N',NOW())",
MsgCod,
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
@ -1379,7 +1382,8 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
/***** Move messages from msg_rcv to 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'",
UsrCod);
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 *****/
/* Insert message into msg_snt_deleted */
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted (MsgCod,CrsCod,UsrCod,CreatTime)"
" SELECT MsgCod,CrsCod,UsrCod,CreatTime FROM msg_snt WHERE UsrCod='%ld'",
sprintf (Query,"INSERT IGNORE INTO msg_snt_deleted"
" (MsgCod,CrsCod,UsrCod,CreatTime)"
" SELECT MsgCod,CrsCod,UsrCod,CreatTime"
" FROM msg_snt WHERE UsrCod='%ld'",
UsrCod);
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 *****/
sprintf (Query,"INSERT INTO msg_rcv"
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" VALUES ('%ld','%ld','%c','N','N','N')",
" VALUES"
" ('%ld','%ld','%c','N','N','N')",
MsgCod,UsrCod,
NotifyByEmail ? 'Y' :
'N');
@ -1442,7 +1449,8 @@ static void Msg_MoveReceivedMsgToDeleted (long MsgCod,long UsrCod)
/***** Move message from msg_rcv to 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"
" FROM msg_rcv WHERE MsgCod='%ld' AND UsrCod='%ld'",
MsgCod,UsrCod);
@ -1472,7 +1480,8 @@ static void Msg_MoveSentMsgToDeleted (long MsgCod)
/***** Move message from msg_snt to 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"
" FROM msg_snt WHERE MsgCod='%ld'",
MsgCod);
@ -1522,7 +1531,8 @@ void Msg_MoveUnusedMsgsContentToDeleted (void)
/***** Move messages from msg_content to 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"
" WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)"
" AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)");
@ -3638,8 +3648,10 @@ void Msg_BanSenderWhenShowingMsgs (void)
Lay_ShowErrorAndExit ("Sender does not exist.");
/***** Insert pair (sender's code - my code) in table of banned senders if not inserted *****/
sprintf (Query,"REPLACE INTO msg_banned (FromUsrCod,ToUsrCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"REPLACE INTO msg_banned"
" (FromUsrCod,ToUsrCod)"
" VALUES"
" ('%ld','%ld')",
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryREPLACE (Query,"can not ban sender");

View File

@ -409,8 +409,10 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
if (URL[0])
{
/***** Insert or replace web / social network *****/
sprintf (Query,"REPLACE INTO usr_webs (UsrCod,Web,URL)"
" VALUES ('%ld','%s','%s')",
sprintf (Query,"REPLACE INTO usr_webs"
" (UsrCod,Web,URL)"
" VALUES"
" ('%ld','%s','%s')",
Gbl.Usrs.Me.UsrDat.UsrCod,
Net_WebsAndSocialNetworksDB[Web],
URL);

View File

@ -432,7 +432,9 @@ void Nck_UpdateMyNick (const char *NewNickname)
/***** Update my nickname in database *****/
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);
DB_QueryREPLACE (Query,"can not update your nickname");
}

View File

@ -163,9 +163,12 @@ static long Not_InsertNoticeInDB (const char *Content)
char Query[256 + Cns_MAX_BYTES_TEXT];
/***** Insert notice in the database *****/
sprintf (Query,"INSERT INTO notices (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES ('%ld','%ld',NOW(),'%s','%u')",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,Content,(unsigned) Not_ACTIVE_NOTICE);
sprintf (Query,"INSERT INTO notices"
" (CrsCod,UsrCod,CreatTime,Content,Status)"
" 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");
}
@ -299,7 +302,8 @@ void Not_RemoveNotice (void)
/***** Remove notice *****/
/* 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"
" FROM notices"
" WHERE NotCod='%ld' AND CrsCod='%ld'",

View File

@ -1434,15 +1434,14 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
}
/***** Store notify event *****/
sprintf (Query,"INSERT INTO notif (NotifyEvent,ToUsrCod,FromUsrCod,"
"InsCod,CtrCod,DegCod,CrsCod,"
"Cod,TimeNotif,Status)"
" VALUES ('%u','%ld','%ld',"
"'%ld','%ld','%ld','%ld',"
"'%ld',NOW(),'%u')",
sprintf (Query,"INSERT INTO notif"
" (NotifyEvent,ToUsrCod,FromUsrCod,"
"InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
" VALUES"
" ('%u','%ld','%ld',"
"'%ld','%ld','%ld','%ld','%ld',NOW(),'%u')",
(unsigned) NotifyEvent,UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
InsCod,CtrCod,DegCod,CrsCod,
Cod,(unsigned) Status);
InsCod,CtrCod,DegCod,CrsCod,Cod,(unsigned) Status);
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);
/***** Update number of users notified *****/
sprintf (Query,"REPLACE INTO sta_notif (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
" VALUES ('%ld','%ld','%u','%u','%u')",
sprintf (Query,"REPLACE INTO sta_notif"
" (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
" VALUES"
" ('%ld','%ld','%u','%u','%u')",
DegCod,CrsCod,(unsigned) NotifyEvent,
CurrentNumEvents + NumEvents,
CurrentNumMails + NumMails);

View File

@ -261,7 +261,7 @@ void Pwd_ShowFormSendNewPwd (void)
" size=\"8\" maxlength=\"%u\" value=\"%s\" />"
"</label>",
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 *****/
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");
/***** Update my current password in database *****/
sprintf (Query,"REPLACE INTO pending_passwd (UsrCod,PendingPassword,DateAndTime)"
" VALUES ('%ld','%s',NOW())",
sprintf (Query,"REPLACE INTO pending_passwd"
" (UsrCod,PendingPassword,DateAndTime)"
" VALUES"
" ('%ld','%s',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PendingPassword);
DB_QueryREPLACE (Query,"can not create pending password");
}

View File

@ -905,7 +905,10 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
else // The user does not exist ==> add him/her
{
/* 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);
DB_QueryINSERT (Query,"can not create number of clicks without photo");
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"
" (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);
DB_QueryREPLACE (Query,"can not save stats of a degree");
}

View File

@ -849,7 +849,8 @@ static void Plc_CreatePlace (struct Place *Plc)
char Query[1024];
/***** Create a new place *****/
sprintf (Query,"INSERT INTO places (InsCod,ShortName,FullName)"
sprintf (Query,"INSERT INTO places"
" (InsCod,ShortName,FullName)"
" VALUES ('%ld','%s','%s')",
Gbl.CurrentIns.Ins.InsCod,Plc->ShrtName,Plc->FullName);
DB_QueryINSERT (Query,"can not create place");

View File

@ -1048,8 +1048,10 @@ static void Plg_CreatePlugin (struct Plugin *Plg)
Cns_MAX_BYTES_IP];
/***** Create a new plugin *****/
sprintf (Query,"INSERT INTO plugins (Name,Description,Logo,AppKey,URL,IP)"
" VALUES ('%s','%s','%s','%s','%s','%s')",
sprintf (Query,"INSERT INTO plugins"
" (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);
DB_QueryINSERT (Query,"can not create plugin");

View File

@ -189,8 +189,10 @@ void Pre_SetPrefsFromIP (void)
char Query[512];
/***** Update preferences from current IP in database *****/
sprintf (Query,"REPLACE INTO IP_prefs (IP,UsrCod,LastChange,FirstDayOfWeek,Theme,IconSet,Menu,SideCols)"
" VALUES ('%s','%ld',NOW(),'%u','%s','%s','%u','%u')",
sprintf (Query,"REPLACE INTO IP_prefs"
" (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.Prefs.FirstDayOfWeek,
The_ThemeId[Gbl.Prefs.Theme],

View File

@ -1076,8 +1076,9 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
/***** Create user's figures *****/
sprintf (Query,"INSERT INTO usr_figures"
"(UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
" VALUES ('%ld',%s,'%ld','%ld','%ld','%ld')",
" (UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
" VALUES"
" ('%ld',%s,'%ld','%ld','%ld','%ld')",
UsrCod,
SubQueryFirstClickTime,
UsrFigures->NumClicks, // -1L ==> unknown number of clicks

View File

@ -552,7 +552,8 @@ void Rec_CreateRecordField (void)
/***** Create the new field *****/
sprintf (Query,"INSERT INTO crs_record_fields"
" (CrsCod,FieldName,NumLines,Visibility)"
" VALUES ('%ld','%s','%u','%u')",
" VALUES"
" ('%ld','%s','%u','%u')",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.CurrentCrs.Records.Field.Name,
Gbl.CurrentCrs.Records.Field.NumLines,
@ -1834,8 +1835,10 @@ void Rec_UpdateCrsRecord (long UsrCod)
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
{
/***** Insert text field of record course *****/
sprintf (Query,"INSERT INTO crs_records (FieldCod,UsrCod,Txt)"
" VALUES ('%ld','%ld','%s')",
sprintf (Query,"INSERT INTO crs_records"
" (FieldCod,UsrCod,Txt)"
" VALUES"
" ('%ld','%ld','%s')",
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,
UsrCod,
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text);

View File

@ -160,9 +160,11 @@ void Ses_InsertSessionInDB (void)
if (Gbl.Search.WhatToSearch == Sch_SEARCH_UNKNOWN)
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)"
" VALUES ('%s','%ld','%s','%u',"
" VALUES"
" ('%s','%ld','%s','%u',"
"'%ld','%ld','%ld','%ld','%ld',NOW(),NOW(),'%u')",
Gbl.Session.Id,
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 *****/
sprintf (Query,"INSERT INTO hidden_params"
" (SessionId,Action,ParamName,ParamValue)"
" VALUES ('%s','%d','%s','%s')",
" VALUES"
" ('%s','%d','%s','%s')",
Gbl.Session.Id,(int) Action,ParamName,ParamValue);
DB_QueryINSERT (Query,"can not create hidden parameter");
Gbl.HiddenParamsInsertedIntoDB = true;

View File

@ -1942,7 +1942,8 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct Soci
/***** Store social note *****/
sprintf (Query,"INSERT INTO social_notes"
" (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);
SocPub->NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
@ -2304,8 +2305,10 @@ static long Soc_ReceiveSocialPost (void)
/***** Publish *****/
/* Insert post content in the database */
sprintf (Query,"INSERT INTO social_posts (Content,ImageName,ImageTitle,ImageURL)"
" VALUES ('%s','%s','%s','%s')",
sprintf (Query,"INSERT INTO social_posts"
" (Content,ImageName,ImageTitle,ImageURL)"
" VALUES"
" ('%s','%s','%s','%s')",
Content,
Image.Name,
(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 */
sprintf (Query,"INSERT INTO social_comments"
" (PubCod,Content,ImageName,ImageTitle,ImageURL)"
" VALUES ('%ld','%s','%s','%s','%s')",
" VALUES"
" ('%ld','%s','%s','%s','%s')",
SocPub.PubCod,
Content,
Image.Name,
@ -3182,7 +3186,9 @@ static long Soc_FavSocialNote (void)
{
/***** Mark as favourite in database *****/
sprintf (Query,"INSERT IGNORE INTO social_notes_fav"
" (NotCod,UsrCod,TimeFav) VALUES ('%ld','%ld',NOW())",
" (NotCod,UsrCod,TimeFav)"
" VALUES"
" ('%ld','%ld',NOW())",
SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryINSERT (Query,"can not favourite social note");
@ -3268,7 +3274,9 @@ static long Soc_FavSocialComment (void)
{
/***** Mark as favourite in database *****/
sprintf (Query,"INSERT IGNORE INTO social_comments_fav"
" (PubCod,UsrCod,TimeFav) VALUES ('%ld','%ld',NOW())",
" (PubCod,UsrCod,TimeFav)"
" VALUES"
" ('%ld','%ld',NOW())",
SocCom.PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryINSERT (Query,"can not favourite social comment");
@ -4722,7 +4730,8 @@ static void Soc_AddNotesJustRetrievedToTimelineThisSession (void)
{
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",
Gbl.Session.Id);
DB_QueryINSERT (Query,"can not insert social notes in timeline");

View File

@ -333,8 +333,10 @@ void Sta_LogAccess (const char *Comments)
if (Comments)
{
/* Log comments */
sprintf (Query,"INSERT INTO log_comments (LogCod,Comments)"
" VALUES ('%ld','",
sprintf (Query,"INSERT INTO log_comments"
" (LogCod,Comments)"
" VALUES"
" ('%ld','",
LogCod);
Str_AddStrToQuery (Query,Comments,sizeof (Query));
Str_Concat (Query,"')",
@ -352,8 +354,10 @@ void Sta_LogAccess (const char *Comments)
if (Gbl.Search.LogSearch && Gbl.Search.Str[0])
{
/* Log search string */
sprintf (Query,"INSERT INTO log_search (LogCod,SearchStr)"
" VALUES ('%ld','",
sprintf (Query,"INSERT INTO log_search"
" (LogCod,SearchStr)"
" VALUES"
" ('%ld','",
LogCod);
Str_AddStrToQuery (Query,Gbl.Search.Str,sizeof (Query));
Str_Concat (Query,"')",
@ -371,8 +375,10 @@ void Sta_LogAccess (const char *Comments)
if (Gbl.WebService.IsWebService)
{
/* Log web service plugin and function */
sprintf (Query,"INSERT INTO log_ws (LogCod,PlgCod,FunCod)"
" VALUES ('%ld','%ld','%u')",
sprintf (Query,"INSERT INTO log_ws"
" (LogCod,PlgCod,FunCod)"
" VALUES"
" ('%ld','%ld','%u')",
LogCod,Gbl.WebService.PlgCod,(unsigned) Gbl.WebService.Function);
if (mysql_query (&Gbl.mysql,Query))
@ -381,8 +387,10 @@ void Sta_LogAccess (const char *Comments)
else if (Gbl.Banners.BanCodClicked > 0)
{
/* Log banner clicked */
sprintf (Query,"INSERT INTO log_banners (LogCod,BanCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO log_banners"
" (LogCod,BanCod)"
" VALUES"
" ('%ld','%ld')",
LogCod,Gbl.Banners.BanCodClicked);
DB_QueryINSERT (Query,"can not log banner clicked");
}

View File

@ -2219,7 +2219,8 @@ static void Svy_CreateSurvey (struct Survey *Svy,const char *Txt)
/***** Create a new survey *****/
sprintf (Query,"INSERT INTO surveys"
" (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'),"
"'%s','%s')",
Sco_ScopeDB[Svy->Scope],Svy->Cod,
@ -2368,7 +2369,10 @@ static void Svy_CreateGrps (long SvyCod)
NumGrpSel++)
{
/* 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]);
DB_QueryINSERT (Query,"can not associate a group to a survey");
}
@ -2996,8 +3000,10 @@ void Svy_ReceiveQst (void)
SvyQst.QstInd = Svy_GetNextQuestionIndexInSvy (SvyCod);
/* Insert question in the table of questions */
sprintf (Query,"INSERT INTO svy_questions (SvyCod,QstInd,AnsType,Stem)"
" VALUES ('%ld','%u','%s','%s')",
sprintf (Query,"INSERT INTO svy_questions"
" (SvyCod,QstInd,AnsType,Stem)"
" VALUES"
" ('%ld','%u','%s','%s')",
SvyCod,SvyQst.QstInd,Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
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
{
/* Create answer into database */
sprintf (Query,"INSERT INTO svy_answers (QstCod,AnsInd,NumUsrs,Answer)"
" VALUES ('%ld','%u','0','%s')",
sprintf (Query,"INSERT INTO svy_answers"
" (QstCod,AnsInd,NumUsrs,Answer)"
" VALUES"
" ('%ld','%u','0','%s')",
SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text);
DB_QueryINSERT (Query,"can not create answer");
}
@ -3702,8 +3710,10 @@ static void Svy_RegisterIHaveAnsweredSvy (long SvyCod)
{
char Query[512];
sprintf (Query,"INSERT INTO svy_users (SvyCod,UsrCod)"
" VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO svy_users"
" (SvyCod,UsrCod)"
" VALUES"
" ('%ld','%ld')",
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryINSERT (Query,"can not register that you have answered the survey");
}

View File

@ -699,7 +699,10 @@ static void Tst_SetTstStatus (unsigned NumTst,Tst_Status_t TstStatus)
DB_QueryDELETE (Query,"can not remove old status of tests");
/***** 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);
DB_QueryREPLACE (Query,"can not update status of test");
}
@ -2147,7 +2150,8 @@ void Tst_ReceiveConfigTst (void)
/***** Update database *****/
sprintf (Query,"REPLACE INTO tst_config"
" (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,
Tst_PluggableDB[Gbl.Test.Config.Pluggable],
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];
/***** Insert new tag into tst_tags table *****/
sprintf (Query,"INSERT INTO tst_tags (CrsCod,ChangeTime,TagTxt,TagHidden)"
" VALUES ('%ld',NOW(),'%s','N')",
sprintf (Query,"INSERT INTO tst_tags"
" (CrsCod,ChangeTime,TagTxt,TagHidden)"
" VALUES"
" ('%ld',NOW(),'%s','N')",
CrsCod,TagTxt);
return DB_QueryINSERTandReturnCode (Query,"can not create new tag");
}
@ -6026,7 +6032,8 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
" (CrsCod,EditTime,AnsType,Shuffle,"
"Stem,Feedback,ImageName,ImageTitle,ImageURL,"
"NumHits,Score)"
" VALUES ('%ld',NOW(),'%s','%c',"
" VALUES"
" ('%ld',NOW(),'%s','%c',"
"'%s','%s','%s','%s','%s',"
"'0','0')",
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]);
/***** Insert tag in tst_question_tags *****/
sprintf (Query,"INSERT INTO tst_question_tags (QstCod,TagCod,TagInd)"
" VALUES ('%ld','%ld','%u')",
sprintf (Query,"INSERT INTO tst_question_tags"
" (QstCod,TagCod,TagInd)"
" VALUES"
" ('%ld','%ld','%u')",
Gbl.Test.QstCod,TagCod,TagIdx);
DB_QueryINSERT (Query,"can not create tag");
@ -6130,7 +6139,8 @@ static void Tst_InsertAnswersIntoDB (void)
sprintf (Query,"INSERT INTO tst_answers"
" (QstCod,AnsInd,Answer,Feedback,"
"ImageName,ImageTitle,ImageURL,Correct)"
" VALUES (%ld,0,'%ld','','','','','Y')",
" VALUES"
" (%ld,0,'%ld','','','','','Y')",
Gbl.Test.QstCod,
Gbl.Test.Answer.Integer);
DB_QueryINSERT (Query,"can not create answer");
@ -6144,7 +6154,8 @@ static void Tst_InsertAnswersIntoDB (void)
sprintf (Query,"INSERT INTO tst_answers"
" (QstCod,AnsInd,Answer,Feedback,"
"ImageName,ImageTitle,ImageURL,Correct)"
" VALUES (%ld,%u,'%lg','','','','','Y')",
" VALUES"
" (%ld,%u,'%lg','','','','','Y')",
Gbl.Test.QstCod,i,
Gbl.Test.Answer.FloatingPoint[i]);
DB_QueryINSERT (Query,"can not create answer");
@ -6155,7 +6166,8 @@ static void Tst_InsertAnswersIntoDB (void)
sprintf (Query,"INSERT INTO tst_answers"
" (QstCod,AnsInd,Answer,Feedback,"
"ImageName,ImageTitle,ImageURL,Correct)"
" VALUES (%ld,0,'%c','','','','','Y')",
" VALUES"
" (%ld,0,'%c','','','','','Y')",
Gbl.Test.QstCod,
Gbl.Test.Answer.TF);
DB_QueryINSERT (Query,"can not create answer");
@ -7018,7 +7030,8 @@ static long Tst_CreateTestResultInDB (void)
/***** Insert new test result into table *****/
sprintf (Query,"INSERT INTO tst_exams"
" (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)"
" VALUES ('%ld','%ld','%c',NOW(),'%u')",
" VALUES"
" ('%ld','%ld','%c',NOW(),'%u')",
Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
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
sprintf (Query,"INSERT INTO tst_exam_questions"
" (TstCod,QstCod,QstInd,Score,Indexes,Answers)"
" VALUES ('%ld','%ld','%u','%lf','%s','%s')",
" VALUES"
" ('%ld','%ld','%u','%lf','%s','%s')",
TstCod,QstCod,
NumQst, // 0, 1, 2, 3...
Score,

View File

@ -476,8 +476,10 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
if (TimeTable[Day][Hour].Columns[Column].HourType == TT_FIRST_HOUR &&
TimeTable[Day][Hour].Columns[Column].Duration > 0)
{
sprintf (Query,"INSERT INTO timetable_crs (CrsCod,GrpCod,Day,Hour,Duration,ClassType,Place,GroupName)"
" VALUES ('%ld','%ld','%c','%u','%d','%s','%s','%s')",
sprintf (Query,"INSERT INTO timetable_crs"
" (CrsCod,GrpCod,Day,Hour,Duration,ClassType,Place,GroupName)"
" VALUES"
" ('%ld','%ld','%c','%u','%d','%s','%s','%s')",
CrsCod,
TimeTable[Day][Hour].Columns[Column].GrpCod,
TimeTableCharsDays[Day],
@ -516,8 +518,10 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
if (TimeTable[Day][Hour].Columns[Column].HourType == TT_FIRST_HOUR &&
TimeTable[Day][Hour].Columns[Column].Duration > 0)
{
sprintf (Query,"INSERT INTO timetable_tut (UsrCod,Day,Hour,Duration,Place)"
" VALUES ('%ld','%c','%u','%d','%s')",
sprintf (Query,"INSERT INTO timetable_tut"
" (UsrCod,Day,Hour,Duration,Place)"
" VALUES"
" ('%ld','%c','%u','%d','%s')",
UsrCod,TimeTableCharsDays[Day],Hour,
TimeTable[Day][Hour].Columns[Column].Duration,
TimeTable[Day][Hour].Columns[Column].Place);

View File

@ -2054,7 +2054,7 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) ())
Gbl.Prefs.IconsURL,
Txt_User[Usr_SEX_UNKNOWN],
Txt_User[Usr_SEX_UNKNOWN],
Cns_MAX_CHARS_EMAIL,
Cns_MAX_CHARS_EMAIL_ADDRESS,
Txt_nick_email_or_ID,
Gbl.Usrs.Me.UsrIdLogin);
@ -2195,7 +2195,10 @@ static void Usr_InsertMyBirthday (void)
DB_QueryDELETE (Query,"can not delete old birthdays");
/***** 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);
DB_QueryINSERT (Query,"can not insert birthday");
}
@ -2299,7 +2302,7 @@ void Usr_PutFormLogOut (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
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 *****/
Par_GetParToText ("OtherUsrIDNickOrEMail",
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 (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)
{
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])
{
@ -5206,7 +5209,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
size_t LengthSelectedUsrsCods;
size_t LengthUsrCod;
const char *Ptr;
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1];
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
struct UsrData UsrDat;
struct ListUsrCods ListUsrCods;
bool Error = false;

View File

@ -118,7 +118,7 @@ struct UsrData
{
long UsrCod;
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 ListIDs *List;
@ -136,7 +136,7 @@ struct UsrData
char FirstName [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
char FullName [Usr_MAX_BYTES_FULL_NAME + 1];
Usr_Sex_t Sex;
char Email [Cns_MAX_BYTES_EMAIL + 1];
char Email [Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
bool EmailConfirmed;
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

View File

@ -465,8 +465,10 @@ static int Svc_GenerateNewWSKey (long UsrCod,
"Generated key already existed in database");
/***** Insert key into database *****/
sprintf (Query,"INSERT INTO ws_keys (WSKey,UsrCod,PlgCod,LastTime)"
" VALUES ('%s','%ld','%ld',NOW())",
sprintf (Query,"INSERT INTO ws_keys"
" (WSKey,UsrCod,PlgCod,LastTime)"
" VALUES"
" ('%s','%ld','%ld',NOW())",
WSKey,UsrCod,Gbl.WebService.PlgCod);
DB_QueryINSERT (Query,"can not insert new key");
@ -695,7 +697,7 @@ int swad__createAccount (struct soap *soap,
{
/* Email updated sucessfully */
Str_Copy (Gbl.Usrs.Me.UsrDat.Email,userEmail,
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
Gbl.Usrs.Me.UsrDat.EmailConfirmed = false;
}
@ -767,7 +769,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
char *userID,char *userPassword,char *appKey, // input
struct swad__loginByUserPasswordKeyOutput *loginByUserPasswordKeyOut) // output
{
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1];
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
int ReturnCode;
char Query[512];
MYSQL_RES *mysql_res;
@ -808,7 +810,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
/***** Check if user's email, @nickname or ID are valid *****/
Str_Copy (UsrIDNickOrEmail,userID,
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
{
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
@ -1078,7 +1080,7 @@ int swad__getNewPassword (struct soap *soap,
struct swad__getNewPasswordOutput *getNewPasswordOut) // output
{
int ReturnCode;
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL + 1];
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
char Query[512];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -1098,7 +1100,7 @@ int swad__getNewPassword (struct soap *soap,
/***** Check if user's email, @nickname or ID are valid *****/
Str_Copy (UsrIDNickOrEmail,userID,
Cns_MAX_BYTES_EMAIL);
Cns_MAX_BYTES_EMAIL_ADDRESS);
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
{
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
@ -3355,15 +3357,18 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
/* Build query */
sprintf (Query,"INSERT INTO msg_content"
" (Subject,Content,ImageName,ImageTitle,ImageURL)"
" VALUES ('%s','%s','','','')",
" VALUES"
" ('%s','%s','','','')",
Subject,Content);
/* Get the code of the inserted item */
NewMsgCod = DB_QueryINSERTandReturnCode (Query,"can not create message");
/***** Insert message in sent messages *****/
sprintf (Query,"INSERT INTO msg_snt (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" VALUES ('%ld','-1','%ld','N',NOW())",
sprintf (Query,"INSERT INTO msg_snt"
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" VALUES"
" ('%ld','-1','%ld','N',NOW())",
NewMsgCod,SenderUsrCod);
DB_QueryINSERT (Query,"can not create message");
@ -3371,8 +3376,10 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
}
/***** Insert message received in the database *****/
sprintf (Query,"INSERT INTO msg_rcv (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" VALUES ('%ld','%ld','%c','N','N','N')",
sprintf (Query,"INSERT INTO msg_rcv"
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" VALUES"
" ('%ld','%ld','%c','N','N','N')",
NewMsgCod,RecipientUsrCod,
NotifyByEmail ? 'Y' :
'N');
@ -3380,8 +3387,10 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
/***** Create notification for this recipient.
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)"
" VALUES ('%u','%ld','%ld','-1','-1','-1','%ld',NOW(),'%u')",
sprintf (Query,"INSERT INTO notif"
" (NotifyEvent,ToUsrCod,FromUsrCod,InsCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
" VALUES"
" ('%u','%ld','%ld','-1','-1','-1','%ld',NOW(),'%u')",
(unsigned) Ntf_EVENT_MESSAGE,
RecipientUsrCod,
SenderUsrCod,
@ -3452,8 +3461,10 @@ int swad__sendNotice (struct soap *soap,
/***** Insert notice in the database *****/
/* Build query */
sprintf (Query,"INSERT INTO notices (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES ('%ld','%ld',NOW(),'%s','%u')",
sprintf (Query,"INSERT INTO notices"
" (CrsCod,UsrCod,CreatTime,Content,Status)"
" VALUES"
" ('%ld','%ld',NOW(),'%s','%u')",
Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
body,(unsigned) Not_ACTIVE_NOTICE);