mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-22 00:00:40 +02:00
Version 18.8.17
This commit is contained in:
parent
9d7b46ffc3
commit
e2472291d3
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.8.16 (2018-10-28)"
|
#define Log_PLATFORM_VERSION "SWAD 18.8.17 (2018-10-28)"
|
||||||
#define CSS_FILE "swad18.4.css"
|
#define CSS_FILE "swad18.4.css"
|
||||||
#define JS_FILE "swad17.17.1.js"
|
#define JS_FILE "swad17.17.1.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.8.17: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236116 lines)
|
||||||
Version 18.8.16: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236263 lines)
|
Version 18.8.16: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236263 lines)
|
||||||
Version 18.8.15: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236425 lines)
|
Version 18.8.15: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236425 lines)
|
||||||
Version 18.8.14: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236493 lines)
|
Version 18.8.14: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236493 lines)
|
||||||
|
|
|
@ -3331,17 +3331,6 @@ void DB_QueryDELETE_new (const char *MsgError)
|
||||||
DB_ExitOnMySQLError (MsgError);
|
DB_ExitOnMySQLError (MsgError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DB_QueryDELETE_free (const char *Query,const char *MsgError)
|
|
||||||
{
|
|
||||||
int Result;
|
|
||||||
|
|
||||||
/***** Query database *****/
|
|
||||||
Result = mysql_query (&Gbl.mysql,Query); // Returns 0 on success
|
|
||||||
free ((void *) Query);
|
|
||||||
if (Result)
|
|
||||||
DB_ExitOnMySQLError (MsgError);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DB_QueryDELETE (const char *Query,const char *MsgError)
|
void DB_QueryDELETE (const char *Query,const char *MsgError)
|
||||||
{
|
{
|
||||||
/***** Query database *****/
|
/***** Query database *****/
|
||||||
|
|
|
@ -58,7 +58,6 @@ void DB_QueryUPDATE_new (const char *MsgError);
|
||||||
void DB_QueryUPDATE (const char *Query,const char *MsgError);
|
void DB_QueryUPDATE (const char *Query,const char *MsgError);
|
||||||
|
|
||||||
void DB_QueryDELETE_new (const char *MsgError);
|
void DB_QueryDELETE_new (const char *MsgError);
|
||||||
void DB_QueryDELETE_free (const char *Query,const char *MsgError);
|
|
||||||
void DB_QueryDELETE (const char *Query,const char *MsgError);
|
void DB_QueryDELETE (const char *Query,const char *MsgError);
|
||||||
|
|
||||||
void DB_Query_free (const char *Query,const char *MsgError);
|
void DB_Query_free (const char *Query,const char *MsgError);
|
||||||
|
|
|
@ -1203,11 +1203,8 @@ void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
|
|
||||||
void Fol_RemoveUsrFromUsrFollow (long UsrCod)
|
void Fol_RemoveUsrFromUsrFollow (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
DB_BuildQuery ("DELETE FROM usr_follow"
|
||||||
|
|
||||||
if (asprintf (&Query,"DELETE FROM usr_follow"
|
|
||||||
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
||||||
UsrCod,UsrCod) < 0)
|
UsrCod,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove user from followers and followed");
|
||||||
DB_QueryDELETE_free (Query,"can not remove user from followers and followed");
|
|
||||||
}
|
}
|
||||||
|
|
108
swad_forum.c
108
swad_forum.c
|
@ -469,13 +469,9 @@ static bool For_GetIfPstIsEnabled (long PstCod)
|
||||||
|
|
||||||
static void For_DeletePstFromDisabledPstTable (long PstCod)
|
static void For_DeletePstFromDisabledPstTable (long PstCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove post from disabled posts table *****/
|
/***** Remove post from disabled posts table *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_disabled_post WHERE PstCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_disabled_post WHERE PstCod=%ld",PstCod);
|
||||||
PstCod) < 0)
|
DB_QueryDELETE_new ("can not unban a post of a forum");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not unban a post of a forum");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -533,7 +529,6 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
||||||
|
|
||||||
static bool For_RemoveForumPst (long PstCod,struct Image *Image)
|
static bool For_RemoveForumPst (long PstCod,struct Image *Image)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long ThrCod;
|
long ThrCod;
|
||||||
bool ThreadDeleted = false;
|
bool ThreadDeleted = false;
|
||||||
|
|
||||||
|
@ -548,10 +543,8 @@ static bool For_RemoveForumPst (long PstCod,struct Image *Image)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Delete post from forum post table *****/
|
/***** Delete post from forum post table *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_post WHERE PstCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_post WHERE PstCod=%ld",PstCod);
|
||||||
PstCod) < 0)
|
DB_QueryDELETE_new ("can not remove a post from a forum");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a post from a forum");
|
|
||||||
|
|
||||||
/***** Delete the post from the table of disabled forum posts *****/
|
/***** Delete the post from the table of disabled forum posts *****/
|
||||||
For_DeletePstFromDisabledPstTable (PstCod);
|
For_DeletePstFromDisabledPstTable (PstCod);
|
||||||
|
@ -615,8 +608,6 @@ static long For_InsertForumThread (long FirstPstCod)
|
||||||
|
|
||||||
static void For_RemoveThreadOnly (long ThrCod)
|
static void For_RemoveThreadOnly (long ThrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Indicate that this thread has not been read by anyone *****/
|
/***** Indicate that this thread has not been read by anyone *****/
|
||||||
For_DeleteThrFromReadThrs (ThrCod);
|
For_DeleteThrFromReadThrs (ThrCod);
|
||||||
|
|
||||||
|
@ -624,10 +615,8 @@ static void For_RemoveThreadOnly (long ThrCod)
|
||||||
For_RemoveThrCodFromThrClipboard (ThrCod);
|
For_RemoveThrCodFromThrClipboard (ThrCod);
|
||||||
|
|
||||||
/***** Delete thread from forum thread table *****/
|
/***** Delete thread from forum thread table *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thread WHERE ThrCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_thread WHERE ThrCod=%ld",ThrCod);
|
||||||
ThrCod) < 0)
|
DB_QueryDELETE_new ("can not remove a thread from a forum");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a thread from a forum");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -636,22 +625,17 @@ static void For_RemoveThreadOnly (long ThrCod)
|
||||||
|
|
||||||
static void For_RemoveThreadAndItsPsts (long ThrCod)
|
static void For_RemoveThreadAndItsPsts (long ThrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Delete banned posts in thread *****/
|
/***** Delete banned posts in thread *****/
|
||||||
if (asprintf (&Query,"DELETE forum_disabled_post"
|
DB_BuildQuery ("DELETE forum_disabled_post"
|
||||||
" FROM forum_post,forum_disabled_post"
|
" FROM forum_post,forum_disabled_post"
|
||||||
" WHERE forum_post.ThrCod=%ld"
|
" WHERE forum_post.ThrCod=%ld"
|
||||||
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
||||||
ThrCod) < 0)
|
ThrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not unban the posts of a thread of a forum");
|
||||||
DB_QueryDELETE_free (Query,"can not unban the posts of a thread of a forum");
|
|
||||||
|
|
||||||
/***** Delete thread posts *****/
|
/***** Delete thread posts *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_post WHERE ThrCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_post WHERE ThrCod=%ld",ThrCod);
|
||||||
ThrCod) < 0)
|
DB_QueryDELETE_new ("can not remove the posts of a thread of a forum");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove the posts of a thread of a forum");
|
|
||||||
|
|
||||||
/***** Delete thread from forum thread table *****/
|
/***** Delete thread from forum thread table *****/
|
||||||
For_RemoveThreadOnly (ThrCod);
|
For_RemoveThreadOnly (ThrCod);
|
||||||
|
@ -912,13 +896,9 @@ static time_t For_GetThrReadTime (long ThrCod)
|
||||||
|
|
||||||
static void For_DeleteThrFromReadThrs (long ThrCod)
|
static void For_DeleteThrFromReadThrs (long ThrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Delete pairs ThrCod-UsrCod in forum_thr_read for a thread *****/
|
/***** Delete pairs ThrCod-UsrCod in forum_thr_read for a thread *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thr_read WHERE ThrCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_thr_read WHERE ThrCod=%ld",ThrCod);
|
||||||
ThrCod) < 0)
|
DB_QueryDELETE_new ("can not remove the status of reading of a thread of a forum");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove the status of reading of a thread of a forum");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -927,13 +907,9 @@ static void For_DeleteThrFromReadThrs (long ThrCod)
|
||||||
|
|
||||||
void For_RemoveUsrFromReadThrs (long UsrCod)
|
void For_RemoveUsrFromReadThrs (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Delete pairs ThrCod-UsrCod in forum_thr_read for a user *****/
|
/***** Delete pairs ThrCod-UsrCod in forum_thr_read for a user *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thr_read WHERE UsrCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_thr_read WHERE UsrCod=%ld",UsrCod);
|
||||||
UsrCod) < 0)
|
DB_QueryDELETE_new ("can not remove the status of reading by a user of all the threads of a forum");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove the status of reading by a user of all the threads of a forum");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4439,14 +4415,11 @@ static void For_InsertThrInClipboard (long ThrCod)
|
||||||
|
|
||||||
static void For_RemoveExpiredThrsClipboards (void)
|
static void For_RemoveExpiredThrsClipboards (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove all expired clipboards *****/
|
/***** Remove all expired clipboards *****/
|
||||||
if (asprintf (&Query,"DELETE LOW_PRIORITY FROM forum_thr_clip"
|
DB_BuildQuery ("DELETE LOW_PRIORITY FROM forum_thr_clip"
|
||||||
" WHERE TimeInsert<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
" WHERE TimeInsert<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||||
Cfg_TIME_TO_DELETE_THREAD_CLIPBOARD) < 0)
|
Cfg_TIME_TO_DELETE_THREAD_CLIPBOARD);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove old threads from clipboards");
|
||||||
DB_QueryDELETE_free (Query,"can not remove old threads from clipboards");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4455,13 +4428,9 @@ static void For_RemoveExpiredThrsClipboards (void)
|
||||||
|
|
||||||
static void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
static void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove thread from thread clipboard *****/
|
/***** Remove thread from thread clipboard *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thr_clip WHERE ThrCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_thr_clip WHERE ThrCod=%ld",ThrCod);
|
||||||
ThrCod) < 0)
|
DB_QueryDELETE_new ("can not remove a thread from clipboard");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a thread from clipboard");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4470,13 +4439,9 @@ static void For_RemoveThrCodFromThrClipboard (long ThrCod)
|
||||||
|
|
||||||
void For_RemoveUsrFromThrClipboard (long UsrCod)
|
void For_RemoveUsrFromThrClipboard (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove clipboard of specified user *****/
|
/***** Remove clipboard of specified user *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thr_clip WHERE UsrCod=%ld",
|
DB_BuildQuery ("DELETE FROM forum_thr_clip WHERE UsrCod=%ld",UsrCod);
|
||||||
UsrCod) < 0)
|
DB_QueryDELETE_new ("can not remove a thread from the clipboard of a user");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a thread from the clipboard of a user");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4499,10 +4464,9 @@ void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation)
|
||||||
{For_FORUM_DEGREE_USRS,For_FORUM_DEGREE_TCHS}, // Sco_SCOPE_DEG
|
{For_FORUM_DEGREE_USRS,For_FORUM_DEGREE_TCHS}, // Sco_SCOPE_DEG
|
||||||
{For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS}, // Sco_SCOPE_CRS
|
{For_FORUM_COURSE_USRS,For_FORUM_COURSE_TCHS}, // Sco_SCOPE_CRS
|
||||||
};
|
};
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove disabled posts *****/
|
/***** Remove disabled posts *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_disabled_post"
|
DB_BuildQuery ("DELETE FROM forum_disabled_post"
|
||||||
" USING forum_thread,forum_post,forum_disabled_post"
|
" USING forum_thread,forum_post,forum_disabled_post"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" (forum_thread.ForumType=%u"
|
" (forum_thread.ForumType=%u"
|
||||||
|
@ -4513,12 +4477,11 @@ void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation)
|
||||||
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
" AND forum_post.PstCod=forum_disabled_post.PstCod",
|
||||||
ForumType[Scope].Usrs,
|
ForumType[Scope].Usrs,
|
||||||
ForumType[Scope].Tchs,
|
ForumType[Scope].Tchs,
|
||||||
ForumLocation) < 0)
|
ForumLocation);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove the disabled posts in forums");
|
||||||
DB_QueryDELETE_free (Query,"can not remove the disabled posts in forums");
|
|
||||||
|
|
||||||
/***** Remove posts *****/
|
/***** Remove posts *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_post"
|
DB_BuildQuery ("DELETE FROM forum_post"
|
||||||
" USING forum_thread,forum_post"
|
" USING forum_thread,forum_post"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" (forum_thread.ForumType=%u"
|
" (forum_thread.ForumType=%u"
|
||||||
|
@ -4528,12 +4491,11 @@ void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation)
|
||||||
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
" AND forum_thread.ThrCod=forum_post.ThrCod",
|
||||||
ForumType[Scope].Usrs,
|
ForumType[Scope].Usrs,
|
||||||
ForumType[Scope].Tchs,
|
ForumType[Scope].Tchs,
|
||||||
ForumLocation) < 0)
|
ForumLocation);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove posts in forums");
|
||||||
DB_QueryDELETE_free (Query,"can not remove posts in forums");
|
|
||||||
|
|
||||||
/***** Remove threads read *****/
|
/***** Remove threads read *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thr_read"
|
DB_BuildQuery ("DELETE FROM forum_thr_read"
|
||||||
" USING forum_thread,forum_thr_read"
|
" USING forum_thread,forum_thr_read"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" (forum_thread.ForumType=%u"
|
" (forum_thread.ForumType=%u"
|
||||||
|
@ -4543,12 +4505,11 @@ void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation)
|
||||||
" AND forum_thread.ThrCod=forum_thr_read.ThrCod",
|
" AND forum_thread.ThrCod=forum_thr_read.ThrCod",
|
||||||
ForumType[Scope].Usrs,
|
ForumType[Scope].Usrs,
|
||||||
ForumType[Scope].Tchs,
|
ForumType[Scope].Tchs,
|
||||||
ForumLocation) < 0)
|
ForumLocation);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove read threads in forums");
|
||||||
DB_QueryDELETE_free (Query,"can not remove read threads in forums");
|
|
||||||
|
|
||||||
/***** Remove threads *****/
|
/***** Remove threads *****/
|
||||||
if (asprintf (&Query,"DELETE FROM forum_thread"
|
DB_BuildQuery ("DELETE FROM forum_thread"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" (forum_thread.ForumType=%u"
|
" (forum_thread.ForumType=%u"
|
||||||
" OR"
|
" OR"
|
||||||
|
@ -4556,7 +4517,6 @@ void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation)
|
||||||
" AND Location=%ld",
|
" AND Location=%ld",
|
||||||
ForumType[Scope].Usrs,
|
ForumType[Scope].Usrs,
|
||||||
ForumType[Scope].Tchs,
|
ForumType[Scope].Tchs,
|
||||||
ForumLocation) < 0)
|
ForumLocation);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove threads in forums");
|
||||||
DB_QueryDELETE_free (Query,"can not remove threads in forums");
|
|
||||||
}
|
}
|
||||||
|
|
96
swad_game.c
96
swad_game.c
|
@ -1512,7 +1512,6 @@ void Gam_AskRemGame (void)
|
||||||
void Gam_RemoveGame (void)
|
void Gam_RemoveGame (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Game_X_removed;
|
extern const char *Txt_Game_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Game Game;
|
struct Game Game;
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
|
@ -1525,26 +1524,19 @@ void Gam_RemoveGame (void)
|
||||||
Lay_ShowErrorAndExit ("You can not remove this game.");
|
Lay_ShowErrorAndExit ("You can not remove this game.");
|
||||||
|
|
||||||
/***** Remove all the users in this game *****/
|
/***** Remove all the users in this game *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_users WHERE GamCod=%ld",
|
DB_BuildQuery ("DELETE FROM gam_users WHERE GamCod=%ld",Game.GamCod);
|
||||||
Game.GamCod) < 0)
|
DB_QueryDELETE_new ("can not remove users who are answered a game");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove users who are answered a game");
|
|
||||||
|
|
||||||
/***** Remove all the questions in this game *****/
|
/***** Remove all the questions in this game *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_questions"
|
DB_BuildQuery ("DELETE FROM gam_questions WHERE GamCod=%ld",Game.GamCod);
|
||||||
" WHERE GamCod=%ld",
|
DB_QueryDELETE_new ("can not remove questions of a game");
|
||||||
Game.GamCod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove questions of a game");
|
|
||||||
|
|
||||||
/***** Remove all the groups of this game *****/
|
/***** Remove all the groups of this game *****/
|
||||||
Gam_RemoveAllTheGrpsAssociatedToAndGame (Game.GamCod);
|
Gam_RemoveAllTheGrpsAssociatedToAndGame (Game.GamCod);
|
||||||
|
|
||||||
/***** Remove game *****/
|
/***** Remove game *****/
|
||||||
if (asprintf (&Query,"DELETE FROM games WHERE GamCod=%ld",
|
DB_BuildQuery ("DELETE FROM games WHERE GamCod=%ld",Game.GamCod);
|
||||||
Game.GamCod) < 0)
|
DB_QueryDELETE_new ("can not remove game");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove game");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1614,7 +1606,6 @@ static void Gam_PutButtonToResetGame (void)
|
||||||
void Gam_ResetGame (void)
|
void Gam_ResetGame (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Game_X_reset;
|
extern const char *Txt_Game_X_reset;
|
||||||
char *Query;
|
|
||||||
struct Game Game;
|
struct Game Game;
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
|
@ -1627,10 +1618,8 @@ void Gam_ResetGame (void)
|
||||||
Lay_ShowErrorAndExit ("You can not reset this game.");
|
Lay_ShowErrorAndExit ("You can not reset this game.");
|
||||||
|
|
||||||
/***** Remove all the users in this game *****/
|
/***** Remove all the users in this game *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_users WHERE GamCod=%ld",
|
DB_BuildQuery ("DELETE FROM gam_users WHERE GamCod=%ld",Game.GamCod);
|
||||||
Game.GamCod) < 0)
|
DB_QueryDELETE_new ("can not remove users who are answered a game");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove users who are answered a game");
|
|
||||||
|
|
||||||
/***** Reset all the answers in this game *****/
|
/***** Reset all the answers in this game *****/
|
||||||
DB_BuildQuery ("UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
|
DB_BuildQuery ("UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
|
||||||
|
@ -2283,13 +2272,9 @@ bool Gam_CheckIfGamIsAssociatedToGrp (long GamCod,long GrpCod)
|
||||||
|
|
||||||
static void Gam_RemoveAllTheGrpsAssociatedToAndGame (long GamCod)
|
static void Gam_RemoveAllTheGrpsAssociatedToAndGame (long GamCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove groups of the game *****/
|
/***** Remove groups of the game *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_grp WHERE GamCod=%ld",
|
DB_BuildQuery ("DELETE FROM gam_grp WHERE GamCod=%ld",GamCod);
|
||||||
GamCod) < 0)
|
DB_QueryDELETE_new ("can not remove the groups associated to a game");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove the groups associated to a game");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2298,13 +2283,9 @@ static void Gam_RemoveAllTheGrpsAssociatedToAndGame (long GamCod)
|
||||||
|
|
||||||
void Gam_RemoveGroup (long GrpCod)
|
void Gam_RemoveGroup (long GrpCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove group from all the games *****/
|
/***** Remove group from all the games *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_grp WHERE GrpCod=%ld",
|
DB_BuildQuery ("DELETE FROM gam_grp WHERE GrpCod=%ld",GrpCod);
|
||||||
GrpCod) < 0)
|
DB_QueryDELETE_new ("can not remove group"
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove group"
|
|
||||||
" from the associations between games and groups");
|
" from the associations between games and groups");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2314,15 +2295,12 @@ void Gam_RemoveGroup (long GrpCod)
|
||||||
|
|
||||||
void Gam_RemoveGroupsOfType (long GrpTypCod)
|
void Gam_RemoveGroupsOfType (long GrpTypCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove group from all the games *****/
|
/***** Remove group from all the games *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_grp USING crs_grp,gam_grp"
|
DB_BuildQuery ("DELETE FROM gam_grp USING crs_grp,gam_grp"
|
||||||
" WHERE crs_grp.GrpTypCod=%ld"
|
" WHERE crs_grp.GrpTypCod=%ld"
|
||||||
" AND crs_grp.GrpCod=gam_grp.GrpCod",
|
" AND crs_grp.GrpCod=gam_grp.GrpCod",
|
||||||
GrpTypCod) < 0)
|
GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove groups of a type"
|
||||||
DB_QueryDELETE_free (Query,"can not remove groups of a type"
|
|
||||||
" from the associations between games and groups");
|
" from the associations between games and groups");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2423,53 +2401,47 @@ static void Gam_GetAndWriteNamesOfGrpsAssociatedToGame (struct Game *Game)
|
||||||
void Gam_RemoveGames (Sco_Scope_t Scope,long Cod)
|
void Gam_RemoveGames (Sco_Scope_t Scope,long Cod)
|
||||||
{
|
{
|
||||||
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove all the users in course games *****/
|
/***** Remove all the users in course games *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_users"
|
DB_BuildQuery ("DELETE FROM gam_users"
|
||||||
" USING games,gam_users"
|
" USING games,gam_users"
|
||||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||||
" AND games.GamCod=gam_users.GamCod",
|
" AND games.GamCod=gam_users.GamCod",
|
||||||
Sco_ScopeDB[Scope],Cod) < 0)
|
Sco_ScopeDB[Scope],Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove users"
|
||||||
DB_QueryDELETE_free (Query,"can not remove users"
|
|
||||||
" who had answered games in a place on the hierarchy");
|
" who had answered games in a place on the hierarchy");
|
||||||
|
|
||||||
/***** Remove all the answers in course games *****/
|
/***** Remove all the answers in course games *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_answers"
|
DB_BuildQuery ("DELETE FROM gam_answers"
|
||||||
" USING games,gam_questions,gam_answers"
|
" USING games,gam_questions,gam_answers"
|
||||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||||
" AND games.GamCod=gam_questions.GamCod"
|
" AND games.GamCod=gam_questions.GamCod"
|
||||||
" AND gam_questions.QstCod=gam_answers.QstCod",
|
" AND gam_questions.QstCod=gam_answers.QstCod",
|
||||||
Sco_ScopeDB[Scope],Cod) < 0)
|
Sco_ScopeDB[Scope],Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove answers of games in a place on the hierarchy");
|
||||||
DB_QueryDELETE_free (Query,"can not remove answers of games in a place on the hierarchy");
|
|
||||||
|
|
||||||
/***** Remove all the questions in course games *****/
|
/***** Remove all the questions in course games *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_questions"
|
DB_BuildQuery ("DELETE FROM gam_questions"
|
||||||
" USING games,gam_questions"
|
" USING games,gam_questions"
|
||||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||||
" AND games.GamCod=gam_questions.GamCod",
|
" AND games.GamCod=gam_questions.GamCod",
|
||||||
Sco_ScopeDB[Scope],Cod) < 0)
|
Sco_ScopeDB[Scope],Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove questions of games in a place on the hierarchy");
|
||||||
DB_QueryDELETE_free (Query,"can not remove questions of games in a place on the hierarchy");
|
|
||||||
|
|
||||||
/***** Remove groups *****/
|
/***** Remove groups *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_grp"
|
DB_BuildQuery ("DELETE FROM gam_grp"
|
||||||
" USING games,gam_grp"
|
" USING games,gam_grp"
|
||||||
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
" WHERE games.Scope='%s' AND games.Cod=%ld"
|
||||||
" AND games.GamCod=gam_grp.GamCod",
|
" AND games.GamCod=gam_grp.GamCod",
|
||||||
Sco_ScopeDB[Scope],Cod) < 0)
|
Sco_ScopeDB[Scope],Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove all the groups"
|
||||||
DB_QueryDELETE_free (Query,"can not remove all the groups"
|
|
||||||
" associated to games of a course");
|
" associated to games of a course");
|
||||||
|
|
||||||
/***** Remove course games *****/
|
/***** Remove course games *****/
|
||||||
if (asprintf (&Query,"DELETE FROM games"
|
DB_BuildQuery ("DELETE FROM games"
|
||||||
" WHERE Scope='%s' AND Cod=%ld",
|
" WHERE Scope='%s' AND Cod=%ld",
|
||||||
Sco_ScopeDB[Scope],Cod) < 0)
|
Sco_ScopeDB[Scope],Cod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove all the games in a place on the hierarchy");
|
||||||
DB_QueryDELETE_free (Query,"can not remove all the games in a place on the hierarchy");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2575,13 +2547,9 @@ static unsigned Gam_GetParamQstInd (void)
|
||||||
|
|
||||||
static void Gam_RemAnswersOfAQuestion (long QstCod)
|
static void Gam_RemAnswersOfAQuestion (long QstCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove answers *****/
|
/***** Remove answers *****/
|
||||||
if (asprintf (&Query,"DELETE FROM gam_answers WHERE QstCod=%ld",
|
DB_BuildQuery ("DELETE FROM gam_answers WHERE QstCod=%ld",QstCod);
|
||||||
QstCod) < 0)
|
DB_QueryDELETE_new ("can not remove the answers of a question");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove the answers of a question");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
60
swad_group.c
60
swad_group.c
|
@ -1210,18 +1210,16 @@ unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *Lst
|
||||||
|
|
||||||
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
bool ItsMe = Usr_ItsMe (UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from all the groups of the course *****/
|
/***** Remove user from all the groups of the course *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr"
|
DB_BuildQuery ("DELETE FROM crs_grp_usr"
|
||||||
" WHERE UsrCod=%ld AND GrpCod IN"
|
" WHERE UsrCod=%ld AND GrpCod IN"
|
||||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||||
" WHERE crs_grp_types.CrsCod=%ld"
|
" WHERE crs_grp_types.CrsCod=%ld"
|
||||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||||
UsrCod,CrsCod) < 0)
|
UsrCod,CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove a user from all groups of a course");
|
||||||
DB_QueryDELETE_free (Query,"can not remove a user from all groups of a course");
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||||
|
@ -1235,14 +1233,11 @@ void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod)
|
||||||
|
|
||||||
void Grp_RemUsrFromAllGrps (long UsrCod)
|
void Grp_RemUsrFromAllGrps (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
bool ItsMe = Usr_ItsMe (UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from all groups *****/
|
/***** Remove user from all groups *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE UsrCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_grp_usr WHERE UsrCod=%ld",UsrCod);
|
||||||
UsrCod) < 0)
|
DB_QueryDELETE_new ("can not remove a user from the groups he/she belongs to");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a user from the groups he/she belongs to");
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||||
|
@ -1256,15 +1251,13 @@ void Grp_RemUsrFromAllGrps (long UsrCod)
|
||||||
|
|
||||||
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
bool ItsMe = Usr_ItsMe (UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
||||||
/***** Remove user from group *****/
|
/***** Remove user from group *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr"
|
DB_BuildQuery ("DELETE FROM crs_grp_usr"
|
||||||
" WHERE GrpCod=%ld AND UsrCod=%ld",
|
" WHERE GrpCod=%ld AND UsrCod=%ld",
|
||||||
GrpCod,UsrCod) < 0)
|
GrpCod,UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove a user from a group");
|
||||||
DB_QueryDELETE_free (Query,"can not remove a user from a group");
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||||
|
@ -4018,7 +4011,6 @@ void Grp_RemoveGroup (void)
|
||||||
static void Grp_RemoveGroupTypeCompletely (void)
|
static void Grp_RemoveGroupTypeCompletely (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Type_of_group_X_removed;
|
extern const char *Txt_Type_of_group_X_removed;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get name and type of the group from database *****/
|
/***** Get name and type of the group from database *****/
|
||||||
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
|
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
|
||||||
|
@ -4043,23 +4035,20 @@ static void Grp_RemoveGroupTypeCompletely (void)
|
||||||
DB_QueryUPDATE_new ("can not update all groups of a type in course timetable");
|
DB_QueryUPDATE_new ("can not update all groups of a type in course timetable");
|
||||||
|
|
||||||
/***** Remove all the students in groups of this type *****/
|
/***** Remove all the students in groups of this type *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
DB_BuildQuery ("DELETE FROM crs_grp_usr WHERE GrpCod IN"
|
||||||
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
" (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)",
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove users from all groups of a type");
|
||||||
DB_QueryDELETE_free (Query,"can not remove users from all groups of a type");
|
|
||||||
|
|
||||||
/***** Remove all the groups of this type *****/
|
/***** Remove all the groups of this type *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp WHERE GrpTypCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_grp WHERE GrpTypCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove groups of a type");
|
||||||
DB_QueryDELETE_free (Query,"can not remove groups of a type");
|
|
||||||
|
|
||||||
/***** Remove the group type *****/
|
/***** Remove the group type *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_types WHERE GrpTypCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_grp_types WHERE GrpTypCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove a type of group");
|
||||||
DB_QueryDELETE_free (Query,"can not remove a type of group");
|
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -4079,7 +4068,6 @@ static void Grp_RemoveGroupCompletely (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Group_X_removed;
|
extern const char *Txt_Group_X_removed;
|
||||||
struct GroupData GrpDat;
|
struct GroupData GrpDat;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get name and type of the group from database *****/
|
/***** Get name and type of the group from database *****/
|
||||||
GrpDat.GrpCod = Gbl.CurrentCrs.Grps.GrpCod;
|
GrpDat.GrpCod = Gbl.CurrentCrs.Grps.GrpCod;
|
||||||
|
@ -4103,16 +4091,14 @@ static void Grp_RemoveGroupCompletely (void)
|
||||||
DB_QueryUPDATE_new ("can not update a group in course timetable");
|
DB_QueryUPDATE_new ("can not update a group in course timetable");
|
||||||
|
|
||||||
/***** Remove all the students in this group *****/
|
/***** Remove all the students in this group *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_grp_usr WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove users from a group");
|
||||||
DB_QueryDELETE_free (Query,"can not remove users from a group");
|
|
||||||
|
|
||||||
/***** Remove the group *****/
|
/***** Remove the group *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_grp WHERE GrpCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_grp WHERE GrpCod=%ld",
|
||||||
Gbl.CurrentCrs.Grps.GrpCod) < 0)
|
Gbl.CurrentCrs.Grps.GrpCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove a group");
|
||||||
DB_QueryDELETE_free (Query,"can not remove a group");
|
|
||||||
|
|
||||||
/***** Create message to show the change made *****/
|
/***** Create message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
|
@ -639,7 +639,6 @@ long Hld_GetParamHldCod (void)
|
||||||
void Hld_RemoveHoliday1 (void)
|
void Hld_RemoveHoliday1 (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Holiday_X_removed;
|
extern const char *Txt_Holiday_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Holiday Hld;
|
struct Holiday Hld;
|
||||||
|
|
||||||
/***** Get holiday code *****/
|
/***** Get holiday code *****/
|
||||||
|
@ -650,10 +649,8 @@ void Hld_RemoveHoliday1 (void)
|
||||||
Hld_GetDataOfHolidayByCod (&Hld);
|
Hld_GetDataOfHolidayByCod (&Hld);
|
||||||
|
|
||||||
/***** Remove holiday *****/
|
/***** Remove holiday *****/
|
||||||
if (asprintf (&Query,"DELETE FROM holidays WHERE HldCod=%ld",
|
DB_BuildQuery ("DELETE FROM holidays WHERE HldCod=%ld",Hld.HldCod);
|
||||||
Hld.HldCod) < 0)
|
DB_QueryDELETE_new ("can not remove a holiday");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a holiday");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
Gbl.Alert.Type = Ale_SUCCESS;
|
Gbl.Alert.Type = Ale_SUCCESS;
|
||||||
|
|
|
@ -741,14 +741,11 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead)
|
||||||
|
|
||||||
void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod)
|
void Inf_RemoveUsrFromCrsInfoRead (long UsrCod,long CrsCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove user's status about reading of course information *****/
|
/***** Remove user's status about reading of course information *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_info_read"
|
DB_BuildQuery ("DELETE FROM crs_info_read"
|
||||||
" WHERE UsrCod=%ld AND CrsCod=%ld",
|
" WHERE UsrCod=%ld AND CrsCod=%ld",
|
||||||
UsrCod,CrsCod) < 0)
|
UsrCod,CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not set that I have not read course info");
|
||||||
DB_QueryDELETE_free (Query,"can not set that I have not read course info");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -1685,7 +1685,6 @@ void Ins_RemoveInstitution (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution;
|
extern const char *Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution;
|
||||||
extern const char *Txt_Institution_X_removed;
|
extern const char *Txt_Institution_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Instit Ins;
|
struct Instit Ins;
|
||||||
char PathIns[PATH_MAX + 1];
|
char PathIns[PATH_MAX + 1];
|
||||||
|
|
||||||
|
@ -1722,10 +1721,8 @@ void Ins_RemoveInstitution (void)
|
||||||
Fil_RemoveTree (PathIns);
|
Fil_RemoveTree (PathIns);
|
||||||
|
|
||||||
/***** Remove institution *****/
|
/***** Remove institution *****/
|
||||||
if (asprintf (&Query,"DELETE FROM institutions WHERE InsCod=%ld",
|
DB_BuildQuery ("DELETE FROM institutions WHERE InsCod=%ld",Ins.InsCod);
|
||||||
Ins.InsCod) < 0)
|
DB_QueryDELETE_new ("can not remove an institution");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove an institution");
|
|
||||||
|
|
||||||
/***** Flush caches *****/
|
/***** Flush caches *****/
|
||||||
Ins_FlushCacheShortNameOfInstitution ();
|
Ins_FlushCacheShortNameOfInstitution ();
|
||||||
|
|
|
@ -487,7 +487,6 @@ long Lnk_GetParamLnkCod (void)
|
||||||
void Lnk_RemoveLink (void)
|
void Lnk_RemoveLink (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Link_X_removed;
|
extern const char *Txt_Link_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Link Lnk;
|
struct Link Lnk;
|
||||||
|
|
||||||
/***** Get link code *****/
|
/***** Get link code *****/
|
||||||
|
@ -498,10 +497,8 @@ void Lnk_RemoveLink (void)
|
||||||
Lnk_GetDataOfLinkByCod (&Lnk);
|
Lnk_GetDataOfLinkByCod (&Lnk);
|
||||||
|
|
||||||
/***** Remove link *****/
|
/***** Remove link *****/
|
||||||
if (asprintf (&Query,"DELETE FROM links WHERE LnkCod=%ld",
|
DB_BuildQuery ("DELETE FROM links WHERE LnkCod=%ld",Lnk.LnkCod);
|
||||||
Lnk.LnkCod) < 0)
|
DB_QueryDELETE_new ("can not remove an institutional link");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove an institutional link");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
39
swad_mail.c
39
swad_mail.c
|
@ -543,7 +543,6 @@ long Mai_GetParamMaiCod (void)
|
||||||
void Mai_RemoveMailDomain (void)
|
void Mai_RemoveMailDomain (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Email_domain_X_removed;
|
extern const char *Txt_Email_domain_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Mail Mai;
|
struct Mail Mai;
|
||||||
|
|
||||||
/***** Get mail code *****/
|
/***** Get mail code *****/
|
||||||
|
@ -554,10 +553,8 @@ void Mai_RemoveMailDomain (void)
|
||||||
Mai_GetDataOfMailDomainByCod (&Mai);
|
Mai_GetDataOfMailDomainByCod (&Mai);
|
||||||
|
|
||||||
/***** Remove mail *****/
|
/***** Remove mail *****/
|
||||||
if (asprintf (&Query,"DELETE FROM mail_domains WHERE MaiCod=%ld",
|
DB_BuildQuery ("DELETE FROM mail_domains WHERE MaiCod=%ld",Mai.MaiCod);
|
||||||
Mai.MaiCod) < 0)
|
DB_QueryDELETE_new ("can not remove a mail domain");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a mail domain");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -1622,8 +1619,6 @@ static void Mai_NewUsrEmail (struct UsrData *UsrDat,bool ItsMe)
|
||||||
|
|
||||||
bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1])
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Check if the new email matches any of the confirmed emails of other users *****/
|
/***** Check if the new email matches any of the confirmed emails of other users *****/
|
||||||
DB_BuildQuery ("SELECT COUNT(*) FROM usr_emails"
|
DB_BuildQuery ("SELECT COUNT(*) FROM usr_emails"
|
||||||
" WHERE E_mail='%s' AND Confirmed='Y'"
|
" WHERE E_mail='%s' AND Confirmed='Y'"
|
||||||
|
@ -1633,18 +1628,16 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
|
||||||
return false; // Don't update
|
return false; // Don't update
|
||||||
|
|
||||||
/***** Delete email (not confirmed) for other users *****/
|
/***** Delete email (not confirmed) for other users *****/
|
||||||
if (asprintf (&Query,"DELETE FROM pending_emails"
|
DB_BuildQuery ("DELETE FROM pending_emails"
|
||||||
" WHERE E_mail='%s' AND UsrCod<>%ld",
|
" WHERE E_mail='%s' AND UsrCod<>%ld",
|
||||||
NewEmail,UsrDat->UsrCod) < 0)
|
NewEmail,UsrDat->UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove pending email for other users");
|
||||||
DB_QueryDELETE_free (Query,"can not remove pending email for other users");
|
|
||||||
|
|
||||||
if (asprintf (&Query,"DELETE FROM usr_emails"
|
DB_BuildQuery ("DELETE FROM usr_emails"
|
||||||
" WHERE E_mail='%s' AND Confirmed='N'"
|
" WHERE E_mail='%s' AND Confirmed='N'"
|
||||||
" AND UsrCod<>%ld",
|
" AND UsrCod<>%ld",
|
||||||
NewEmail,UsrDat->UsrCod) < 0)
|
NewEmail,UsrDat->UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove not confirmed email for other users");
|
||||||
DB_QueryDELETE_free (Query,"can not remove not confirmed email for other users");
|
|
||||||
|
|
||||||
/***** Update email in database *****/
|
/***** Update email in database *****/
|
||||||
DB_BuildQuery ("REPLACE INTO usr_emails"
|
DB_BuildQuery ("REPLACE INTO usr_emails"
|
||||||
|
@ -1771,14 +1764,11 @@ bool Mai_SendMailMsgToConfirmEmail (void)
|
||||||
static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1],
|
static void Mai_InsertMailKey (const char Email[Cns_MAX_BYTES_EMAIL_ADDRESS + 1],
|
||||||
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1])
|
const char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1])
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove expired pending emails from database *****/
|
/***** Remove expired pending emails from database *****/
|
||||||
if (asprintf (&Query,"DELETE FROM pending_emails"
|
DB_BuildQuery ("DELETE FROM pending_emails"
|
||||||
" WHERE DateAndTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
" WHERE DateAndTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||||
Cfg_TIME_TO_DELETE_OLD_PENDING_EMAILS) < 0)
|
Cfg_TIME_TO_DELETE_OLD_PENDING_EMAILS);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove old pending mail keys");
|
||||||
DB_QueryDELETE_free (Query,"can not remove old pending mail keys");
|
|
||||||
|
|
||||||
/***** Insert mail key in database *****/
|
/***** Insert mail key in database *****/
|
||||||
DB_BuildQuery ("INSERT INTO pending_emails"
|
DB_BuildQuery ("INSERT INTO pending_emails"
|
||||||
|
@ -1801,7 +1791,6 @@ void Mai_ConfirmEmail (void)
|
||||||
extern const char *Txt_The_email_X_has_been_confirmed;
|
extern const char *Txt_The_email_X_has_been_confirmed;
|
||||||
extern const char *Txt_The_email_address_has_not_been_confirmed;
|
extern const char *Txt_The_email_address_has_not_been_confirmed;
|
||||||
extern const char *Txt_Failed_email_confirmation_key;
|
extern const char *Txt_Failed_email_confirmation_key;
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1];
|
char MailKey[Mai_LENGTH_EMAIL_CONFIRM_KEY + 1];
|
||||||
|
@ -1837,10 +1826,8 @@ void Mai_ConfirmEmail (void)
|
||||||
if (KeyIsCorrect)
|
if (KeyIsCorrect)
|
||||||
{
|
{
|
||||||
/***** Delete this key *****/
|
/***** Delete this key *****/
|
||||||
if (asprintf (&Query,"DELETE FROM pending_emails WHERE MailKey='%s'",
|
DB_BuildQuery ("DELETE FROM pending_emails WHERE MailKey='%s'",MailKey);
|
||||||
MailKey) < 0)
|
DB_QueryDELETE_new ("can not remove an email key");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove an email key");
|
|
||||||
|
|
||||||
/***** Check user's code and email
|
/***** Check user's code and email
|
||||||
and get if email is already confirmed *****/
|
and get if email is already confirmed *****/
|
||||||
|
|
|
@ -292,7 +292,6 @@ void Not_RequestRemNotice (void)
|
||||||
|
|
||||||
void Not_RemoveNotice (void)
|
void Not_RemoveNotice (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
long NotCod;
|
long NotCod;
|
||||||
|
|
||||||
/***** Get the code of the notice to remove *****/
|
/***** Get the code of the notice to remove *****/
|
||||||
|
@ -309,11 +308,10 @@ void Not_RemoveNotice (void)
|
||||||
DB_QueryINSERT_new ("can not remove notice");
|
DB_QueryINSERT_new ("can not remove notice");
|
||||||
|
|
||||||
/* Remove notice */
|
/* Remove notice */
|
||||||
if (asprintf (&Query,"DELETE FROM notices"
|
DB_BuildQuery ("DELETE FROM notices"
|
||||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||||
NotCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
NotCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove notice");
|
||||||
DB_QueryDELETE_free (Query,"can not remove notice");
|
|
||||||
|
|
||||||
/***** Mark possible notifications as removed *****/
|
/***** Mark possible notifications as removed *****/
|
||||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod);
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod);
|
||||||
|
|
|
@ -1506,7 +1506,6 @@ static void Ntf_UpdateMyLastAccessToNotifications (void)
|
||||||
|
|
||||||
void Ntf_SendPendingNotifByEMailToAllUsrs (void)
|
void Ntf_SendPendingNotifByEMailToAllUsrs (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long NumRow,NumRows;
|
unsigned long NumRow,NumRows;
|
||||||
|
@ -1559,11 +1558,10 @@ void Ntf_SendPendingNotifByEMailToAllUsrs (void)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
/***** Delete old notifications ******/
|
/***** Delete old notifications ******/
|
||||||
if (asprintf (&Query,"DELETE LOW_PRIORITY FROM notif"
|
DB_BuildQuery ("DELETE LOW_PRIORITY FROM notif"
|
||||||
" WHERE TimeNotif<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
" WHERE TimeNotif<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||||
Cfg_TIME_TO_DELETE_OLD_NOTIF) < 0)
|
Cfg_TIME_TO_DELETE_OLD_NOTIF);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove old notifications");
|
||||||
DB_QueryDELETE_free (Query,"can not remove old notifications");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2101,12 +2099,8 @@ static unsigned Ntf_GetNumberOfMyNewUnseenNtfs (void)
|
||||||
|
|
||||||
void Ntf_RemoveUsrNtfs (long ToUsrCod)
|
void Ntf_RemoveUsrNtfs (long ToUsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Delete notifications of a user ******/
|
/***** Delete notifications of a user ******/
|
||||||
if (asprintf (&Query,"DELETE LOW_PRIORITY FROM notif"
|
DB_BuildQuery ("DELETE LOW_PRIORITY FROM notif WHERE ToUsrCod=%ld",
|
||||||
" WHERE ToUsrCod=%ld",
|
ToUsrCod);
|
||||||
ToUsrCod) < 0)
|
DB_QueryDELETE_new ("can not remove notifications of a user");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove notifications of a user");
|
|
||||||
}
|
}
|
||||||
|
|
17
swad_photo.c
17
swad_photo.c
|
@ -1030,12 +1030,8 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
|
||||||
|
|
||||||
void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
|
void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
DB_BuildQuery ("DELETE FROM clicks_without_photo WHERE UsrCod=%ld",UsrCod);
|
||||||
|
DB_QueryDELETE_new ("can not remove a user from the list of users without photo");
|
||||||
if (asprintf (&Query,"DELETE FROM clicks_without_photo WHERE UsrCod=%ld",
|
|
||||||
UsrCod) < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a user from the list of users without photo");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1503,12 +1499,9 @@ static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void)
|
||||||
|
|
||||||
void Pho_RemoveObsoleteStatDegrees (void)
|
void Pho_RemoveObsoleteStatDegrees (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
DB_BuildQuery ("DELETE FROM sta_degrees"
|
||||||
|
" WHERE DegCod NOT IN (SELECT DegCod FROM degrees)");
|
||||||
if (asprintf (&Query,"DELETE FROM sta_degrees"
|
DB_QueryDELETE_new ("can not remove old degrees from stats");
|
||||||
" WHERE DegCod NOT IN (SELECT DegCod FROM degrees)") < 0)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove old degrees from stats");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -556,7 +556,6 @@ void Plc_RemovePlace (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_To_remove_a_place_you_must_first_remove_all_centres_of_that_place;
|
extern const char *Txt_To_remove_a_place_you_must_first_remove_all_centres_of_that_place;
|
||||||
extern const char *Txt_Place_X_removed;
|
extern const char *Txt_Place_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Place Plc;
|
struct Place Plc;
|
||||||
|
|
||||||
/***** Get place code *****/
|
/***** Get place code *****/
|
||||||
|
@ -572,10 +571,8 @@ void Plc_RemovePlace (void)
|
||||||
else // Place has no centres ==> remove it
|
else // Place has no centres ==> remove it
|
||||||
{
|
{
|
||||||
/***** Remove place *****/
|
/***** Remove place *****/
|
||||||
if (asprintf (&Query,"DELETE FROM places WHERE PlcCod=%ld",
|
DB_BuildQuery ("DELETE FROM places WHERE PlcCod=%ld",Plc.PlcCod);
|
||||||
Plc.PlcCod) < 0)
|
DB_QueryDELETE_new ("can not remove a place");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a place");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
|
@ -486,7 +486,6 @@ long Plg_GetParamPlgCod (void)
|
||||||
void Plg_RemovePlugin (void)
|
void Plg_RemovePlugin (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Plugin_X_removed;
|
extern const char *Txt_Plugin_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Plugin Plg;
|
struct Plugin Plg;
|
||||||
|
|
||||||
/***** Get plugin code *****/
|
/***** Get plugin code *****/
|
||||||
|
@ -497,10 +496,8 @@ void Plg_RemovePlugin (void)
|
||||||
Plg_GetDataOfPluginByCod (&Plg);
|
Plg_GetDataOfPluginByCod (&Plg);
|
||||||
|
|
||||||
/***** Remove plugin *****/
|
/***** Remove plugin *****/
|
||||||
if (asprintf (&Query,"DELETE FROM plugins WHERE PlgCod=%ld",
|
DB_BuildQuery ("DELETE FROM plugins WHERE PlgCod=%ld",Plg.PlgCod);
|
||||||
Plg.PlgCod) < 0)
|
DB_QueryDELETE_new ("can not remove a plugin");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not remove a plugin");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
|
|
@ -216,14 +216,11 @@ void Pre_SetPrefsFromIP (void)
|
||||||
|
|
||||||
void Pre_RemoveOldPrefsFromIP (void)
|
void Pre_RemoveOldPrefsFromIP (void)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove old preferences *****/
|
/***** Remove old preferences *****/
|
||||||
if (asprintf (&Query,"DELETE LOW_PRIORITY FROM IP_prefs"
|
DB_BuildQuery ("DELETE LOW_PRIORITY FROM IP_prefs"
|
||||||
" WHERE LastChange<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
" WHERE LastChange<FROM_UNIXTIME(UNIX_TIMESTAMP()-'%lu')",
|
||||||
Cfg_TIME_TO_DELETE_IP_PREFS) < 0)
|
Cfg_TIME_TO_DELETE_IP_PREFS);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove old preferences");
|
||||||
DB_QueryDELETE_free (Query,"can not remove old preferences");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -1057,13 +1057,9 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
|
||||||
|
|
||||||
void Prf_RemoveUsrFigures (long UsrCod)
|
void Prf_RemoveUsrFigures (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove user's figures *****/
|
/***** Remove user's figures *****/
|
||||||
if (asprintf (&Query,"DELETE FROM usr_figures WHERE UsrCod=%ld",
|
DB_BuildQuery ("DELETE FROM usr_figures WHERE UsrCod=%ld",UsrCod);
|
||||||
UsrCod) < 0)
|
DB_QueryDELETE_new ("can not delete user's figures");
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
DB_QueryDELETE_free (Query,"can not delete user's figures");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -2116,7 +2116,6 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
||||||
extern const char *Txt_THE_USER_X_has_been_removed_as_a_Y_from_the_project_Z;
|
extern const char *Txt_THE_USER_X_has_been_removed_as_a_Y_from_the_project_Z;
|
||||||
extern const char *Txt_PROJECT_ROLES_SINGUL_abc[Prj_NUM_ROLES_IN_PROJECT];
|
extern const char *Txt_PROJECT_ROLES_SINGUL_abc[Prj_NUM_ROLES_IN_PROJECT];
|
||||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||||
char *Query;
|
|
||||||
struct Project Prj;
|
struct Project Prj;
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
|
|
||||||
|
@ -2137,13 +2136,12 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
||||||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||||
{
|
{
|
||||||
/***** Remove user from the table of project-users *****/
|
/***** Remove user from the table of project-users *****/
|
||||||
if (asprintf (&Query,"DELETE FROM prj_usr"
|
DB_BuildQuery ("DELETE FROM prj_usr"
|
||||||
" WHERE PrjCod=%ld AND RoleInProject=%u AND UsrCod=%ld",
|
" WHERE PrjCod=%ld AND RoleInProject=%u AND UsrCod=%ld",
|
||||||
Prj.PrjCod,
|
Prj.PrjCod,
|
||||||
(unsigned) RoleInProject,
|
(unsigned) RoleInProject,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod) < 0)
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove a user from a project");
|
||||||
DB_QueryDELETE_free (Query,"can not remove a user from a project");
|
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
@ -2760,7 +2758,6 @@ void Prj_ReqRemProject (void)
|
||||||
void Prj_RemoveProject (void)
|
void Prj_RemoveProject (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Project_X_removed;
|
extern const char *Txt_Project_X_removed;
|
||||||
char *Query;
|
|
||||||
struct Project Prj;
|
struct Project Prj;
|
||||||
char PathRelPrj[PATH_MAX + 1];
|
char PathRelPrj[PATH_MAX + 1];
|
||||||
|
|
||||||
|
@ -2778,22 +2775,20 @@ void Prj_RemoveProject (void)
|
||||||
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
|
||||||
{
|
{
|
||||||
/***** Remove users in project *****/
|
/***** Remove users in project *****/
|
||||||
if (asprintf (&Query,"DELETE FROM prj_usr USING projects,prj_usr"
|
DB_BuildQuery ("DELETE FROM prj_usr USING projects,prj_usr"
|
||||||
" WHERE projects.PrjCod=%ld AND projects.CrsCod=%ld"
|
" WHERE projects.PrjCod=%ld AND projects.CrsCod=%ld"
|
||||||
" AND projects.PrjCod=prj_usr.PrjCod",
|
" AND projects.PrjCod=prj_usr.PrjCod",
|
||||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove project");
|
||||||
DB_QueryDELETE_free (Query,"can not remove project");
|
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
Prj_FlushCacheMyRoleInProject ();
|
Prj_FlushCacheMyRoleInProject ();
|
||||||
|
|
||||||
/***** Remove project *****/
|
/***** Remove project *****/
|
||||||
if (asprintf (&Query,"DELETE FROM projects"
|
DB_BuildQuery ("DELETE FROM projects"
|
||||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||||
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod) < 0)
|
Prj.PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove project");
|
||||||
DB_QueryDELETE_free (Query,"can not remove project");
|
|
||||||
|
|
||||||
/***** Remove information related to files in project *****/
|
/***** Remove information related to files in project *****/
|
||||||
Brw_RemovePrjFilesFromDB (Prj.PrjCod);
|
Brw_RemovePrjFilesFromDB (Prj.PrjCod);
|
||||||
|
@ -3431,23 +3426,19 @@ static void Prj_UpdateProject (struct Project *Prj)
|
||||||
|
|
||||||
void Prj_RemoveCrsProjects (long CrsCod)
|
void Prj_RemoveCrsProjects (long CrsCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove users in projects of the course *****/
|
/***** Remove users in projects of the course *****/
|
||||||
if (asprintf (&Query,"DELETE FROM prj_usr USING projects,prj_usr"
|
DB_BuildQuery ("DELETE FROM prj_usr USING projects,prj_usr"
|
||||||
" WHERE projects.CrsCod=%ld"
|
" WHERE projects.CrsCod=%ld"
|
||||||
" AND projects.PrjCod=prj_usr.PrjCod",
|
" AND projects.PrjCod=prj_usr.PrjCod",
|
||||||
CrsCod) < 0)
|
CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove all the projects of a course");
|
||||||
DB_QueryDELETE_free (Query,"can not remove all the projects of a course");
|
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
Prj_FlushCacheMyRoleInProject ();
|
Prj_FlushCacheMyRoleInProject ();
|
||||||
|
|
||||||
/***** Remove projects *****/
|
/***** Remove projects *****/
|
||||||
if (asprintf (&Query,"DELETE FROM projects WHERE CrsCod=%ld",CrsCod) < 0)
|
DB_BuildQuery ("DELETE FROM projects WHERE CrsCod=%ld",CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove all the projects of a course");
|
||||||
DB_QueryDELETE_free (Query,"can not remove all the projects of a course");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3456,13 +3447,11 @@ void Prj_RemoveCrsProjects (long CrsCod)
|
||||||
|
|
||||||
void Prj_RemoveUsrFromProjects (long UsrCod)
|
void Prj_RemoveUsrFromProjects (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Remove user from projects *****/
|
/***** Remove user from projects *****/
|
||||||
if (asprintf (&Query,"DELETE FROM prj_usr WHERE UsrCod=%ld",UsrCod) < 0)
|
DB_BuildQuery ("DELETE FROM prj_usr WHERE UsrCod=%ld",UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove user from projects");
|
||||||
DB_QueryDELETE_free (Query,"can not remove user from projects");
|
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
ItsMe = Usr_ItsMe (UsrCod);
|
ItsMe = Usr_ItsMe (UsrCod);
|
||||||
|
|
|
@ -683,7 +683,6 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
|
||||||
void Rec_RemoveFieldFromDB (void)
|
void Rec_RemoveFieldFromDB (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Record_field_X_removed;
|
extern const char *Txt_Record_field_X_removed;
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Get from the database the name of the field *****/
|
/***** Get from the database the name of the field *****/
|
||||||
Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,
|
Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,
|
||||||
|
@ -692,16 +691,14 @@ void Rec_RemoveFieldFromDB (void)
|
||||||
&Gbl.CurrentCrs.Records.Field.Visibility);
|
&Gbl.CurrentCrs.Records.Field.Visibility);
|
||||||
|
|
||||||
/***** Remove field from all records *****/
|
/***** Remove field from all records *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_records WHERE FieldCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_records WHERE FieldCod=%ld",
|
||||||
Gbl.CurrentCrs.Records.Field.FieldCod) < 0)
|
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove field from all students' records");
|
||||||
DB_QueryDELETE_free (Query,"can not remove field from all students' records");
|
|
||||||
|
|
||||||
/***** Remove the field *****/
|
/***** Remove the field *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_record_fields WHERE FieldCod=%ld",
|
DB_BuildQuery ("DELETE FROM crs_record_fields WHERE FieldCod=%ld",
|
||||||
Gbl.CurrentCrs.Records.Field.FieldCod) < 0)
|
Gbl.CurrentCrs.Records.Field.FieldCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove field of record");
|
||||||
DB_QueryDELETE_free (Query,"can not remove field of record");
|
|
||||||
|
|
||||||
/***** Write message to show the change made *****/
|
/***** Write message to show the change made *****/
|
||||||
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
|
||||||
|
@ -2032,15 +2029,12 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
||||||
|
|
||||||
void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs)
|
void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove text of the field of record course *****/
|
/***** Remove text of the field of record course *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_records"
|
DB_BuildQuery ("DELETE FROM crs_records"
|
||||||
" WHERE UsrCod=%ld AND FieldCod IN"
|
" WHERE UsrCod=%ld AND FieldCod IN"
|
||||||
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)",
|
" (SELECT FieldCod FROM crs_record_fields WHERE CrsCod=%ld)",
|
||||||
UsrCod,Crs->CrsCod) < 0)
|
UsrCod,Crs->CrsCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove user's record in a course");
|
||||||
DB_QueryDELETE_free (Query,"can not remove user's record in a course");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2049,12 +2043,9 @@ void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs)
|
||||||
|
|
||||||
void Rec_RemoveFieldsCrsRecordAll (long UsrCod)
|
void Rec_RemoveFieldsCrsRecordAll (long UsrCod)
|
||||||
{
|
{
|
||||||
char *Query;
|
|
||||||
|
|
||||||
/***** Remove text of the field of record course *****/
|
/***** Remove text of the field of record course *****/
|
||||||
if (asprintf (&Query,"DELETE FROM crs_records WHERE UsrCod=%ld",UsrCod) < 0)
|
DB_BuildQuery ("DELETE FROM crs_records WHERE UsrCod=%ld",UsrCod);
|
||||||
Lay_NotEnoughMemoryExit ();
|
DB_QueryDELETE_new ("can not remove user's records in all courses");
|
||||||
DB_QueryDELETE_free (Query,"can not remove user's records in all courses");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user