Version 16.127

This commit is contained in:
Antonio Cañas Vargas 2017-01-28 15:58:46 +01:00
parent d8df950fdf
commit d4f15919a2
100 changed files with 2494 additions and 2472 deletions

View File

@ -249,7 +249,6 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs)
time_t CallTimeUTC;
long ExaCod;
unsigned long NumExa,NumExamAnnouncements;
// char Content[Cns_MAX_BYTES_TEXT+1];
if (Gbl.DB.DatabaseIsOpen)
{
@ -298,11 +297,6 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs)
fprintf (FileRSS,"<description><![CDATA[<p><em>Fecha examen: %s</em></p>]]></description>\n",
row[2]);
/* Write author */
// if (UsrDat.Email[0])
// fprintf (FileRSS,"<author>%s (%s %s %s)</author>\n",
// UsrDat.Email,UsrDat.FirstName,UsrDat.Surname1,UsrDat.Surname2);
/* Write unique string for this item */
fprintf (FileRSS,"<guid isPermaLink=\"false\">%s, course #%ld, exam #%ld</guid>\n",
Cfg_URL_SWAD_CGI,Crs->CrsCod,ExaCod);
@ -315,8 +309,6 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs)
fprintf (FileRSS,"</item>\n");
}
// Usr_UsrDataDestructor (&UsrDat);
}
/***** Free structure that stores the query result *****/

View File

@ -523,7 +523,7 @@ static void Agd_PutIconsOtherPublicAgenda (void)
extern const char *Txt_View_record_and_office_hours;
/***** Button to view user's public profile *****/
if (Pri_ShowIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,
if (Pri_ShowingIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,
&Gbl.Usrs.Other.UsrDat))
Lay_PutContextualLink (ActSeePubPrf,
Usr_PutParamOtherUsrCodEncrypted,

View File

@ -444,7 +444,7 @@ static void Asg_WriteAsgAuthor (struct Assignment *Asg)
/***** Get data of author *****/
UsrDat.UsrCod = Asg->UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
/***** Show photo *****/
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :

View File

@ -486,7 +486,7 @@ static void Att_WriteAttEventAuthor (struct AttendanceEvent *Att)
/***** Get data of author *****/
UsrDat.UsrCod = Att->UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get of the database the data of the author
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
/***** Show photo *****/
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
@ -2097,7 +2097,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat
{
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
@ -3339,7 +3339,7 @@ static void Att_WriteRowStdSeveralAttEvents (unsigned NumStd,struct UsrData *Usr
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE COLOR%u\""
" style=\"width:22px;\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
@ -3483,7 +3483,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE COLOR%u\""
" style=\"width:22px;\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);

View File

@ -99,7 +99,8 @@ static long Ctr_GetParamOtherCtrCod (void);
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod);
static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
static bool Ctr_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,long CtrCod,long InsCod);
static void Ctr_UpdateCtrWWWDB (long CtrCod,const char NewWWW[Cns_MAX_LENGTH_WWW+1]);
static void Ctr_UpdateCtrWWWDB (long CtrCod,
const char NewWWW[Cns_MAX_LENGTH_WWW + 1]);
static void Ctr_PutButtonToGoToCtr (struct Centre *Ctr);
static void Ctr_PutFormToCreateCentre (void);
@ -2062,7 +2063,8 @@ void Ctr_ChangeCtrWWWInConfig (void)
/**************** Update database changing old WWW by new WWW ****************/
/*****************************************************************************/
static void Ctr_UpdateCtrWWWDB (long CtrCod,const char NewWWW[Cns_MAX_LENGTH_WWW+1])
static void Ctr_UpdateCtrWWWDB (long CtrCod,
const char NewWWW[Cns_MAX_LENGTH_WWW + 1])
{
char Query[256 + Cns_MAX_LENGTH_WWW];

View File

@ -191,13 +191,15 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.126.4 (2017-01-27)"
#define Log_PLATFORM_VERSION "SWAD 16.127 (2017-01-28)"
#define CSS_FILE "swad16.123.css"
#define JS_FILE "swad16.123.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.127: Jan 28, 2017 Code refactoring. (212118 lines)
Version 16.126.6: Jan 27, 2017 Fixed bug related with list of students. (212098 lines)
Version 16.126.5: Jan 27, 2017 Changes in permissions to view/change another user's data. (212093 lines)
Version 16.126.4: Jan 27, 2017 Code refactoring related to permissions to view/change another user's data. (212105 lines)
Version 16.126.3: Jan 27, 2017 Fixed bug in search of user, reported by Javier Fernández Baldomero. (212086 lines)

View File

@ -1094,7 +1094,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
// is dynamically updated via AJAX
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
Act_LinkFormSubmitUnique (UsrDat.FullName,NULL);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
@ -1286,7 +1286,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
"<td class=\"LEFT_MIDDLE COLOR%u\""
" style=\"width:22px;\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);

View File

@ -1071,7 +1071,8 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
}
/* Get number of users who claim to belong to this country */
if (sscanf (row[1+Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
if (sscanf (row[1 + Txt_NUM_LANGUAGES * 2 + 1],"%u",
&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
Cty->NumUsrsWhoClaimToBelongToCty = 0;
/* Get number of institutions in this country */
@ -1326,7 +1327,8 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
}
/* Get number of users who claim to belong to this country */
if (sscanf (row[Txt_NUM_LANGUAGES*2+1],"%u",&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
if (sscanf (row[Txt_NUM_LANGUAGES * 2 + 1],"%u",
&Cty->NumUsrsWhoClaimToBelongToCty) != 1)
Cty->NumUsrsWhoClaimToBelongToCty = 0;
/* Get number of user in courses of this institution */

View File

@ -76,7 +76,8 @@ extern const char Str_BIN_TO_BASE64URL[64];
/*****************************************************************************/
// Pointers to PlainText and EncryptedText can point to the same place
void Cry_EncryptSHA256Base64 (const char *PlainText,char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1])
void Cry_EncryptSHA256Base64 (const char *PlainText,
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1])
{
int i,j;
unsigned char digest256[SHA256_DIGEST_SIZE];
@ -110,9 +111,11 @@ void Cry_EncryptSHA256Base64 (const char *PlainText,char EncryptedText[Cry_LENGT
/*****************************************************************************/
// Pointers to PlainText and EncryptedText can point to the same place
void Cry_EncryptSHA512Base64 (const char *PlainText,char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64+1])
void Cry_EncryptSHA512Base64 (const char *PlainText,
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1])
{
int i,j;
int i;
int j;
unsigned char digest512[SHA512_DIGEST_SIZE];
/* Encrypt function */

View File

@ -42,8 +42,10 @@
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Cry_EncryptSHA256Base64 (const char *PlainText,char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1]);
void Cry_EncryptSHA512Base64 (const char *PlainText,char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64+1]);
void Cry_EncryptSHA256Base64 (const char *PlainText,
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);
void Cry_EncryptSHA512Base64 (const char *PlainText,
char EncryptedText[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1]);
void Cry_CreateUniqueNameEncrypted (char UniqueNameEncrypted[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]);

View File

@ -2749,7 +2749,7 @@ static void Enr_ShowEnrollmentRequestsGivenRoles (unsigned RolesSelected)
/***** User photo *****/
fprintf (Gbl.F.Out,"<td class=\"DAT CENTER_TOP\""
" style=\"width:22px;\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);

View File

@ -1612,14 +1612,10 @@ void Exa_PutHiddenParamExaCod (long ExaCod)
static long Exa_GetParamExaCod (void)
{
char LongStr[1 + 10 + 1]; // String that holds the exam announcement code
long ExaCod;
/* Get notice code */
Par_GetParToText ("ExaCod",LongStr,1 + 10);
if (sscanf (LongStr,"%ld",&ExaCod) != 1)
ExaCod = -1L;
return ExaCod;
return Str_ConvertStrCodToLongCod (LongStr);
}
/*****************************************************************************/

View File

@ -3395,7 +3395,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
/***** Show user's photo *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\" style=\"width:64px;\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO60x80",Pho_ZOOM,false);
@ -6153,7 +6153,7 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,unsigned long UsrCod)
if (ShowUsr)
{
/***** Show photo *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20B",Pho_ZOOM,false);
@ -9141,7 +9141,7 @@ void Brw_ShowFileMetadata (void)
if (FileHasPublisher)
{
/* Show photo */
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&PublisherUsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&PublisherUsrDat,PhotoURL);
Pho_ShowUsrPhoto (&PublisherUsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20",Pho_ZOOM,false);

View File

@ -684,13 +684,13 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
extern const char *Txt_Follow;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowIsAllowed (UsrDat->ProfileVisibility,UsrDat);
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
/***** Show user's photo *****/
fprintf (Gbl.F.Out,"<td class=\"FOLLOW_USR_PHOTO\">");
if (Visible)
{
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO60x80",Pho_ZOOM,false);
@ -774,7 +774,7 @@ void Fol_FollowUsr (void)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
// Follow only if I can view his/her public profile
if (Pri_ShowIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,&Gbl.Usrs.Other.UsrDat))
if (Pri_ShowingIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,&Gbl.Usrs.Other.UsrDat))
// Follow only if I do not follow him/her
if (!Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Other.UsrDat.UsrCod))

View File

@ -298,10 +298,14 @@ static void For_PutParamsForumInsDegCrs (void);
static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static void For_WriteLinksToPlatformForums (bool IsLastForum,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static void For_WriteLinkToAForum (For_ForumType_t ForumType,bool ShowNumOfPosts,
unsigned Level,bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static void For_WriteLinkToForum (For_ForumType_t ForumType,Act_Action_t NextAct,const char *Icon,const char *ForumName,bool ShowNumOfPosts,
@ -2003,7 +2007,8 @@ static void For_WriteLinksToPlatformForums (bool IsLastForum,
/*****************************************************************************/
// Returns institution code
static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool ICanSeeTeacherForum;
@ -2036,7 +2041,8 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastIte
/*****************************************************************************/
// Returns centre code
static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool ICanSeeTeacherForum;
@ -2069,7 +2075,8 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,bool IsLastIte
/*****************************************************************************/
// Returns degree code
static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool ICanSeeTeacherForum;
@ -2102,7 +2109,8 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,bool IsLastIte
/*****************************************************************************/
// Returns course code
static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool ICanSeeTeacherForum;
@ -2135,7 +2143,8 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,bool IsLastIte
/*****************************************************************************/
static void For_WriteLinkToAForum (For_ForumType_t ForumType,bool ShowNumOfPosts,
unsigned Level,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
unsigned Level,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
char Icon[512];
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];

View File

@ -4126,12 +4126,14 @@ void Grp_GetLstCodsGrpWanted (struct ListCodGrps *LstGrpsWanted)
NumGrpTyp++)
{
/***** Allocate memory for the list of group codes of this type *****/
if ((LstStrCodGrps[NumGrpTyp] = (char *) malloc ((1+10+1) * Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)) == NULL)
if ((LstStrCodGrps[NumGrpTyp] = (char *) malloc ((size_t) ((1 + 10 + 1) *
Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps))) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store codes of groups in which a user wants to be enrolled.");
/***** Get the multiple parameter code of group of this type *****/
sprintf (Param,"GrpCod%ld",Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod);
Par_GetParMultiToText (Param,LstStrCodGrps[NumGrpTyp],((1+10+1) * Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - 1);
Par_GetParMultiToText (Param,LstStrCodGrps[NumGrpTyp],
((1 + 10 + 1) * Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - 1);
if (LstStrCodGrps[NumGrpTyp][0])
{
/***** Count the number of groups selected of this type of LstCodGrps[NumGrpTyp] *****/

View File

@ -81,7 +81,8 @@ static void Mai_CreateMailDomain (struct Mail *Mai);
static void Mai_RemoveEmail (struct UsrData *UsrDat);
static void Mai_RemoveEmailFromDB (long UsrCod,const char *Email);
static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe);
static void Mai_InsertMailKey (const char *Email,const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY+1]);
static void Mai_InsertMailKey (const char *Email,
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1]);
/*****************************************************************************/
/************************* List all the mail domains *************************/
@ -1654,7 +1655,8 @@ void Mai_ShowMsgConfirmEmailHasBeenSent (void)
/************************* Insert mail hey in database ***********************/
/*****************************************************************************/
static void Mai_InsertMailKey (const char *Email,const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY+1])
static void Mai_InsertMailKey (const char *Email,
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1])
{
char Query[512 + Mai_LENGTH_EMAIL_CONFIRM_KEY];

View File

@ -394,7 +394,7 @@ static void Msg_ShowOneUniqueRecipient (void)
bool ShowPhoto;
/***** Show user's photo *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
@ -1037,7 +1037,8 @@ void Msg_GetParamMsgsCrsCod (void)
void Msg_GetParamFilterFromTo (void)
{
/***** Get "from"/"to" filter *****/
Par_GetParToText ("FilterFromTo",Gbl.Msg.FilterFromTo,Usr_MAX_LENGTH_USR_NAME_OR_SURNAME*3);
Par_GetParToText ("FilterFromTo",Gbl.Msg.FilterFromTo,
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME * 3);
}
/*****************************************************************************/
@ -1047,7 +1048,8 @@ void Msg_GetParamFilterFromTo (void)
void Msg_GetParamFilterContent (void)
{
/***** Get content filter *****/
Par_GetParToText ("FilterContent",Gbl.Msg.FilterContent,Msg_MAX_LENGTH_FILTER_CONTENT);
Par_GetParToText ("FilterContent",Gbl.Msg.FilterContent,
Msg_MAX_LENGTH_FILTER_CONTENT);
}
/*****************************************************************************/
@ -3143,7 +3145,7 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat,
if (WriteAuthor)
{
/***** First column with author's photo (if author has a web page, put a link to it) *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,false);
@ -3304,7 +3306,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted)
/***** Put user's photo *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\" style=\"width:30px;\">");
ShowPhoto = (Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL));
ShowPhoto = (Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL));
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
@ -3454,7 +3456,7 @@ static void Msg_WriteMsgTo (long MsgCod)
/* Put user's photo */
fprintf (Gbl.F.Out,"<td class=\"CENTER_TOP\" style=\"width:30px;\">");
ShowPhoto = (UsrValid ? Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL) :
ShowPhoto = (UsrValid ? Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL) :
false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
@ -3828,7 +3830,7 @@ void Msg_ListBannedUsrs (void)
/* Show photo */
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\""
" style=\"width:30px;\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);

View File

@ -410,8 +410,8 @@ int Pwd_SendNewPasswordByEmail (char NewRandomPlainPassword[Pwd_MAX_LENGTH_PLAIN
/* Message body */
fprintf (Gbl.Msg.FileMail,Txt_The_following_password_has_been_assigned_to_you_to_log_in_X_NO_HTML,
Cfg_PLATFORM_SHORT_NAME,NewRandomPlainPassword,
Cfg_URL_SWAD_CGI,(unsigned) (Cfg_TIME_TO_DELETE_OLD_PENDING_PASSWORDS/(24L*60L*60L)),
Cfg_PLATFORM_SHORT_NAME,NewRandomPlainPassword,Cfg_URL_SWAD_CGI,
(unsigned) (Cfg_TIME_TO_DELETE_OLD_PENDING_PASSWORDS / (24L * 60L * 60L)),
Gbl.Usrs.Me.UsrDat.Email);
/* Footer note */

View File

@ -936,12 +936,12 @@ void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
// Returns true if the photo can be shown and false if not.
// Public photo means two different things depending on the user's type
bool Pho_ShowUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL)
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL)
{
bool ICanSeePhoto;
/***** Check if I can see the other's photo *****/
ICanSeePhoto = Pri_ShowIsAllowed (UsrDat->PhotoVisibility,UsrDat);
ICanSeePhoto = Pri_ShowingIsAllowed (UsrDat->PhotoVisibility,UsrDat);
/***** Photo is shown if I can see it, and it exists *****/
return ICanSeePhoto ? Pho_BuildLinkToPhoto (UsrDat,PhotoURL) :
@ -973,13 +973,8 @@ bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL)
/***** Create a symbolic link to the private photo, if not exists *****/
if (!Fil_CheckIfPathExists (PathPublPhoto))
if (symlink (PathPrivPhoto,PathPublPhoto) != 0)
{
sprintf (Gbl.Message,"symlink (%s,%s)",
PathPrivPhoto,PathPublPhoto);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
Lay_ShowErrorAndExit ("Can not create public link"
" to access to user's private photo");
}
/***** Create the public URL of the photo *****/
sprintf (PhotoURL,"%s/%s/%s.jpg",

View File

@ -103,7 +103,7 @@ void Pho_UpdateUsrPhoto2 (void);
unsigned Pho_UpdateMyClicksWithoutPhoto (void);
void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod);
bool Pho_ShowUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL);
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL);
bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char *PhotoURL);
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char *PathPrivRelPhoto);
bool Pho_RemovePhoto (struct UsrData *UsrDat);

View File

@ -248,7 +248,7 @@ Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName)
/*****************************************************************************/
// Returns true if it can be shown and false if not.
bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
{
/***** It's me? I always can see my things *****/
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)
@ -263,7 +263,9 @@ bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
{
case Pri_VISIBILITY_UNKNOWN:
return false; // It's not me
case Pri_VISIBILITY_USER: // Only visible by me and my teachers if I am a student or me and my students if I am a teacher
case Pri_VISIBILITY_USER: // Only visible
// by me and my teachers if I am a student
// or me and my students if I am a teacher
// Do both users share the same course but whit different role?
return Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (UsrDat->UsrCod);
case Pri_VISIBILITY_COURSE: // Visible by users sharing courses with me

View File

@ -48,6 +48,6 @@ void Pri_EditMyPrivacy (void);
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str);
Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName);
bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat);
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat);
#endif

