mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-10 10:45:23 +02:00
Version 16.155.11
This commit is contained in:
parent
42e48f4ba5
commit
20e22eb3b4
|
@ -527,7 +527,7 @@ CREATE TABLE IF NOT EXISTS forum_post (
|
|||
Subject TEXT NOT NULL,
|
||||
Content LONGTEXT NOT NULL,
|
||||
ImageName VARCHAR(43) NOT NULL,
|
||||
ImageTitle VARCHAR(255) NOT NULL,
|
||||
ImageTitle VARCHAR(2047) NOT NULL,
|
||||
ImageURL VARCHAR(255) NOT NULL,
|
||||
UNIQUE INDEX(PstCod),
|
||||
INDEX(ThrCod),
|
||||
|
|
|
@ -207,14 +207,20 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.155.10 (2017-03-11)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.155.11 (2017-03-11)"
|
||||
#define CSS_FILE "swad16.147.css"
|
||||
#define JS_FILE "swad16.144.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.155.10:Mar 11, 2017 Adjusting size of database fields. (216694 lines)
|
||||
Version 16.155.11:Mar 11, 2017 Adjusting size of database fields. (? lines)
|
||||
1 change necessary in database:
|
||||
ALTER TABLE forum_post CHANGE COLUMN ImageTitle ImageTitle VARCHAR(2047) NOT NULL;
|
||||
|
||||
"ImageTitle VARCHAR(2047) NOT NULL," // Img_MAX_BYTES_TITLE
|
||||
|
||||
Version 16.155.10:Mar 11, 2017 Adjusting size of database fields. (216695 lines)
|
||||
2 changes necessary in database:
|
||||
ALTER TABLE exam_announcements CHANGE COLUMN CrsFullName CrsFullName VARCHAR(2047) NOT NULL;
|
||||
ALTER TABLE exam_announcements CHANGE COLUMN ExamSession ExamSession VARCHAR(2047) NOT NULL;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 43 // 42,66 base-64 characters store 256 bits
|
||||
#define Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 86 // 85,33 base-64 characters store 512 bits
|
||||
#define Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 43 // 42,66 base-64 characters store 256 bits
|
||||
#define Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 86 // 85,33 base-64 characters store 512 bits
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************************* Headers ***********************************/
|
||||
|
|
152
swad_database.c
152
swad_database.c
|
@ -1002,15 +1002,15 @@ mysql> DESCRIBE expanded_folders;
|
|||
6 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS expanded_folders ("
|
||||
"UsrCod INT NOT NULL,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"WorksUsrCod INT NOT NULL,"
|
||||
"Path TEXT COLLATE latin1_bin NOT NULL,"
|
||||
"ClickTime DATETIME NOT NULL,"
|
||||
"INDEX(UsrCod,FileBrowser,Cod),"
|
||||
"INDEX(FileBrowser,Cod),"
|
||||
"INDEX(WorksUsrCod))");
|
||||
"UsrCod INT NOT NULL,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"WorksUsrCod INT NOT NULL,"
|
||||
"Path TEXT COLLATE latin1_bin NOT NULL," // PATH_MAX
|
||||
"ClickTime DATETIME NOT NULL,"
|
||||
"INDEX(UsrCod,FileBrowser,Cod),"
|
||||
"INDEX(FileBrowser,Cod),"
|
||||
"INDEX(WorksUsrCod))");
|
||||
|
||||
/***** Table file_browser_last *****/
|
||||
/*
|
||||
|
@ -1026,11 +1026,11 @@ mysql> DESCRIBE file_browser_last;
|
|||
4 rows in set (0.01 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS file_browser_last ("
|
||||
"UsrCod INT NOT NULL,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"LastClick DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(UsrCod,FileBrowser,Cod))");
|
||||
"UsrCod INT NOT NULL,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"LastClick DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(UsrCod,FileBrowser,Cod))");
|
||||
|
||||
/***** Table file_browser_size *****/
|
||||
/*
|
||||
|
@ -1049,15 +1049,15 @@ mysql> DESCRIBE file_browser_size;
|
|||
7 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS file_browser_size ("
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"NumLevels INT NOT NULL,"
|
||||
"NumFolders INT NOT NULL,"
|
||||
"NumFiles INT NOT NULL,"
|
||||
"TotalSize BIGINT NOT NULL,"
|
||||
"UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||
"INDEX(ZoneUsrCod))");
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"NumLevels INT NOT NULL,"
|
||||
"NumFolders INT NOT NULL,"
|
||||
"NumFiles INT NOT NULL,"
|
||||
"TotalSize BIGINT NOT NULL,"
|
||||
"UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||
"INDEX(ZoneUsrCod))");
|
||||
|
||||
/***** Table file_view *****/
|
||||
/*
|
||||
|
@ -1072,9 +1072,9 @@ mysql> DESCRIBE file_view;
|
|||
3 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS file_view ("
|
||||
"FilCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"NumViews INT NOT NULL DEFAULT 0,"
|
||||
"FilCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"NumViews INT NOT NULL DEFAULT 0,"
|
||||
"UNIQUE INDEX(FilCod,UsrCod),"
|
||||
"INDEX(UsrCod))");
|
||||
|
||||
|
@ -1098,20 +1098,20 @@ mysql> DESCRIBE files;
|
|||
10 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS files ("
|
||||
"FilCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"PublisherUsrCod INT NOT NULL,"
|
||||
"FileType TINYINT NOT NULL DEFAULT 0,"
|
||||
"Path TEXT COLLATE latin1_bin NOT NULL,"
|
||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"Public ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"License TINYINT NOT NULL DEFAULT 0,"
|
||||
"UNIQUE INDEX(FilCod),"
|
||||
"INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||
"INDEX(ZoneUsrCod),"
|
||||
"INDEX(PublisherUsrCod))");
|
||||
"FilCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"FileBrowser TINYINT NOT NULL,"
|
||||
"Cod INT NOT NULL DEFAULT -1,"
|
||||
"ZoneUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"PublisherUsrCod INT NOT NULL,"
|
||||
"FileType TINYINT NOT NULL DEFAULT 0,"
|
||||
"Path TEXT COLLATE latin1_bin NOT NULL," // PATH_MAX
|
||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"Public ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"License TINYINT NOT NULL DEFAULT 0,"
|
||||
"UNIQUE INDEX(FilCod),"
|
||||
"INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||
"INDEX(ZoneUsrCod),"
|
||||
"INDEX(PublisherUsrCod))");
|
||||
|
||||
/***** Table forum_disabled_post *****/
|
||||
/*
|
||||
|
@ -1126,48 +1126,48 @@ mysql> DESCRIBE forum_disabled_post;
|
|||
3 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS forum_disabled_post ("
|
||||
"PstCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"DisableTime DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(PstCod))");
|
||||
"PstCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"DisableTime DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(PstCod))");
|
||||
|
||||
/***** Table forum_post *****/
|
||||
/*
|
||||
mysql> DESCRIBE forum_post;
|
||||
+------------+--------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+------------+--------------+------+-----+---------+----------------+
|
||||
| PstCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| ThrCod | int(11) | NO | MUL | NULL | |
|
||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||
| CreatTime | datetime | NO | MUL | NULL | |
|
||||
| ModifTime | datetime | NO | MUL | NULL | |
|
||||
| NumNotif | int(11) | NO | | 0 | |
|
||||
| Subject | text | NO | | NULL | |
|
||||
| Content | longtext | NO | | NULL | |
|
||||
| ImageName | varchar(43) | NO | | NULL | |
|
||||
| ImageTitle | varchar(255) | NO | | NULL | |
|
||||
| ImageURL | varchar(255) | NO | | NULL | |
|
||||
+------------+--------------+------+-----+---------+----------------+
|
||||
11 rows in set (0.00 sec)
|
||||
+------------+---------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+------------+---------------+------+-----+---------+----------------+
|
||||
| PstCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| ThrCod | int(11) | NO | MUL | NULL | |
|
||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||
| CreatTime | datetime | NO | MUL | NULL | |
|
||||
| ModifTime | datetime | NO | MUL | NULL | |
|
||||
| NumNotif | int(11) | NO | | 0 | |
|
||||
| Subject | text | NO | | NULL | |
|
||||
| Content | longtext | NO | | NULL | |
|
||||
| ImageName | varchar(43) | NO | | NULL | |
|
||||
| ImageTitle | varchar(2047) | NO | | NULL | |
|
||||
| ImageURL | varchar(255) | NO | | NULL | |
|
||||
+------------+---------------+------+-----+---------+----------------+
|
||||
11 rows in set (0,00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS forum_post ("
|
||||
"PstCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"ThrCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"CreatTime DATETIME NOT NULL,"
|
||||
"ModifTime DATETIME NOT NULL,"
|
||||
"NumNotif INT NOT NULL DEFAULT 0,"
|
||||
"Subject TEXT NOT NULL,"
|
||||
"Content LONGTEXT NOT NULL,"
|
||||
"ImageName VARCHAR(43) NOT NULL,"
|
||||
"ImageTitle VARCHAR(255) NOT NULL,"
|
||||
"ImageURL VARCHAR(255) NOT NULL,"
|
||||
"UNIQUE INDEX(PstCod),"
|
||||
"INDEX(ThrCod),"
|
||||
"INDEX(UsrCod),"
|
||||
"INDEX(CreatTime),"
|
||||
"INDEX(ModifTime))");
|
||||
"PstCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"ThrCod INT NOT NULL,"
|
||||
"UsrCod INT NOT NULL,"
|
||||
"CreatTime DATETIME NOT NULL,"
|
||||
"ModifTime DATETIME NOT NULL,"
|
||||
"NumNotif INT NOT NULL DEFAULT 0,"
|
||||
"Subject TEXT NOT NULL," // Cns_MAX_BYTES_SUBJECT
|
||||
"Content LONGTEXT NOT NULL," // Cns_MAX_BYTES_LONG_TEXT
|
||||
"ImageName VARCHAR(43) NOT NULL," // Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64
|
||||
"ImageTitle VARCHAR(2047) NOT NULL," // Img_MAX_BYTES_TITLE
|
||||
"ImageURL VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(PstCod),"
|
||||
"INDEX(ThrCod),"
|
||||
"INDEX(UsrCod),"
|
||||
"INDEX(CreatTime),"
|
||||
"INDEX(ModifTime))");
|
||||
|
||||
/***** Table forum_thr_clip *****/
|
||||
/*
|
||||
|
|
|
@ -2747,7 +2747,8 @@ static void Brw_CreateFoldersAssignmentsIfNotExist (long ZoneUsrCod)
|
|||
" WHERE CrsCod='%ld' AND Hidden='N' AND Folder<>''"
|
||||
" AND (AsgCod NOT IN (SELECT AsgCod FROM asg_grp) OR"
|
||||
" AsgCod IN (SELECT asg_grp.AsgCod FROM asg_grp,crs_grp_usr"
|
||||
" WHERE crs_grp_usr.UsrCod='%ld' AND asg_grp.GrpCod=crs_grp_usr.GrpCod))",
|
||||
" WHERE crs_grp_usr.UsrCod='%ld'"
|
||||
" AND asg_grp.GrpCod=crs_grp_usr.GrpCod))",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,ZoneUsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get folders of assignments");
|
||||
|
||||
|
@ -4898,7 +4899,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
|||
|
||||
static long Brw_GetGrpLastAccZone (const char *FieldNameDB)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
@ -7244,7 +7245,7 @@ static long Brw_GetWorksUsrCodForExpandedFolders (void)
|
|||
|
||||
void Brw_RemoveExpiredExpandedFolders (void)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Remove all expired clipboards *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
|
@ -7259,7 +7260,7 @@ void Brw_RemoveExpiredExpandedFolders (void)
|
|||
|
||||
static void Brw_RemoveExpiredClipboards (void)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Remove all expired clipboards *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM clipboard"
|
||||
|
@ -7275,7 +7276,7 @@ static void Brw_RemoveExpiredClipboards (void)
|
|||
static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
||||
long MyUsrCod,long WorksUsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Remove clipboards associated to a file browser
|
||||
from a course or from a user *****/
|
||||
|
|
98
swad_forum.c
98
swad_forum.c
|
@ -395,11 +395,10 @@ void For_DisPst (void)
|
|||
|
||||
static bool For_GetIfForumPstExists (long PstCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Get if a forum post exists from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_post"
|
||||
" WHERE PstCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_post WHERE PstCod='%ld'",
|
||||
PstCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a post of a forum already existed") != 0); // Post exists if it appears in table of forum posts
|
||||
}
|
||||
|
@ -430,11 +429,10 @@ static bool For_GetIfPstIsEnabled (long PstCod)
|
|||
|
||||
static void For_DeletePstFromDisabledPstTable (long PstCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Remove post from disabled posts table *****/
|
||||
sprintf (Query,"DELETE FROM forum_disabled_post"
|
||||
" WHERE PstCod='%ld'",
|
||||
sprintf (Query,"DELETE FROM forum_disabled_post WHERE PstCod='%ld'",
|
||||
PstCod);
|
||||
DB_QueryDELETE (Query,"can not unban a post of a forum");
|
||||
}
|
||||
|
@ -445,7 +443,7 @@ static void For_DeletePstFromDisabledPstTable (long PstCod)
|
|||
|
||||
static void For_InsertPstIntoBannedPstTable (long PstCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Remove post from banned posts table *****/
|
||||
sprintf (Query,"REPLACE INTO forum_disabled_post"
|
||||
|
@ -471,7 +469,8 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
|||
strlen (Subject) +
|
||||
strlen (Content) +
|
||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 +
|
||||
Img_MAX_BYTES_TITLE)) == NULL)
|
||||
Img_MAX_BYTES_TITLE +
|
||||
Cns_MAX_BYTES_WWW)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Not enough memory to store database query.");
|
||||
|
||||
/***** Check if image is received and processed *****/
|
||||
|
@ -506,7 +505,7 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
|||
|
||||
static bool For_RemoveForumPst (long PstCod,struct Image *Image)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
long ThrCod;
|
||||
bool ThreadDeleted = false;
|
||||
|
||||
|
@ -623,7 +622,7 @@ static long For_InsertForumThread (For_ForumType_t ForumType,long FirstPstCod)
|
|||
|
||||
static void For_RemoveThreadOnly (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Indicate that this thread has not been read by anyone *****/
|
||||
For_DeleteThrFromReadThrs (ThrCod);
|
||||
|
@ -730,7 +729,7 @@ For_ForumType_t For_GetForumTypeOfAPost (long PstCod)
|
|||
|
||||
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Update the code of the first and last posts of a thread *****/
|
||||
sprintf (Query,"UPDATE forum_thread SET FirstPstCod='%ld',LastPstCod='%ld'"
|
||||
|
@ -745,7 +744,7 @@ static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long Last
|
|||
|
||||
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Update the code of the last post of a thread *****/
|
||||
sprintf (Query,"UPDATE forum_thread SET LastPstCod='%ld' WHERE ThrCod='%ld'",
|
||||
|
@ -759,7 +758,7 @@ static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
|||
|
||||
static long For_GetLastPstCod (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
long LastPstCod;
|
||||
|
@ -802,7 +801,7 @@ static void For_UpdateThrReadTime (long ThrCod,time_t ReadTimeUTC)
|
|||
|
||||
static unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Get number of distinct readers of a thread from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_thr_read WHERE ThrCod='%ld'",
|
||||
|
@ -816,14 +815,15 @@ static unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
|||
|
||||
static unsigned For_GetNumOfWritersInThr (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumWriters;
|
||||
|
||||
/***** Get number of distinct writers in a thread from database *****/
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM forum_post"
|
||||
" WHERE ThrCod='%ld'",ThrCod);
|
||||
" WHERE ThrCod='%ld'",
|
||||
ThrCod);
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get the number of writers in a thread of a forum");
|
||||
|
||||
/* Get row with number of writers */
|
||||
|
@ -845,11 +845,10 @@ static unsigned For_GetNumOfWritersInThr (long ThrCod)
|
|||
|
||||
static unsigned For_GetNumPstsInThr (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Get number of posts in a thread from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_post"
|
||||
" WHERE ThrCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_post WHERE ThrCod='%ld'",
|
||||
ThrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of posts in a thread of a forum");
|
||||
}
|
||||
|
@ -860,7 +859,7 @@ static unsigned For_GetNumPstsInThr (long ThrCod)
|
|||
|
||||
static unsigned For_GetNumMyPstInThr (long ThrCod)
|
||||
{
|
||||
char Query[128];
|
||||
char Query[256];
|
||||
|
||||
/***** Get if I have write posts in a thread from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_post"
|
||||
|
@ -889,7 +888,7 @@ unsigned long For_GetNumPostsUsr (long UsrCod)
|
|||
|
||||
static time_t For_GetThrReadTime (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
time_t ReadTimeUTC;
|
||||
|
@ -956,7 +955,7 @@ static void For_ShowThreadPosts (long ThrCod,char LastSubject[Cns_MAX_BYTES_SUBJ
|
|||
extern const char *Txt_Posts;
|
||||
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS];
|
||||
struct ForumThread Thr;
|
||||
char Query[1024];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRow;
|
||||
|
@ -1018,8 +1017,7 @@ static void For_ShowThreadPosts (long ThrCod,char LastSubject[Cns_MAX_BYTES_SUBJ
|
|||
For_WriteThrSubject (ThrCod);
|
||||
|
||||
/***** Get posts of a thread from database *****/
|
||||
sprintf (Query,"SELECT PstCod,UNIX_TIMESTAMP(CreatTime)"
|
||||
" FROM forum_post"
|
||||
sprintf (Query,"SELECT PstCod,UNIX_TIMESTAMP(CreatTime) FROM forum_post"
|
||||
" WHERE ThrCod='%ld' ORDER BY PstCod",
|
||||
ThrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get posts of a thread");
|
||||
|
@ -1403,7 +1401,7 @@ void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1
|
|||
char **ContentStr,
|
||||
long PstCod,bool GetContent)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
size_t Length;
|
||||
|
@ -2441,7 +2439,7 @@ unsigned For_GetNumThrsWithNewPstsInForum (For_ForumType_t ForumType,unsigned Nu
|
|||
static unsigned For_GetNumOfThreadsInForumNewerThan (For_ForumType_t ForumType,const char *Time)
|
||||
{
|
||||
char SubQuery[256];
|
||||
char Query[2048];
|
||||
char Query[1024];
|
||||
|
||||
/***** Get number of threads with a last message modify time
|
||||
> specified time from database *****/
|
||||
|
@ -2485,7 +2483,7 @@ static unsigned For_GetNumOfThreadsInForumNewerThan (For_ForumType_t ForumType,c
|
|||
|
||||
static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr)
|
||||
{
|
||||
char Query[2048];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
@ -2517,7 +2515,7 @@ static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr
|
|||
|
||||
static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time)
|
||||
{
|
||||
char Query[2048];
|
||||
char Query[256];
|
||||
|
||||
/***** Get the number of posts in thread with a modify time > a specified time from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_post"
|
||||
|
@ -3371,7 +3369,8 @@ unsigned For_GetNumPstsInForum (For_ForumType_t ForumType)
|
|||
break;
|
||||
}
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_thread,forum_post "
|
||||
" WHERE forum_thread.ForumType='%u'%s AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
" WHERE forum_thread.ForumType='%u'%s"
|
||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||
(unsigned) ForumType,SubQuery);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of posts in a forum");
|
||||
}
|
||||
|
@ -4044,7 +4043,7 @@ void For_RecForumPst (void)
|
|||
|
||||
static void For_UpdateNumUsrsNotifiedByEMailAboutPost (long PstCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Update number of users notified *****/
|
||||
sprintf (Query,"UPDATE forum_post SET NumNotif=NumNotif+'%u'"
|
||||
|
@ -4317,7 +4316,7 @@ void For_PasteThr (void)
|
|||
|
||||
long For_GetThrInMyClipboard (void)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
|
@ -4370,7 +4369,8 @@ bool For_CheckIfThrBelongsToForum (long ThrCod,For_ForumType_t ForumType)
|
|||
SubQuery[0] = '\0';
|
||||
break;
|
||||
}
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_thread WHERE ThrCod='%ld' AND ForumType='%u'%s",
|
||||
sprintf (Query,"SELECT COUNT(*) FROM forum_thread"
|
||||
" WHERE ThrCod='%ld' AND ForumType='%u'%s",
|
||||
ThrCod,(unsigned) ForumType,SubQuery);
|
||||
return (DB_QueryCOUNT (Query,"can not get if a thread belong to current forum") != 0);
|
||||
}
|
||||
|
@ -4388,23 +4388,33 @@ void For_MoveThrToCurrentForum (long ThrCod)
|
|||
{
|
||||
case For_FORUM_SWAD_USRS: case For_FORUM_SWAD_TCHS:
|
||||
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_TCHS:
|
||||
sprintf (Query,"UPDATE forum_thread SET ForumType='%u',Location='-1' WHERE ThrCod='%ld'",
|
||||
sprintf (Query,"UPDATE forum_thread"
|
||||
" SET ForumType='%u',Location='-1'"
|
||||
" WHERE ThrCod='%ld'",
|
||||
(unsigned) Gbl.Forum.ForumType,ThrCod);
|
||||
break;
|
||||
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_TCHS:
|
||||
sprintf (Query,"UPDATE forum_thread SET ForumType='%u',Location='%ld' WHERE ThrCod='%ld'",
|
||||
sprintf (Query,"UPDATE forum_thread"
|
||||
" SET ForumType='%u',Location='%ld'"
|
||||
" WHERE ThrCod='%ld'",
|
||||
(unsigned) Gbl.Forum.ForumType,Gbl.Forum.Ins.InsCod,ThrCod);
|
||||
break;
|
||||
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_TCHS:
|
||||
sprintf (Query,"UPDATE forum_thread SET ForumType='%u',Location='%ld' WHERE ThrCod='%ld'",
|
||||
sprintf (Query,"UPDATE forum_thread"
|
||||
" SET ForumType='%u',Location='%ld'"
|
||||
" WHERE ThrCod='%ld'",
|
||||
(unsigned) Gbl.Forum.ForumType,Gbl.Forum.Ctr.CtrCod,ThrCod);
|
||||
break;
|
||||
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_TCHS:
|
||||
sprintf (Query,"UPDATE forum_thread SET ForumType='%u',Location='%ld' WHERE ThrCod='%ld'",
|
||||
sprintf (Query,"UPDATE forum_thread"
|
||||
" SET ForumType='%u',Location='%ld'"
|
||||
" WHERE ThrCod='%ld'",
|
||||
(unsigned) Gbl.Forum.ForumType,Gbl.Forum.Deg.DegCod,ThrCod);
|
||||
break;
|
||||
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_TCHS:
|
||||
sprintf (Query,"UPDATE forum_thread SET ForumType='%u',Location='%ld' WHERE ThrCod='%ld'",
|
||||
sprintf (Query,"UPDATE forum_thread"
|
||||
" SET ForumType='%u',Location='%ld'"
|
||||
" WHERE ThrCod='%ld'",
|
||||
(unsigned) Gbl.Forum.ForumType,Gbl.Forum.Crs.CrsCod,ThrCod);
|
||||
break;
|
||||
}
|
||||
|
@ -4417,7 +4427,7 @@ void For_MoveThrToCurrentForum (long ThrCod)
|
|||
|
||||
void For_InsertThrInClipboard (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Remove expired thread clipboards *****/
|
||||
For_RemoveExpiredThrsClipboards ();
|
||||
|
@ -4435,7 +4445,7 @@ void For_InsertThrInClipboard (long ThrCod)
|
|||
|
||||
void For_RemoveExpiredThrsClipboards (void)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
|
||||
/***** Remove all expired clipboards *****/
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM forum_thr_clip"
|
||||
|
@ -4450,10 +4460,11 @@ void For_RemoveExpiredThrsClipboards (void)
|
|||
|
||||
void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Remove thread from thread clipboard *****/
|
||||
sprintf (Query,"DELETE FROM forum_thr_clip WHERE ThrCod='%ld'",ThrCod);
|
||||
sprintf (Query,"DELETE FROM forum_thr_clip WHERE ThrCod='%ld'",
|
||||
ThrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a thread from clipboard");
|
||||
}
|
||||
|
||||
|
@ -4463,10 +4474,11 @@ void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
|||
|
||||
void For_RemoveUsrFromThrClipboard (long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
|
||||
/***** Remove clipboard of specified user *****/
|
||||
sprintf (Query,"DELETE FROM forum_thr_clip WHERE UsrCod='%ld'",UsrCod);
|
||||
sprintf (Query,"DELETE FROM forum_thr_clip WHERE UsrCod='%ld'",
|
||||
UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove a thread from the clipboard of a user");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user