Version 14.38.7

This commit is contained in:
Antonio Cañas Vargas 2014-12-17 23:54:11 +01:00
parent 1e4a8aafdc
commit 0c54540382
2 changed files with 25 additions and 6 deletions

View File

@ -35,11 +35,12 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.38.6 (2014/12/17)" #define Log_PLATFORM_VERSION "SWAD 14.38.7 (2014/12/17)"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1
/* /*
Version 14.38.7 :Dic 17, 2014 Link to banned users is shown only if user has banned one or more users. (170792 lines)
Version 14.38.6 :Dic 17, 2014 Banned users option is integrated in received messages option. (170776 lines) Version 14.38.6 :Dic 17, 2014 Banned users option is integrated in received messages option. (170776 lines)
Version 14.38.5 :Dic 16, 2014 User's institution option is integrated in record card option. (170819 lines) Version 14.38.5 :Dic 16, 2014 User's institution option is integrated in record card option. (170819 lines)
Version 14.38.4 :Dic 16, 2014 User's photo option is integrated in record card option. (170941 lines) Version 14.38.4 :Dic 16, 2014 User's photo option is integrated in record card option. (170941 lines)

View File

@ -69,6 +69,7 @@ extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
static void Msg_PutFormMsgUsrs (const char *Content); static void Msg_PutFormMsgUsrs (const char *Content);
static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages); static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages);
static unsigned long Msg_GetNumUsrsBannedByMe (void);
static void Msg_PutLinkToViewBannedUsers(void); static void Msg_PutLinkToViewBannedUsers(void);
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod, static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod,
long FilterCrsCod,const char *FilterFromToSubquery); long FilterCrsCod,const char *FilterFromToSubquery);
@ -1459,9 +1460,12 @@ void Msg_ShowSntMsgs (void)
void Msg_ShowRecMsgs (void) void Msg_ShowRecMsgs (void)
{ {
/***** Link to view banned users *****/ /***** Link to view banned users *****/
fprintf (Gbl.F.Out,"<div align=\"center\" style=\"margin-bottom:10px;\">"); if (Msg_GetNumUsrsBannedByMe ())
Msg_PutLinkToViewBannedUsers (); {
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"<div align=\"center\" style=\"margin-bottom:10px;\">");
Msg_PutLinkToViewBannedUsers ();
fprintf (Gbl.F.Out,"</div>");
}
/***** Show the received messages *****/ /***** Show the received messages *****/
Msg_ShowSentOrReceivedMessages (Msg_MESSAGES_RECEIVED); Msg_ShowSentOrReceivedMessages (Msg_MESSAGES_RECEIVED);
@ -1601,6 +1605,20 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/
/********************* Get number of user I have banned **********************/
/*****************************************************************************/
static unsigned long Msg_GetNumUsrsBannedByMe (void)
{
char Query[128];
/***** Get number of users I have banned *****/
sprintf (Query,"SELECT COUNT(*) FROM msg_banned WHERE ToUsrCod='%ld'",
Gbl.Usrs.Me.UsrDat.UsrCod);
return DB_QueryCOUNT (Query,"can not get number of users you have banned");
}
/*****************************************************************************/ /*****************************************************************************/
/****************** Put a link (form) to view banned users *******************/ /****************** Put a link (form) to view banned users *******************/
/*****************************************************************************/ /*****************************************************************************/
@ -3311,14 +3329,14 @@ static void Msg_UnbanSender (void)
} }
/*****************************************************************************/ /*****************************************************************************/
/************************ Unban a sender of a message ************************/ /**************** Chech if a user is banned by another user ******************/
/*****************************************************************************/ /*****************************************************************************/
static bool Msg_CheckIfUsrIsBanned (long FromUsrCod,long ToUsrCod) static bool Msg_CheckIfUsrIsBanned (long FromUsrCod,long ToUsrCod)
{ {
char Query[256]; char Query[256];
/***** Get if the message code is in table of sent messages not deleted *****/ /***** Get if FromUsrCod is banned by ToUsrCod *****/
sprintf (Query,"SELECT COUNT(*) FROM msg_banned" sprintf (Query,"SELECT COUNT(*) FROM msg_banned"
" WHERE FromUsrCod='%ld' AND ToUsrCod='%ld'", " WHERE FromUsrCod='%ld' AND ToUsrCod='%ld'",
FromUsrCod,ToUsrCod); FromUsrCod,ToUsrCod);