View File

@ -269,7 +269,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
}
/***** Check if I can see the public profile *****/
if (Pri_ShowIsAllowed (UsrDat->ProfileVisibility,UsrDat))
if (Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat))
{
if (!ItsMe && // If not it's me...
Gbl.CurrentCrs.Crs.CrsCod > 0) // ...and a course is selected
@ -1490,7 +1490,7 @@ void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank)
extern const char *Txt_View_public_profile;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowIsAllowed (UsrDat->ProfileVisibility,UsrDat);
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
fprintf (Gbl.F.Out,"<td class=\"RANK RIGHT_MIDDLE COLOR%u\""
" style=\"height:50px;\">"
@ -1506,7 +1506,7 @@ void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank)
if (Visible)
{
/***** User's photo *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,false);

View File

@ -2365,7 +2365,7 @@ static void Rec_PutIconsCommands (void)
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW && // Only in main window
Gbl.Usrs.Me.Logged) // Only if I am logged
{
ICanViewUsrProfile = Pri_ShowIsAllowed (Gbl.Record.UsrDat->ProfileVisibility,
ICanViewUsrProfile = Pri_ShowingIsAllowed (Gbl.Record.UsrDat->ProfileVisibility,
Gbl.Record.UsrDat);
/***** Start container *****/
@ -2580,7 +2580,7 @@ static void Rec_ShowInstitutionInHead (struct Instit *Ins,bool PutFormLinks)
static void Rec_ShowPhoto (struct UsrData *UsrDat)
{
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
bool ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
/***** User's photo *****/
fprintf (Gbl.F.Out,"<td rowspan=\"3\" class=\"REC_C3_TOP CENTER_TOP\">");

View File

@ -1160,7 +1160,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
/***** Left: write author's photo *****/
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_NOTE_LEFT_PHOTO\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO42x56",Pho_ZOOM,true); // Use unique id
@ -1973,7 +1973,7 @@ static void Soc_PutFormToWriteNewPost (void)
/***** Left: write author's photo (my photo) *****/
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_NOTE_LEFT_PHOTO\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO42x56",Pho_ZOOM,false);
@ -2229,7 +2229,7 @@ static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
/***** Left: write author's photo (my photo) *****/
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_PHOTO\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,true); // Use unique id
@ -2398,7 +2398,7 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
/***** Left: write author's photo *****/
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_PHOTO\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,true); // Use unique id
@ -4332,7 +4332,7 @@ static void Soc_ShowSharersOrFavers (unsigned NumUsrs,const char *Query)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
{
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_SHARER\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20",Pho_ZOOM,true); // Use unique id

View File

@ -1865,7 +1865,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,
/* Show the photo */
fprintf (Gbl.F.Out,"<td class=\"CENTER_TOP COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20",Pho_ZOOM,false);
@ -2808,9 +2808,9 @@ static void Sta_WriteAccessHour (unsigned Hour,struct Sta_Hits *Hits,unsigned Co
/**** Show a listing with the number of clicks in every minute of the day ***/
/*****************************************************************************/
#define NUM_MINUTES_PER_DAY (60*24) // 1440 minutes in a day
#define WIDTH_SEMIDIVISION_GRAPHIC 30
#define NUM_DIVISIONS_X 10
#define Sta_NUM_MINUTES_PER_DAY (60 * 24) // 1440 minutes in a day
#define Sta_WIDTH_SEMIDIVISION_GRAPHIC 30
#define Sta_NUM_DIVISIONS_X 10
static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *mysql_res)
{
@ -2823,7 +2823,7 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
unsigned MinuteDayRead = 0;
unsigned i;
struct Sta_Hits Hits;
float NumClicksPerMin[NUM_MINUTES_PER_DAY];
float NumClicksPerMin[Sta_NUM_MINUTES_PER_DAY];
float Power10LeastOrEqual;
float MaxX;
float IncX;
@ -2833,7 +2833,7 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
{
/***** Compute number of clicks (and máximo) in every minute *****/
Hits.Max = 0.0;
while (MinuteDay < NUM_MINUTES_PER_DAY)
while (MinuteDay < Sta_NUM_MINUTES_PER_DAY)
{
if (NumRow <= NumRows) // If not all the result of the query are yet read
{
@ -2855,7 +2855,7 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
}
else
for (i = MinuteDayRead + 1;
i < NUM_MINUTES_PER_DAY;
i < Sta_NUM_MINUTES_PER_DAY;
i++, MinuteDay++)
NumClicksPerMin[i] = 0.0;
}
@ -2868,7 +2868,7 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
Power10LeastOrEqual = (float) pow (10.0,floor (log10 ((double) Hits.Max)));
MaxX = ceil (Hits.Max / Power10LeastOrEqual) * Power10LeastOrEqual;
}
IncX = MaxX / (float) NUM_DIVISIONS_X;
IncX = MaxX / (float) Sta_NUM_DIVISIONS_X;
if (IncX >= 1.0)
Format = "%.0f";
else if (IncX >= 0.1)
@ -2885,7 +2885,7 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
/***** Y axis and graphic *****/
for (i = 0;
i < NUM_MINUTES_PER_DAY;
i < Sta_NUM_MINUTES_PER_DAY;
i++)
Sta_WriteAccessMinute (i,NumClicksPerMin[i],MaxX);
@ -2897,11 +2897,11 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
" alt=\"\" title=\"\""
" style=\"display:block; width:%upx; height:1px;\" />"
"</td>",
WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,
WIDTH_SEMIDIVISION_GRAPHIC);
Sta_WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,
Sta_WIDTH_SEMIDIVISION_GRAPHIC);
/* All the intermediate divisions */
for (i = 0;
i < NUM_DIVISIONS_X*2;
i < Sta_NUM_DIVISIONS_X * 2;
i++)
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\" style=\"width:%upx;\">"
"<img src=\"%s/ejex24x1.gif\""
@ -2909,8 +2909,8 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
" style=\"display:block;"
" width:%upx; height:1px;\" />"
"</td>",
WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,
WIDTH_SEMIDIVISION_GRAPHIC);
Sta_WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,
Sta_WIDTH_SEMIDIVISION_GRAPHIC);
/* Last division (right) */
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\" style=\"width:%upx;\">"
"<img src=\"%s/tr24x1.gif\""
@ -2918,8 +2918,8 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
" style=\"display:block; width:%upx; height:1px;\" />"
"</td>"
"</tr>",
WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,
WIDTH_SEMIDIVISION_GRAPHIC);
Sta_WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,
Sta_WIDTH_SEMIDIVISION_GRAPHIC);
/***** Write again the labels of the X axis *****/
Sta_WriteLabelsXAxisAccMin (IncX,Format);
@ -2930,7 +2930,7 @@ static void Sta_ShowAverageAccessesPerMinute (unsigned long NumRows,MYSQL_RES *m
/****** Write labels of the X axis in the graphic of clicks per minute *******/
/*****************************************************************************/
#define WIDTH_DIVISION_GRAPHIC (WIDTH_SEMIDIVISION_GRAPHIC*2) // 60
#define Sta_WIDTH_DIVISION_GRAPHIC (Sta_WIDTH_SEMIDIVISION_GRAPHIC * 2) // 60
static void Sta_WriteLabelsXAxisAccMin (float IncX,const char *Format)
{
@ -2939,12 +2939,12 @@ static void Sta_WriteLabelsXAxisAccMin (float IncX,const char *Format)
fprintf (Gbl.F.Out,"<tr>");
for (i = 0, NumX = 0;
i <= NUM_DIVISIONS_X;
i <= Sta_NUM_DIVISIONS_X;
i++, NumX += IncX)
{
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"LOG CENTER_BOTTOM\""
" style=\"width:%upx;\">",
WIDTH_DIVISION_GRAPHIC);
Sta_WIDTH_DIVISION_GRAPHIC);
fprintf (Gbl.F.Out,Format,NumX);
fprintf (Gbl.F.Out,"</td>");
}
@ -2955,7 +2955,7 @@ static void Sta_WriteLabelsXAxisAccMin (float IncX,const char *Format)
/***** Write a row of the graphic with number of clicks in every minute ******/
/*****************************************************************************/
#define WIDTH_GRAPHIC (WIDTH_DIVISION_GRAPHIC*NUM_DIVISIONS_X) // 60*10=600
#define Sta_WIDTH_GRAPHIC (Sta_WIDTH_DIVISION_GRAPHIC * Sta_NUM_DIVISIONS_X) // 60 * 10 = 600
static void Sta_WriteAccessMinute (unsigned Minute,float HitsNum,float MaxX)
{
@ -2974,8 +2974,8 @@ static void Sta_WriteAccessMinute (unsigned Minute,float HitsNum,float MaxX)
" background-repeat:repeat;\">"
"00h"
"</td>",
WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL);
else if (Minute == (NUM_MINUTES_PER_DAY - 30))
Sta_WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL);
else if (Minute == (Sta_NUM_MINUTES_PER_DAY - 30))
// If 23:30
fprintf (Gbl.F.Out,"<td rowspan=\"30\" class=\"LOG LEFT_BOTTOM\""
" style=\"width:%upx;"
@ -2984,7 +2984,7 @@ static void Sta_WriteAccessMinute (unsigned Minute,float HitsNum,float MaxX)
" background-repeat:repeat;\">"
"24h"
"</td>",
WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL);
Sta_WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL);
else if (!(Minute % 30) && (Minute % 60))
// If minute is multiple of 30 but not of 60 (i.e.: 30, 90, 150...)
fprintf (Gbl.F.Out,"<td rowspan=\"60\" class=\"LOG LEFT_MIDDLE\""
@ -2994,7 +2994,7 @@ static void Sta_WriteAccessMinute (unsigned Minute,float HitsNum,float MaxX)
" background-repeat:repeat;\">"
"%02uh"
"</td>",
WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,(Minute + 30) / 60);
Sta_WIDTH_SEMIDIVISION_GRAPHIC,Gbl.Prefs.IconsURL,(Minute + 30) / 60);
/***** Start of cell for the graphic *****/
fprintf (Gbl.F.Out,"<td colspan=\"%u\" class=\"LEFT_BOTTOM\""
@ -3002,13 +3002,13 @@ static void Sta_WriteAccessMinute (unsigned Minute,float HitsNum,float MaxX)
" background-image:url('%s/malla%c48x1.gif');"
" background-size:60px 1px;"
" background-repeat:repeat;\">",
NUM_DIVISIONS_X*2,WIDTH_GRAPHIC,Gbl.Prefs.IconsURL,
Sta_NUM_DIVISIONS_X * 2,Sta_WIDTH_GRAPHIC,Gbl.Prefs.IconsURL,
(Minute % 60) == 0 ? 'v' :
'h');
/***** Draw bar with anchura proporcional al number of clicks *****/
if (HitsNum != 0.0)
if ((BarWidth = (unsigned) (((HitsNum * (float) WIDTH_GRAPHIC / MaxX)) + 0.5)) != 0)
if ((BarWidth = (unsigned) (((HitsNum * (float) Sta_WIDTH_GRAPHIC / MaxX)) + 0.5)) != 0)
fprintf (Gbl.F.Out,"<img src=\"%s/b%c1x1.gif\""
" alt=\"\" title=\"\""
" style=\"display:block;"
@ -9423,5 +9423,7 @@ void Sta_WriteTime (char *Str,long TimeInMicroseconds)
else if (TimeInMicroseconds < (60 * 1000000L))
sprintf (Str,"%.1f s",(float) TimeInMicroseconds / 1E6);
else
sprintf (Str,"%ld min, %ld s",TimeInMicroseconds / (60*1000000L),(TimeInMicroseconds/1000000L) % 60);
sprintf (Str,"%ld min, %ld s",
TimeInMicroseconds / (60 * 1000000L),
(TimeInMicroseconds / 1000000L) % 60);
}

