mirror of https://github.com/acanas/swad-core.git
Version 20.32: Feb 15, 2021 Fixed bugs in copy of strings.
This commit is contained in:
parent
8ce0f8c6b5
commit
3ca6d7a706
333
swad_API.c
333
swad_API.c
|
@ -225,8 +225,8 @@ static int API_RemoveOldWSKeys (struct soap *soap);
|
||||||
static int API_GetCurrentDegCodFromCurrentCrsCod (void);
|
static int API_GetCurrentDegCodFromCurrentCrsCod (void);
|
||||||
static bool API_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod);
|
static bool API_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod);
|
||||||
|
|
||||||
static int API_CheckParamsNewAccount (char *NewNickWithArroba, // Input
|
static int API_CheckParamsNewAccount (char *NewNickWithArr, // Input
|
||||||
char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1], // Output
|
char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1], // Output
|
||||||
char *NewEmail, // Input-output
|
char *NewEmail, // Input-output
|
||||||
char *NewPlainPassword, // Input
|
char *NewPlainPassword, // Input
|
||||||
char *NewEncryptedPassword); // Output
|
char *NewEncryptedPassword); // Output
|
||||||
|
@ -619,7 +619,11 @@ static bool API_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
||||||
|
|
||||||
/***** Get some user's data *****/
|
/***** Get some user's data *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get user's data",
|
if (DB_QuerySELECT (&mysql_res,"can not get user's data",
|
||||||
"SELECT Surname1,Surname2,FirstName,Photo,DATE_FORMAT(Birthday,'%%Y%%m%%d')"
|
"SELECT Surname1," // row[0]
|
||||||
|
"Surname2," // row[1]
|
||||||
|
"FirstName," // row[2]
|
||||||
|
"Photo," // row[3]
|
||||||
|
"DATE_FORMAT(Birthday,'%%Y%%m%%d')" // row[4]
|
||||||
" FROM usr_data WHERE UsrCod=%ld",
|
" FROM usr_data WHERE UsrCod=%ld",
|
||||||
UsrDat->UsrCod) != 1)
|
UsrDat->UsrCod) != 1)
|
||||||
return false;
|
return false;
|
||||||
|
@ -627,15 +631,13 @@ static bool API_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
|
||||||
/* Read some user's data */
|
/* Read some user's data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get user's name */
|
/* Get user's name (row[0], row[1], row[2]) and photo (row[3]) */
|
||||||
Str_Copy (UsrDat->Surname1,row[0],sizeof (UsrDat->Surname1) - 1);
|
Str_Copy (UsrDat->Surname1,row[0],sizeof (UsrDat->Surname1) - 1);
|
||||||
Str_Copy (UsrDat->Surname2,row[1],sizeof (UsrDat->Surname2) - 1);
|
Str_Copy (UsrDat->Surname2,row[1],sizeof (UsrDat->Surname2) - 1);
|
||||||
Str_Copy (UsrDat->FrstName,row[2],sizeof (UsrDat->FrstName) - 1);
|
Str_Copy (UsrDat->FrstName,row[2],sizeof (UsrDat->FrstName) - 1);
|
||||||
|
|
||||||
/* Get user's photo */
|
|
||||||
Str_Copy (UsrDat->Photo ,row[3],sizeof (UsrDat->Photo ) - 1);
|
Str_Copy (UsrDat->Photo ,row[3],sizeof (UsrDat->Photo ) - 1);
|
||||||
|
|
||||||
/* Get user's brithday */
|
/* Get user's brithday (row[4]) */
|
||||||
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[4]);
|
Dat_GetDateFromYYYYMMDD (&(UsrDat->Birthday),row[4]);
|
||||||
|
|
||||||
/* Free structure that stores the query result */
|
/* Free structure that stores the query result */
|
||||||
|
@ -734,7 +736,7 @@ int swad__createAccount (struct soap *soap,
|
||||||
char *userNickname,char *userEmail,char *userPassword,char *appKey, // input
|
char *userNickname,char *userEmail,char *userPassword,char *appKey, // input
|
||||||
struct swad__createAccountOutput *createAccountOut) // output
|
struct swad__createAccountOutput *createAccountOut) // output
|
||||||
{
|
{
|
||||||
char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
char NewEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
char NewEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
||||||
int Result;
|
int Result;
|
||||||
int ReturnCode;
|
int ReturnCode;
|
||||||
|
@ -744,7 +746,7 @@ int swad__createAccount (struct soap *soap,
|
||||||
Gbl.WebService.Function = API_createAccount;
|
Gbl.WebService.Function = API_createAccount;
|
||||||
|
|
||||||
/***** Allocate space for strings *****/
|
/***** Allocate space for strings *****/
|
||||||
createAccountOut->wsKey = (char *) soap_malloc (soap,API_BYTES_WS_KEY + 1);
|
createAccountOut->wsKey = soap_malloc (soap,API_BYTES_WS_KEY + 1);
|
||||||
|
|
||||||
/***** Default values returned on error *****/
|
/***** Default values returned on error *****/
|
||||||
createAccountOut->userCode = 0; // Undefined error
|
createAccountOut->userCode = 0; // Undefined error
|
||||||
|
@ -756,7 +758,7 @@ int swad__createAccount (struct soap *soap,
|
||||||
|
|
||||||
/***** Check parameters used to create the new account *****/
|
/***** Check parameters used to create the new account *****/
|
||||||
Result = API_CheckParamsNewAccount (userNickname, // Input
|
Result = API_CheckParamsNewAccount (userNickname, // Input
|
||||||
NewNickWithoutArroba,// Output
|
NewNickWithoutArr,// Output
|
||||||
userEmail, // Input-output
|
userEmail, // Input-output
|
||||||
userPassword, // Input
|
userPassword, // Input
|
||||||
NewEncryptedPassword); // Output
|
NewEncryptedPassword); // Output
|
||||||
|
@ -779,8 +781,8 @@ int swad__createAccount (struct soap *soap,
|
||||||
true); // I am creating my own account
|
true); // I am creating my own account
|
||||||
|
|
||||||
/***** Save nickname *****/
|
/***** Save nickname *****/
|
||||||
Nck_UpdateNickInDB (Gbl.Usrs.Me.UsrDat.UsrCod,NewNickWithoutArroba);
|
Nck_UpdateNickInDB (Gbl.Usrs.Me.UsrDat.UsrCod,NewNickWithoutArr);
|
||||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNickWithoutArroba,
|
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNickWithoutArr,
|
||||||
sizeof (Gbl.Usrs.Me.UsrDat.Nickname) - 1);
|
sizeof (Gbl.Usrs.Me.UsrDat.Nickname) - 1);
|
||||||
|
|
||||||
/***** Save email *****/
|
/***** Save email *****/
|
||||||
|
@ -806,26 +808,25 @@ int swad__createAccount (struct soap *soap,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Return false on error
|
// Return false on error
|
||||||
//char *userNickname,char *userEmail,char *userID,char *userPassword
|
//char *userNickname,char *userEmail,char *userID,char *userPassword
|
||||||
static int API_CheckParamsNewAccount (char *NewNickWithArroba, // Input
|
static int API_CheckParamsNewAccount (char *NewNickWithArr, // Input
|
||||||
char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1], // Output
|
char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1], // Output
|
||||||
char *NewEmail, // Input-output
|
char *NewEmail, // Input-output
|
||||||
char *NewPlainPassword, // Input
|
char *NewPlainPassword, // Input
|
||||||
char *NewEncryptedPassword) // Output
|
char *NewEncryptedPassword) // Output
|
||||||
{
|
{
|
||||||
/***** Step 1/3: Check new nickname *****/
|
/***** Step 1/3: Check new nickname *****/
|
||||||
/* Make a copy without possible starting arrobas */
|
/* Make a copy without possible starting arrobas */
|
||||||
Str_Copy (NewNickWithoutArroba,NewNickWithArroba,
|
Str_Copy (NewNickWithoutArr,NewNickWithArr,Nck_MAX_BYTES_NICK_FROM_FORM);
|
||||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
if (Nck_CheckIfNickWithArrIsValid (NewNickWithArr)) // If new nickname is valid
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (NewNickWithArroba)) // If new nickname is valid
|
|
||||||
{
|
{
|
||||||
/***** Remove arrobas at the beginning *****/
|
/***** Remove arrobas at the beginning *****/
|
||||||
Str_RemoveLeadingArrobas (NewNickWithoutArroba);
|
Str_RemoveLeadingArrobas (NewNickWithoutArr);
|
||||||
|
|
||||||
/***** Check if the new nickname matches any of the nicknames of other users *****/
|
/***** Check if the new nickname matches any of the nicknames of other users *****/
|
||||||
if (DB_QueryCOUNT ("can not check if nickname already existed",
|
if (DB_QueryCOUNT ("can not check if nickname already existed",
|
||||||
"SELECT COUNT(*) FROM usr_nicknames"
|
"SELECT COUNT(*) FROM usr_nicknames"
|
||||||
" WHERE Nickname='%s'",
|
" WHERE Nickname='%s'",
|
||||||
NewNickWithoutArroba)) // A nickname of another user is the same that this nickname
|
NewNickWithoutArr)) // A nickname of another user is the same that this nickname
|
||||||
return API_CHECK_NEW_ACCOUNT_NICKNAME_REGISTERED_BY_ANOTHER_USER;
|
return API_CHECK_NEW_ACCOUNT_NICKNAME_REGISTERED_BY_ANOTHER_USER;
|
||||||
}
|
}
|
||||||
else // New nickname is not valid
|
else // New nickname is not valid
|
||||||
|
@ -873,14 +874,14 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
Gbl.WebService.Function = API_loginByUserPasswordKey;
|
Gbl.WebService.Function = API_loginByUserPasswordKey;
|
||||||
|
|
||||||
/***** Allocate space for strings *****/
|
/***** Allocate space for strings *****/
|
||||||
loginByUserPasswordKeyOut->wsKey = (char *) soap_malloc (soap,API_BYTES_WS_KEY + 1);
|
loginByUserPasswordKeyOut->wsKey = soap_malloc (soap,API_BYTES_WS_KEY + 1);
|
||||||
loginByUserPasswordKeyOut->userNickname = (char *) soap_malloc (soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
loginByUserPasswordKeyOut->userNickname = soap_malloc (soap,Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1);
|
||||||
loginByUserPasswordKeyOut->userID = (char *) soap_malloc (soap,ID_MAX_BYTES_USR_ID + 1);
|
loginByUserPasswordKeyOut->userID = soap_malloc (soap,ID_MAX_BYTES_USR_ID + 1);
|
||||||
loginByUserPasswordKeyOut->userFirstname = (char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
loginByUserPasswordKeyOut->userFirstname = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginByUserPasswordKeyOut->userSurname1 = (char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
loginByUserPasswordKeyOut->userSurname1 = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginByUserPasswordKeyOut->userSurname2 = (char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
loginByUserPasswordKeyOut->userSurname2 = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginByUserPasswordKeyOut->userPhoto = (char *) soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
loginByUserPasswordKeyOut->userPhoto = soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
loginByUserPasswordKeyOut->userBirthday = (char *) soap_malloc (soap,Dat_LENGTH_YYYYMMDD + 1);
|
loginByUserPasswordKeyOut->userBirthday = soap_malloc (soap,Dat_LENGTH_YYYYMMDD + 1);
|
||||||
|
|
||||||
/***** Default values returned on error *****/
|
/***** Default values returned on error *****/
|
||||||
loginByUserPasswordKeyOut->userCode = -1;
|
loginByUserPasswordKeyOut->userCode = -1;
|
||||||
|
@ -901,7 +902,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,sizeof (UsrIDNickOrEmail) - 1);
|
Str_Copy (UsrIDNickOrEmail,userID,sizeof (UsrIDNickOrEmail) - 1);
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
||||||
|
|
||||||
|
@ -977,8 +978,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
loginByUserPasswordKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
loginByUserPasswordKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userNickname,
|
Str_Copy (loginByUserPasswordKeyOut->userNickname,
|
||||||
Gbl.Usrs.Me.UsrDat.Nickname,
|
Gbl.Usrs.Me.UsrDat.Nickname,Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userID,
|
Str_Copy (loginByUserPasswordKeyOut->userID,
|
||||||
|
@ -986,24 +986,20 @@ int swad__loginByUserPasswordKey (struct soap *soap,
|
||||||
ID_MAX_BYTES_USR_ID);
|
ID_MAX_BYTES_USR_ID);
|
||||||
|
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userSurname1,
|
Str_Copy (loginByUserPasswordKeyOut->userSurname1,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
Gbl.Usrs.Me.UsrDat.Surname1,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userSurname2,
|
Str_Copy (loginByUserPasswordKeyOut->userSurname2,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname2,
|
Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userFirstname,
|
Str_Copy (loginByUserPasswordKeyOut->userFirstname,
|
||||||
Gbl.Usrs.Me.UsrDat.FrstName,
|
Gbl.Usrs.Me.UsrDat.FrstName,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,
|
Str_Copy (loginByUserPasswordKeyOut->userPhoto,PhotoURL,Cns_MAX_BYTES_WWW);
|
||||||
Cns_MAX_BYTES_WWW);
|
|
||||||
|
|
||||||
Str_Copy (loginByUserPasswordKeyOut->userBirthday,
|
Str_Copy (loginByUserPasswordKeyOut->userBirthday,
|
||||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
|
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||||
Dat_LENGTH_YYYYMMDD);
|
|
||||||
|
|
||||||
loginByUserPasswordKeyOut->userRole = API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role];
|
loginByUserPasswordKeyOut->userRole =
|
||||||
|
API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role];
|
||||||
|
|
||||||
/***** Generate a key used in subsequents calls to other web services *****/
|
/***** Generate a key used in subsequents calls to other web services *****/
|
||||||
return API_GenerateNewWSKey (soap,
|
return API_GenerateNewWSKey (soap,
|
||||||
|
@ -1046,16 +1042,16 @@ int swad__loginBySessionKey (struct soap *soap,
|
||||||
Gbl.WebService.Function = API_loginBySessionKey;
|
Gbl.WebService.Function = API_loginBySessionKey;
|
||||||
|
|
||||||
/***** Allocate space for strings *****/
|
/***** Allocate space for strings *****/
|
||||||
loginBySessionKeyOut->wsKey = (char *) soap_malloc (soap,API_BYTES_WS_KEY + 1);
|
loginBySessionKeyOut->wsKey = soap_malloc (soap,API_BYTES_WS_KEY + 1);
|
||||||
loginBySessionKeyOut->userNickname = (char *) soap_malloc (soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
loginBySessionKeyOut->userNickname = soap_malloc (soap,Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1);
|
||||||
loginBySessionKeyOut->userID = (char *) soap_malloc (soap,ID_MAX_BYTES_USR_ID + 1);
|
loginBySessionKeyOut->userID = soap_malloc (soap,ID_MAX_BYTES_USR_ID + 1);
|
||||||
loginBySessionKeyOut->userFirstname = (char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
loginBySessionKeyOut->userFirstname = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginBySessionKeyOut->userSurname1 = (char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
loginBySessionKeyOut->userSurname1 = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginBySessionKeyOut->userSurname2 = (char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
loginBySessionKeyOut->userSurname2 = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
loginBySessionKeyOut->userPhoto = (char *) soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
loginBySessionKeyOut->userPhoto = soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
loginBySessionKeyOut->userBirthday = (char *) soap_malloc (soap,Dat_LENGTH_YYYYMMDD + 1);
|
loginBySessionKeyOut->userBirthday = soap_malloc (soap,Dat_LENGTH_YYYYMMDD + 1);
|
||||||
loginBySessionKeyOut->degreeName = (char *) soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1);
|
loginBySessionKeyOut->degreeName = soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1);
|
||||||
loginBySessionKeyOut->courseName = (char *) soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1);
|
loginBySessionKeyOut->courseName = soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1);
|
||||||
|
|
||||||
/***** Default values returned on error *****/
|
/***** Default values returned on error *****/
|
||||||
loginBySessionKeyOut->userCode = -1;
|
loginBySessionKeyOut->userCode = -1;
|
||||||
|
@ -1135,7 +1131,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
||||||
loginBySessionKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
loginBySessionKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
|
||||||
Str_Copy (loginBySessionKeyOut->userNickname,Gbl.Usrs.Me.UsrDat.Nickname,
|
Str_Copy (loginBySessionKeyOut->userNickname,Gbl.Usrs.Me.UsrDat.Nickname,
|
||||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
if (Gbl.Usrs.Me.UsrDat.IDs.Num)
|
||||||
Str_Copy (loginBySessionKeyOut->userID,
|
Str_Copy (loginBySessionKeyOut->userID,
|
||||||
|
@ -1143,21 +1139,17 @@ int swad__loginBySessionKey (struct soap *soap,
|
||||||
ID_MAX_BYTES_USR_ID);
|
ID_MAX_BYTES_USR_ID);
|
||||||
|
|
||||||
Str_Copy (loginBySessionKeyOut->userSurname1,
|
Str_Copy (loginBySessionKeyOut->userSurname1,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname1,
|
Gbl.Usrs.Me.UsrDat.Surname1,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
Str_Copy (loginBySessionKeyOut->userSurname2,
|
Str_Copy (loginBySessionKeyOut->userSurname2,
|
||||||
Gbl.Usrs.Me.UsrDat.Surname2,
|
Gbl.Usrs.Me.UsrDat.Surname2,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
Str_Copy (loginBySessionKeyOut->userFirstname,
|
Str_Copy (loginBySessionKeyOut->userFirstname,
|
||||||
Gbl.Usrs.Me.UsrDat.FrstName,
|
Gbl.Usrs.Me.UsrDat.FrstName,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL);
|
||||||
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,Cns_MAX_BYTES_WWW);
|
Str_Copy (loginBySessionKeyOut->userPhoto,PhotoURL,Cns_MAX_BYTES_WWW);
|
||||||
|
|
||||||
Str_Copy (loginBySessionKeyOut->userBirthday,
|
Str_Copy (loginBySessionKeyOut->userBirthday,
|
||||||
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
|
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,Dat_LENGTH_YYYYMMDD);
|
||||||
Dat_LENGTH_YYYYMMDD);
|
|
||||||
|
|
||||||
loginBySessionKeyOut->userRole = API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role];
|
loginBySessionKeyOut->userRole = API_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role];
|
||||||
|
|
||||||
|
@ -1268,7 +1260,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,sizeof (UsrIDNickOrEmail) - 1);
|
Str_Copy (UsrIDNickOrEmail,userID,sizeof (UsrIDNickOrEmail) - 1);
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
Str_RemoveLeadingArrobas (UsrIDNickOrEmail);
|
||||||
|
|
||||||
|
@ -1405,13 +1397,13 @@ int swad__getCourses (struct soap *soap,
|
||||||
|
|
||||||
/* Get course short name (row[1]) */
|
/* Get course short name (row[1]) */
|
||||||
getCoursesOut->coursesArray.__ptr[NumRow].courseShortName =
|
getCoursesOut->coursesArray.__ptr[NumRow].courseShortName =
|
||||||
(char *) soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1);
|
soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1);
|
||||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseShortName,
|
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseShortName,
|
||||||
row[1],Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
row[1],Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
||||||
|
|
||||||
/* Get course full name (row[2]) */
|
/* Get course full name (row[2]) */
|
||||||
getCoursesOut->coursesArray.__ptr[NumRow].courseFullName =
|
getCoursesOut->coursesArray.__ptr[NumRow].courseFullName =
|
||||||
(char *) soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1);
|
soap_malloc (soap,Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1);
|
||||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseFullName,
|
Str_Copy (getCoursesOut->coursesArray.__ptr[NumRow].courseFullName,
|
||||||
row[2],Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
|
row[2],Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
|
||||||
|
|
||||||
|
@ -1522,7 +1514,7 @@ int swad__getCourseInfo (struct soap *soap,
|
||||||
Gbl.Crs.Info.Type,
|
Gbl.Crs.Info.Type,
|
||||||
&InfoSrc,&MustBeRead);
|
&InfoSrc,&MustBeRead);
|
||||||
Length = strlen (NamesInWSForInfoSrc[InfoSrc]);
|
Length = strlen (NamesInWSForInfoSrc[InfoSrc]);
|
||||||
getCourseInfo->infoSrc = (char *) soap_malloc (soap,Length + 1);
|
getCourseInfo->infoSrc = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc],Length);
|
Str_Copy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc],Length);
|
||||||
|
|
||||||
/***** Get info text *****/
|
/***** Get info text *****/
|
||||||
|
@ -1550,7 +1542,7 @@ int swad__getCourseInfo (struct soap *soap,
|
||||||
Result = API_WritePageIntoHTMLBuffer (soap,&(getCourseInfo->infoTxt));
|
Result = API_WritePageIntoHTMLBuffer (soap,&(getCourseInfo->infoTxt));
|
||||||
break;
|
break;
|
||||||
case Inf_INFO_SRC_URL: // Link to a web page
|
case Inf_INFO_SRC_URL: // Link to a web page
|
||||||
getCourseInfo->infoTxt = (char *) soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
getCourseInfo->infoTxt = soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
Inf_WriteURLIntoTxtBuffer (getCourseInfo->infoTxt);
|
Inf_WriteURLIntoTxtBuffer (getCourseInfo->infoTxt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1558,7 +1550,7 @@ int swad__getCourseInfo (struct soap *soap,
|
||||||
/***** Return empty text if pointer is null *****/
|
/***** Return empty text if pointer is null *****/
|
||||||
if (getCourseInfo->infoTxt == NULL)
|
if (getCourseInfo->infoTxt == NULL)
|
||||||
{
|
{
|
||||||
getCourseInfo->infoTxt = (char *) soap_malloc (soap,1);
|
getCourseInfo->infoTxt = soap_malloc (soap,1);
|
||||||
getCourseInfo->infoTxt[0] = '\0';
|
getCourseInfo->infoTxt[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2134,7 +2126,7 @@ int swad__getGroupTypes (struct soap *soap,
|
||||||
|
|
||||||
/* Get group type name (row[1]) */
|
/* Get group type name (row[1]) */
|
||||||
getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName =
|
getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName =
|
||||||
(char *) soap_malloc (soap,Grp_MAX_BYTES_GROUP_TYPE_NAME + 1);
|
soap_malloc (soap,Grp_MAX_BYTES_GROUP_TYPE_NAME + 1);
|
||||||
Str_Copy (getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName,
|
Str_Copy (getGroupTypesOut->groupTypesArray.__ptr[NumRow].groupTypeName,
|
||||||
row[1],Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
row[1],Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
||||||
|
|
||||||
|
@ -2257,7 +2249,7 @@ int swad__getGroups (struct soap *soap,
|
||||||
|
|
||||||
/* Get group type name (row[1]) */
|
/* Get group type name (row[1]) */
|
||||||
getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName =
|
getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName =
|
||||||
(char *) soap_malloc (soap,Grp_MAX_BYTES_GROUP_TYPE_NAME + 1);
|
soap_malloc (soap,Grp_MAX_BYTES_GROUP_TYPE_NAME + 1);
|
||||||
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,row[1],
|
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,row[1],
|
||||||
Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
||||||
|
|
||||||
|
@ -2267,7 +2259,7 @@ int swad__getGroups (struct soap *soap,
|
||||||
|
|
||||||
/* Get group name (row[3]) */
|
/* Get group name (row[3]) */
|
||||||
getGroupsOut->groupsArray.__ptr[NumRow].groupName =
|
getGroupsOut->groupsArray.__ptr[NumRow].groupName =
|
||||||
(char *) soap_malloc (soap,Grp_MAX_BYTES_GROUP_NAME + 1);
|
soap_malloc (soap,Grp_MAX_BYTES_GROUP_NAME + 1);
|
||||||
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupName,row[3],
|
Str_Copy (getGroupsOut->groupsArray.__ptr[NumRow].groupName,row[3],
|
||||||
Grp_MAX_BYTES_GROUP_NAME);
|
Grp_MAX_BYTES_GROUP_NAME);
|
||||||
|
|
||||||
|
@ -2429,7 +2421,7 @@ int swad__sendMyGroups (struct soap *soap,
|
||||||
|
|
||||||
/* Get group type name (row[1]) */
|
/* Get group type name (row[1]) */
|
||||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName =
|
SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName =
|
||||||
(char *) soap_malloc (soap,Grp_MAX_BYTES_GROUP_TYPE_NAME + 1);
|
soap_malloc (soap,Grp_MAX_BYTES_GROUP_TYPE_NAME + 1);
|
||||||
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,row[1],
|
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupTypeName,row[1],
|
||||||
Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
Grp_MAX_BYTES_GROUP_TYPE_NAME);
|
||||||
|
|
||||||
|
@ -2439,7 +2431,7 @@ int swad__sendMyGroups (struct soap *soap,
|
||||||
|
|
||||||
/* Get group name (row[3]) */
|
/* Get group name (row[3]) */
|
||||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName =
|
SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName =
|
||||||
(char *) soap_malloc (soap,Grp_MAX_BYTES_GROUP_NAME + 1);
|
soap_malloc (soap,Grp_MAX_BYTES_GROUP_NAME + 1);
|
||||||
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName,row[3],
|
Str_Copy (SendMyGroupsOut->groupsArray.__ptr[NumRow].groupName,row[3],
|
||||||
Grp_MAX_BYTES_GROUP_NAME);
|
Grp_MAX_BYTES_GROUP_NAME);
|
||||||
|
|
||||||
|
@ -2488,7 +2480,7 @@ static void API_CopyUsrData (struct soap *soap,
|
||||||
|
|
||||||
/* Copy user's nickname */
|
/* Copy user's nickname */
|
||||||
Length = strlen (UsrDat->Nickname);
|
Length = strlen (UsrDat->Nickname);
|
||||||
Usr->userNickname = (char *) soap_malloc (soap,Length + 1);
|
Usr->userNickname = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (Usr->userNickname,UsrDat->Nickname,Length);
|
Str_Copy (Usr->userNickname,UsrDat->Nickname,Length);
|
||||||
|
|
||||||
/* Copy user's first ID */
|
/* Copy user's first ID */
|
||||||
|
@ -2497,28 +2489,28 @@ static void API_CopyUsrData (struct soap *soap,
|
||||||
else // Hide user's ID
|
else // Hide user's ID
|
||||||
FirstID = "********";
|
FirstID = "********";
|
||||||
Length = strlen (FirstID);
|
Length = strlen (FirstID);
|
||||||
Usr->userID = (char *) soap_malloc (soap,Length + 1);
|
Usr->userID = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (Usr->userID,FirstID,Length);
|
Str_Copy (Usr->userID,FirstID,Length);
|
||||||
|
|
||||||
/* Copy user's surname1 */
|
/* Copy user's surname1 */
|
||||||
Length = strlen (UsrDat->Surname1);
|
Length = strlen (UsrDat->Surname1);
|
||||||
Usr->userSurname1 = (char *) soap_malloc (soap,Length + 1);
|
Usr->userSurname1 = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (Usr->userSurname1,UsrDat->Surname1,Length);
|
Str_Copy (Usr->userSurname1,UsrDat->Surname1,Length);
|
||||||
|
|
||||||
/* Copy user's surname2 */
|
/* Copy user's surname2 */
|
||||||
Length = strlen (UsrDat->Surname2);
|
Length = strlen (UsrDat->Surname2);
|
||||||
Usr->userSurname2 = (char *) soap_malloc (soap,Length + 1);
|
Usr->userSurname2 = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (Usr->userSurname2,UsrDat->Surname2,Length);
|
Str_Copy (Usr->userSurname2,UsrDat->Surname2,Length);
|
||||||
|
|
||||||
/* Copy user's first name */
|
/* Copy user's first name */
|
||||||
Length = strlen (UsrDat->FrstName);
|
Length = strlen (UsrDat->FrstName);
|
||||||
Usr->userFirstname = (char *) soap_malloc (soap,Length + 1);
|
Usr->userFirstname = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (Usr->userFirstname,UsrDat->FrstName,Length);
|
Str_Copy (Usr->userFirstname,UsrDat->FrstName,Length);
|
||||||
|
|
||||||
/* User's photo URL */
|
/* User's photo URL */
|
||||||
Pho_BuildLinkToPhoto (UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (UsrDat,PhotoURL);
|
||||||
Length = strlen (PhotoURL);
|
Length = strlen (PhotoURL);
|
||||||
Usr->userPhoto = (char *) soap_malloc (soap,Length + 1);
|
Usr->userPhoto = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (Usr->userPhoto,PhotoURL,Length);
|
Str_Copy (Usr->userPhoto,PhotoURL,Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2618,26 +2610,26 @@ int swad__getAttendanceEvents (struct soap *soap,
|
||||||
{
|
{
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
||||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1 =
|
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1,
|
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
||||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname2 =
|
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname2 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname2,
|
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname2,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
||||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userFirstname =
|
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userFirstname =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userFirstname,
|
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userFirstname,
|
||||||
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||||
Length = strlen (PhotoURL);
|
Length = strlen (PhotoURL);
|
||||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userPhoto =
|
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userPhoto =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userPhoto,
|
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userPhoto,
|
||||||
PhotoURL,Length);
|
PhotoURL,Length);
|
||||||
}
|
}
|
||||||
|
@ -2668,14 +2660,14 @@ int swad__getAttendanceEvents (struct soap *soap,
|
||||||
/* Get title of the event (row[6]) */
|
/* Get title of the event (row[6]) */
|
||||||
Length = strlen (row[6]);
|
Length = strlen (row[6]);
|
||||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title =
|
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title,
|
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].title,
|
||||||
row[6],Length);
|
row[6],Length);
|
||||||
|
|
||||||
/* Get Txt (row[7]) */
|
/* Get Txt (row[7]) */
|
||||||
Length = strlen (row[7]);
|
Length = strlen (row[7]);
|
||||||
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text =
|
getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text,
|
Str_Copy (getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].text,
|
||||||
row[7],Length);
|
row[7],Length);
|
||||||
|
|
||||||
|
@ -3078,7 +3070,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
{
|
{
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Nickname);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Nickname);
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userNickname =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userNickname =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userNickname,
|
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userNickname,
|
||||||
Gbl.Usrs.Other.UsrDat.Nickname,Length);
|
Gbl.Usrs.Other.UsrDat.Nickname,Length);
|
||||||
|
|
||||||
|
@ -3086,39 +3078,39 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
{
|
{
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID); // TODO: What user's ID?
|
Length = strlen (Gbl.Usrs.Other.UsrDat.IDs.List[0].ID); // TODO: What user's ID?
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userID,
|
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userID,
|
||||||
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,Length);
|
Gbl.Usrs.Other.UsrDat.IDs.List[0].ID,Length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID =
|
||||||
(char *) soap_malloc (soap,1);
|
soap_malloc (soap,1);
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID[0] = '\0';
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userID[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname1 =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname1 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname1,
|
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname1,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname2 =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname2 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname2,
|
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userSurname2,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userFirstname =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userFirstname =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userFirstname,
|
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userFirstname,
|
||||||
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||||
Length = strlen (PhotoURL);
|
Length = strlen (PhotoURL);
|
||||||
getAttendanceUsersOut->usersArray.__ptr[NumRow].userPhoto =
|
getAttendanceUsersOut->usersArray.__ptr[NumRow].userPhoto =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userPhoto,
|
Str_Copy (getAttendanceUsersOut->usersArray.__ptr[NumRow].userPhoto,
|
||||||
PhotoURL,Length);
|
PhotoURL,Length);
|
||||||
}
|
}
|
||||||
|
@ -3375,7 +3367,7 @@ int swad__getNotifications (struct soap *soap,
|
||||||
/* Get notification event type (row[1]) */
|
/* Get notification event type (row[1]) */
|
||||||
NotifyEvent = Ntf_GetNotifyEventFromStr ((const char *) row[1]);
|
NotifyEvent = Ntf_GetNotifyEventFromStr ((const char *) row[1]);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType =
|
||||||
(char *) soap_malloc (soap,Ntf_MAX_BYTES_NOTIFY_EVENT + 1);
|
soap_malloc (soap,Ntf_MAX_BYTES_NOTIFY_EVENT + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].eventType,
|
||||||
Ntf_WSNotifyEvents[NotifyEvent],Ntf_MAX_BYTES_NOTIFY_EVENT);
|
Ntf_WSNotifyEvents[NotifyEvent],Ntf_MAX_BYTES_NOTIFY_EVENT);
|
||||||
|
|
||||||
|
@ -3395,32 +3387,32 @@ int swad__getNotifications (struct soap *soap,
|
||||||
if (API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Hie.Crs.CrsCod)) // Get some user's data from database
|
if (API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Hie.Crs.CrsCod)) // Get some user's data from database
|
||||||
{
|
{
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname =
|
||||||
(char *) soap_malloc (soap,Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1);
|
soap_malloc (soap,Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname,
|
||||||
Gbl.Usrs.Other.UsrDat.Nickname,
|
Gbl.Usrs.Other.UsrDat.Nickname,
|
||||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
|
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1 =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1 =
|
||||||
(char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname1,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname1,
|
Gbl.Usrs.Other.UsrDat.Surname1,
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2 =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2 =
|
||||||
(char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userSurname2,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname2,
|
Gbl.Usrs.Other.UsrDat.Surname2,
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname =
|
||||||
(char *) soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userFirstname,
|
||||||
Gbl.Usrs.Other.UsrDat.FrstName,
|
Gbl.Usrs.Other.UsrDat.FrstName,
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto,
|
||||||
PhotoURL,Cns_MAX_BYTES_WWW);
|
PhotoURL,Cns_MAX_BYTES_WWW);
|
||||||
}
|
}
|
||||||
|
@ -3451,7 +3443,7 @@ int swad__getNotifications (struct soap *soap,
|
||||||
|
|
||||||
/* Set location */
|
/* Set location */
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].location =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].location =
|
||||||
(char *) soap_malloc (soap,Ntf_MAX_BYTES_NOTIFY_LOCATION + 1);
|
soap_malloc (soap,Ntf_MAX_BYTES_NOTIFY_LOCATION + 1);
|
||||||
|
|
||||||
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
||||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||||
|
@ -3491,21 +3483,21 @@ int swad__getNotifications (struct soap *soap,
|
||||||
|
|
||||||
Length = strlen (SummaryStr);
|
Length = strlen (SummaryStr);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].summary =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].summary =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].summary,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].summary,
|
||||||
SummaryStr,Length);
|
SummaryStr,Length);
|
||||||
|
|
||||||
if (ContentStr == NULL)
|
if (ContentStr == NULL)
|
||||||
{
|
{
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].content =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].content =
|
||||||
(char *) soap_malloc (soap,1);
|
soap_malloc (soap,1);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].content[0] = '\0';
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].content[0] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Length = strlen (ContentStr);
|
Length = strlen (ContentStr);
|
||||||
getNotificationsOut->notificationsArray.__ptr[NumNotif].content =
|
getNotificationsOut->notificationsArray.__ptr[NumNotif].content =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].content,
|
Str_Copy (getNotificationsOut->notificationsArray.__ptr[NumNotif].content,
|
||||||
ContentStr,Length);
|
ContentStr,Length);
|
||||||
|
|
||||||
|
@ -3646,7 +3638,7 @@ int swad__sendMessage (struct soap *soap,
|
||||||
{
|
{
|
||||||
int ReturnCode;
|
int ReturnCode;
|
||||||
long ReplyUsrCod = -1L;
|
long ReplyUsrCod = -1L;
|
||||||
char Nickname[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char Nickname[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
char *Query = NULL;
|
char *Query = NULL;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -3750,15 +3742,15 @@ int swad__sendMessage (struct soap *soap,
|
||||||
while (*Ptr)
|
while (*Ptr)
|
||||||
{
|
{
|
||||||
/* Find next string in text until comma (leading and trailing spaces are removed) */
|
/* Find next string in text until comma (leading and trailing spaces are removed) */
|
||||||
Str_GetNextStringUntilComma (&Ptr,Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
Str_GetNextStringUntilComma (&Ptr,Nickname,Nck_MAX_BYTES_NICK_FROM_FORM);
|
||||||
|
|
||||||
/* Check if string is a valid nickname */
|
/* Check if string is a valid nickname */
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (Nickname)) // String is a nickname?
|
if (Nck_CheckIfNickWithArrIsValid (Nickname)) // String is a nickname?
|
||||||
{
|
{
|
||||||
Str_RemoveLeadingArrobas (Nickname);
|
Str_RemoveLeadingArrobas (Nickname);
|
||||||
|
|
||||||
/* Check for overflow in query */
|
/* Check for overflow in query */
|
||||||
if (strlen (Query) + Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 32 >
|
if (strlen (Query) + Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 32 >
|
||||||
API_MAX_BYTES_QUERY_RECIPIENTS)
|
API_MAX_BYTES_QUERY_RECIPIENTS)
|
||||||
return soap_sender_fault (soap,
|
return soap_sender_fault (soap,
|
||||||
"Can not send message",
|
"Can not send message",
|
||||||
|
@ -4047,7 +4039,7 @@ int swad__getTestConfig (struct soap *soap,
|
||||||
getTestConfigOut->visibility = TstVis_MIN_VISIBILITY;
|
getTestConfigOut->visibility = TstVis_MIN_VISIBILITY;
|
||||||
|
|
||||||
/* TODO: Remove these lines in 2021 */
|
/* TODO: Remove these lines in 2021 */
|
||||||
getTestConfigOut->feedback = (char *) soap_malloc (soap,TstPrn_MAX_BYTES_FEEDBACK_TYPE + 1);
|
getTestConfigOut->feedback = soap_malloc (soap,TstPrn_MAX_BYTES_FEEDBACK_TYPE + 1);
|
||||||
getTestConfigOut->feedback[0] = '\0';
|
getTestConfigOut->feedback[0] = '\0';
|
||||||
|
|
||||||
/***** Get test configuration *****/
|
/***** Get test configuration *****/
|
||||||
|
@ -4280,7 +4272,7 @@ static int API_GetTstTags (struct soap *soap,
|
||||||
|
|
||||||
/* Get tag text (row[1]) */
|
/* Get tag text (row[1]) */
|
||||||
getTestsOut->tagsArray.__ptr[NumRow].tagText =
|
getTestsOut->tagsArray.__ptr[NumRow].tagText =
|
||||||
(char *) soap_malloc (soap,Tag_MAX_BYTES_TAG + 1);
|
soap_malloc (soap,Tag_MAX_BYTES_TAG + 1);
|
||||||
Str_Copy (getTestsOut->tagsArray.__ptr[NumRow].tagText,row[1],
|
Str_Copy (getTestsOut->tagsArray.__ptr[NumRow].tagText,row[1],
|
||||||
Tag_MAX_BYTES_TAG);
|
Tag_MAX_BYTES_TAG);
|
||||||
}
|
}
|
||||||
|
@ -4357,7 +4349,7 @@ static int API_GetTstQuestions (struct soap *soap,
|
||||||
/* Get answer type (row[1]) */
|
/* Get answer type (row[1]) */
|
||||||
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||||
getTestsOut->questionsArray.__ptr[NumRow].answerType =
|
getTestsOut->questionsArray.__ptr[NumRow].answerType =
|
||||||
(char *) soap_malloc (soap,Tst_MAX_BYTES_ANSWER_TYPE + 1);
|
soap_malloc (soap,Tst_MAX_BYTES_ANSWER_TYPE + 1);
|
||||||
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].answerType,
|
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].answerType,
|
||||||
Tst_StrAnswerTypesXML[AnswerType],
|
Tst_StrAnswerTypesXML[AnswerType],
|
||||||
Tst_MAX_BYTES_ANSWER_TYPE);
|
Tst_MAX_BYTES_ANSWER_TYPE);
|
||||||
|
@ -4368,13 +4360,13 @@ static int API_GetTstQuestions (struct soap *soap,
|
||||||
|
|
||||||
/* Get question stem (row[3]) */
|
/* Get question stem (row[3]) */
|
||||||
getTestsOut->questionsArray.__ptr[NumRow].stem =
|
getTestsOut->questionsArray.__ptr[NumRow].stem =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].stem,row[3],
|
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].stem,row[3],
|
||||||
Cns_MAX_BYTES_TEXT);
|
Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get question feedback (row[4]) */
|
/* Get question feedback (row[4]) */
|
||||||
getTestsOut->questionsArray.__ptr[NumRow].feedback =
|
getTestsOut->questionsArray.__ptr[NumRow].feedback =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].feedback,row[4],
|
Str_Copy (getTestsOut->questionsArray.__ptr[NumRow].feedback,row[4],
|
||||||
Cns_MAX_BYTES_TEXT);
|
Cns_MAX_BYTES_TEXT);
|
||||||
}
|
}
|
||||||
|
@ -4459,13 +4451,13 @@ static int API_GetTstAnswers (struct soap *soap,
|
||||||
|
|
||||||
/* Get answer (row[3]) */
|
/* Get answer (row[3]) */
|
||||||
getTestsOut->answersArray.__ptr[NumRow].answerText =
|
getTestsOut->answersArray.__ptr[NumRow].answerText =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerText,
|
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerText,
|
||||||
row[3],Cns_MAX_BYTES_TEXT);
|
row[3],Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get feedback (row[4]) */
|
/* Get feedback (row[4]) */
|
||||||
getTestsOut->answersArray.__ptr[NumRow].answerFeedback =
|
getTestsOut->answersArray.__ptr[NumRow].answerFeedback =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerFeedback,
|
Str_Copy (getTestsOut->answersArray.__ptr[NumRow].answerFeedback,
|
||||||
row[4],Cns_MAX_BYTES_TEXT);
|
row[4],Cns_MAX_BYTES_TEXT);
|
||||||
}
|
}
|
||||||
|
@ -4679,10 +4671,9 @@ int swad__getTrivialQuestion (struct soap *soap,
|
||||||
/* Get answer type (row[1]) */
|
/* Get answer type (row[1]) */
|
||||||
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||||
getTrivialQuestionOut->question.answerType =
|
getTrivialQuestionOut->question.answerType =
|
||||||
(char *) soap_malloc (soap,Tst_MAX_BYTES_ANSWER_TYPE + 1);
|
soap_malloc (soap,Tst_MAX_BYTES_ANSWER_TYPE + 1);
|
||||||
Str_Copy (getTrivialQuestionOut->question.answerType,
|
Str_Copy (getTrivialQuestionOut->question.answerType,
|
||||||
Tst_StrAnswerTypesXML[AnswerType],
|
Tst_StrAnswerTypesXML[AnswerType],Tst_MAX_BYTES_ANSWER_TYPE);
|
||||||
Tst_MAX_BYTES_ANSWER_TYPE);
|
|
||||||
|
|
||||||
/* Get shuffle (row[2]) */
|
/* Get shuffle (row[2]) */
|
||||||
getTrivialQuestionOut->question.shuffle = (row[2][0] == 'Y') ? 1 :
|
getTrivialQuestionOut->question.shuffle = (row[2][0] == 'Y') ? 1 :
|
||||||
|
@ -4690,15 +4681,13 @@ int swad__getTrivialQuestion (struct soap *soap,
|
||||||
|
|
||||||
/* Get question stem (row[3]) */
|
/* Get question stem (row[3]) */
|
||||||
getTrivialQuestionOut->question.stem =
|
getTrivialQuestionOut->question.stem =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTrivialQuestionOut->question.stem,row[3],
|
Str_Copy (getTrivialQuestionOut->question.stem,row[3],Cns_MAX_BYTES_TEXT);
|
||||||
Cns_MAX_BYTES_TEXT);
|
|
||||||
|
|
||||||
/* Get question feedback (row[4]) */
|
/* Get question feedback (row[4]) */
|
||||||
getTrivialQuestionOut->question.feedback =
|
getTrivialQuestionOut->question.feedback =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTrivialQuestionOut->question.feedback,row[4],
|
Str_Copy (getTrivialQuestionOut->question.feedback,row[4],Cns_MAX_BYTES_TEXT);
|
||||||
Cns_MAX_BYTES_TEXT);
|
|
||||||
}
|
}
|
||||||
else // Empty question
|
else // Empty question
|
||||||
{
|
{
|
||||||
|
@ -4707,18 +4696,18 @@ int swad__getTrivialQuestion (struct soap *soap,
|
||||||
getTrivialQuestionOut->question.questionCode = -1;
|
getTrivialQuestionOut->question.questionCode = -1;
|
||||||
|
|
||||||
/* Answer type (row[1]) */
|
/* Answer type (row[1]) */
|
||||||
getTrivialQuestionOut->question.answerType = (char *) soap_malloc (soap,1);
|
getTrivialQuestionOut->question.answerType = soap_malloc (soap,1);
|
||||||
getTrivialQuestionOut->question.answerType[0] = '\0';
|
getTrivialQuestionOut->question.answerType[0] = '\0';
|
||||||
|
|
||||||
/* Shuffle (row[2]) */
|
/* Shuffle (row[2]) */
|
||||||
getTrivialQuestionOut->question.shuffle = 0;
|
getTrivialQuestionOut->question.shuffle = 0;
|
||||||
|
|
||||||
/* Question stem (row[3]) */
|
/* Question stem (row[3]) */
|
||||||
getTrivialQuestionOut->question.stem = (char *) soap_malloc (soap,1);
|
getTrivialQuestionOut->question.stem = soap_malloc (soap,1);
|
||||||
getTrivialQuestionOut->question.stem[0] = '\0';
|
getTrivialQuestionOut->question.stem[0] = '\0';
|
||||||
|
|
||||||
/* Get question feedback (row[4]) */
|
/* Get question feedback (row[4]) */
|
||||||
getTrivialQuestionOut->question.feedback = (char *) soap_malloc (soap,1);
|
getTrivialQuestionOut->question.feedback = soap_malloc (soap,1);
|
||||||
getTrivialQuestionOut->question.feedback[0] = '\0';
|
getTrivialQuestionOut->question.feedback[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4767,13 +4756,13 @@ int swad__getTrivialQuestion (struct soap *soap,
|
||||||
|
|
||||||
/* Get answer (row[3]) */
|
/* Get answer (row[3]) */
|
||||||
getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText =
|
getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText,
|
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerText,
|
||||||
row[3],Cns_MAX_BYTES_TEXT);
|
row[3],Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get feedback (row[4]) */
|
/* Get feedback (row[4]) */
|
||||||
getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback =
|
getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback =
|
||||||
(char *) soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
soap_malloc (soap,Cns_MAX_BYTES_TEXT + 1);
|
||||||
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback,
|
Str_Copy (getTrivialQuestionOut->answersArray.__ptr[NumRow].answerFeedback,
|
||||||
row[4],Cns_MAX_BYTES_TEXT);
|
row[4],Cns_MAX_BYTES_TEXT);
|
||||||
}
|
}
|
||||||
|
@ -4886,26 +4875,26 @@ int swad__getGames (struct soap *soap,
|
||||||
{
|
{
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
||||||
getGamesOut->gamesArray.__ptr[NumGame].userSurname1 =
|
getGamesOut->gamesArray.__ptr[NumGame].userSurname1 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userSurname1,
|
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userSurname1,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
||||||
getGamesOut->gamesArray.__ptr[NumGame].userSurname2 =
|
getGamesOut->gamesArray.__ptr[NumGame].userSurname2 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userSurname2,
|
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userSurname2,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
||||||
getGamesOut->gamesArray.__ptr[NumGame].userFirstname =
|
getGamesOut->gamesArray.__ptr[NumGame].userFirstname =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userFirstname,
|
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userFirstname,
|
||||||
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||||
Length = strlen (PhotoURL);
|
Length = strlen (PhotoURL);
|
||||||
getGamesOut->gamesArray.__ptr[NumGame].userPhoto =
|
getGamesOut->gamesArray.__ptr[NumGame].userPhoto =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userPhoto,
|
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].userPhoto,
|
||||||
PhotoURL,Length);
|
PhotoURL,Length);
|
||||||
}
|
}
|
||||||
|
@ -4940,13 +4929,13 @@ int swad__getGames (struct soap *soap,
|
||||||
/* Get title of the game (row[6]) */
|
/* Get title of the game (row[6]) */
|
||||||
Length = strlen (row[6]);
|
Length = strlen (row[6]);
|
||||||
getGamesOut->gamesArray.__ptr[NumGame].title =
|
getGamesOut->gamesArray.__ptr[NumGame].title =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].title,row[6],Length);
|
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].title,row[6],Length);
|
||||||
|
|
||||||
/* Get Txt (row[7]) */
|
/* Get Txt (row[7]) */
|
||||||
Length = strlen (row[7]);
|
Length = strlen (row[7]);
|
||||||
getGamesOut->gamesArray.__ptr[NumGame].text =
|
getGamesOut->gamesArray.__ptr[NumGame].text =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].text,row[7],Length);
|
Str_Copy (getGamesOut->gamesArray.__ptr[NumGame].text,row[7],Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5071,26 +5060,26 @@ int swad__getMatches (struct soap *soap,
|
||||||
{
|
{
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1);
|
||||||
getMatchesOut->matchesArray.__ptr[NumMatch].userSurname1 =
|
getMatchesOut->matchesArray.__ptr[NumMatch].userSurname1 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userSurname1,
|
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userSurname1,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
Gbl.Usrs.Other.UsrDat.Surname1,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.Surname2);
|
||||||
getMatchesOut->matchesArray.__ptr[NumMatch].userSurname2 =
|
getMatchesOut->matchesArray.__ptr[NumMatch].userSurname2 =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userSurname2,
|
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userSurname2,
|
||||||
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
Gbl.Usrs.Other.UsrDat.Surname2,Length);
|
||||||
|
|
||||||
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
Length = strlen (Gbl.Usrs.Other.UsrDat.FrstName);
|
||||||
getMatchesOut->matchesArray.__ptr[NumMatch].userFirstname =
|
getMatchesOut->matchesArray.__ptr[NumMatch].userFirstname =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userFirstname,
|
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userFirstname,
|
||||||
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
Gbl.Usrs.Other.UsrDat.FrstName,Length);
|
||||||
|
|
||||||
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
|
||||||
Length = strlen (PhotoURL);
|
Length = strlen (PhotoURL);
|
||||||
getMatchesOut->matchesArray.__ptr[NumMatch].userPhoto =
|
getMatchesOut->matchesArray.__ptr[NumMatch].userPhoto =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userPhoto,
|
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].userPhoto,
|
||||||
PhotoURL,Length);
|
PhotoURL,Length);
|
||||||
}
|
}
|
||||||
|
@ -5117,7 +5106,7 @@ int swad__getMatches (struct soap *soap,
|
||||||
/* Get title of the match (row[4]) */
|
/* Get title of the match (row[4]) */
|
||||||
Length = strlen (row[4]);
|
Length = strlen (row[4]);
|
||||||
getMatchesOut->matchesArray.__ptr[NumMatch].title =
|
getMatchesOut->matchesArray.__ptr[NumMatch].title =
|
||||||
(char *) soap_malloc (soap,Length + 1);
|
soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].title,row[4],
|
Str_Copy (getMatchesOut->matchesArray.__ptr[NumMatch].title,row[4],
|
||||||
Length);
|
Length);
|
||||||
|
|
||||||
|
@ -5539,7 +5528,7 @@ int swad__getDirectoryTree (struct soap *soap,
|
||||||
fseek (Gbl.F.XML,0L,SEEK_SET);
|
fseek (Gbl.F.XML,0L,SEEK_SET);
|
||||||
|
|
||||||
/* Copy XML content from file to memory */
|
/* Copy XML content from file to memory */
|
||||||
getDirectoryTreeOut->tree = (char *) soap_malloc (soap,FileSize + 1);
|
getDirectoryTreeOut->tree = soap_malloc (soap,FileSize + 1);
|
||||||
NumBytesRead = fread (getDirectoryTreeOut->tree,1,FileSize,Gbl.F.XML);
|
NumBytesRead = fread (getDirectoryTreeOut->tree,1,FileSize,Gbl.F.XML);
|
||||||
getDirectoryTreeOut->tree[NumBytesRead] = '\0';
|
getDirectoryTreeOut->tree[NumBytesRead] = '\0';
|
||||||
|
|
||||||
|
@ -5713,11 +5702,11 @@ int swad__getFile (struct soap *soap,
|
||||||
Gbl.WebService.Function = API_getFile;
|
Gbl.WebService.Function = API_getFile;
|
||||||
|
|
||||||
/***** Allocate space for strings *****/
|
/***** Allocate space for strings *****/
|
||||||
getFileOut->fileName = (char *) soap_malloc (soap,NAME_MAX + 1);
|
getFileOut->fileName = soap_malloc (soap,NAME_MAX + 1);
|
||||||
getFileOut->URL = (char *) soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
getFileOut->URL = soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
getFileOut->license = (char *) soap_malloc (soap,Brw_MAX_BYTES_LICENSE + 1);
|
getFileOut->license = soap_malloc (soap,Brw_MAX_BYTES_LICENSE + 1);
|
||||||
getFileOut->publisherName = (char *) soap_malloc (soap,Usr_MAX_BYTES_FULL_NAME + 1);
|
getFileOut->publisherName = soap_malloc (soap,Usr_MAX_BYTES_FULL_NAME + 1);
|
||||||
getFileOut->publisherPhoto = (char *) soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
getFileOut->publisherPhoto = soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||||
|
|
||||||
/***** Default values returned on error *****/
|
/***** Default values returned on error *****/
|
||||||
getFileOut->fileName[0] = '\0';
|
getFileOut->fileName[0] = '\0';
|
||||||
|
@ -5940,14 +5929,14 @@ int swad__getMarks (struct soap *soap,
|
||||||
if (ContentStr != NULL)
|
if (ContentStr != NULL)
|
||||||
{
|
{
|
||||||
Length = strlen (ContentStr);
|
Length = strlen (ContentStr);
|
||||||
getMarksOut->content = (char *) soap_malloc (soap,Length + 1);
|
getMarksOut->content = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (getMarksOut->content,ContentStr,Length);
|
Str_Copy (getMarksOut->content,ContentStr,Length);
|
||||||
free (ContentStr);
|
free (ContentStr);
|
||||||
ContentStr = NULL;
|
ContentStr = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getMarksOut->content = (char *) soap_malloc (soap,1);
|
getMarksOut->content = soap_malloc (soap,1);
|
||||||
getMarksOut->content[0] = '\0';
|
getMarksOut->content[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6209,12 +6198,12 @@ static void API_GetDataOfLocation (struct soap *soap,
|
||||||
|
|
||||||
/* Get institution short name (row[1]) */
|
/* Get institution short name (row[1]) */
|
||||||
Length = strlen (row[1]);
|
Length = strlen (row[1]);
|
||||||
location->institutionShortName = (char *) soap_malloc (soap,Length + 1);
|
location->institutionShortName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->institutionShortName,row[1],Length);
|
Str_Copy (location->institutionShortName,row[1],Length);
|
||||||
|
|
||||||
/* Get institution full name (row[2]) */
|
/* Get institution full name (row[2]) */
|
||||||
Length = strlen (row[2]);
|
Length = strlen (row[2]);
|
||||||
location->institutionFullName = (char *) soap_malloc (soap,Length + 1);
|
location->institutionFullName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->institutionFullName,row[2],Length);
|
Str_Copy (location->institutionFullName,row[2],Length);
|
||||||
|
|
||||||
/* Get center code (row[3]) */
|
/* Get center code (row[3]) */
|
||||||
|
@ -6222,12 +6211,12 @@ static void API_GetDataOfLocation (struct soap *soap,
|
||||||
|
|
||||||
/* Get center short name (row[4]) */
|
/* Get center short name (row[4]) */
|
||||||
Length = strlen (row[4]);
|
Length = strlen (row[4]);
|
||||||
location->centerShortName = (char *) soap_malloc (soap,Length + 1);
|
location->centerShortName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->centerShortName,row[4],Length);
|
Str_Copy (location->centerShortName,row[4],Length);
|
||||||
|
|
||||||
/* Get center full name (row[5]) */
|
/* Get center full name (row[5]) */
|
||||||
Length = strlen (row[5]);
|
Length = strlen (row[5]);
|
||||||
location->centerFullName = (char *) soap_malloc (soap,Length + 1);
|
location->centerFullName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->centerFullName,row[5],Length);
|
Str_Copy (location->centerFullName,row[5],Length);
|
||||||
|
|
||||||
/* Get building code (row[6]) */
|
/* Get building code (row[6]) */
|
||||||
|
@ -6235,12 +6224,12 @@ static void API_GetDataOfLocation (struct soap *soap,
|
||||||
|
|
||||||
/* Get building short name (row[7]) */
|
/* Get building short name (row[7]) */
|
||||||
Length = strlen (row[7]);
|
Length = strlen (row[7]);
|
||||||
location->buildingShortName = (char *) soap_malloc (soap,Length + 1);
|
location->buildingShortName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->buildingShortName,row[7],Length);
|
Str_Copy (location->buildingShortName,row[7],Length);
|
||||||
|
|
||||||
/* Get building full name (row[8]) */
|
/* Get building full name (row[8]) */
|
||||||
Length = strlen (row[8]);
|
Length = strlen (row[8]);
|
||||||
location->buildingFullName = (char *) soap_malloc (soap,Length + 1);
|
location->buildingFullName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->buildingFullName,row[8],Length);
|
Str_Copy (location->buildingFullName,row[8],Length);
|
||||||
|
|
||||||
/* Get floor (row[9]) */
|
/* Get floor (row[9]) */
|
||||||
|
@ -6251,12 +6240,12 @@ static void API_GetDataOfLocation (struct soap *soap,
|
||||||
|
|
||||||
/* Get room short name (row[11]) */
|
/* Get room short name (row[11]) */
|
||||||
Length = strlen (row[11]);
|
Length = strlen (row[11]);
|
||||||
location->roomShortName = (char *) soap_malloc (soap,Length + 1);
|
location->roomShortName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->roomShortName,row[11],Length);
|
Str_Copy (location->roomShortName,row[11],Length);
|
||||||
|
|
||||||
/* Get room full name (row[12]) */
|
/* Get room full name (row[12]) */
|
||||||
Length = strlen (row[12]);
|
Length = strlen (row[12]);
|
||||||
location->roomFullName = (char *) soap_malloc (soap,Length + 1);
|
location->roomFullName = soap_malloc (soap,Length + 1);
|
||||||
Str_Copy (location->roomFullName,row[12],Length);
|
Str_Copy (location->roomFullName,row[12],Length);
|
||||||
|
|
||||||
/* Get check in time (row[13]) */
|
/* Get check in time (row[13]) */
|
||||||
|
@ -6287,29 +6276,29 @@ static void API_GetDataOfLocation (struct soap *soap,
|
||||||
static void API_ResetLocation (struct soap *soap,
|
static void API_ResetLocation (struct soap *soap,
|
||||||
struct swad__location *location)
|
struct swad__location *location)
|
||||||
{
|
{
|
||||||
location->institutionCode = -1;
|
location->institutionCode = -1;
|
||||||
location->institutionShortName = (char *) soap_malloc (soap,1);
|
location->institutionShortName = soap_malloc (soap,1);
|
||||||
location->institutionShortName[0] = '\0';
|
location->institutionShortName[0] = '\0';
|
||||||
location->institutionFullName = (char *) soap_malloc (soap,1);
|
location->institutionFullName = soap_malloc (soap,1);
|
||||||
location->institutionFullName[0] = '\0';
|
location->institutionFullName[0] = '\0';
|
||||||
|
|
||||||
location->centerCode = -1;
|
location->centerCode = -1;
|
||||||
location->centerShortName = (char *) soap_malloc (soap,1);
|
location->centerShortName = soap_malloc (soap,1);
|
||||||
location->centerShortName[0] = '\0';
|
location->centerShortName[0] = '\0';
|
||||||
location->centerFullName = (char *) soap_malloc (soap,1);
|
location->centerFullName = soap_malloc (soap,1);
|
||||||
location->centerFullName[0] = '\0';
|
location->centerFullName[0] = '\0';
|
||||||
|
|
||||||
location->buildingCode = -1;
|
location->buildingCode = -1;
|
||||||
location->buildingShortName = (char *) soap_malloc (soap,1);
|
location->buildingShortName = soap_malloc (soap,1);
|
||||||
location->buildingShortName[0] = '\0';
|
location->buildingShortName[0] = '\0';
|
||||||
location->buildingFullName = (char *) soap_malloc (soap,1);
|
location->buildingFullName = soap_malloc (soap,1);
|
||||||
location->buildingFullName[0] = '\0';
|
location->buildingFullName[0] = '\0';
|
||||||
|
|
||||||
location->floor = 0;
|
location->floor = 0;
|
||||||
|
|
||||||
location->roomCode = -1;
|
location->roomCode = -1;
|
||||||
location->roomShortName = (char *) soap_malloc (soap,1);
|
location->roomShortName = soap_malloc (soap,1);
|
||||||
location->roomShortName[0] = '\0';
|
location->roomShortName[0] = '\0';
|
||||||
location->roomFullName = (char *) soap_malloc (soap,1);
|
location->roomFullName = soap_malloc (soap,1);
|
||||||
location->roomFullName[0] = '\0';
|
location->roomFullName[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ extern struct Globals Gbl;
|
||||||
|
|
||||||
static void Acc_ShowFormCheckIfIHaveAccount (const char *Title);
|
static void Acc_ShowFormCheckIfIHaveAccount (const char *Title);
|
||||||
static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrData *UsrDat);
|
static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrData *UsrDat);
|
||||||
static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1],
|
static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1],
|
||||||
const char *NewEmail);
|
const char *NewEmail);
|
||||||
static bool Acc_GetParamsNewAccount (char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1],
|
static bool Acc_GetParamsNewAccount (char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1],
|
||||||
char *NewEmail,
|
char *NewEmail,
|
||||||
char *NewEncryptedPassword);
|
char *NewEncryptedPassword);
|
||||||
static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat);
|
static void Acc_CreateNewEncryptedUsrCod (struct UsrData *UsrDat);
|
||||||
|
@ -353,7 +353,7 @@ void Acc_ShowFormCreateMyAccount (void)
|
||||||
/************ Show form to create a new account using parameters *************/
|
/************ Show form to create a new account using parameters *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1],
|
static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1],
|
||||||
const char *NewEmail)
|
const char *NewEmail)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_PROFILE_SignUp;
|
extern const char *Hlp_PROFILE_SignUp;
|
||||||
|
@ -363,7 +363,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
||||||
extern const char *Txt_HELP_nickname;
|
extern const char *Txt_HELP_nickname;
|
||||||
extern const char *Txt_HELP_email;
|
extern const char *Txt_HELP_email;
|
||||||
extern const char *Txt_Email;
|
extern const char *Txt_Email;
|
||||||
char NewNickWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
|
|
||||||
/***** Begin form to enter some data of the new user *****/
|
/***** Begin form to enter some data of the new user *****/
|
||||||
Frm_StartForm (ActCreUsrAcc);
|
Frm_StartForm (ActCreUsrAcc);
|
||||||
|
@ -374,11 +374,11 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
||||||
Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE,2);
|
Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE,2);
|
||||||
|
|
||||||
/***** Nickname *****/
|
/***** Nickname *****/
|
||||||
if (NewNickWithoutArroba[0])
|
if (NewNickWithoutArr[0])
|
||||||
snprintf (NewNickWithArroba,sizeof (NewNickWithArroba),"@%s",
|
snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
|
||||||
NewNickWithoutArroba);
|
NewNickWithoutArr);
|
||||||
else
|
else
|
||||||
NewNickWithArroba[0] = '\0';
|
NewNickWithArr[0] = '\0';
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
/* Label */
|
/* Label */
|
||||||
|
@ -386,8 +386,8 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char NewNickWithoutAr
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
HTM_INPUT_TEXT ("NewNick",1 + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA,
|
HTM_INPUT_TEXT ("NewNick",1 + Nck_MAX_CHARS_NICK_WITHOUT_ARROBA,
|
||||||
NewNickWithArroba,HTM_DONT_SUBMIT_ON_CHANGE,
|
NewNickWithArr,HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"NewNick\" size=\"18\" placeholder=\"%s\" required=\"required\"",
|
"id=\"NewNick\" size=\"18\" placeholder=\"%s\" required=\"required\"",
|
||||||
Txt_HELP_nickname);
|
Txt_HELP_nickname);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -582,11 +582,11 @@ static void Acc_PutParamsToRemoveMyAccount (void *EncryptedUsrCod)
|
||||||
|
|
||||||
bool Acc_CreateMyNewAccountAndLogIn (void)
|
bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||||
{
|
{
|
||||||
char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
||||||
char NewEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
char NewEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
||||||
|
|
||||||
if (Acc_GetParamsNewAccount (NewNickWithoutArroba,NewEmail,NewEncryptedPassword))
|
if (Acc_GetParamsNewAccount (NewNickWithoutArr,NewEmail,NewEncryptedPassword))
|
||||||
{
|
{
|
||||||
/***** User's has no ID *****/
|
/***** User's has no ID *****/
|
||||||
Gbl.Usrs.Me.UsrDat.IDs.Num = 0;
|
Gbl.Usrs.Me.UsrDat.IDs.Num = 0;
|
||||||
|
@ -601,8 +601,8 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||||
true); // I am creating my own account
|
true); // I am creating my own account
|
||||||
|
|
||||||
/***** Save nickname *****/
|
/***** Save nickname *****/
|
||||||
Nck_UpdateNickInDB (Gbl.Usrs.Me.UsrDat.UsrCod,NewNickWithoutArroba);
|
Nck_UpdateNickInDB (Gbl.Usrs.Me.UsrDat.UsrCod,NewNickWithoutArr);
|
||||||
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNickWithoutArroba,
|
Str_Copy (Gbl.Usrs.Me.UsrDat.Nickname,NewNickWithoutArr,
|
||||||
sizeof (Gbl.Usrs.Me.UsrDat.Nickname) - 1);
|
sizeof (Gbl.Usrs.Me.UsrDat.Nickname) - 1);
|
||||||
|
|
||||||
/***** Save email *****/
|
/***** Save email *****/
|
||||||
|
@ -620,7 +620,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Show form again ******/
|
/***** Show form again ******/
|
||||||
Acc_ShowFormRequestNewAccountWithParams (NewNickWithoutArroba,NewEmail);
|
Acc_ShowFormRequestNewAccountWithParams (NewNickWithoutArr,NewEmail);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,7 +630,7 @@ bool Acc_CreateMyNewAccountAndLogIn (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Return false on error
|
// Return false on error
|
||||||
|
|
||||||
static bool Acc_GetParamsNewAccount (char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1],
|
static bool Acc_GetParamsNewAccount (char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1],
|
||||||
char *NewEmail,
|
char *NewEmail,
|
||||||
char *NewEncryptedPassword)
|
char *NewEncryptedPassword)
|
||||||
{
|
{
|
||||||
|
@ -638,45 +638,43 @@ static bool Acc_GetParamsNewAccount (char NewNickWithoutArroba[Nck_MAX_BYTES_NIC
|
||||||
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
|
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
|
||||||
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;
|
||||||
char NewNickWithArroba[1 + Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithArr[1 + Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
char NewPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
char NewPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
|
||||||
bool Error = false;
|
bool Error = false;
|
||||||
|
|
||||||
/***** Step 1/3: Get new nickname from form *****/
|
/***** Step 1/3: Get new nickname from form *****/
|
||||||
Par_GetParToText ("NewNick",NewNickWithArroba,
|
Par_GetParToText ("NewNick",NewNickWithArr,Nck_MAX_BYTES_NICK_FROM_FORM);
|
||||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
|
||||||
|
|
||||||
/* Remove arrobas at the beginning */
|
/* Remove arrobas at the beginning */
|
||||||
Str_Copy (NewNickWithoutArroba,NewNickWithArroba,
|
Str_Copy (NewNickWithoutArr,NewNickWithArr,Nck_MAX_BYTES_NICK_FROM_FORM);
|
||||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
Str_RemoveLeadingArrobas (NewNickWithoutArr);
|
||||||
Str_RemoveLeadingArrobas (NewNickWithoutArroba);
|
|
||||||
|
|
||||||
/* Create a new version of the nickname with arroba */
|
/* Create a new version of the nickname with arroba */
|
||||||
snprintf (NewNickWithArroba,sizeof (NewNickWithArroba),"@%s",
|
snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
|
||||||
NewNickWithoutArroba);
|
NewNickWithoutArr);
|
||||||
|
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (NewNickWithArroba)) // If new nickname is valid
|
if (Nck_CheckIfNickWithArrIsValid (NewNickWithArr)) // If new nickname is valid
|
||||||
{
|
{
|
||||||
/* Check if the new nickname
|
/* Check if the new nickname
|
||||||
matches any of the nicknames of other users */
|
matches any of the nicknames of other users */
|
||||||
if (DB_QueryCOUNT ("can not check if nickname already existed",
|
if (DB_QueryCOUNT ("can not check if nickname already existed",
|
||||||
"SELECT COUNT(*) FROM usr_nicknames"
|
"SELECT COUNT(*) FROM usr_nicknames"
|
||||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||||
NewNickWithoutArroba,
|
NewNickWithoutArr,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // A nickname of another user is the same that this nickname
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // A nickname of another user is the same that this nickname
|
||||||
{
|
{
|
||||||
Error = true;
|
Error = true;
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_nickname_X_had_been_registered_by_another_user,
|
Ale_ShowAlert (Ale_WARNING,Txt_The_nickname_X_had_been_registered_by_another_user,
|
||||||
NewNickWithoutArroba);
|
NewNickWithoutArr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // New nickname is not valid
|
else // New nickname is not valid
|
||||||
{
|
{
|
||||||
Error = true;
|
Error = true;
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_nickname_entered_X_is_not_valid_,
|
Ale_ShowAlert (Ale_WARNING,Txt_The_nickname_entered_X_is_not_valid_,
|
||||||
NewNickWithArroba,
|
NewNickWithArr,
|
||||||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
Nck_MIN_CHARS_NICK_WITHOUT_ARROBA,
|
||||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_CHARS_NICK_WITHOUT_ARROBA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Step 2/3: Get new email from form *****/
|
/***** Step 2/3: Get new email from form *****/
|
||||||
|
|
|
@ -168,7 +168,7 @@ void Agd_PutFormLogInToShowUsrAgenda (void)
|
||||||
|
|
||||||
void Agd_PutParamAgd (void)
|
void Agd_PutParamAgd (void)
|
||||||
{
|
{
|
||||||
char Nickname[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char Nickname[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
|
|
||||||
snprintf (Nickname,sizeof (Nickname),"@%s",Gbl.Usrs.Other.UsrDat.Nickname);
|
snprintf (Nickname,sizeof (Nickname),"@%s",Gbl.Usrs.Other.UsrDat.Nickname);
|
||||||
Par_PutHiddenParamString (NULL,"agd",Nickname);
|
Par_PutHiddenParamString (NULL,"agd",Nickname);
|
||||||
|
@ -1230,16 +1230,13 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
|
||||||
/* Get code of the event (row[0]) */
|
/* Get code of the event (row[0]) */
|
||||||
AgdEvent->AgdCod = Str_ConvertStrCodToLongCod (row[0]);
|
AgdEvent->AgdCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
/* Get whether the event is public or not (row[1]) */
|
/* Get whether the event is public or not (row[1])
|
||||||
|
and whether it is hidden or not (row[2]) */
|
||||||
AgdEvent->Public = (row[1][0] == 'Y');
|
AgdEvent->Public = (row[1][0] == 'Y');
|
||||||
|
|
||||||
/* Get whether the event is hidden or not (row[2]) */
|
|
||||||
AgdEvent->Hidden = (row[2][0] == 'Y');
|
AgdEvent->Hidden = (row[2][0] == 'Y');
|
||||||
|
|
||||||
/* Get start date (row[3] holds the start UTC time) */
|
/* Get start date (row[3]) and end date (row[4]) in UTC time */
|
||||||
AgdEvent->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
AgdEvent->TimeUTC[Dat_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
|
|
||||||
/* Get end date (row[4] holds the end UTC time) */
|
|
||||||
AgdEvent->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
|
AgdEvent->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
|
|
||||||
/* Get whether the event is past, present or future (row(5), row[6]) */
|
/* Get whether the event is past, present or future (row(5), row[6]) */
|
||||||
|
@ -1247,10 +1244,8 @@ static void Agd_GetDataOfEventByCod (struct Agd_Event *AgdEvent)
|
||||||
((row[6][0] == '1') ? Dat_FUTURE :
|
((row[6][0] == '1') ? Dat_FUTURE :
|
||||||
Dat_PRESENT));
|
Dat_PRESENT));
|
||||||
|
|
||||||
/* Get the event (row[7]) */
|
/* Get the event (row[7]) and its location (row[8]) */
|
||||||
Str_Copy (AgdEvent->Event ,row[7],sizeof (AgdEvent->Event ) - 1);
|
Str_Copy (AgdEvent->Event ,row[7],sizeof (AgdEvent->Event ) - 1);
|
||||||
|
|
||||||
/* Get the event (row[8]) */
|
|
||||||
Str_Copy (AgdEvent->Location,row[8],sizeof (AgdEvent->Location) - 1);
|
Str_Copy (AgdEvent->Location,row[8],sizeof (AgdEvent->Location) - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -155,10 +155,8 @@ void Ann_ShowAllAnnouncements (void)
|
||||||
if (sscanf (row[2],"%u",&Roles) != 1)
|
if (sscanf (row[2],"%u",&Roles) != 1)
|
||||||
Lay_ShowErrorAndExit ("Error when reading roles of announcement.");
|
Lay_ShowErrorAndExit ("Error when reading roles of announcement.");
|
||||||
|
|
||||||
/* Get the content (row[3]) */
|
/* Get the subject (row[3]), the content (row[4]), and insert links */
|
||||||
Str_Copy (Subject,row[3],sizeof (Subject) - 1);
|
Str_Copy (Subject,row[3],sizeof (Subject) - 1);
|
||||||
|
|
||||||
/* Get the content (row[4]) and insert links */
|
|
||||||
Str_Copy (Content,row[4],sizeof (Content) - 1);
|
Str_Copy (Content,row[4],sizeof (Content) - 1);
|
||||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
||||||
|
|
||||||
|
@ -245,10 +243,8 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
|
||||||
if (sscanf (row[0],"%ld",&AnnCod) != 1)
|
if (sscanf (row[0],"%ld",&AnnCod) != 1)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of announcement.");
|
Lay_ShowErrorAndExit ("Wrong code of announcement.");
|
||||||
|
|
||||||
/* Get the content (row[1]) */
|
/* Get the subject (row[1]), the content (row[2]), and insert links */
|
||||||
Str_Copy (Subject,row[1],sizeof (Subject) - 1);
|
Str_Copy (Subject,row[1],sizeof (Subject) - 1);
|
||||||
|
|
||||||
/* Get the content (row[2]) and insert links */
|
|
||||||
Str_Copy (Content,row[2],sizeof (Content) - 1);
|
Str_Copy (Content,row[2],sizeof (Content) - 1);
|
||||||
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
Str_InsertLinks (Content,Cns_MAX_BYTES_TEXT,50);
|
||||||
|
|
||||||
|
|
|
@ -543,8 +543,7 @@ static void Asg_WriteAssignmentFolder (struct Asg_Assignment *Asg,bool PrintView
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
Gbl.FileBrowser.Type = Brw_ADMI_ASG_CRS; // Course assignments
|
Gbl.FileBrowser.Type = Brw_ADMI_ASG_CRS; // Course assignments
|
||||||
Str_Copy (Gbl.Usrs.Other.UsrDat.EnUsrCod,
|
Str_Copy (Gbl.Usrs.Other.UsrDat.EnUsrCod,Gbl.Usrs.Me.UsrDat.EnUsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.EnUsrCod,
|
|
||||||
sizeof (Gbl.Usrs.Other.UsrDat.EnUsrCod) - 1);
|
sizeof (Gbl.Usrs.Other.UsrDat.EnUsrCod) - 1);
|
||||||
Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (&Gbl.Usrs.Selected);
|
Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (&Gbl.Usrs.Selected);
|
||||||
Frm_StartForm (ActFrmCreAsgCrs);
|
Frm_StartForm (ActFrmCreAsgCrs);
|
||||||
|
@ -553,8 +552,7 @@ static void Asg_WriteAssignmentFolder (struct Asg_Assignment *Asg,bool PrintView
|
||||||
Rol_WrongRoleExit ();
|
Rol_WrongRoleExit ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,
|
Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS,
|
||||||
Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS,
|
|
||||||
sizeof (Gbl.FileBrowser.FilFolLnk.Path) - 1);
|
sizeof (Gbl.FileBrowser.FilFolLnk.Path) - 1);
|
||||||
Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,Asg->Folder,
|
Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,Asg->Folder,
|
||||||
sizeof (Gbl.FileBrowser.FilFolLnk.Name) - 1);
|
sizeof (Gbl.FileBrowser.FilFolLnk.Name) - 1);
|
||||||
|
@ -865,10 +863,8 @@ static void Asg_GetDataOfAssignment (struct Asg_Assignment *Asg,
|
||||||
/* Get whether the assignment is open or closed (row(5)) */
|
/* Get whether the assignment is open or closed (row(5)) */
|
||||||
Asg->Open = (row[5][0] == '1');
|
Asg->Open = (row[5][0] == '1');
|
||||||
|
|
||||||
/* Get the title of the assignment (row[6]) */
|
/* Get the title (row[6]) and the folder (row[7]) of the assignment */
|
||||||
Str_Copy (Asg->Title ,row[6],sizeof (Asg->Title ) - 1);
|
Str_Copy (Asg->Title ,row[6],sizeof (Asg->Title ) - 1);
|
||||||
|
|
||||||
/* Get the folder for the assignment files (row[7]) */
|
|
||||||
Str_Copy (Asg->Folder,row[7],sizeof (Asg->Folder) - 1);
|
Str_Copy (Asg->Folder,row[7],sizeof (Asg->Folder) - 1);
|
||||||
Asg->SendWork = (Asg->Folder[0] != '\0');
|
Asg->SendWork = (Asg->Folder[0] != '\0');
|
||||||
|
|
||||||
|
|
|
@ -791,10 +791,8 @@ bool Att_GetDataOfAttEventByCod (struct Att_Event *Event)
|
||||||
/* Get author of the attendance event (row[3]) */
|
/* Get author of the attendance event (row[3]) */
|
||||||
Event->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
Event->UsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||||
|
|
||||||
/* Get start date (row[4] holds the start UTC time) */
|
/* Get start date (row[4]) and end date (row[5]) in UTC time */
|
||||||
Event->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
Event->TimeUTC[Att_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||||
|
|
||||||
/* Get end date (row[5] holds the end UTC time) */
|
|
||||||
Event->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
|
Event->TimeUTC[Att_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||||
|
|
||||||
/* Get whether the attendance event is open or closed (row(6)) */
|
/* Get whether the attendance event is open or closed (row(6)) */
|
||||||
|
@ -2600,10 +2598,8 @@ static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long Us
|
||||||
/* Get if present (row[0]) */
|
/* Get if present (row[0]) */
|
||||||
Present = (row[0][0] == 'Y');
|
Present = (row[0][0] == 'Y');
|
||||||
|
|
||||||
/* Get student's comment (row[1]) */
|
/* Get student's (row[1]) and teacher's (row[2]) comment */
|
||||||
Str_Copy (CommentStd,row[1],Cns_MAX_BYTES_TEXT);
|
Str_Copy (CommentStd,row[1],Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get teacher's comment (row[2]) */
|
|
||||||
Str_Copy (CommentTch,row[2],Cns_MAX_BYTES_TEXT);
|
Str_Copy (CommentTch,row[2],Cns_MAX_BYTES_TEXT);
|
||||||
}
|
}
|
||||||
else // User is not present
|
else // User is not present
|
||||||
|
|
|
@ -317,16 +317,11 @@ static void Ban_GetListBanners (struct Ban_Banners *Banners,
|
||||||
/* Get if banner is hidden (row[1]) */
|
/* Get if banner is hidden (row[1]) */
|
||||||
Ban->Hidden = (row[1][0] == 'Y');
|
Ban->Hidden = (row[1][0] == 'Y');
|
||||||
|
|
||||||
/* Get the short name of the banner (row[2]) */
|
/* Get short name (row[2]), full name (row[3]),
|
||||||
|
image (row[4]) and URL (row[5]) of the banner */
|
||||||
Str_Copy (Ban->ShrtName,row[2],sizeof (Ban->ShrtName) - 1);
|
Str_Copy (Ban->ShrtName,row[2],sizeof (Ban->ShrtName) - 1);
|
||||||
|
|
||||||
/* Get the full name of the banner (row[3]) */
|
|
||||||
Str_Copy (Ban->FullName,row[3],sizeof (Ban->FullName) - 1);
|
Str_Copy (Ban->FullName,row[3],sizeof (Ban->FullName) - 1);
|
||||||
|
|
||||||
/* Get the image of the banner (row[4]) */
|
|
||||||
Str_Copy (Ban->Img ,row[4],sizeof (Ban->Img ) - 1);
|
Str_Copy (Ban->Img ,row[4],sizeof (Ban->Img ) - 1);
|
||||||
|
|
||||||
/* Get the URL of the banner (row[5]) */
|
|
||||||
Str_Copy (Ban->WWW ,row[5],sizeof (Ban->WWW ) - 1);
|
Str_Copy (Ban->WWW ,row[5],sizeof (Ban->WWW ) - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,16 +362,11 @@ void Ban_GetDataOfBannerByCod (struct Ban_Banner *Ban)
|
||||||
/* Get if the banner is hidden (row[0]) */
|
/* Get if the banner is hidden (row[0]) */
|
||||||
Ban->Hidden = (row[0][0] == 'Y');
|
Ban->Hidden = (row[0][0] == 'Y');
|
||||||
|
|
||||||
/* Get the short name of the banner (row[1]) */
|
/* Get short name (row[1]), full name (row[2]),
|
||||||
|
image (row[3]) and URL (row[4]) of the banner */
|
||||||
Str_Copy (Ban->ShrtName,row[1],sizeof (Ban->ShrtName) - 1);
|
Str_Copy (Ban->ShrtName,row[1],sizeof (Ban->ShrtName) - 1);
|
||||||
|
|
||||||
/* Get the full name of the banner (row[2]) */
|
|
||||||
Str_Copy (Ban->FullName,row[2],sizeof (Ban->FullName) - 1);
|
Str_Copy (Ban->FullName,row[2],sizeof (Ban->FullName) - 1);
|
||||||
|
|
||||||
/* Get the image of the banner (row[3]) */
|
|
||||||
Str_Copy (Ban->Img ,row[3],sizeof (Ban->Img ) - 1);
|
Str_Copy (Ban->Img ,row[3],sizeof (Ban->Img ) - 1);
|
||||||
|
|
||||||
/* Get the URL of the banner (row[4]) */
|
|
||||||
Str_Copy (Ban->WWW ,row[4],sizeof (Ban->WWW ) - 1);
|
Str_Copy (Ban->WWW ,row[4],sizeof (Ban->WWW ) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,13 +377,9 @@ void Bld_GetListBuildings (struct Bld_Buildings *Buildings,
|
||||||
|
|
||||||
if (WhichData == Bld_ALL_DATA)
|
if (WhichData == Bld_ALL_DATA)
|
||||||
{
|
{
|
||||||
/* Get the full name of the building (row[2]) */
|
/* Get full name (row[2]) and location (row[3]) of the building */
|
||||||
Str_Copy (Building->FullName,row[2],
|
Str_Copy (Building->FullName,row[2],sizeof (Building->FullName) - 1);
|
||||||
sizeof (Building->FullName) - 1);
|
Str_Copy (Building->Location,row[3],sizeof (Building->Location) - 1);
|
||||||
|
|
||||||
/* Get the full name of the building (row[3]) */
|
|
||||||
Str_Copy (Building->Location,row[3],
|
|
||||||
sizeof (Building->Location) - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,13 +423,10 @@ void Bld_GetDataOfBuildingByCod (struct Bld_Building *Building)
|
||||||
/* Get row */
|
/* Get row */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get the short name of the building (row[0]) */
|
/* Get short name (row[0]), full name (row[1])
|
||||||
|
and location (row[2]) of the building */
|
||||||
Str_Copy (Building->ShrtName,row[0],sizeof (Building->ShrtName) - 1);
|
Str_Copy (Building->ShrtName,row[0],sizeof (Building->ShrtName) - 1);
|
||||||
|
|
||||||
/* Get the full name of the building (row[1]) */
|
|
||||||
Str_Copy (Building->FullName,row[1],sizeof (Building->FullName) - 1);
|
Str_Copy (Building->FullName,row[1],sizeof (Building->FullName) - 1);
|
||||||
|
|
||||||
/* Get the location of the building (row[2]) */
|
|
||||||
Str_Copy (Building->Location,row[2],sizeof (Building->Location) - 1);
|
Str_Copy (Building->Location,row[2],sizeof (Building->Location) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -768,23 +768,16 @@ static void Ctr_GetDataOfCentreFromRow (struct Ctr_Centre *Ctr,MYSQL_ROW row)
|
||||||
/***** Get requester user's code (row[4]) *****/
|
/***** Get requester user's code (row[4]) *****/
|
||||||
Ctr->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
Ctr->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
||||||
|
|
||||||
/***** Get latitude (row[5]) *****/
|
/***** Get latitude (row[5], longitude (row[6]) and altitude (row[7])*****/
|
||||||
Ctr->Coord.Latitude = Map_GetLatitudeFromStr (row[5]);
|
Ctr->Coord.Latitude = Map_GetLatitudeFromStr (row[5]);
|
||||||
|
|
||||||
/***** Get longitude (row[6]) *****/
|
|
||||||
Ctr->Coord.Longitude = Map_GetLongitudeFromStr (row[6]);
|
Ctr->Coord.Longitude = Map_GetLongitudeFromStr (row[6]);
|
||||||
|
Ctr->Coord.Altitude = Map_GetAltitudeFromStr (row[7]);
|
||||||
|
|
||||||
/***** Get altitude (row[7]) *****/
|
/***** Get short name (row[8]), full name (row[9])
|
||||||
Ctr->Coord.Altitude = Map_GetAltitudeFromStr (row[7]);
|
and URL (row[10]) of the centre *****/
|
||||||
|
Str_Copy (Ctr->ShrtName,row[ 8],sizeof (Ctr->ShrtName) - 1);
|
||||||
/***** Get the short name of the centre (row[8]) *****/
|
Str_Copy (Ctr->FullName,row[ 9],sizeof (Ctr->FullName) - 1);
|
||||||
Str_Copy (Ctr->ShrtName,row[8],sizeof (Ctr->ShrtName) - 1);
|
Str_Copy (Ctr->WWW ,row[10],sizeof (Ctr->WWW ) - 1);
|
||||||
|
|
||||||
/***** Get the full name of the centre (row[9]) *****/
|
|
||||||
Str_Copy (Ctr->FullName,row[9],sizeof (Ctr->FullName) - 1);
|
|
||||||
|
|
||||||
/***** Get the URL of the centre (row[10]) *****/
|
|
||||||
Str_Copy (Ctr->WWW,row[10],sizeof (Ctr->WWW) - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -836,7 +829,6 @@ void Ctr_GetShortNameOfCentreByCod (struct Ctr_Centre *Ctr)
|
||||||
{
|
{
|
||||||
/***** Get the short name of this centre *****/
|
/***** Get the short name of this centre *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
Str_Copy (Ctr->ShrtName,row[0],sizeof (Ctr->ShrtName) - 1);
|
Str_Copy (Ctr->ShrtName,row[0],sizeof (Ctr->ShrtName) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1211,8 +1211,7 @@ void CtrCfg_ChangeCtrWWW (void)
|
||||||
{
|
{
|
||||||
/***** Update database changing old WWW by new WWW *****/
|
/***** Update database changing old WWW by new WWW *****/
|
||||||
Ctr_UpdateCtrWWWDB (Gbl.Hierarchy.Ctr.CtrCod,NewWWW);
|
Ctr_UpdateCtrWWWDB (Gbl.Hierarchy.Ctr.CtrCod,NewWWW);
|
||||||
Str_Copy (Gbl.Hierarchy.Ctr.WWW,NewWWW,
|
Str_Copy (Gbl.Hierarchy.Ctr.WWW,NewWWW,sizeof (Gbl.Hierarchy.Ctr.WWW) - 1);
|
||||||
sizeof (Gbl.Hierarchy.Ctr.WWW) - 1);
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
|
||||||
|
|
|
@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.31 (2021-02-15)"
|
#define Log_PLATFORM_VERSION "SWAD 20.32 (2021-02-15)"
|
||||||
#define CSS_FILE "swad20.8.css"
|
#define CSS_FILE "swad20.8.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
|
@ -601,6 +601,8 @@ TODO: DNI de un estudiante sale err
|
||||||
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
|
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
|
||||||
TODO: Salvador Romero Cortés: @acanas opción para editar posts
|
TODO: Salvador Romero Cortés: @acanas opción para editar posts
|
||||||
|
|
||||||
|
Version 20.32: Feb 15, 2021 Fixed bug in copy of strings.
|
||||||
|
Code refactoring in copy. (304755 lines)
|
||||||
Version 20.31: Feb 15, 2021 Code refactoring in copy, concat and sprintf. (304811 lines)
|
Version 20.31: Feb 15, 2021 Code refactoring in copy, concat and sprintf. (304811 lines)
|
||||||
Version 20.30.1: Feb 14, 2021 Code refactoring in timeline related to temporary tables. (305883 lines)
|
Version 20.30.1: Feb 14, 2021 Code refactoring in timeline related to temporary tables. (305883 lines)
|
||||||
Version 20.30: Feb 11, 2021 Code refactoring in hierarchy. (305853 lines)
|
Version 20.30: Feb 11, 2021 Code refactoring in hierarchy. (305853 lines)
|
||||||
|
|
|
@ -532,8 +532,7 @@ void Cty_DrawCountryMapAndNameWithLink (struct Cty_Countr *Cty,Act_Action_t Acti
|
||||||
Cty_DrawCountryMap (Cty,ClassMap);
|
Cty_DrawCountryMap (Cty,ClassMap);
|
||||||
|
|
||||||
/***** Write country name *****/
|
/***** Write country name *****/
|
||||||
Str_Copy (CountryName,Cty->Name[Gbl.Prefs.Language],
|
Str_Copy (CountryName,Cty->Name[Gbl.Prefs.Language],sizeof (CountryName) - 1);
|
||||||
sizeof (CountryName) - 1);
|
|
||||||
HTM_TxtF (" %s ",CountryName);
|
HTM_TxtF (" %s ",CountryName);
|
||||||
HTM_TxtF ("(%s)",Cty->Alpha2);
|
HTM_TxtF ("(%s)",Cty->Alpha2);
|
||||||
|
|
||||||
|
|
|
@ -1802,8 +1802,7 @@ static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row)
|
||||||
Crs->Year = Deg_ConvStrToYear (row[2]);
|
Crs->Year = Deg_ConvStrToYear (row[2]);
|
||||||
|
|
||||||
/***** Get institutional course code (row[3]) *****/
|
/***** Get institutional course code (row[3]) *****/
|
||||||
Str_Copy (Crs->InstitutionalCrsCod,row[3],
|
Str_Copy (Crs->InstitutionalCrsCod,row[3],sizeof (Crs->InstitutionalCrsCod) - 1);
|
||||||
sizeof (Crs->InstitutionalCrsCod) - 1);
|
|
||||||
|
|
||||||
/***** Get course status (row[4]) *****/
|
/***** Get course status (row[4]) *****/
|
||||||
if (sscanf (row[4],"%u",&(Crs->Status)) != 1)
|
if (sscanf (row[4],"%u",&(Crs->Status)) != 1)
|
||||||
|
@ -1812,10 +1811,8 @@ static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row)
|
||||||
/***** Get requester user'code (row[5]) *****/
|
/***** Get requester user'code (row[5]) *****/
|
||||||
Crs->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[5]);
|
Crs->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||||
|
|
||||||
/***** Get the short name of the course (row[6]) *****/
|
/***** Get short name (row[6]) and full name (row[7]) of the course *****/
|
||||||
Str_Copy (Crs->ShrtName,row[6],sizeof (Crs->ShrtName) - 1);
|
Str_Copy (Crs->ShrtName,row[6],sizeof (Crs->ShrtName) - 1);
|
||||||
|
|
||||||
/***** Get the full name of the course (row[7]) *****/
|
|
||||||
Str_Copy (Crs->FullName,row[7],sizeof (Crs->FullName) - 1);
|
Str_Copy (Crs->FullName,row[7],sizeof (Crs->FullName) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1842,9 +1839,8 @@ static void Crs_GetShortNamesByCod (long CrsCod,
|
||||||
" AND courses.DegCod=degrees.DegCod",
|
" AND courses.DegCod=degrees.DegCod",
|
||||||
CrsCod) == 1)
|
CrsCod) == 1)
|
||||||
{
|
{
|
||||||
/***** Get the short name of this course *****/
|
/***** Get the course short name and degree short name *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
Str_Copy (CrsShortName,row[0],Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
Str_Copy (CrsShortName,row[0],Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
||||||
Str_Copy (DegShortName,row[1],Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
Str_Copy (DegShortName,row[1],Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3647,7 +3647,7 @@ mysql> DESCRIBE usr_nicknames;
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_nicknames ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_nicknames ("
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"Nickname CHAR(16) COLLATE latin1_spanish_ci NOT NULL," // Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA
|
"Nickname CHAR(16) COLLATE latin1_spanish_ci NOT NULL," // Nck_MAX_BYTES_NICK_WITHOUT_ARROBA
|
||||||
"CreatTime DATETIME NOT NULL,"
|
"CreatTime DATETIME NOT NULL,"
|
||||||
"UNIQUE INDEX(UsrCod,Nickname),"
|
"UNIQUE INDEX(UsrCod,Nickname),"
|
||||||
"UNIQUE INDEX(Nickname))");
|
"UNIQUE INDEX(Nickname))");
|
||||||
|
|
|
@ -1570,8 +1570,7 @@ void Dat_AssignDate (struct Date *DateDst,struct Date *DateSrc)
|
||||||
DateDst->Month = DateSrc->Month;
|
DateDst->Month = DateSrc->Month;
|
||||||
DateDst->Day = DateSrc->Day;
|
DateDst->Day = DateSrc->Day;
|
||||||
DateDst->Week = DateSrc->Week;
|
DateDst->Week = DateSrc->Week;
|
||||||
Str_Copy (DateDst->YYYYMMDD,DateSrc->YYYYMMDD,
|
Str_Copy (DateDst->YYYYMMDD,DateSrc->YYYYMMDD,sizeof (DateDst->YYYYMMDD) - 1);
|
||||||
sizeof (DateDst->YYYYMMDD) - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -1386,14 +1386,10 @@ static void Deg_GetDataOfDegreeFromRow (struct Deg_Degree *Deg,MYSQL_ROW row)
|
||||||
/* Get requester user's code (row[4]) */
|
/* Get requester user's code (row[4]) */
|
||||||
Deg->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
Deg->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[4]);
|
||||||
|
|
||||||
/***** Get degree short name (row[5]) *****/
|
/***** Get degree short name (row[5]), full name (row[6]) and WWW (row[7]) *****/
|
||||||
Str_Copy (Deg->ShrtName,row[5],sizeof (Deg->ShrtName) - 1);
|
Str_Copy (Deg->ShrtName,row[5],sizeof (Deg->ShrtName) - 1);
|
||||||
|
|
||||||
/***** Get degree full name (row[6]) *****/
|
|
||||||
Str_Copy (Deg->FullName,row[6],sizeof (Deg->FullName) - 1);
|
Str_Copy (Deg->FullName,row[6],sizeof (Deg->FullName) - 1);
|
||||||
|
Str_Copy (Deg->WWW ,row[7],sizeof (Deg->WWW ) - 1);
|
||||||
/***** Get WWW (row[7]) *****/
|
|
||||||
Str_Copy (Deg->WWW,row[7],sizeof (Deg->WWW) - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1415,7 +1411,6 @@ void Deg_GetShortNameOfDegreeByCod (struct Deg_Degree *Deg)
|
||||||
{
|
{
|
||||||
/***** Get the short name of this degree *****/
|
/***** Get the short name of this degree *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
Str_Copy (Deg->ShrtName,row[0],sizeof (Deg->ShrtName) - 1);
|
Str_Copy (Deg->ShrtName,row[0],sizeof (Deg->ShrtName) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -440,8 +440,7 @@ void DegCfg_ChangeDegWWW (void)
|
||||||
{
|
{
|
||||||
/***** Update the table changing old WWW by new WWW *****/
|
/***** Update the table changing old WWW by new WWW *****/
|
||||||
Deg_UpdateDegWWWDB (Gbl.Hierarchy.Deg.DegCod,NewWWW);
|
Deg_UpdateDegWWWDB (Gbl.Hierarchy.Deg.DegCod,NewWWW);
|
||||||
Str_Copy (Gbl.Hierarchy.Deg.WWW,NewWWW,
|
Str_Copy (Gbl.Hierarchy.Deg.WWW,NewWWW,sizeof (Gbl.Hierarchy.Deg.WWW) - 1);
|
||||||
sizeof (Gbl.Hierarchy.Deg.WWW) - 1);
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
|
||||||
|
|
|
@ -394,14 +394,11 @@ static void Dpt_GetListDepartments (struct Dpt_Departments *Departments,long Ins
|
||||||
if ((Dpt->InsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((Dpt->InsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of institution.");
|
Lay_ShowErrorAndExit ("Wrong code of institution.");
|
||||||
|
|
||||||
/* Get the short name of the department (row[2]) */
|
/* Get short name (row[2]), full name (row[3])
|
||||||
|
and URL (row[4]) of the department */
|
||||||
Str_Copy (Dpt->ShrtName,row[2],sizeof (Dpt->ShrtName) - 1);
|
Str_Copy (Dpt->ShrtName,row[2],sizeof (Dpt->ShrtName) - 1);
|
||||||
|
|
||||||
/* Get the full name of the department (row[3]) */
|
|
||||||
Str_Copy (Dpt->FullName,row[3],sizeof (Dpt->FullName) - 1);
|
Str_Copy (Dpt->FullName,row[3],sizeof (Dpt->FullName) - 1);
|
||||||
|
Str_Copy (Dpt->WWW ,row[4],sizeof (Dpt->WWW ) - 1);
|
||||||
/* Get the URL of the department (row[4]) */
|
|
||||||
Str_Copy (Dpt->WWW,row[4],sizeof (Dpt->WWW) - 1);
|
|
||||||
|
|
||||||
/* Get number of non-editing teachers and teachers in this department (row[5]) */
|
/* Get number of non-editing teachers and teachers in this department (row[5]) */
|
||||||
if (sscanf (row[5],"%u",&Dpt->NumTchs) != 1)
|
if (sscanf (row[5],"%u",&Dpt->NumTchs) != 1)
|
||||||
|
@ -464,14 +461,11 @@ void Dpt_GetDataOfDepartmentByCod (struct Dpt_Department *Dpt)
|
||||||
/* Get the code of the institution (row[0]) */
|
/* Get the code of the institution (row[0]) */
|
||||||
Dpt->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
Dpt->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
/* Get the short name of the department (row[1]) */
|
/* Get short name (row[1]), full name (row[2])
|
||||||
|
and URL (row[3]) of the department */
|
||||||
Str_Copy (Dpt->ShrtName,row[1],sizeof (Dpt->ShrtName) - 1);
|
Str_Copy (Dpt->ShrtName,row[1],sizeof (Dpt->ShrtName) - 1);
|
||||||
|
|
||||||
/* Get the full name of the department (row[2]) */
|
|
||||||
Str_Copy (Dpt->FullName,row[2],sizeof (Dpt->FullName) - 1);
|
Str_Copy (Dpt->FullName,row[2],sizeof (Dpt->FullName) - 1);
|
||||||
|
Str_Copy (Dpt->WWW ,row[3],sizeof (Dpt->WWW ) - 1);
|
||||||
/* Get the URL of the department (row[3]) */
|
|
||||||
Str_Copy (Dpt->WWW,row[3],sizeof (Dpt->WWW) - 1);
|
|
||||||
|
|
||||||
/* Get number of teachers in this department (row[4]) */
|
/* Get number of teachers in this department (row[4]) */
|
||||||
if (sscanf (row[4],"%u",&Dpt->NumTchs) != 1)
|
if (sscanf (row[4],"%u",&Dpt->NumTchs) != 1)
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
||||||
ListUsrCods.Lst = NULL;
|
ListUsrCods.Lst = NULL;
|
||||||
|
|
||||||
/* Check if string is a user's ID, user's nickname or user's email address */
|
/* Check if string is a user's ID, user's nickname or user's email address */
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrDat.UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (UsrDat.UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.UsrIDNickOrEmail)) > 0)
|
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.UsrIDNickOrEmail)) > 0)
|
||||||
{
|
{
|
||||||
|
@ -1346,7 +1346,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
|
||||||
ListUsrCods.Lst = NULL;
|
ListUsrCods.Lst = NULL;
|
||||||
|
|
||||||
/* Check if the string is a user's ID, a user's nickname or a user's email address */
|
/* Check if the string is a user's ID, a user's nickname or a user's email address */
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrDat.UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (UsrDat.UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.UsrIDNickOrEmail)) > 0)
|
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrDat.UsrIDNickOrEmail)) > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1020,36 +1020,22 @@ static void ExaAnn_GetDataExamAnnFromDB (struct ExaAnn_ExamAnnouncements *ExamAn
|
||||||
ExamAnns->ExamAnn.ExamDate.Day);
|
ExamAnns->ExamAnn.ExamDate.Day);
|
||||||
|
|
||||||
/* Approximate duration (row[7]) */
|
/* Approximate duration (row[7]) */
|
||||||
if (sscanf (row[7],"%02u:%02u:%02u",&ExamAnns->ExamAnn.Duration.Hour,&ExamAnns->ExamAnn.Duration.Minute,&Second) != 3)
|
if (sscanf (row[7],"%02u:%02u:%02u",
|
||||||
|
&ExamAnns->ExamAnn.Duration.Hour,
|
||||||
|
&ExamAnns->ExamAnn.Duration.Minute,
|
||||||
|
&Second) != 3)
|
||||||
Lay_ShowErrorAndExit ("Wrong duration of exam.");
|
Lay_ShowErrorAndExit ("Wrong duration of exam.");
|
||||||
|
|
||||||
/* Place (row[8]) */
|
/* Place (row[8]), exam mode (row[9]), structure (row[10]),
|
||||||
Str_Copy (ExamAnns->ExamAnn.Place,row[8],
|
documentation required (row[11]), material required (row[12]),
|
||||||
sizeof (ExamAnns->ExamAnn.Place) - 1);
|
material allowed (row[13]) and other information for students (row[14]) */
|
||||||
|
Str_Copy (ExamAnns->ExamAnn.Place ,row[ 8],Cns_MAX_BYTES_TEXT);
|
||||||
/* Exam mode (row[9]) */
|
Str_Copy (ExamAnns->ExamAnn.Mode ,row[ 9],Cns_MAX_BYTES_TEXT);
|
||||||
Str_Copy (ExamAnns->ExamAnn.Mode,row[9],
|
Str_Copy (ExamAnns->ExamAnn.Structure ,row[10],Cns_MAX_BYTES_TEXT);
|
||||||
sizeof (ExamAnns->ExamAnn.Mode) - 1);
|
Str_Copy (ExamAnns->ExamAnn.DocRequired,row[11],Cns_MAX_BYTES_TEXT);
|
||||||
|
Str_Copy (ExamAnns->ExamAnn.MatRequired,row[12],Cns_MAX_BYTES_TEXT);
|
||||||
/* Structure (row[10]) */
|
Str_Copy (ExamAnns->ExamAnn.MatAllowed ,row[13],Cns_MAX_BYTES_TEXT);
|
||||||
Str_Copy (ExamAnns->ExamAnn.Structure,row[10],
|
Str_Copy (ExamAnns->ExamAnn.OtherInfo ,row[14],Cns_MAX_BYTES_TEXT);
|
||||||
sizeof (ExamAnns->ExamAnn.Structure) - 1);
|
|
||||||
|
|
||||||
/* Documentation required (row[11]) */
|
|
||||||
Str_Copy (ExamAnns->ExamAnn.DocRequired,row[11],
|
|
||||||
sizeof (ExamAnns->ExamAnn.DocRequired) - 1);
|
|
||||||
|
|
||||||
/* Material required (row[12]) */
|
|
||||||
Str_Copy (ExamAnns->ExamAnn.MatRequired,row[12],
|
|
||||||
sizeof (ExamAnns->ExamAnn.MatRequired) - 1);
|
|
||||||
|
|
||||||
/* Material allowed (row[13]) */
|
|
||||||
Str_Copy (ExamAnns->ExamAnn.MatAllowed,row[13],
|
|
||||||
sizeof (ExamAnns->ExamAnn.MatAllowed) - 1);
|
|
||||||
|
|
||||||
/* Other information for students (row[14]) */
|
|
||||||
Str_Copy (ExamAnns->ExamAnn.OtherInfo,row[14],
|
|
||||||
sizeof (ExamAnns->ExamAnn.OtherInfo) - 1);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
|
@ -646,11 +646,11 @@ void ExaPrn_GetPrintQuestionsFromDB (struct ExaPrn_Print *Print)
|
||||||
|
|
||||||
/* Get indexes for this question (row[3]) */
|
/* Get indexes for this question (row[3]) */
|
||||||
Str_Copy (Print->PrintedQuestions[NumQst].StrIndexes,row[3],
|
Str_Copy (Print->PrintedQuestions[NumQst].StrIndexes,row[3],
|
||||||
strlen (Print->PrintedQuestions[NumQst].StrIndexes) - 1);
|
sizeof (Print->PrintedQuestions[NumQst].StrIndexes) - 1);
|
||||||
|
|
||||||
/* Get answers selected by user for this question (row[4]) */
|
/* Get answers selected by user for this question (row[4]) */
|
||||||
Str_Copy (Print->PrintedQuestions[NumQst].StrAnswers,row[4],
|
Str_Copy (Print->PrintedQuestions[NumQst].StrAnswers,row[4],
|
||||||
strlen (Print->PrintedQuestions[NumQst].StrAnswers) - 1);
|
sizeof (Print->PrintedQuestions[NumQst].StrAnswers) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -1414,7 +1414,7 @@ static void ExaPrn_GetCorrectTxtAnswerFromDB (struct Tst_Question *Question)
|
||||||
|
|
||||||
/***** Copy answer text (row[0]) ******/
|
/***** Copy answer text (row[0]) ******/
|
||||||
Str_Copy (Question->Answer.Options[NumOpt].Text,row[0],
|
Str_Copy (Question->Answer.Options[NumOpt].Text,row[0],
|
||||||
strlen (Question->Answer.Options[NumOpt].Text) - 1);
|
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Change format of answers text *****/
|
/***** Change format of answers text *****/
|
||||||
|
|
|
@ -1425,13 +1425,13 @@ void ExaSet_GetQstDataFromDB (struct Tst_Question *Question)
|
||||||
Question->Stem[0] = '\0';
|
Question->Stem[0] = '\0';
|
||||||
if (row[3])
|
if (row[3])
|
||||||
if (row[3][0])
|
if (row[3][0])
|
||||||
Str_Copy (Question->Stem,row[3],sizeof (Question->Stem) - 1);
|
Str_Copy (Question->Stem ,row[3],Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get the feedback (row[4]) */
|
/* Get the feedback (row[4]) */
|
||||||
Question->Feedback[0] = '\0';
|
Question->Feedback[0] = '\0';
|
||||||
if (row[4])
|
if (row[4])
|
||||||
if (row[4][0])
|
if (row[4][0])
|
||||||
Str_Copy (Question->Feedback,row[4],sizeof (Question->Feedback) - 1);
|
Str_Copy (Question->Feedback,row[4],Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get media (row[5]) */
|
/* Get media (row[5]) */
|
||||||
Question->Media.MedCod = Str_ConvertStrCodToLongCod (row[5]);
|
Question->Media.MedCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||||
|
@ -1486,15 +1486,15 @@ void ExaSet_GetQstDataFromDB (struct Tst_Question *Question)
|
||||||
Question->Answer.Options[NumOpt].Text[0] = '\0';
|
Question->Answer.Options[NumOpt].Text[0] = '\0';
|
||||||
if (row[1])
|
if (row[1])
|
||||||
if (row[1][0])
|
if (row[1][0])
|
||||||
Str_Copy (Question->Answer.Options[NumOpt].Text,row[1],
|
Str_Copy (Question->Answer.Options[NumOpt].Text ,row[1],
|
||||||
sizeof (Question->Answer.Options[NumOpt].Text) - 1);
|
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||||
|
|
||||||
/* Get feedback (row[2]) */
|
/* Get feedback (row[2]) */
|
||||||
Question->Answer.Options[NumOpt].Feedback[0] = '\0';
|
Question->Answer.Options[NumOpt].Feedback[0] = '\0';
|
||||||
if (row[2])
|
if (row[2])
|
||||||
if (row[2][0])
|
if (row[2][0])
|
||||||
Str_Copy (Question->Answer.Options[NumOpt].Feedback,row[2],
|
Str_Copy (Question->Answer.Options[NumOpt].Feedback,row[2],
|
||||||
sizeof (Question->Answer.Options[NumOpt].Feedback) - 1);
|
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||||
|
|
||||||
/* Get media (row[3]) */
|
/* Get media (row[3]) */
|
||||||
Question->Answer.Options[NumOpt].Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);
|
Question->Answer.Options[NumOpt].Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||||
|
|
10
swad_forum.c
10
swad_forum.c
|
@ -337,7 +337,7 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
|
bool LastPst,char LastSubject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||||
bool NewPst,bool ICanModerateForum);
|
bool NewPst,bool ICanModerateForum);
|
||||||
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||||
char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||||
struct Med_Media *Media);
|
struct Med_Media *Media);
|
||||||
static void For_WriteNumberOfPosts (const struct For_Forums *Forums,long UsrCod);
|
static void For_WriteNumberOfPosts (const struct For_Forums *Forums,long UsrCod);
|
||||||
|
@ -1340,7 +1340,7 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
char Subject[Cns_MAX_BYTES_SUBJECT + 1],
|
||||||
char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||||
struct Med_Media *Media)
|
struct Med_Media *Media)
|
||||||
{
|
{
|
||||||
|
@ -1371,10 +1371,8 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||||
/***** Get creation time (row[1]) *****/
|
/***** Get creation time (row[1]) *****/
|
||||||
*CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
|
*CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
|
||||||
|
|
||||||
/***** Get subject (row[2]) *****/
|
/***** Get subject (row[2]) and location (row[3]) *****/
|
||||||
Str_Copy (Subject,row[2],Cns_MAX_BYTES_SUBJECT);
|
Str_Copy (Subject,row[2],Cns_MAX_BYTES_SUBJECT );
|
||||||
|
|
||||||
/***** Get location (row[3]) *****/
|
|
||||||
Str_Copy (Content,row[3],Cns_MAX_BYTES_LONG_TEXT);
|
Str_Copy (Content,row[3],Cns_MAX_BYTES_LONG_TEXT);
|
||||||
|
|
||||||
/***** Get media (row[4]) *****/
|
/***** Get media (row[4]) *****/
|
||||||
|
|
|
@ -1638,7 +1638,7 @@ static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD)
|
||||||
|
|
||||||
void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
char InfoTxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1],
|
char InfoTxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||||
char InfoTxtMD[Cns_MAX_BYTES_LONG_TEXT + 1])
|
char InfoTxtMD [Cns_MAX_BYTES_LONG_TEXT + 1])
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -1663,14 +1663,14 @@ void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
|
|
||||||
/* Get text in Markdown format */
|
/* Get text in Markdown format */
|
||||||
if (InfoTxtMD)
|
if (InfoTxtMD)
|
||||||
Str_Copy (InfoTxtMD,row[1],Cns_MAX_BYTES_LONG_TEXT);
|
Str_Copy (InfoTxtMD ,row[1],Cns_MAX_BYTES_LONG_TEXT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (InfoTxtHTML)
|
if (InfoTxtHTML)
|
||||||
InfoTxtHTML[0] = '\0';
|
InfoTxtHTML[0] = '\0';
|
||||||
if (InfoTxtMD)
|
if (InfoTxtMD)
|
||||||
InfoTxtMD[0] = '\0';
|
InfoTxtMD [0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
|
|
@ -104,7 +104,7 @@ Inf_InfoSrc_t Inf_ConvertFromStrDBToInfoSrc (const char *StrInfoSrcDB);
|
||||||
|
|
||||||
void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
void Inf_GetInfoTxtFromDB (long CrsCod,Inf_InfoType_t InfoType,
|
||||||
char InfoTxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1],
|
char InfoTxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||||
char InfoTxtMD[Cns_MAX_BYTES_LONG_TEXT + 1]);
|
char InfoTxtMD [Cns_MAX_BYTES_LONG_TEXT + 1]);
|
||||||
|
|
||||||
void Inf_EditPlainTxtInfo (void);
|
void Inf_EditPlainTxtInfo (void);
|
||||||
void Inf_EditRichTxtInfo (void);
|
void Inf_EditRichTxtInfo (void);
|
||||||
|
|
|
@ -848,13 +848,10 @@ static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
||||||
/***** Get requester user's code (row[3]) *****/
|
/***** Get requester user's code (row[3]) *****/
|
||||||
Ins->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
Ins->RequesterUsrCod = Str_ConvertStrCodToLongCod (row[3]);
|
||||||
|
|
||||||
/***** Get the short name of the institution (row[4]) *****/
|
/***** Get short name (row[4]), full name (row[5])
|
||||||
|
and URL (row[6]) of the institution *****/
|
||||||
Str_Copy (Ins->ShrtName,row[4],sizeof (Ins->ShrtName) - 1);
|
Str_Copy (Ins->ShrtName,row[4],sizeof (Ins->ShrtName) - 1);
|
||||||
|
|
||||||
/***** Get the full name of the institution (row[5]) *****/
|
|
||||||
Str_Copy (Ins->FullName,row[5],sizeof (Ins->FullName) - 1);
|
Str_Copy (Ins->FullName,row[5],sizeof (Ins->FullName) - 1);
|
||||||
|
|
||||||
/***** Get the URL of the institution (row[6]) *****/
|
|
||||||
Str_Copy (Ins->WWW ,row[6],sizeof (Ins->WWW ) - 1);
|
Str_Copy (Ins->WWW ,row[6],sizeof (Ins->WWW ) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,18 +960,16 @@ static void Ins_GetShrtNameAndCtyOfInstitution (struct Ins_Instit *Ins,
|
||||||
/* Get row */
|
/* Get row */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/* Get the short name of this institution (row[0]) */
|
/* Get short name (row[0]) and country name (row[1]) of this institution */
|
||||||
Str_Copy (Gbl.Cache.InstitutionShrtNameAndCty.ShrtName,row[0],
|
Str_Copy (Gbl.Cache.InstitutionShrtNameAndCty.ShrtName,row[0],
|
||||||
sizeof (Gbl.Cache.InstitutionShrtNameAndCty.ShrtName) - 1);
|
sizeof (Gbl.Cache.InstitutionShrtNameAndCty.ShrtName) - 1);
|
||||||
|
Str_Copy (Gbl.Cache.InstitutionShrtNameAndCty.CtyName ,row[1],
|
||||||
/* Get the name of the country (row[1]) */
|
sizeof (Gbl.Cache.InstitutionShrtNameAndCty.CtyName ) - 1);
|
||||||
Str_Copy (Gbl.Cache.InstitutionShrtNameAndCty.CtyName,row[1],
|
|
||||||
sizeof (Gbl.Cache.InstitutionShrtNameAndCty.CtyName) - 1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Gbl.Cache.InstitutionShrtNameAndCty.ShrtName[0] = '\0';
|
Gbl.Cache.InstitutionShrtNameAndCty.ShrtName[0] = '\0';
|
||||||
Gbl.Cache.InstitutionShrtNameAndCty.CtyName[0] = '\0';
|
Gbl.Cache.InstitutionShrtNameAndCty.CtyName [0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free structure that stores the query result */
|
/* Free structure that stores the query result */
|
||||||
|
@ -982,7 +977,7 @@ static void Ins_GetShrtNameAndCtyOfInstitution (struct Ins_Instit *Ins,
|
||||||
|
|
||||||
Str_Copy (Ins->ShrtName,Gbl.Cache.InstitutionShrtNameAndCty.ShrtName,
|
Str_Copy (Ins->ShrtName,Gbl.Cache.InstitutionShrtNameAndCty.ShrtName,
|
||||||
sizeof (Ins->ShrtName) - 1);
|
sizeof (Ins->ShrtName) - 1);
|
||||||
Str_Copy (CtyName,Gbl.Cache.InstitutionShrtNameAndCty.CtyName,
|
Str_Copy (CtyName ,Gbl.Cache.InstitutionShrtNameAndCty.CtyName ,
|
||||||
Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
|
Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,8 @@ static void Mai_GetParamMaiOrder (void);
|
||||||
static void Mai_PutIconToEditMailDomains (__attribute__((unused)) void *Args);
|
static void Mai_PutIconToEditMailDomains (__attribute__((unused)) void *Args);
|
||||||
static void Mai_EditMailDomainsInternal (void);
|
static void Mai_EditMailDomainsInternal (void);
|
||||||
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
static void Mai_GetListMailDomainsAllowedForNotif (void);
|
||||||
static void Mai_GetMailDomain (const char *Email,char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 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 bool Mai_CheckIfMailDomainIsAllowedForNotif (const char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
||||||
|
|
||||||
static void Mai_ListMailDomainsForEdition (void);
|
static void Mai_ListMailDomainsForEdition (void);
|
||||||
|
@ -359,7 +360,8 @@ 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_ADDRESS + 1])
|
static void Mai_GetMailDomain (const char *Email,
|
||||||
|
char MailDomain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
|
||||||
extern const char *Txt_Other_recipients;
|
extern const char *Txt_Other_recipients;
|
||||||
extern const char *Txt_Recipients;
|
extern const char *Txt_Recipients;
|
||||||
extern const char *Txt_nicks_emails_or_IDs_separated_by_commas;
|
extern const char *Txt_nicks_emails_or_IDs_separated_by_commas;
|
||||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
char Nickname[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||||
unsigned ColSpan;
|
unsigned ColSpan;
|
||||||
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == Hie_Lvl_CRS && // Course selected
|
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == Hie_Lvl_CRS && // Course selected
|
||||||
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
|
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
|
||||||
|
@ -707,10 +707,10 @@ static void Msg_WriteFormSubjectAndContentMsgToUsrs (struct Msg_Messages *Messag
|
||||||
|
|
||||||
static void Msg_PutHiddenParamAnotherRecipient (const struct UsrData *UsrDat)
|
static void Msg_PutHiddenParamAnotherRecipient (const struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
char NickWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NickWithArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
|
|
||||||
snprintf (NickWithArroba,sizeof (NickWithArroba),"@%s",UsrDat->Nickname);
|
snprintf (NickWithArr,sizeof (NickWithArr),"@%s",UsrDat->Nickname);
|
||||||
Par_PutHiddenParamString (NULL,"OtherRecipients",NickWithArroba);
|
Par_PutHiddenParamString (NULL,"OtherRecipients",NickWithArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
104
swad_nickname.c
104
swad_nickname.c
|
@ -74,29 +74,29 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat);
|
||||||
/********* Check whether a nickname (with initial arroba) if valid ***********/
|
/********* Check whether a nickname (with initial arroba) if valid ***********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
bool Nck_CheckIfNickWithArrobaIsValid (const char *NickWithArroba)
|
bool Nck_CheckIfNickWithArrIsValid (const char *NickWithArr)
|
||||||
{
|
{
|
||||||
char NickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
unsigned Length;
|
unsigned Length;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
|
||||||
/***** A nickname must start by '@' *****/
|
/***** A nickname must start by '@' *****/
|
||||||
if (NickWithArroba[0] != '@') // It's not a nickname
|
if (NickWithArr[0] != '@') // It's not a nickname
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** Make a copy of nickname *****/
|
/***** Make a copy of nickname *****/
|
||||||
Str_Copy (NickWithoutArroba,NickWithArroba,sizeof (NickWithoutArroba) - 1);
|
Str_Copy (NickWithoutArr,NickWithArr,sizeof (NickWithoutArr) - 1);
|
||||||
Str_RemoveLeadingArrobas (NickWithoutArroba);
|
Str_RemoveLeadingArrobas (NickWithoutArr);
|
||||||
Length = strlen (NickWithoutArroba);
|
Length = strlen (NickWithoutArr);
|
||||||
|
|
||||||
/***** A nick (without arroba) must have a number of characters
|
/***** A nick (without arroba) must have a number of characters
|
||||||
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA *****/
|
Nck_MIN_BYTES_NICK_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICK_WITHOUT_ARROBA *****/
|
||||||
if (Length < Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA ||
|
if (Length < Nck_MIN_BYTES_NICK_WITHOUT_ARROBA ||
|
||||||
Length > Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA)
|
Length > Nck_MAX_BYTES_NICK_WITHOUT_ARROBA)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/***** A nick can have digits, letters and '_' *****/
|
/***** A nick can have digits, letters and '_' *****/
|
||||||
for (Ptr = NickWithoutArroba;
|
for (Ptr = NickWithoutArr;
|
||||||
*Ptr;
|
*Ptr;
|
||||||
Ptr++)
|
Ptr++)
|
||||||
if (!((*Ptr >= 'a' && *Ptr <= 'z') ||
|
if (!((*Ptr >= 'a' && *Ptr <= 'z') ||
|
||||||
|
@ -113,7 +113,7 @@ bool Nck_CheckIfNickWithArrobaIsValid (const char *NickWithArroba)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1])
|
char Nickname[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1])
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -127,7 +127,7 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||||
{
|
{
|
||||||
/* Get nickname */
|
/* Get nickname */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
Str_Copy (Nickname,row[0],Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Str_Copy (Nickname,row[0],Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
Found = true;
|
Found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -150,7 +150,7 @@ bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||||
|
|
||||||
long Nck_GetUsrCodFromNickname (const char *Nickname)
|
long Nck_GetUsrCodFromNickname (const char *Nickname)
|
||||||
{
|
{
|
||||||
char NickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
long UsrCod = -1L;
|
long UsrCod = -1L;
|
||||||
|
@ -159,8 +159,8 @@ long Nck_GetUsrCodFromNickname (const char *Nickname)
|
||||||
if (Nickname[0])
|
if (Nickname[0])
|
||||||
{
|
{
|
||||||
/***** Make a copy without possible starting arrobas *****/
|
/***** Make a copy without possible starting arrobas *****/
|
||||||
Str_Copy (NickWithoutArroba,Nickname,sizeof (NickWithoutArroba) - 1);
|
Str_Copy (NickWithoutArr,Nickname,sizeof (NickWithoutArr) - 1);
|
||||||
Str_RemoveLeadingArrobas (NickWithoutArroba);
|
Str_RemoveLeadingArrobas (NickWithoutArr);
|
||||||
|
|
||||||
/***** Get user's code from database *****/
|
/***** Get user's code from database *****/
|
||||||
/* Check if user code from table usr_nicknames is also in table usr_data */
|
/* Check if user code from table usr_nicknames is also in table usr_data */
|
||||||
|
@ -169,7 +169,7 @@ long Nck_GetUsrCodFromNickname (const char *Nickname)
|
||||||
" FROM usr_nicknames,usr_data"
|
" FROM usr_nicknames,usr_data"
|
||||||
" WHERE usr_nicknames.Nickname='%s'"
|
" WHERE usr_nicknames.Nickname='%s'"
|
||||||
" AND usr_nicknames.UsrCod=usr_data.UsrCod",
|
" AND usr_nicknames.UsrCod=usr_data.UsrCod",
|
||||||
NickWithoutArroba))
|
NickWithoutArr))
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -227,7 +227,7 @@ static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
|
||||||
unsigned NumNicks;
|
unsigned NumNicks;
|
||||||
unsigned NumNick;
|
unsigned NumNick;
|
||||||
Act_Action_t NextAction;
|
Act_Action_t NextAction;
|
||||||
char NickWithArroba[1 + Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
char NickWithArr[1 + Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||||
const struct UsrData *UsrDat = (ItsMe ? &Gbl.Usrs.Me.UsrDat :
|
const struct UsrData *UsrDat = (ItsMe ? &Gbl.Usrs.Me.UsrDat :
|
||||||
&Gbl.Usrs.Other.UsrDat);
|
&Gbl.Usrs.Other.UsrDat);
|
||||||
|
|
||||||
|
@ -347,8 +347,8 @@ static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf (NickWithArroba,sizeof (NickWithArroba),"@%s",row[0]);
|
snprintf (NickWithArr,sizeof (NickWithArr),"@%s",row[0]);
|
||||||
Par_PutHiddenParamString (NULL,"NewNick",NickWithArroba); // Nickname
|
Par_PutHiddenParamString (NULL,"NewNick",NickWithArr); // Nickname
|
||||||
Btn_PutConfirmButtonInline (Txt_Use_this_nickname);
|
Btn_PutConfirmButtonInline (Txt_Use_this_nickname);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
@ -393,10 +393,10 @@ static void Nck_ShowFormChangeUsrNickname (bool ItsMe,
|
||||||
Frm_StartFormAnchor (NextAction,Nck_NICKNAME_SECTION_ID);
|
Frm_StartFormAnchor (NextAction,Nck_NICKNAME_SECTION_ID);
|
||||||
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
||||||
}
|
}
|
||||||
snprintf (NickWithArroba,sizeof (NickWithArroba),"@%s",
|
snprintf (NickWithArr,sizeof (NickWithArr),"@%s",
|
||||||
Gbl.Usrs.Me.UsrDat.Nickname);
|
Gbl.Usrs.Me.UsrDat.Nickname);
|
||||||
HTM_INPUT_TEXT ("NewNick",1 + Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA,
|
HTM_INPUT_TEXT ("NewNick",1 + Nck_MAX_CHARS_NICK_WITHOUT_ARROBA,
|
||||||
NickWithArroba,HTM_DONT_SUBMIT_ON_CHANGE,
|
NickWithArr,HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"NewNick\" size=\"18\"");
|
"id=\"NewNick\" size=\"18\"");
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
Btn_PutCreateButtonInline (NumNicks ? Txt_Change_nickname : // I already have a nickname
|
Btn_PutCreateButtonInline (NumNicks ? Txt_Change_nickname : // I already have a nickname
|
||||||
|
@ -436,21 +436,21 @@ void Nck_RemoveMyNick (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Nickname_X_removed;
|
extern const char *Txt_Nickname_X_removed;
|
||||||
extern const char *Txt_You_can_not_delete_your_current_nickname;
|
extern const char *Txt_You_can_not_delete_your_current_nickname;
|
||||||
char NickWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
char NickWithoutArr[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||||
|
|
||||||
/***** Get nickname from form *****/
|
/***** Get nickname from form *****/
|
||||||
Par_GetParToText ("Nick",NickWithoutArroba,
|
Par_GetParToText ("Nick",NickWithoutArr,
|
||||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
|
|
||||||
if (strcasecmp (NickWithoutArroba,Gbl.Usrs.Me.UsrDat.Nickname)) // Only if not my current nickname
|
if (strcasecmp (NickWithoutArr,Gbl.Usrs.Me.UsrDat.Nickname)) // Only if not my current nickname
|
||||||
{
|
{
|
||||||
/***** Remove one of my old nicknames *****/
|
/***** Remove one of my old nicknames *****/
|
||||||
Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NickWithoutArroba);
|
Nck_RemoveNicknameFromDB (Gbl.Usrs.Me.UsrDat.UsrCod,NickWithoutArr);
|
||||||
|
|
||||||
/***** Show message *****/
|
/***** Show message *****/
|
||||||
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
||||||
Txt_Nickname_X_removed,
|
Txt_Nickname_X_removed,
|
||||||
NickWithoutArroba);
|
NickWithoutArr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||||
|
@ -467,7 +467,7 @@ void Nck_RemoveMyNick (void)
|
||||||
void Nck_RemoveOtherUsrNick (void)
|
void Nck_RemoveOtherUsrNick (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Nickname_X_removed;
|
extern const char *Txt_Nickname_X_removed;
|
||||||
char NickWithoutArroba[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
char NickWithoutArr[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||||
|
|
||||||
/***** Get user whose nick must be removed *****/
|
/***** Get user whose nick must be removed *****/
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
|
@ -475,16 +475,16 @@ void Nck_RemoveOtherUsrNick (void)
|
||||||
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
if (Usr_ICanEditOtherUsr (&Gbl.Usrs.Other.UsrDat))
|
||||||
{
|
{
|
||||||
/***** Get nickname from form *****/
|
/***** Get nickname from form *****/
|
||||||
Par_GetParToText ("Nick",NickWithoutArroba,
|
Par_GetParToText ("Nick",NickWithoutArr,
|
||||||
Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
|
|
||||||
/***** Remove one of the old nicknames *****/
|
/***** Remove one of the old nicknames *****/
|
||||||
Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NickWithoutArroba);
|
Nck_RemoveNicknameFromDB (Gbl.Usrs.Other.UsrDat.UsrCod,NickWithoutArr);
|
||||||
|
|
||||||
/***** Show message *****/
|
/***** Show message *****/
|
||||||
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
||||||
Txt_Nickname_X_removed,
|
Txt_Nickname_X_removed,
|
||||||
NickWithoutArroba);
|
NickWithoutArr);
|
||||||
|
|
||||||
/***** Show user's account again *****/
|
/***** Show user's account again *****/
|
||||||
Acc_ShowFormChgOtherUsrAccount ();
|
Acc_ShowFormChgOtherUsrAccount ();
|
||||||
|
@ -556,57 +556,57 @@ static void Nck_UpdateUsrNick (struct UsrData *UsrDat)
|
||||||
extern const char *Txt_The_nickname_X_had_been_registered_by_another_user;
|
extern const char *Txt_The_nickname_X_had_been_registered_by_another_user;
|
||||||
extern const char *Txt_The_nickname_X_has_been_registered_successfully;
|
extern const char *Txt_The_nickname_X_has_been_registered_successfully;
|
||||||
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
|
extern const char *Txt_The_nickname_entered_X_is_not_valid_;
|
||||||
char NewNickWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
char NewNickWithoutArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithoutArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
|
|
||||||
/***** Get new nickname from form *****/
|
/***** Get new nickname from form *****/
|
||||||
Par_GetParToText ("NewNick",NewNickWithArroba,
|
Par_GetParToText ("NewNick",NewNickWithArr,
|
||||||
Nck_MAX_BYTES_NICKNAME_FROM_FORM);
|
Nck_MAX_BYTES_NICK_FROM_FORM);
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (NewNickWithArroba)) // If new nickname is valid
|
if (Nck_CheckIfNickWithArrIsValid (NewNickWithArr)) // If new nickname is valid
|
||||||
{
|
{
|
||||||
/***** Remove arrobas at the beginning *****/
|
/***** Remove arrobas at the beginning *****/
|
||||||
Str_Copy (NewNickWithoutArroba,NewNickWithArroba,sizeof (NewNickWithoutArroba) - 1);
|
Str_Copy (NewNickWithoutArr,NewNickWithArr,sizeof (NewNickWithoutArr) - 1);
|
||||||
Str_RemoveLeadingArrobas (NewNickWithoutArroba);
|
Str_RemoveLeadingArrobas (NewNickWithoutArr);
|
||||||
|
|
||||||
/***** Check if new nickname exists in database *****/
|
/***** Check if new nickname exists in database *****/
|
||||||
if (!strcmp (UsrDat->Nickname,NewNickWithoutArroba)) // User's nickname match exactly the new nickname
|
if (!strcmp (UsrDat->Nickname,NewNickWithoutArr)) // User's nickname match exactly the new nickname
|
||||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||||
Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
|
Txt_The_nickname_X_matches_the_one_you_had_previously_registered,
|
||||||
NewNickWithoutArroba);
|
NewNickWithoutArr);
|
||||||
else if (strcasecmp (UsrDat->Nickname,NewNickWithoutArroba)) // User's nickname does not match, not even case insensitive, the new nickname
|
else if (strcasecmp (UsrDat->Nickname,NewNickWithoutArr)) // User's nickname does not match, not even case insensitive, the new nickname
|
||||||
{
|
{
|
||||||
/***** Check if the new nickname matches any of my old nicknames *****/
|
/***** Check if the new nickname matches any of my old nicknames *****/
|
||||||
if (!DB_QueryCOUNT ("can not check if nickname already existed",
|
if (!DB_QueryCOUNT ("can not check if nickname already existed",
|
||||||
"SELECT COUNT(*) FROM usr_nicknames"
|
"SELECT COUNT(*) FROM usr_nicknames"
|
||||||
" WHERE UsrCod=%ld AND Nickname='%s'",
|
" WHERE UsrCod=%ld AND Nickname='%s'",
|
||||||
UsrDat->UsrCod,NewNickWithoutArroba)) // No matches
|
UsrDat->UsrCod,NewNickWithoutArr)) // No matches
|
||||||
/***** Check if the new nickname matches any of the nicknames of other users *****/
|
/***** Check if the new nickname matches any of the nicknames of other users *****/
|
||||||
if (DB_QueryCOUNT ("can not check if nickname already existed",
|
if (DB_QueryCOUNT ("can not check if nickname already existed",
|
||||||
"SELECT COUNT(*) FROM usr_nicknames"
|
"SELECT COUNT(*) FROM usr_nicknames"
|
||||||
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
" WHERE Nickname='%s' AND UsrCod<>%ld",
|
||||||
NewNickWithoutArroba,UsrDat->UsrCod)) // A nickname of another user is the same that user's nickname
|
NewNickWithoutArr,UsrDat->UsrCod)) // A nickname of another user is the same that user's nickname
|
||||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||||
Txt_The_nickname_X_had_been_registered_by_another_user,
|
Txt_The_nickname_X_had_been_registered_by_another_user,
|
||||||
NewNickWithoutArroba);
|
NewNickWithoutArr);
|
||||||
}
|
}
|
||||||
if (Ale_GetNumAlerts () == 0) // No problems
|
if (Ale_GetNumAlerts () == 0) // No problems
|
||||||
{
|
{
|
||||||
// Now we know the new nickname is not already in database
|
// Now we know the new nickname is not already in database
|
||||||
// and is diffent to the current one
|
// and is diffent to the current one
|
||||||
Nck_UpdateNickInDB (UsrDat->UsrCod,NewNickWithoutArroba);
|
Nck_UpdateNickInDB (UsrDat->UsrCod,NewNickWithoutArr);
|
||||||
Str_Copy (UsrDat->Nickname,NewNickWithoutArroba,sizeof (UsrDat->Nickname) - 1);
|
Str_Copy (UsrDat->Nickname,NewNickWithoutArr,sizeof (UsrDat->Nickname) - 1);
|
||||||
|
|
||||||
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_SUCCESS,Nck_NICKNAME_SECTION_ID,
|
||||||
Txt_The_nickname_X_has_been_registered_successfully,
|
Txt_The_nickname_X_has_been_registered_successfully,
|
||||||
NewNickWithoutArroba);
|
NewNickWithoutArr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // New nickname is not valid
|
else // New nickname is not valid
|
||||||
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
Ale_CreateAlert (Ale_WARNING,Nck_NICKNAME_SECTION_ID,
|
||||||
Txt_The_nickname_entered_X_is_not_valid_,
|
Txt_The_nickname_entered_X_is_not_valid_,
|
||||||
NewNickWithArroba,
|
NewNickWithArr,
|
||||||
Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA,
|
Nck_MIN_CHARS_NICK_WITHOUT_ARROBA,
|
||||||
Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA);
|
Nck_MAX_CHARS_NICK_WITHOUT_ARROBA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -32,24 +32,24 @@
|
||||||
/************************* Public types and constants ************************/
|
/************************* Public types and constants ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA 3
|
#define Nck_MIN_CHARS_NICK_WITHOUT_ARROBA 3
|
||||||
#define Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA Nck_MIN_CHARS_NICKNAME_WITHOUT_ARROBA
|
#define Nck_MIN_BYTES_NICK_WITHOUT_ARROBA Nck_MIN_CHARS_NICK_WITHOUT_ARROBA
|
||||||
|
|
||||||
#define Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA 16
|
#define Nck_MAX_CHARS_NICK_WITHOUT_ARROBA 16
|
||||||
#define Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA Nck_MAX_CHARS_NICKNAME_WITHOUT_ARROBA
|
#define Nck_MAX_BYTES_NICK_WITHOUT_ARROBA Nck_MAX_CHARS_NICK_WITHOUT_ARROBA
|
||||||
|
|
||||||
#define Nck_MAX_BYTES_NICKNAME_FROM_FORM (128 - 1) // For variables that store characters typed in a form
|
#define Nck_MAX_BYTES_NICK_FROM_FORM (128 - 1) // For variables that store characters typed in a form
|
||||||
|
|
||||||
#define Nck_MAX_BYTES_LIST_NICKS ((Nck_MAX_BYTES_NICKNAME_FROM_FORM + 2) * Cfg_MAX_USRS_IN_LIST)
|
#define Nck_MAX_BYTES_LIST_NICKS ((Nck_MAX_BYTES_NICK_FROM_FORM + 2) * Cfg_MAX_USRS_IN_LIST)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Public prototypes *****************************/
|
/***************************** Public prototypes *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
bool Nck_CheckIfNickWithArrobaIsValid (const char *NickWithArroba);
|
bool Nck_CheckIfNickWithArrIsValid (const char *NickWithArr);
|
||||||
|
|
||||||
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
bool Nck_GetNicknameFromUsrCod (long UsrCod,
|
||||||
char Nickname[Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1]);
|
char Nickname[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1]);
|
||||||
long Nck_GetUsrCodFromNickname (const char *Nickname);
|
long Nck_GetUsrCodFromNickname (const char *Nickname);
|
||||||
|
|
||||||
void Nck_ShowFormChangeMyNickname (bool IMustFillNickname);
|
void Nck_ShowFormChangeMyNickname (bool IMustFillNickname);
|
||||||
|
|
|
@ -660,7 +660,7 @@ void Par_GetMainParameters (void)
|
||||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||||
long ActCod;
|
long ActCod;
|
||||||
char Nickname[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char Nickname[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
char URL[PATH_MAX + 1];
|
char URL[PATH_MAX + 1];
|
||||||
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ void Par_GetMainParameters (void)
|
||||||
/***** Get another user's nickname, if exists
|
/***** Get another user's nickname, if exists
|
||||||
(this nickname is used to go to another user's profile,
|
(this nickname is used to go to another user's profile,
|
||||||
not to get the logged user) *****/
|
not to get the logged user) *****/
|
||||||
if (Par_GetParToText ("usr",Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM))
|
if (Par_GetParToText ("usr",Nickname,Nck_MAX_BYTES_NICK_FROM_FORM))
|
||||||
{
|
{
|
||||||
if (Nickname[0])
|
if (Nickname[0])
|
||||||
{
|
{
|
||||||
|
@ -704,7 +704,7 @@ void Par_GetMainParameters (void)
|
||||||
Gbl.Action.Act = Gbl.Action.Original = ActSeeOthPubPrf; // Set default action if no other is specified
|
Gbl.Action.Act = Gbl.Action.Original = ActSeeOthPubPrf; // Set default action if no other is specified
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Par_GetParToText ("agd",Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM))
|
else if (Par_GetParToText ("agd",Nickname,Nck_MAX_BYTES_NICK_FROM_FORM))
|
||||||
{
|
{
|
||||||
if (Nickname[0])
|
if (Nickname[0])
|
||||||
{
|
{
|
||||||
|
@ -796,12 +796,10 @@ void Par_GetMainParameters (void)
|
||||||
if (Gbl.Prefs.Theme == The_THEME_UNKNOWN)
|
if (Gbl.Prefs.Theme == The_THEME_UNKNOWN)
|
||||||
Gbl.Prefs.Theme = The_THEME_DEFAULT;
|
Gbl.Prefs.Theme = The_THEME_DEFAULT;
|
||||||
|
|
||||||
/***** Set path of theme *****/
|
/***** Set path of theme and path of icon set *****/
|
||||||
snprintf (URL,sizeof (URL),"%s/%s",
|
snprintf (URL,sizeof (URL),"%s/%s",
|
||||||
Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Gbl.Prefs.Theme]);
|
Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Gbl.Prefs.Theme ]);
|
||||||
Str_Copy (Gbl.Prefs.URLTheme,URL,sizeof (Gbl.Prefs.URLTheme) - 1);
|
Str_Copy (Gbl.Prefs.URLTheme ,URL,sizeof (Gbl.Prefs.URLTheme ) - 1);
|
||||||
|
|
||||||
/***** Set path of icon set *****/
|
|
||||||
snprintf (URL,sizeof (URL),"%s/%s",
|
snprintf (URL,sizeof (URL),"%s/%s",
|
||||||
Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[Gbl.Prefs.IconSet]);
|
Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[Gbl.Prefs.IconSet]);
|
||||||
Str_Copy (Gbl.Prefs.URLIconSet,URL,sizeof (Gbl.Prefs.URLIconSet) - 1);
|
Str_Copy (Gbl.Prefs.URLIconSet,URL,sizeof (Gbl.Prefs.URLIconSet) - 1);
|
||||||
|
|
|
@ -333,7 +333,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void)
|
||||||
|
|
||||||
/***** Check if user exists *****/
|
/***** Check if user exists *****/
|
||||||
/* Check if user has typed his user's ID or his nickname */
|
/* Check if user has typed his user's ID or his nickname */
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (Gbl.Usrs.Me.UsrIdLogin)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (Gbl.Usrs.Me.UsrIdLogin)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
if ((Gbl.Usrs.Me.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Me.UsrIdLogin)) > 0)
|
if ((Gbl.Usrs.Me.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Me.UsrIdLogin)) > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -455,8 +455,8 @@ void Plc_GetDataOfPlaceByCod (struct Plc_Place *Plc)
|
||||||
}
|
}
|
||||||
else if (Plc->PlcCod == 0)
|
else if (Plc->PlcCod == 0)
|
||||||
{
|
{
|
||||||
Str_Copy (Plc->ShrtName,Txt_Another_place,sizeof (Plc->ShrtName) - 1);
|
Str_Copy (Plc->ShrtName,Txt_Another_place ,sizeof (Plc->ShrtName) - 1);
|
||||||
Str_Copy (Plc->FullName,Txt_Another_place,sizeof (Plc->FullName) - 1);
|
Str_Copy (Plc->FullName,Txt_Another_place ,sizeof (Plc->FullName) - 1);
|
||||||
}
|
}
|
||||||
else if (Plc->PlcCod > 0)
|
else if (Plc->PlcCod > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -708,8 +708,7 @@ void Plg_ChangePlgAppKey (void)
|
||||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||||
|
|
||||||
/***** Update app key *****/
|
/***** Update app key *****/
|
||||||
Str_Copy (Plg_EditingPlg->AppKey,NewAppKey,
|
Str_Copy (Plg_EditingPlg->AppKey,NewAppKey,sizeof (Plg_EditingPlg->AppKey) - 1);
|
||||||
sizeof (Plg_EditingPlg->AppKey) - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -139,14 +139,14 @@ void Prf_SeeSocialProfiles (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1],
|
char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1],
|
||||||
const char *NickWithoutArroba)
|
const char *NickWithoutArr)
|
||||||
{
|
{
|
||||||
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||||
|
|
||||||
/***** Build URL using nickname *****/
|
/***** Build URL using nickname *****/
|
||||||
snprintf (URL,Cns_MAX_BYTES_WWW + 1,"%s/%s?usr=@%s",
|
snprintf (URL,Cns_MAX_BYTES_WWW + 1,"%s/%s?usr=@%s",
|
||||||
Cfg_URL_SWAD_CGI,Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
Cfg_URL_SWAD_CGI,Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
NickWithoutArroba);
|
NickWithoutArr);
|
||||||
|
|
||||||
return URL;
|
return URL;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void Prf_RequestUserProfile (void)
|
||||||
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
||||||
extern const char *Txt_Nickname;
|
extern const char *Txt_Nickname;
|
||||||
extern const char *Txt_Continue;
|
extern const char *Txt_Continue;
|
||||||
char NickWithArroba[1 + Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
char NickWithArr[1 + Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
|
@ -215,9 +215,9 @@ void Prf_RequestUserProfile (void)
|
||||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||||
HTM_TxtColonNBSP (Txt_Nickname);
|
HTM_TxtColonNBSP (Txt_Nickname);
|
||||||
|
|
||||||
snprintf (NickWithArroba,sizeof (NickWithArroba),"@%s",
|
snprintf (NickWithArr,sizeof (NickWithArr),"@%s",
|
||||||
Gbl.Usrs.Me.UsrDat.Nickname);
|
Gbl.Usrs.Me.UsrDat.Nickname);
|
||||||
HTM_INPUT_TEXT ("usr",Nck_MAX_BYTES_NICKNAME_FROM_FORM,NickWithArroba,
|
HTM_INPUT_TEXT ("usr",Nck_MAX_BYTES_NICK_FROM_FORM,NickWithArr,
|
||||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"size=\"18\"");
|
"size=\"18\"");
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct UsrFigures
|
||||||
void Prf_SeeSocialProfiles (void);
|
void Prf_SeeSocialProfiles (void);
|
||||||
|
|
||||||
char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1],
|
char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1],
|
||||||
const char *NickWithoutArroba);
|
const char *NickWithoutArr);
|
||||||
void Prf_PutLinkMyPublicProfile (void);
|
void Prf_PutLinkMyPublicProfile (void);
|
||||||
void Prf_PutLinkRequestAnotherUserProfile (void);
|
void Prf_PutLinkRequestAnotherUserProfile (void);
|
||||||
void Prf_RequestUserProfile (void);
|
void Prf_RequestUserProfile (void);
|
||||||
|
|
|
@ -3229,11 +3229,11 @@ void Prj_GetDataOfProjectByCod (struct Prj_Project *Prj)
|
||||||
|
|
||||||
/* Get title (row[10]), description (row[11]), required knowledge (row[12]),
|
/* Get title (row[10]), description (row[11]), required knowledge (row[12]),
|
||||||
required materials (row[13]) and URL (row[14]) of the project */
|
required materials (row[13]) and URL (row[14]) of the project */
|
||||||
Str_Copy (Prj->Title ,row[10],sizeof (Prj->Title ) - 1);
|
Str_Copy (Prj->Title ,row[10],sizeof (Prj->Title) - 1);
|
||||||
Str_Copy (Prj->Description,row[11],Cns_MAX_BYTES_TEXT);
|
Str_Copy (Prj->Description,row[11],Cns_MAX_BYTES_TEXT);
|
||||||
Str_Copy (Prj->Knowledge ,row[12],Cns_MAX_BYTES_TEXT);
|
Str_Copy (Prj->Knowledge ,row[12],Cns_MAX_BYTES_TEXT);
|
||||||
Str_Copy (Prj->Materials ,row[13],Cns_MAX_BYTES_TEXT);
|
Str_Copy (Prj->Materials ,row[13],Cns_MAX_BYTES_TEXT);
|
||||||
Str_Copy (Prj->URL ,row[14],sizeof (Prj->URL ) - 1);
|
Str_Copy (Prj->URL ,row[14],sizeof (Prj->URL ) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
|
|
@ -3675,29 +3675,26 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
|
||||||
|
|
||||||
void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat)
|
void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary surname 1
|
char Surname1[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary surname 1
|
||||||
char FirstName[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary first name
|
char FrstName[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary first name
|
||||||
|
|
||||||
/***** Get surname 1 *****/
|
/***** Get surname 1 *****/
|
||||||
Par_GetParToText ("Surname1",Surname1,
|
Par_GetParToText ("Surname1",Surname1,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
Str_ConvertToTitleType (Surname1);
|
Str_ConvertToTitleType (Surname1);
|
||||||
// Surname 1 is mandatory, so avoid overwriting surname 1 with empty string
|
// Surname 1 is mandatory, so avoid overwriting surname 1 with empty string
|
||||||
if (Surname1[0]) // New surname 1 not empty
|
if (Surname1[0]) // New surname 1 not empty
|
||||||
Str_Copy (UsrDat->Surname1,Surname1,sizeof (UsrDat->Surname1) - 1);
|
Str_Copy (UsrDat->Surname1,Surname1,sizeof (UsrDat->Surname1) - 1);
|
||||||
|
|
||||||
/***** Get surname 2 *****/
|
/***** Get surname 2 *****/
|
||||||
Par_GetParToText ("Surname2",UsrDat->Surname2,
|
Par_GetParToText ("Surname2",UsrDat->Surname2,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
||||||
Str_ConvertToTitleType (UsrDat->Surname2);
|
Str_ConvertToTitleType (UsrDat->Surname2);
|
||||||
|
|
||||||
/***** Get first name *****/
|
/***** Get first name *****/
|
||||||
Par_GetParToText ("FirstName",FirstName,
|
Par_GetParToText ("FirstName",FrstName,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
||||||
Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
Str_ConvertToTitleType (FrstName);
|
||||||
Str_ConvertToTitleType (FirstName);
|
|
||||||
// First name is mandatory, so avoid overwriting first name with empty string
|
// First name is mandatory, so avoid overwriting first name with empty string
|
||||||
if (FirstName[0]) // New first name not empty
|
if (FrstName[0]) // New first name not empty
|
||||||
Str_Copy (UsrDat->FrstName,FirstName,sizeof (UsrDat->FrstName) - 1);
|
Str_Copy (UsrDat->FrstName,FrstName,sizeof (UsrDat->FrstName) - 1);
|
||||||
|
|
||||||
/***** Build full name *****/
|
/***** Build full name *****/
|
||||||
Usr_BuildFullName (UsrDat);
|
Usr_BuildFullName (UsrDat);
|
||||||
|
|
|
@ -290,10 +290,10 @@ void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
|
||||||
Links[NumLinks].NumActualBytes = (size_t) (PtrSrc - Links[NumLinks].PtrStart);
|
Links[NumLinks].NumActualBytes = (size_t) (PtrSrc - Links[NumLinks].PtrStart);
|
||||||
|
|
||||||
/* A nick (without arroba) must have a number of characters
|
/* A nick (without arroba) must have a number of characters
|
||||||
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA */
|
Nck_MIN_BYTES_NICK_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICK_WITHOUT_ARROBA */
|
||||||
Length = Links[NumLinks].NumActualBytes - 1; // Do not count the initial @
|
Length = Links[NumLinks].NumActualBytes - 1; // Do not count the initial @
|
||||||
IsNickname = (Length >= Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA &&
|
IsNickname = (Length >= Nck_MIN_BYTES_NICK_WITHOUT_ARROBA &&
|
||||||
Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Length <= Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
|
|
||||||
if (IsNickname)
|
if (IsNickname)
|
||||||
{
|
{
|
||||||
|
@ -730,9 +730,9 @@ void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const char *T
|
||||||
Nickname.Length = (size_t) (Ptr - Nickname.PtrStart);
|
Nickname.Length = (size_t) (Ptr - Nickname.PtrStart);
|
||||||
|
|
||||||
/* A nick (without arroba) must have a number of characters
|
/* A nick (without arroba) must have a number of characters
|
||||||
Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA */
|
Nck_MIN_BYTES_NICK_WITHOUT_ARROBA <= Length <= Nck_MAX_BYTES_NICK_WITHOUT_ARROBA */
|
||||||
IsNickname = (Nickname.Length >= Nck_MIN_BYTES_NICKNAME_WITHOUT_ARROBA &&
|
IsNickname = (Nickname.Length >= Nck_MIN_BYTES_NICK_WITHOUT_ARROBA &&
|
||||||
Nickname.Length <= Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA);
|
Nickname.Length <= Nck_MAX_BYTES_NICK_WITHOUT_ARROBA);
|
||||||
|
|
||||||
if (IsNickname)
|
if (IsNickname)
|
||||||
{
|
{
|
||||||
|
@ -3068,7 +3068,7 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize)
|
||||||
static char *Str_String = NULL;
|
static char *Str_String = NULL;
|
||||||
|
|
||||||
// fmt must be a string including "%s"
|
// fmt must be a string including "%s"
|
||||||
// Str_FreeMsg() must be called after calling this function
|
// Str_FreeString() must be called after calling this function
|
||||||
|
|
||||||
char *Str_BuildStringStr (const char *fmt,const char *Str)
|
char *Str_BuildStringStr (const char *fmt,const char *Str)
|
||||||
{
|
{
|
||||||
|
@ -3080,7 +3080,7 @@ char *Str_BuildStringStr (const char *fmt,const char *Str)
|
||||||
}
|
}
|
||||||
|
|
||||||
// fmt must be a string including "%ld"
|
// fmt must be a string including "%ld"
|
||||||
// Str_FreeMsg() must be called after calling this function
|
// Str_FreeString() must be called after calling this function
|
||||||
|
|
||||||
char *Str_BuildStringLong (const char *fmt,long Num)
|
char *Str_BuildStringLong (const char *fmt,long Num)
|
||||||
{
|
{
|
||||||
|
@ -3091,7 +3091,7 @@ char *Str_BuildStringLong (const char *fmt,long Num)
|
||||||
return Str_String;
|
return Str_String;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Str_FreeMsg() must be called after calling this function
|
// Str_FreeString() must be called after calling this function
|
||||||
|
|
||||||
char *Str_BuildStringLongStr (long Num,const char *Str)
|
char *Str_BuildStringLongStr (long Num,const char *Str)
|
||||||
{
|
{
|
||||||
|
|
16
swad_test.c
16
swad_test.c
|
@ -3868,13 +3868,11 @@ bool Tst_GetQstDataFromDB (struct Tst_Question *Question)
|
||||||
/* Get shuffle (row[2]) */
|
/* Get shuffle (row[2]) */
|
||||||
Question->Answer.Shuffle = (row[2][0] == 'Y');
|
Question->Answer.Shuffle = (row[2][0] == 'Y');
|
||||||
|
|
||||||
/* Get the stem (row[3]) */
|
/* Get the stem (row[3]) and the feedback (row[4]) */
|
||||||
Question->Stem[0] = '\0';
|
Question->Stem [0] = '\0';
|
||||||
if (row[3])
|
if (row[3])
|
||||||
if (row[3][0])
|
if (row[3][0])
|
||||||
Str_Copy (Question->Stem,row[3],Cns_MAX_BYTES_TEXT);
|
Str_Copy (Question->Stem ,row[3],Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/* Get the feedback (row[4]) */
|
|
||||||
Question->Feedback[0] = '\0';
|
Question->Feedback[0] = '\0';
|
||||||
if (row[4])
|
if (row[4])
|
||||||
if (row[4][0])
|
if (row[4][0])
|
||||||
|
@ -3961,14 +3959,12 @@ bool Tst_GetQstDataFromDB (struct Tst_Question *Question)
|
||||||
/* Abort on error */
|
/* Abort on error */
|
||||||
Ale_ShowAlertsAndExit ();
|
Ale_ShowAlertsAndExit ();
|
||||||
|
|
||||||
/* Get text (row[1]) */
|
/* Get text (row[1]) and feedback (row[2])*/
|
||||||
Question->Answer.Options[NumOpt].Text[0] = '\0';
|
Question->Answer.Options[NumOpt].Text [0] = '\0';
|
||||||
if (row[1])
|
if (row[1])
|
||||||
if (row[1][0])
|
if (row[1][0])
|
||||||
Str_Copy (Question->Answer.Options[NumOpt].Text,row[1],
|
Str_Copy (Question->Answer.Options[NumOpt].Text ,row[1],
|
||||||
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
|
||||||
|
|
||||||
/* Get feedback (row[2]) */
|
|
||||||
Question->Answer.Options[NumOpt].Feedback[0] = '\0';
|
Question->Answer.Options[NumOpt].Feedback[0] = '\0';
|
||||||
if (row[2])
|
if (row[2])
|
||||||
if (row[2][0])
|
if (row[2][0])
|
||||||
|
|
22
swad_user.c
22
swad_user.c
|
@ -2840,7 +2840,7 @@ unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *Lis
|
||||||
/***** Check if it's an ID, a nickname or an email address *****/
|
/***** Check if it's an ID, a nickname or an email address *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail[0])
|
if (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail[0])
|
||||||
{
|
{
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
if ((Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail)) > 0)
|
if ((Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Other.UsrDat.UsrIDNickOrEmail)) > 0)
|
||||||
{
|
{
|
||||||
|
@ -3137,7 +3137,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Check if user has typed his user's ID, his nickname or his email address *****/
|
/***** Check if user has typed his user's ID, his nickname or his email address *****/
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (Gbl.Usrs.Me.UsrIdLogin)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (Gbl.Usrs.Me.UsrIdLogin)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
// User is trying to log using his/her nickname
|
// User is trying to log using his/her nickname
|
||||||
if ((Gbl.Usrs.Me.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Me.UsrIdLogin)) <= 0)
|
if ((Gbl.Usrs.Me.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Me.UsrIdLogin)) <= 0)
|
||||||
|
@ -5376,16 +5376,16 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,Hie_Lvl_Level_
|
||||||
/* Get encrypted user's code (row[1]), encrypted password (row[2]),
|
/* Get encrypted user's code (row[1]), encrypted password (row[2]),
|
||||||
surname 1 (row[3]), surname 2 (row[4]), first name (row[5]), */
|
surname 1 (row[3]), surname 2 (row[4]), first name (row[5]), */
|
||||||
Str_Copy (UsrInList->EnUsrCod,row[1],sizeof (UsrInList->EnUsrCod) - 1);
|
Str_Copy (UsrInList->EnUsrCod,row[1],sizeof (UsrInList->EnUsrCod) - 1);
|
||||||
Str_Copy (UsrInList->Password ,row[2],sizeof (UsrInList->Password ) - 1);
|
Str_Copy (UsrInList->Password,row[2],sizeof (UsrInList->Password) - 1);
|
||||||
Str_Copy (UsrInList->Surname1 ,row[3],sizeof (UsrInList->Surname1 ) - 1);
|
Str_Copy (UsrInList->Surname1,row[3],sizeof (UsrInList->Surname1) - 1);
|
||||||
Str_Copy (UsrInList->Surname2 ,row[4],sizeof (UsrInList->Surname2 ) - 1);
|
Str_Copy (UsrInList->Surname2,row[4],sizeof (UsrInList->Surname2) - 1);
|
||||||
Str_Copy (UsrInList->FrstName ,row[5],sizeof (UsrInList->FrstName ) - 1);
|
Str_Copy (UsrInList->FrstName,row[5],sizeof (UsrInList->FrstName) - 1);
|
||||||
|
|
||||||
/* Get user's sex (row[6]) */
|
/* Get user's sex (row[6]) */
|
||||||
UsrInList->Sex = Usr_GetSexFromStr (row[6]);
|
UsrInList->Sex = Usr_GetSexFromStr (row[6]);
|
||||||
|
|
||||||
/* Get user's photo (row[7]) */
|
/* Get user's photo (row[7]) */
|
||||||
Str_Copy (UsrInList->Photo ,row[7],sizeof (UsrInList->Photo ) - 1);
|
Str_Copy (UsrInList->Photo ,row[7],sizeof (UsrInList->Photo ) - 1);
|
||||||
|
|
||||||
/* Get user's photo visibility (row[8]) */
|
/* Get user's photo visibility (row[8]) */
|
||||||
UsrInList->PhotoVisibility = Pri_GetVisibilityFromStr (row[8]);
|
UsrInList->PhotoVisibility = Pri_GetVisibilityFromStr (row[8]);
|
||||||
|
@ -5783,7 +5783,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
|
||||||
ListUsrCods.NumUsrs = 0;
|
ListUsrCods.NumUsrs = 0;
|
||||||
ListUsrCods.Lst = NULL;
|
ListUsrCods.Lst = NULL;
|
||||||
|
|
||||||
if (Nck_CheckIfNickWithArrobaIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
if (Nck_CheckIfNickWithArrIsValid (UsrIDNickOrEmail)) // 1: It's a nickname
|
||||||
{
|
{
|
||||||
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrIDNickOrEmail)) > 0)
|
if ((UsrDat.UsrCod = Nck_GetUsrCodFromNickname (UsrIDNickOrEmail)) > 0)
|
||||||
{
|
{
|
||||||
|
@ -9843,7 +9843,7 @@ void Usr_RemoveUsrFromUsrBanned (long UsrCod)
|
||||||
|
|
||||||
void Usr_PrintUsrQRCode (void)
|
void Usr_PrintUsrQRCode (void)
|
||||||
{
|
{
|
||||||
char NewNickWithArroba[Nck_MAX_BYTES_NICKNAME_FROM_FORM + 1];
|
char NewNickWithArr[Nck_MAX_BYTES_NICK_FROM_FORM + 1];
|
||||||
|
|
||||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||||
{
|
{
|
||||||
|
@ -9855,9 +9855,9 @@ void Usr_PrintUsrQRCode (void)
|
||||||
/***** Show QR code *****/
|
/***** Show QR code *****/
|
||||||
if (Gbl.Usrs.Other.UsrDat.Nickname[0])
|
if (Gbl.Usrs.Other.UsrDat.Nickname[0])
|
||||||
{
|
{
|
||||||
snprintf (NewNickWithArroba,sizeof (NewNickWithArroba),"@%s",
|
snprintf (NewNickWithArr,sizeof (NewNickWithArr),"@%s",
|
||||||
Gbl.Usrs.Other.UsrDat.Nickname);
|
Gbl.Usrs.Other.UsrDat.Nickname);
|
||||||
QR_ImageQRCode (NewNickWithArroba);
|
QR_ImageQRCode (NewNickWithArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
|
|
|
@ -165,7 +165,7 @@ struct UsrData
|
||||||
struct ListIDs *List;
|
struct ListIDs *List;
|
||||||
unsigned Num;
|
unsigned Num;
|
||||||
} IDs;
|
} IDs;
|
||||||
char Nickname [Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
|
char Nickname [Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||||
char Password [Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
char Password [Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue