mirror of https://github.com/acanas/swad-core.git
Version 15.20
This commit is contained in:
parent
1221d128f8
commit
5936cfac19
|
@ -108,11 +108,12 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.19 (2015/10/23)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.20 (2015/10/24)"
|
||||
|
||||
// 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 15.20: Oct 24, 2015 Date-times in notifications, messages and forums are displayed in client local date-time. (186334 lines)
|
||||
Version 15.19: Oct 23, 2015 Surveys date-times are displayed in client local date-time. (186309 lines)
|
||||
Version 15.18: Oct 23, 2015 Attendance date-times are displayed in client local date-time.
|
||||
Changes in JavaScript functions related to date-time. (186403 lines)
|
||||
|
|
|
@ -2162,6 +2162,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
bool ShowPhoto = false;
|
||||
char PhotoURL[PATH_MAX+1];
|
||||
Rol_Role_t DesiredRole;
|
||||
time_t RequestTimeUTC;
|
||||
|
||||
/***** Start frame *****/
|
||||
Lay_StartRoundFrame (NULL,Txt_Enrollment_requests);
|
||||
|
@ -2240,7 +2241,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2254,7 +2255,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||
" AND admin.Cod=courses.DegCod"
|
||||
|
@ -2269,7 +2270,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Ctr'"
|
||||
" AND admin.Cod=degrees.CtrCod"
|
||||
|
@ -2285,7 +2286,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Ins'"
|
||||
" AND admin.Cod=centres.InsCod"
|
||||
|
@ -2302,7 +2303,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"CrsCod,"
|
||||
"UsrCod,"
|
||||
"Role,"
|
||||
"DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(RequestTime)"
|
||||
" FROM crs_usr_requests"
|
||||
" WHERE ((1<<Role)&%u)<>0"
|
||||
" ORDER BY RequestTime DESC",
|
||||
|
@ -2321,7 +2322,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
|
@ -2340,7 +2341,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
|
@ -2359,7 +2360,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Ctr'"
|
||||
" AND admin.Cod=centres.CtrCod"
|
||||
|
@ -2379,7 +2380,7 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM centres,degrees,courses,crs_usr_requests"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
|
@ -2399,7 +2400,11 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
switch (Gbl.Usrs.Me.LoggedRole)
|
||||
{
|
||||
case Rol_TEACHER:
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
|
||||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,degrees,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
|
@ -2413,7 +2418,11 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
Roles);
|
||||
break;
|
||||
case Rol_DEG_ADM:
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
|
||||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM admin,degrees,courses,crs_usr_requests"
|
||||
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
|
||||
" AND admin.Cod=degrees.DegCod"
|
||||
|
@ -2429,7 +2438,11 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
case Rol_CTR_ADM: // If I am logged as admin of this centre , I can view all the requesters from this centre
|
||||
case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all the requesters from this centre
|
||||
case Rol_SYS_ADM:
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
|
||||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM degrees,courses,crs_usr_requests"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
|
@ -2448,7 +2461,11 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
switch (Gbl.Usrs.Me.LoggedRole)
|
||||
{
|
||||
case Rol_TEACHER:
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
|
||||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM crs_usr,courses,crs_usr_requests"
|
||||
" WHERE crs_usr.UsrCod='%ld'"
|
||||
" AND crs_usr.CrsCod=courses.CrsCod"
|
||||
|
@ -2464,7 +2481,11 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
case Rol_CTR_ADM: // If I am logged as admin of this centre , I can view all the requesters from this degree
|
||||
case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all the requesters from this degree
|
||||
case Rol_SYS_ADM:
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT crs_usr_requests.ReqCod,"
|
||||
"crs_usr_requests.CrsCod,"
|
||||
"crs_usr_requests.UsrCod,"
|
||||
"crs_usr_requests.Role,"
|
||||
"UNIX_TIMESTAMP(crs_usr_requests.RequestTime)"
|
||||
" FROM courses,crs_usr_requests"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=crs_usr_requests.CrsCod"
|
||||
|
@ -2486,7 +2507,8 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
case Rol_CTR_ADM: // If I am logged as admin of this centre , I can view all the requesters from this course
|
||||
case Rol_INS_ADM: // If I am logged as admin of this institution, I can view all the requesters from this course
|
||||
case Rol_SYS_ADM:
|
||||
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,"
|
||||
"UNIX_TIMESTAMP(RequestTime)"
|
||||
" FROM crs_usr_requests"
|
||||
" WHERE CrsCod='%ld'"
|
||||
" AND ((1<<Role)&%u)<>0"
|
||||
|
@ -2619,7 +2641,8 @@ void Enr_ShowEnrollmentRequests (void)
|
|||
Txt_ROLES_SINGUL_abc[DesiredRole][UsrDat.Sex]);
|
||||
|
||||
/***** Request time (row[4]) *****/
|
||||
Msg_WriteMsgDate (row[4],"DAT");
|
||||
RequestTimeUTC = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
Msg_WriteMsgDate (RequestTimeUTC,"DAT");
|
||||
|
||||
/***** Button to confirm the request *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_TOP\">");
|
||||
|
|
|
@ -5765,7 +5765,7 @@ void Brw_ParamListFiles (Brw_FileType_t FileType,const char *PathInTree,const ch
|
|||
static void Brw_WriteDatesAssignment (void)
|
||||
{
|
||||
extern const char *Txt_unknown_assignment;
|
||||
static unsigned UniqueId;
|
||||
static unsigned UniqueId = 0;
|
||||
|
||||
fprintf (Gbl.F.Out,"<td colspan=\"2\""
|
||||
" class=\"ASG_LST_DATE_GREEN RIGHT_MIDDLE COLOR%u\">",
|
||||
|
@ -5778,12 +5778,12 @@ static void Brw_WriteDatesAssignment (void)
|
|||
/***** Write start date *****/
|
||||
fprintf (Gbl.F.Out,"<table>"
|
||||
"<tr>"
|
||||
"<td id=\"asg_start_date%u\" class=\"%s RIGHT_MIDDLE\">",
|
||||
"<td id=\"asg_start_date_%u\" class=\"%s RIGHT_MIDDLE\">",
|
||||
UniqueId,
|
||||
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
|
||||
"ASG_LST_DATE_RED");
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||
"writeLocalDateTimeFromUTC('asg_start_date%u',%ld,' ');"
|
||||
"writeLocalDateTimeFromUTC('asg_start_date_%u',%ld,' ');"
|
||||
"</script>",
|
||||
UniqueId,
|
||||
(long) Gbl.FileBrowser.Asg.TimeUTC[Asg_START_TIME]);
|
||||
|
@ -5800,12 +5800,12 @@ static void Brw_WriteDatesAssignment (void)
|
|||
"red");
|
||||
|
||||
/***** Write end date *****/
|
||||
fprintf (Gbl.F.Out,"<td id=\"asg_end_date%u\" class=\"%s RIGHT_MIDDLE\">",
|
||||
fprintf (Gbl.F.Out,"<td id=\"asg_end_date_%u\" class=\"%s RIGHT_MIDDLE\">",
|
||||
UniqueId,
|
||||
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
|
||||
"ASG_LST_DATE_RED");
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||
"writeLocalDateTimeFromUTC('asg_end_date%u',%ld,' ');"
|
||||
"writeLocalDateTimeFromUTC('asg_end_date_%u',%ld,' ');"
|
||||
"</script>",
|
||||
UniqueId,
|
||||
(long) Gbl.FileBrowser.Asg.TimeUTC[Asg_END_TIME]);
|
||||
|
|
123
swad_forum.c
123
swad_forum.c
|
@ -241,6 +241,12 @@ const Act_Action_t For_ActionsDisPstFor[For_NUM_TYPES_FORUM] =
|
|||
/***************************** Private prototypes ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_UpdateThrReadTime (long ThrCod,time_t ReadTimeUTC);
|
||||
static unsigned For_GetNumOfReadersOfThr (long ThrCod);
|
||||
static unsigned For_GetNumOfWritersInThr (long ThrCod);
|
||||
static unsigned For_GetNumPstsInThr (long ThrCod);
|
||||
static unsigned For_GetNumMyPstInThr (long ThrCod);
|
||||
static time_t For_GetThrReadTime (long ThrCod);
|
||||
static void For_ShowThreadPosts (long ThrCod,char *LastSubject);
|
||||
static void For_PutParamWhichForum (void);
|
||||
static void For_PutParamForumOrder (void);
|
||||
|
@ -270,8 +276,11 @@ static void For_WriteThrSubject (long ThrCod);
|
|||
static long For_GetParamThrCod (void);
|
||||
static void For_PutHiddenParamPstCod (long PstCod);
|
||||
static long For_GetParamPstCod (void);
|
||||
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,bool LastPst,char *LastSubject,bool NewPst,bool ICanModerateForum);
|
||||
static void For_GetPstData (long PstCod,long *UsrCod,char *CreatTime,char *Subject, char *Content);
|
||||
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,
|
||||
bool LastPst,char *LastSubject,
|
||||
bool NewPst,bool ICanModerateForum);
|
||||
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||
char *Subject, char *Content);
|
||||
static void For_WriteNumberOfPosts (For_ForumType_t ForumType,long UsrCod);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -699,14 +708,14 @@ long For_GetLastPstCod (long ThrCod)
|
|||
// have been read and have no new posts for the current user
|
||||
// (even if any previous pages have been no read actually)
|
||||
|
||||
void For_UpdateThrReadTime (long ThrCod,const char *ReadTime)
|
||||
static void For_UpdateThrReadTime (long ThrCod,time_t ReadTimeUTC)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Insert or replace pair ThrCod-UsrCod in forum_thr_read *****/
|
||||
sprintf (Query,"REPLACE INTO forum_thr_read (ThrCod,UsrCod,ReadTime)"
|
||||
" VALUES ('%ld','%ld','%s')",
|
||||
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,ReadTime);
|
||||
" VALUES ('%ld','%ld',FROM_UNIXTIME('%ld'))",
|
||||
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,(long) ReadTimeUTC);
|
||||
DB_QueryREPLACE (Query,"can not update the status of reading of a thread of a forum");
|
||||
}
|
||||
|
||||
|
@ -714,7 +723,7 @@ void For_UpdateThrReadTime (long ThrCod,const char *ReadTime)
|
|||
/**************** Get number of users that have read a thread ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
||||
static unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
|
@ -728,7 +737,7 @@ unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
|||
/********** Get number of users that have write posts in a thread ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumOfWritersInThr (long ThrCod)
|
||||
static unsigned For_GetNumOfWritersInThr (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -757,7 +766,7 @@ unsigned For_GetNumOfWritersInThr (long ThrCod)
|
|||
/********************** Get number of posts in a thread **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumPstsInThr (long ThrCod)
|
||||
static unsigned For_GetNumPstsInThr (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
|
@ -772,7 +781,7 @@ unsigned For_GetNumPstsInThr (long ThrCod)
|
|||
/************** Get whether there are posts of mine in a thread **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumMyPstInThr (long ThrCod)
|
||||
static unsigned For_GetNumMyPstInThr (long ThrCod)
|
||||
{
|
||||
char Query[128];
|
||||
|
||||
|
@ -800,35 +809,33 @@ unsigned long For_GetNumPostsUsr (long UsrCod)
|
|||
/*****************************************************************************/
|
||||
/****************** Get thread read time for the current user ****************/
|
||||
/*****************************************************************************/
|
||||
// ReadTime is return in YYYYMMDDHHMMSS format
|
||||
|
||||
void For_GetThrReadTime (long ThrCod,char *ReadTime)
|
||||
static time_t For_GetThrReadTime (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
time_t ReadTimeUTC;
|
||||
|
||||
/***** Get read time of a thread from database *****/
|
||||
sprintf (Query,"SELECT DATE_FORMAT(ReadTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT UNIX_TIMESTAMP(ReadTime)"
|
||||
" FROM forum_thr_read"
|
||||
" WHERE ThrCod='%ld' AND UsrCod='%ld'",
|
||||
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get date of reading of a thread of a forum");
|
||||
|
||||
/***** Check if there is a row with read time *****/
|
||||
if (NumRows)
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get date of reading of a thread of a forum"))
|
||||
{
|
||||
/***** There is a row ==> get read time inf format YYYYMMDDHHMMSS *****/
|
||||
/***** There is a row ==> get read time *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
strncpy (ReadTime,row[0],4+2+2+2+2+2);
|
||||
ReadTime[4+2+2+2+2+2] = '\0';
|
||||
|
||||
ReadTimeUTC = Dat_GetUNIXTimeFromStr (row[0]);
|
||||
}
|
||||
else
|
||||
strcpy (ReadTime,"00000000000000"); // If there is no row for this thread and current user, then current user has not read this thread
|
||||
ReadTimeUTC = (time_t) 0; // If there is no row for this thread and current user, then current user has not read this thread
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return ReadTimeUTC;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -877,7 +884,8 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
|||
unsigned long NumRow,NumRows;
|
||||
unsigned NumPst = 0; // Initialized to avoid warning
|
||||
unsigned NumPsts;
|
||||
char ReadTime[4+2+2+2+2+2+1]; // Read time of thread for the current user in YYYYMMDDHHMMSS format
|
||||
time_t ReadTimeUTC; // Read time of thread for the current user
|
||||
time_t CreatTimeUTC; // Creation time of post
|
||||
struct Pagination Pagination;
|
||||
long PstCod;
|
||||
bool NewPst = false;
|
||||
|
@ -897,7 +905,7 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
|||
Gbl.Forum.ThreadToMove = For_GetThrInMyClipboard ();
|
||||
|
||||
/* Get thread read time for the current user */
|
||||
For_GetThrReadTime (ThrCod,ReadTime);
|
||||
ReadTimeUTC = For_GetThrReadTime (ThrCod);
|
||||
|
||||
/* Table start */
|
||||
Lay_StartRoundFrame (NULL,Txt_Thread);
|
||||
|
@ -933,7 +941,7 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
|||
For_WriteThrSubject (ThrCod);
|
||||
|
||||
/***** Get posts of a thread from database *****/
|
||||
sprintf (Query,"SELECT PstCod,DATE_FORMAT(CreatTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT PstCod,UNIX_TIMESTAMP(CreatTime)"
|
||||
" FROM forum_post"
|
||||
" WHERE ThrCod='%ld' ORDER BY PstCod",
|
||||
ThrCod);
|
||||
|
@ -999,17 +1007,21 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
|||
if (sscanf (row[0],"%ld",&PstCod) != 1)
|
||||
Lay_ShowErrorAndExit ("Wrong code of post.");
|
||||
|
||||
CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
|
||||
|
||||
NumPst = (unsigned) NumRow;
|
||||
NewPst = (strcmp (row[1],ReadTime) > 0);
|
||||
NewPst = (CreatTimeUTC > ReadTimeUTC);
|
||||
|
||||
if (NewPst && NumRow == Pagination.LastItemVisible)
|
||||
/* Update forum_thr_read table indicating that this thread page and previous ones
|
||||
have been read and have no new posts for the current user
|
||||
(even if any previous pages have been no read actually) */
|
||||
For_UpdateThrReadTime (ThrCod,row[1]);
|
||||
For_UpdateThrReadTime (ThrCod,CreatTimeUTC);
|
||||
|
||||
/* Show post */
|
||||
For_ShowAForumPost (&Thr,NumPst,PstCod,(NumRow == NumRows),LastSubject,NewPst,ICanModerateForum);
|
||||
For_ShowAForumPost (&Thr,NumPst,PstCod,
|
||||
(NumRow == NumRows),LastSubject,
|
||||
NewPst,ICanModerateForum);
|
||||
|
||||
/* Mark possible notification as seen */
|
||||
switch (Gbl.Forum.ForumType)
|
||||
|
@ -1044,7 +1056,9 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
|
|||
/**************************** Show a post from forum *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,bool LastPst,char *LastSubject,bool NewPst,bool ICanModerateForum)
|
||||
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,
|
||||
bool LastPst,char *LastSubject,
|
||||
bool NewPst,bool ICanModerateForum)
|
||||
{
|
||||
extern const char *Txt_unread_MESSAGE;
|
||||
extern const char *Txt_MSG_Open;
|
||||
|
@ -1056,7 +1070,7 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
extern const char *Txt_Post_X_banned_Click_to_unban_it;
|
||||
extern const char *Txt_This_post_has_been_banned_probably_for_not_satisfy_the_rules_of_the_forums;
|
||||
struct UsrData UsrDat;
|
||||
char CreatTime[4+2+2+2+2+2+1]; // Creation time of a post in YYYYMMDDHHMMSS format
|
||||
time_t CreatTimeUTC; // Creation time of a post
|
||||
char OriginalContent[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT+1];
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||
|
@ -1069,7 +1083,7 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
Enabled = For_GetIfPstIsEnabled (PstCod);
|
||||
|
||||
/***** Get data of post *****/
|
||||
For_GetPstData (PstCod,&UsrDat.UsrCod,CreatTime,Subject,OriginalContent);
|
||||
For_GetPstData (PstCod,&UsrDat.UsrCod,&CreatTimeUTC,Subject,OriginalContent);
|
||||
if (Enabled)
|
||||
{
|
||||
/* Return this subject as last subject */
|
||||
|
@ -1098,8 +1112,8 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
Msg_WriteMsgNumber ((unsigned long) PstNum,NewPst);
|
||||
|
||||
/***** Write date *****/
|
||||
Msg_WriteMsgDate (CreatTime,NewPst ? "MSG_TIT_BG_NEW" :
|
||||
"MSG_TIT_BG");
|
||||
Msg_WriteMsgDate (CreatTimeUTC,NewPst ? "MSG_TIT_BG_NEW" :
|
||||
"MSG_TIT_BG");
|
||||
|
||||
/***** Write subject *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">",
|
||||
|
@ -1221,7 +1235,8 @@ static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long Pst
|
|||
/*************************** Get data of a forum post ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_GetPstData (long PstCod,long *UsrCod,char *CreatTime,char *Subject, char *Content)
|
||||
static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
|
||||
char *Subject, char *Content)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -1229,7 +1244,7 @@ static void For_GetPstData (long PstCod,long *UsrCod,char *CreatTime,char *Subje
|
|||
unsigned NumRows;
|
||||
|
||||
/***** Get data of a post from database *****/
|
||||
sprintf (Query,"SELECT UsrCod,DATE_FORMAT(CreatTime,'%%Y%%m%%d%%H%%i%%S'),Subject,Content"
|
||||
sprintf (Query,"SELECT UsrCod,UNIX_TIMESTAMP(CreatTime),Subject,Content"
|
||||
" FROM forum_post WHERE PstCod='%ld'",PstCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a post");
|
||||
|
||||
|
@ -1244,7 +1259,7 @@ static void For_GetPstData (long PstCod,long *UsrCod,char *CreatTime,char *Subje
|
|||
*UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/****** Get creation time (row[1]) *****/
|
||||
strcpy (CreatTime,row[1]);
|
||||
*CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[1]);
|
||||
|
||||
/****** Get subject (row[2]) *****/
|
||||
strcpy (Subject,row[2]);
|
||||
|
@ -3212,12 +3227,13 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
|
|||
extern const char *Txt_There_are_new_posts;
|
||||
extern const char *Txt_No_new_posts;
|
||||
extern const char *Txt_Move_thread;
|
||||
static unsigned UniqueId = 0;
|
||||
unsigned NumThr;
|
||||
unsigned NumThrInScreen; // From 0 to Pag_ITEMS_PER_PAGE-1
|
||||
struct ForumThread Thr;
|
||||
struct UsrData UsrDat;
|
||||
For_ForumOrderType_t Order;
|
||||
const char *DateTime;
|
||||
time_t TimeUTC;
|
||||
struct Pagination PaginationPsts;
|
||||
const char *Style;
|
||||
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
|
||||
|
@ -3326,7 +3342,7 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
|
|||
true);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** Write the authors and dates of first and last posts *****/
|
||||
/***** Write the authors and date-times of first and last posts *****/
|
||||
for (Order = For_FIRST_MSG;
|
||||
Order <= For_LAST_MSG;
|
||||
Order++)
|
||||
|
@ -3339,13 +3355,15 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
|
|||
Msg_WriteMsgAuthor (&UsrDat,68,9,Style,Thr.Enabled[Order],BgColor);
|
||||
|
||||
/* Write the date of first or last message (it's in YYYYMMDDHHMMSS format) */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP %s\">",
|
||||
Style,BgColor);
|
||||
DateTime = Thr.WriteTime[Order];
|
||||
Dat_WriteDate (DateTime);
|
||||
fprintf (Gbl.F.Out,"<br />");
|
||||
Dat_WriteHourMinute (&DateTime[8]);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
TimeUTC = Thr.WriteTime[Order];
|
||||
UniqueId++;
|
||||
fprintf (Gbl.F.Out,"<td id=\"date_%u\" class=\"%s LEFT_TOP %s\">"
|
||||
"<script type=\"text/javascript\">"
|
||||
"writeLocalDateTimeFromUTC('date_%u',%ld,'<br />');"
|
||||
"</script>"
|
||||
"</td>",
|
||||
UniqueId,Style,BgColor,
|
||||
UniqueId,(long) TimeUTC);
|
||||
}
|
||||
else
|
||||
for (Column = 1;
|
||||
|
@ -3405,7 +3423,8 @@ void For_GetThrData (struct ForumThread *Thr)
|
|||
|
||||
/***** Get data of a thread from database *****/
|
||||
sprintf (Query,"SELECT m0.PstCod,m1.PstCod,m0.UsrCod,m1.UsrCod,"
|
||||
"DATE_FORMAT(m0.CreatTime,'%%Y%%m%%d%%H%%i%%S'),DATE_FORMAT(m1.CreatTime,'%%Y%%m%%d%%H%%i%%S'),"
|
||||
"UNIX_TIMESTAMP(m0.CreatTime),"
|
||||
"UNIX_TIMESTAMP(m1.CreatTime),"
|
||||
"m0.Subject"
|
||||
" FROM forum_thread,forum_post AS m0,forum_post AS m1"
|
||||
" WHERE forum_thread.ThrCod='%ld' AND forum_thread.FirstPstCod=m0.PstCod AND forum_thread.LastPstCod=m1.PstCod",
|
||||
|
@ -3432,12 +3451,10 @@ void For_GetThrData (struct ForumThread *Thr)
|
|||
Thr->UsrCod[For_LAST_MSG] = Str_ConvertStrCodToLongCod (row[3]);
|
||||
|
||||
/***** Get the date of the first message in this thread (row[4]) *****/
|
||||
strncpy (Thr->WriteTime[For_FIRST_MSG],row[4],Cns_MAX_BYTES_DATE);
|
||||
Thr->WriteTime[For_FIRST_MSG][Cns_MAX_BYTES_DATE] = '\0';
|
||||
Thr->WriteTime[For_FIRST_MSG] = Dat_GetUNIXTimeFromStr (row[4]);
|
||||
|
||||
/***** Get the date of the last message in this thread (row[5]) *****/
|
||||
strncpy (Thr->WriteTime[For_LAST_MSG],row[5],Cns_MAX_BYTES_DATE);
|
||||
Thr->WriteTime[For_LAST_MSG][Cns_MAX_BYTES_DATE] = '\0';
|
||||
/***** Get the date of the last message in this thread (row[5]) *****/
|
||||
Thr->WriteTime[For_LAST_MSG ] = Dat_GetUNIXTimeFromStr (row[5]);
|
||||
|
||||
/***** Get the subject of this thread (row[6]) *****/
|
||||
strncpy (Thr->Subject,row[6],Cns_MAX_BYTES_SUBJECT);
|
||||
|
@ -3839,7 +3856,7 @@ void For_DelPst (void)
|
|||
extern const char *Txt_Post_removed;
|
||||
long PstCod,ThrCod;
|
||||
struct UsrData UsrDat;
|
||||
char CreatTime[4+2+2+2+2+2+1]; // Creation time of a message in YYYYMMDDHHMMSS format
|
||||
time_t CreatTimeUTC; // Creation time of a message
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT+1];
|
||||
char OriginalContent[Cns_MAX_BYTES_TEXT+1];
|
||||
bool ThreadDeleted = false;
|
||||
|
@ -3860,7 +3877,7 @@ void For_DelPst (void)
|
|||
Lay_ShowErrorAndExit ("The post to remove no longer exists.");
|
||||
|
||||
/* Check if I am the author of the message */
|
||||
For_GetPstData (PstCod,&UsrDat.UsrCod,CreatTime,Subject,OriginalContent);
|
||||
For_GetPstData (PstCod,&UsrDat.UsrCod,&CreatTimeUTC,Subject,OriginalContent);
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod)
|
||||
Lay_ShowErrorAndExit ("You can not remove post because you aren't the author.");
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ struct ForumThread
|
|||
long ThrCod;
|
||||
long PstCod[2];
|
||||
long UsrCod[2];
|
||||
char WriteTime[2][Cns_MAX_BYTES_DATE+1];
|
||||
time_t WriteTime[2];
|
||||
bool Enabled[2];
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT+1];
|
||||
unsigned NumPosts;
|
||||
|
@ -105,13 +105,7 @@ For_ForumType_t For_GetForumTypeOfAPost (long PstCod);
|
|||
void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod);
|
||||
void For_UpdateThrLastPst (long ThrCod,long LastPstCod);
|
||||
long For_GetLastPstCod (long ThrCod);
|
||||
void For_UpdateThrReadTime (long ThrCod,const char *ReadTime);
|
||||
unsigned For_GetNumOfReadersOfThr (long ThrCod);
|
||||
unsigned For_GetNumOfWritersInThr (long ThrCod);
|
||||
unsigned For_GetNumPstsInThr (long ThrCod);
|
||||
unsigned For_GetNumMyPstInThr (long ThrCod);
|
||||
unsigned long For_GetNumPostsUsr (long UsrCod);
|
||||
void For_GetThrReadTime (long ThrCod,char *ReadTime);
|
||||
void For_DeleteThrFromReadThrs (long ThrCod);
|
||||
void For_RemoveUsrFromReadThrs (long UsrCod);
|
||||
|
||||
|
|
|
@ -103,7 +103,8 @@ static bool Msg_CheckIfSentMsgIsDeleted (long MsgCod);
|
|||
static bool Msg_CheckIfReceivedMsgIsDeletedForAllItsRecipients (long MsgCod);
|
||||
static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromToSubquery);
|
||||
|
||||
static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,char *CreatTime,char *Subject,bool *Deleted);
|
||||
static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
||||
time_t *CreatTimeUTC,char *Subject,bool *Deleted);
|
||||
static void Msg_GetMsgContent (long MsgCod,char *Content);
|
||||
|
||||
static void Msg_WriteSentOrReceivedMsgSubject (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod,const char *Subject,bool Open,bool Expanded);
|
||||
|
@ -2406,7 +2407,8 @@ static void Msg_GetParamOnlyUnreadMsgs (void)
|
|||
/***************************** Get data of a message *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,char *CreatTime,char *Subject,bool *Deleted)
|
||||
static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
||||
time_t *CreatTimeUTC,char *Subject,bool *Deleted)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -2415,14 +2417,14 @@ static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,char *Creat
|
|||
|
||||
/***** Get data of message from table msg_snt *****/
|
||||
*Deleted = false;
|
||||
sprintf (Query,"SELECT CrsCod,UsrCod,DATE_FORMAT(CreatTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT CrsCod,UsrCod,UNIX_TIMESTAMP(CreatTime)"
|
||||
" FROM msg_snt WHERE MsgCod='%ld'",MsgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a message");
|
||||
|
||||
if (NumRows == 0) // If not result ==> sent message is deleted
|
||||
{
|
||||
/***** Get data of message from table msg_snt_deleted *****/
|
||||
sprintf (Query,"SELECT CrsCod,UsrCod,DATE_FORMAT(CreatTime,'%%Y%%m%%d%%H%%i%%S')"
|
||||
sprintf (Query,"SELECT CrsCod,UsrCod,UNIX_TIMESTAMP(CreatTime)"
|
||||
" FROM msg_snt_deleted WHERE MsgCod='%ld'",MsgCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get data of a message");
|
||||
|
||||
|
@ -2443,7 +2445,7 @@ static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,char *Creat
|
|||
*UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get creation time (row[2]) */
|
||||
strcpy (CreatTime,row[2]);
|
||||
*CreatTimeUTC = Dat_GetUNIXTimeFromStr (row[2]);
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -2592,21 +2594,21 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
|||
extern const char *Txt_MSG_Message;
|
||||
struct UsrData UsrDat;
|
||||
const char *Title;
|
||||
bool FromThisCrs = false; // Initialized to avoid warning
|
||||
char CreatTime[4+2+2+2+2+2+1]; // Creation time of a message in YYYYMMDDHHMMSS format
|
||||
bool FromThisCrs = false; // Initialized to avoid warning
|
||||
time_t CreatTimeUTC; // Creation time of a message
|
||||
long CrsCod;
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT+1];
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||
bool Deleted;
|
||||
bool Open = true;
|
||||
bool Replied = false; // Initialized to avoid warning
|
||||
bool Replied = false; // Initialized to avoid warning
|
||||
bool Expanded = false;
|
||||
|
||||
/***** Initialize structure with user's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** Get data of message *****/
|
||||
Msg_GetMsgSntData (MsgCod,&CrsCod,&UsrDat.UsrCod,CreatTime,Subject,&Deleted);
|
||||
Msg_GetMsgSntData (MsgCod,&CrsCod,&UsrDat.UsrCod,&CreatTimeUTC,Subject,&Deleted);
|
||||
switch (TypeOfMessages)
|
||||
{
|
||||
case Msg_MESSAGES_RECEIVED:
|
||||
|
@ -2658,10 +2660,10 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
|||
/***** Write subject *****/
|
||||
Msg_WriteSentOrReceivedMsgSubject (TypeOfMessages,MsgCod,Subject,Open,Expanded);
|
||||
|
||||
/***** Write date *****/
|
||||
Msg_WriteMsgDate (CreatTime,
|
||||
Open ? "MSG_TIT_BG" :
|
||||
"MSG_TIT_BG_NEW");
|
||||
/***** Write date-time *****/
|
||||
Msg_WriteMsgDate (CreatTimeUTC,Open ? "MSG_TIT_BG" :
|
||||
"MSG_TIT_BG_NEW");
|
||||
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
|
||||
if (Expanded)
|
||||
|
@ -3233,17 +3235,26 @@ static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod)
|
|||
/*****************************************************************************/
|
||||
/******************* Write the date of creation of a message *****************/
|
||||
/*****************************************************************************/
|
||||
// TimeUTC holds UTC date and time in UNIX format (seconds since 1970)
|
||||
|
||||
void Msg_WriteMsgDate (const char *DateTime,const char *ClassBackground)
|
||||
void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground)
|
||||
{
|
||||
/***** Start cell *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP\" style=\"width:106px;\">",
|
||||
ClassBackground);
|
||||
static unsigned UniqueId = 0;
|
||||
|
||||
/***** Write date and time (DateTime holds date and time in YYYYMMDDHHMMSS format) *****/
|
||||
Dat_WriteDate (DateTime);
|
||||
fprintf (Gbl.F.Out," ");
|
||||
Dat_WriteHourMinute (&DateTime[8]);
|
||||
UniqueId++;
|
||||
|
||||
/***** Start cell *****/
|
||||
fprintf (Gbl.F.Out,"<td id=\"date_%u\" class=\"%s RIGHT_TOP\""
|
||||
" style=\"width:106px;\">",
|
||||
UniqueId,ClassBackground);
|
||||
|
||||
/***** Write date and time *****/
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||
"writeLocalDateTimeFromUTC('date_%u',%ld,' ');"
|
||||
"</script>",
|
||||
UniqueId,(long) TimeUTC);
|
||||
|
||||
/***** End cell *****/
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
}
|
||||
|
||||
|
@ -3305,20 +3316,6 @@ static long Msg_GetParamMsgCod (void)
|
|||
return MsgCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Write a link to netiquette rules ********************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
void Msg_WriteLinkToNetiquette (void)
|
||||
{
|
||||
extern const char *Txt_Mandatory_rules_to_compose_messages;
|
||||
char Title[1024];
|
||||
|
||||
sprintf (Title,"<a href=\"%s\" target=\"_blank\">%s</a>",
|
||||
Cfg_NETTIQUETE,Txt_Mandatory_rules_to_compose_messages);
|
||||
Lay_WriteTitle (Title);
|
||||
}
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/***************** Put a form to ban the sender of a message *****************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -103,13 +103,11 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat,unsigned WidthOfNameColumn,unsig
|
|||
const char *Style,bool Enabled,const char *BgColor);
|
||||
bool Msg_WriteCrsOrgMsg (long CrsCod);
|
||||
void Msg_WriteListUsrsDstMsg (long MsgCod);
|
||||
void Msg_WriteMsgDate (const char *DateTime,const char *ClassBackground);
|
||||
void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground);
|
||||
void Msg_WriteMsgContent (char *Content,unsigned long MaxLength,bool InsertLinks,bool ChangeBRToRet);
|
||||
|
||||
void Msg_PutHiddenParamMsgCod (long MsgCod);
|
||||
|
||||
// void Msg_WriteLinkToNetiquette (void);
|
||||
|
||||
void Msg_BanSenderWhenShowingMsgs (void);
|
||||
void Msg_UnbanSenderWhenShowingMsgs (void);
|
||||
void Msg_UnbanSenderWhenListingUsrs (void);
|
||||
|
|
|
@ -273,7 +273,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
struct Course Crs;
|
||||
long Cod;
|
||||
char ForumName[512];
|
||||
char DateTime[4+2+2+2+2+2+1]; // Time of the event in YYYYMMDDHHMMSS format
|
||||
time_t DateTimeUTC; // Date-time of the event
|
||||
Ntf_Status_t Status;
|
||||
Ntf_StatusTxt_t StatusTxt;
|
||||
char *SummaryStr;
|
||||
|
@ -292,7 +292,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
Ntf_STATUS_BIT_READ |
|
||||
Ntf_STATUS_BIT_REMOVED);
|
||||
sprintf (Query,"SELECT NotifyEvent,FromUsrCod,InsCod,CtrCod,DegCod,CrsCod,"
|
||||
"Cod,DATE_FORMAT(TimeNotif,'%%Y%%m%%d%%H%%i%%S'),Status"
|
||||
"Cod,UNIX_TIMESTAMP(TimeNotif),Status"
|
||||
" FROM notif"
|
||||
" WHERE ToUsrCod='%ld'%s"
|
||||
" ORDER BY TimeNotif DESC",
|
||||
|
@ -396,8 +396,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
}
|
||||
|
||||
/* Get time of the event (row[7]) */
|
||||
strncpy (DateTime,row[7],4+2+2+2+2+2);
|
||||
DateTime[4+2+2+2+2+2] = '\0';
|
||||
DateTimeUTC = Dat_GetUNIXTimeFromStr (row[7]);
|
||||
|
||||
/* Get status (row[8]) */
|
||||
if (sscanf (row[8],"%u",&Status) != 1)
|
||||
|
@ -533,7 +532,7 @@ void Ntf_ShowMyNotifications (void)
|
|||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/* Write date and time (DateTime holds date and time in YYYYMMDDHHMMSS format) */
|
||||
Msg_WriteMsgDate (DateTime,ClassBackground);
|
||||
Msg_WriteMsgDate (DateTimeUTC,ClassBackground);
|
||||
|
||||
/* Write status (sent by email / pending to be sent by email) */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">"
|
||||
|
|
|
@ -1750,10 +1750,10 @@ void Svy_RecFormSurvey (void)
|
|||
|
||||
/***** Get scope *****/
|
||||
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
|
||||
// 1 << Sco_SCOPE_CTY | // TODO: Add this scope
|
||||
// 1 << Sco_SCOPE_CTY | // TODO: Add this scope
|
||||
// 1 << Sco_SCOPE_INS | // TODO: Add this scope
|
||||
// 1 << Sco_SCOPE_CTR | // TODO: Add this scope
|
||||
1 << Sco_SCOPE_DEG |
|
||||
// 1 << Sco_SCOPE_CTR | // TODO: Add this scope
|
||||
1 << Sco_SCOPE_DEG |
|
||||
1 << Sco_SCOPE_CRS;
|
||||
Gbl.Scope.Default = Sco_SCOPE_SYS;
|
||||
Sco_GetScope ();
|
||||
|
|
Loading…
Reference in New Issue