View File

@ -2620,7 +2620,7 @@ If what is read exceed MaxLength, abort and return 0.
If StrDelimit is not found, return -1.
*/
#define MAX_LENGTH_BOUNDARY_STR 100
#define Str_MAX_LENGTH_BOUNDARY_STR 100
int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
const char *BoundaryStr,
@ -2630,7 +2630,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
unsigned NumBytesIdentical; // Number of characters identical in each iteration of the loop
unsigned NumBytesReadButNotDiscarded; // Number of characters read from the source file...
// ...and not fully discarded in search
int Buffer[MAX_LENGTH_BOUNDARY_STR+1];
int Buffer[Str_MAX_LENGTH_BOUNDARY_STR + 1];
unsigned StartIndex;
unsigned i;
char *Ptr; // Pointer used to go through StrDst writing characters
@ -2643,7 +2643,7 @@ int Str_ReadFileUntilBoundaryStr (FILE *FileSrc,char *StrDst,
*StrDst = '\0';
return 1;
}
if (LengthBoundaryStr > MAX_LENGTH_BOUNDARY_STR)
if (LengthBoundaryStr > Str_MAX_LENGTH_BOUNDARY_STR)
Lay_ShowErrorAndExit ("Delimiter string too large.");
Ptr = StrDst;

View File

@ -683,7 +683,7 @@ static void Svy_WriteAuthor (struct Survey *Svy)
/***** Get data of author *****/
UsrDat.UsrCod = Svy->UsrCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Get of the database the data of the author
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
/***** Show photo *****/
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
@ -3727,7 +3727,8 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
/* Get possible parameter with the user's answer */
sprintf (ParamName,"Ans%010u",(unsigned) QstCod);
// Lay_ShowAlert (Lay_INFO,ParamName);
Par_GetParMultiToText (ParamName,StrAnswersIndexes,Svy_MAX_ANSWERS_PER_QUESTION*(10+1));
Par_GetParMultiToText (ParamName,StrAnswersIndexes,
Svy_MAX_ANSWERS_PER_QUESTION * (10 + 1));
Ptr = StrAnswersIndexes;
while (*Ptr)
{

View File

@ -7526,7 +7526,7 @@ static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumTestResults)
fprintf (Gbl.F.Out,"rowspan=\"%u\"",NumTestResults + 1);
fprintf (Gbl.F.Out," class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
@ -7697,7 +7697,7 @@ void Tst_ShowOneTestResult (void)
fprintf (Gbl.F.Out,", %s",
Gbl.Usrs.Other.UsrDat.FirstName);
fprintf (Gbl.F.Out,"<br />");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);

View File

@ -210,7 +210,7 @@ static void TT_GetParamsTimeTable (void)
Lay_ShowErrorAndExit ("Wrong code of group.");
}
else
Gbl.TimeTable.GrpCod = -1;
Gbl.TimeTable.GrpCod = -1L;
/***** Get place *****/
Par_GetParToText ("ModHorLugar",Gbl.TimeTable.Place,TT_MAX_BYTES_PLACE);
@ -879,7 +879,8 @@ static void TT_DrawTimeTable (void)
" style=\"width:%u%%; height:40px;\">"
"%2u:00"
"</td>",
TT_PERCENT_WIDTH_OF_AN_HOUR_COLUMN,TT_START_HOUR + (Hour+1)/2);
TT_PERCENT_WIDTH_OF_AN_HOUR_COLUMN,
TT_START_HOUR + (Hour + 1) / 2);
/* Empty column used to adjust height */
TT_DrawCellAlignTimeTable ();
@ -944,7 +945,8 @@ static void TT_DrawTimeTable (void)
" style=\"width:%u%%; height:40px;\">"
"%2u:00"
"</td>",
TT_PERCENT_WIDTH_OF_AN_HOUR_COLUMN,TT_START_HOUR + (Hour+1)/2);
TT_PERCENT_WIDTH_OF_AN_HOUR_COLUMN,
TT_START_HOUR + (Hour + 1) / 2);
fprintf (Gbl.F.Out,"</tr>");
}

View File

@ -1001,14 +1001,19 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
{
bool HeIsAStudentInCurrentCrs = UsrDat->RoleInCurrentCrsDB == Rol_STUDENT;
bool IBelongToCurrentCrs = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER;
bool IAmLoggedAsSysAdm = Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
if (UsrDat->RoleInCurrentCrsDB != Rol_STUDENT) // Not a student in the current course
return false;
return HeIsAStudentInCurrentCrs && // Course is selected and user is student in it
(IBelongToCurrentCrs || // I am student or teacher in current course
IAmLoggedAsSysAdm); // I am logged as system admin
// The user is a student in the current course
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_STUDENT:
case Rol_TEACHER:
case Rol_SYS_ADM:
return true;
default:
return false;
}
}
/*****************************************************************************/
@ -2261,7 +2266,7 @@ void Usr_WriteLoggedUsrHead (void)
}
/***** Show my photo *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO18x24",Pho_ZOOM,false);
@ -3189,7 +3194,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
{
/***** Show user's photo *****/
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE %s\">",BgColor);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
@ -3237,7 +3242,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
/***** Show guest's photo *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_NO_ZOOM,false);
@ -3339,7 +3344,7 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
/***** Show student's photo *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_NO_ZOOM,false);
@ -3458,7 +3463,7 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
/***** Show teacher's photo *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_NO_ZOOM,false);
@ -3537,7 +3542,7 @@ static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
/***** Show administrator's photo *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE COLOR%u\">",
Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
@ -5880,7 +5885,8 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr)
if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs)
{
/***** Allocate memory for the string with the list of group names where student belongs to *****/
if ((GroupNames = (char *) malloc ((Grp_MAX_LENGTH_GROUP_NAME+3)*Gbl.CurrentCrs.Grps.GrpTypes.NumGrpsTotal)) == NULL)
if ((GroupNames = (char *) malloc ((Grp_MAX_LENGTH_GROUP_NAME + 3) *
Gbl.CurrentCrs.Grps.GrpTypes.NumGrpsTotal)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store names of groups.");
/***** Start table with list of students *****/
@ -7258,7 +7264,6 @@ void Usr_SeeStudents (void)
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
(Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
/***** Get groups to show ******/
@ -7933,7 +7938,7 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
Usr_PutCheckboxToSelectUser (&UsrDat,UsrIsTheMsgSender);
/***** Show photo *****/
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
ClassPhoto,Pho_ZOOM,false);

View File

@ -3248,7 +3248,8 @@ int swad__sendMessage (struct soap *soap,
Str_RemoveLeadingArrobas (Nickname);
/* Check for overflow in query */
if (strlen (Query)+Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA+32 > Svc_MAX_LENGTH_QUERY_RECIPIENTS)
if (strlen (Query) + Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA + 32 >
Svc_MAX_LENGTH_QUERY_RECIPIENTS)
return soap_sender_fault (Gbl.soap,
"Can not send message",
"Too many recipients");